subscriptions without names will not have files retrieved any longer

This commit is contained in:
Isaac Grynsztein
2020-03-05 21:19:36 -05:00
parent 41bfc80c4e
commit f5073b83ed

View File

@@ -909,9 +909,18 @@ app.post('/api/getSubscription', async (req, res) => {
} }
// get sub videos // get sub videos
if (subscription.name) {
let base_path = config_api.getConfigItem('ytdl_subscriptions_base_path'); let base_path = config_api.getConfigItem('ytdl_subscriptions_base_path');
let appended_base_path = path.join(base_path, subscription.isPlaylist ? 'playlists' : 'channels', subscription.name, '/'); let appended_base_path = path.join(base_path, subscription.isPlaylist ? 'playlists' : 'channels', subscription.name, '/');
var files = recFindByExt(appended_base_path, 'mp4'); let files;
try {
files = recFindByExt(appended_base_path, 'mp4');
} catch(e) {
files = null;
console.log('Failed to get folder for subscription: ' + subscription.name);
res.sendStatus(500);
return;
}
var parsed_files = []; var parsed_files = [];
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
let file = files[i]; let file = files[i];
@@ -932,6 +941,12 @@ app.post('/api/getSubscription', async (req, res) => {
subscription: subscription, subscription: subscription,
files: parsed_files files: parsed_files
}); });
} else {
res.sendStatus(500);
}
}); });
app.post('/api/downloadVideosForSubscription', async (req, res) => { app.post('/api/downloadVideosForSubscription', async (req, res) => {