mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-17 18:20:56 +03:00
Fixed bug where subscription videos would get duplicated
This commit is contained in:
@@ -1634,8 +1634,6 @@ app.post('/api/getAllFiles', optionalJwt, async function (req, res) {
|
||||
let playlists = null;
|
||||
const uuid = req.isAuthenticated() ? req.user.uid : null;
|
||||
|
||||
let subscriptions = config_api.getConfigItem('ytdl_allow_subscriptions') ? (await subscriptions_api.getSubscriptions(req.isAuthenticated() ? req.user.uid : null)) : [];
|
||||
|
||||
files = await db_api.getRecords('files', {user_uid: uuid});
|
||||
playlists = await db_api.getRecords('playlists', {user_uid: uuid});
|
||||
|
||||
@@ -1644,18 +1642,6 @@ app.post('/api/getAllFiles', optionalJwt, async function (req, res) {
|
||||
playlists = playlists.concat(categories);
|
||||
}
|
||||
|
||||
// loop through subscriptions and add videos
|
||||
for (let i = 0; i < subscriptions.length; i++) {
|
||||
sub = subscriptions[i];
|
||||
if (!sub.videos) continue;
|
||||
// add sub id for UI
|
||||
for (let j = 0; j < sub.videos.length; j++) {
|
||||
sub.videos[j].sub_id = sub.id;
|
||||
}
|
||||
|
||||
files = files.concat(sub.videos);
|
||||
}
|
||||
|
||||
files = JSON.parse(JSON.stringify(files));
|
||||
|
||||
res.send({
|
||||
@@ -1981,6 +1967,8 @@ app.post('/api/getSubscription', optionalJwt, async (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
subscription = JSON.parse(JSON.stringify(subscription));
|
||||
|
||||
// get sub videos
|
||||
if (subscription.name && !subscription.streamingOnly) {
|
||||
var parsed_files = await db_api.getRecords('files', {sub_id: subscription.id}); // subscription.videos;
|
||||
|
||||
Reference in New Issue
Block a user