mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-14 12:21:29 +03:00
subscriptions without names will not have files retrieved any longer
This commit is contained in:
@@ -909,29 +909,44 @@ app.post('/api/getSubscription', async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get sub videos
|
// get sub videos
|
||||||
let base_path = config_api.getConfigItem('ytdl_subscriptions_base_path');
|
if (subscription.name) {
|
||||||
let appended_base_path = path.join(base_path, subscription.isPlaylist ? 'playlists' : 'channels', subscription.name, '/');
|
let base_path = config_api.getConfigItem('ytdl_subscriptions_base_path');
|
||||||
var files = recFindByExt(appended_base_path, 'mp4');
|
let appended_base_path = path.join(base_path, subscription.isPlaylist ? 'playlists' : 'channels', subscription.name, '/');
|
||||||
var parsed_files = [];
|
let files;
|
||||||
for (let i = 0; i < files.length; i++) {
|
try {
|
||||||
let file = files[i];
|
files = recFindByExt(appended_base_path, 'mp4');
|
||||||
var file_path = file.substring(appended_base_path.length, file.length);
|
} catch(e) {
|
||||||
var id = file_path.substring(0, file_path.length-4);
|
files = null;
|
||||||
var jsonobj = getJSONMp4(id, appended_base_path);
|
console.log('Failed to get folder for subscription: ' + subscription.name);
|
||||||
if (!jsonobj) continue;
|
res.sendStatus(500);
|
||||||
var title = jsonobj.title;
|
return;
|
||||||
|
}
|
||||||
|
var parsed_files = [];
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
let file = files[i];
|
||||||
|
var file_path = file.substring(appended_base_path.length, file.length);
|
||||||
|
var id = file_path.substring(0, file_path.length-4);
|
||||||
|
var jsonobj = getJSONMp4(id, appended_base_path);
|
||||||
|
if (!jsonobj) continue;
|
||||||
|
var title = jsonobj.title;
|
||||||
|
|
||||||
var thumbnail = jsonobj.thumbnail;
|
var thumbnail = jsonobj.thumbnail;
|
||||||
var duration = jsonobj.duration;
|
var duration = jsonobj.duration;
|
||||||
var isaudio = false;
|
var isaudio = false;
|
||||||
var file_obj = new File(id, title, thumbnail, isaudio, duration);
|
var file_obj = new File(id, title, thumbnail, isaudio, duration);
|
||||||
parsed_files.push(file_obj);
|
parsed_files.push(file_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.send({
|
||||||
|
subscription: subscription,
|
||||||
|
files: parsed_files
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
res.sendStatus(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
res.send({
|
|
||||||
subscription: subscription,
|
|
||||||
files: parsed_files
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/downloadVideosForSubscription', async (req, res) => {
|
app.post('/api/downloadVideosForSubscription', async (req, res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user