Added ability to add more metadata to db through migrations, and added scaffolding for supporting description and play count in the player component

This commit is contained in:
Isaac Abadi
2020-12-09 17:28:00 -05:00
parent f425b9842f
commit c6fc5352c5
4 changed files with 58 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ function getTrueFileName(unfixed_path, type) {
return fixed_path;
}
async function getDownloadedFilesByType(basePath, type) {
async function getDownloadedFilesByType(basePath, type, full_metadata = false) {
// return empty array if the path doesn't exist
if (!(await fs.pathExists(basePath))) return [];
@@ -36,6 +36,11 @@ async function getDownloadedFilesByType(basePath, type) {
var id = file_path.substring(0, file_path.length-4);
var jsonobj = await getJSONByType(type, id, basePath);
if (!jsonobj) continue;
if (full_metadata) {
jsonobj['id'] = id;
files.push(jsonobj);
continue;
}
var title = jsonobj.title;
var url = jsonobj.webpage_url;
var uploader = jsonobj.uploader;