Added ability to randomize playlists

Missing videos now show a more verbose error in the logs
This commit is contained in:
Isaac Abadi
2021-07-21 20:03:53 -06:00
parent b56b371ece
commit 9f908aa3fc
6 changed files with 23 additions and 4 deletions

View File

@@ -2399,14 +2399,17 @@ app.get('/api/stream', optionalJwt, async (req, res) => {
let uid = decodeURIComponent(req.query.uid);
let file_path = null;
let file_obj = null;
const multiUserMode = config_api.getConfigItem('ytdl_multi_user_mode');
if (!multiUserMode || req.isAuthenticated() || req.can_watch) {
const file_obj = await db_api.getVideo(uid, uuid, sub_id);
file_obj = await db_api.getVideo(uid, uuid, sub_id);
if (file_obj) file_path = file_obj['path'];
else file_path = null;
}
if (!fs.existsSync(file_path)) {
logger.error(`File ${file_path} could not be found! UID: ${uid}, ID: ${file_obj.id}`);
}
const stat = fs.statSync(file_path)
const fileSize = stat.size
const range = req.headers.range

View File

@@ -413,6 +413,7 @@ exports.createPlaylist = async (playlist_name, uids, type, thumbnail_url, user_u
thumbnailURL: thumbnail_url,
type: type,
registered: Date.now(),
randomize_order: false
};
const duration = await exports.calculatePlaylistDuration(new_playlist, user_uid);