@ -229,13 +229,20 @@ async function getVideosForSub(sub, user_uid = null) {
const downloadConfig = await generateArgsForSubscription ( sub , user _uid ) ;
// get videos
logger . verbose ( ` Subscription: getting videos for subscription ${ sub . name } with args: ${ downloadConfig . join ( ',' ) } ` ) ;
logger . verbose ( ` Subscription: getting list of videos to download for ${ sub . name } with args: ${ downloadConfig . join ( ',' ) } ` ) ;
return new Promise ( async resolve => {
youtubedl . exec ( sub . url , downloadConfig , { maxBuffer : Infinity } , async function ( err , output ) {
// cleanup
updateSubscriptionProperty ( sub , { downloading : false } , user _uid ) ;
// remove temporary archive file if it exists
const archive _path = path . join ( appendedBasePath , 'archive.txt' ) ;
const archive _exists = await fs . pathExists ( archive _path ) ;
if ( archive _exists ) {
await fs . unlink ( archive _path ) ;
}
logger . verbose ( 'Subscription: finished check for ' + sub . name ) ;
if ( err && ! output ) {
logger . error ( err . stderr ? err . stderr : err . message ) ;
@ -354,6 +361,16 @@ async function generateArgsForSubscription(sub, user_uid, redownload = false, de
downloadConfig . push ( ... qualityPath )
// if archive is being used, we want to quickly skip videos that are in the archive. otherwise sub download can be permanently slow (vs. just the first time)
const useYoutubeDLArchive = config _api . getConfigItem ( 'ytdl_use_youtubedl_archive' ) ;
if ( useYoutubeDLArchive ) {
const archive _text = await archive _api . generateArchive ( sub . type , sub . user _uid , sub . id ) ;
logger . verbose ( ` Generating temporary archive file for ${ sub . id } with ${ archive _text . split ( '\n' ) . length - 1 } entries. ` )
const archive _path = path . join ( appendedBasePath , 'archive.txt' ) ;
await fs . writeFile ( archive _path , archive _text ) ;
downloadConfig . push ( '--download-archive' , archive _path ) ;
}
if ( sub . custom _args ) {
const customArgsArray = sub . custom _args . split ( ',,' ) ;
if ( customArgsArray . indexOf ( '-f' ) !== - 1 ) {