mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-04 01:51:29 +03:00
Fixed bug where sharing didn't work for some videos
View count now increments on each play unless the video is shared
This commit is contained in:
@@ -205,10 +205,28 @@ async function importUnregisteredFiles() {
|
||||
|
||||
}
|
||||
|
||||
async function getVideo(file_uid, uuid, sub_id) {
|
||||
const base_db_path = uuid ? users_db.get('users').find({uid: uuid}) : db;
|
||||
const sub_db_path = sub_id ? base_db_path.get('subscriptions').find({id: sub_id}).get('videos') : base_db_path.get('files');
|
||||
return sub_db_path.find({uid: file_uid}).value();
|
||||
}
|
||||
|
||||
async function setVideoProperty(file_uid, assignment_obj, uuid, sub_id) {
|
||||
const base_db_path = uuid ? users_db.get('users').find({uid: uuid}) : db;
|
||||
const sub_db_path = sub_id ? base_db_path.get('subscriptions').find({id: sub_id}).get('videos') : base_db_path.get('files');
|
||||
const file_db_path = sub_db_path.find({uid: file_uid});
|
||||
if (!(file_db_path.value())) {
|
||||
logger.error(`Failed to find file with uid ${file_uid}`);
|
||||
}
|
||||
sub_db_path.find({uid: file_uid}).assign(assignment_obj).write();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
initialize: initialize,
|
||||
registerFileDB: registerFileDB,
|
||||
updatePlaylist: updatePlaylist,
|
||||
getFileDirectoriesAndDBs: getFileDirectoriesAndDBs,
|
||||
importUnregisteredFiles: importUnregisteredFiles
|
||||
importUnregisteredFiles: importUnregisteredFiles,
|
||||
getVideo: getVideo,
|
||||
setVideoProperty: setVideoProperty
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user