File cards now include the video's real ID (for YT videos). Otherwise the file name will be used as a fallback

This commit is contained in:
Isaac Grynsztein
2020-05-25 16:51:49 -04:00
parent cec0ed78ec
commit 57a9434b3c
6 changed files with 12 additions and 5 deletions

View File

@@ -44,6 +44,13 @@ export class FileCardComponent implements OnInit {
ngOnInit() {
this.type = this.isAudio ? 'audio' : 'video';
if (this.file && this.file.url && this.file.url.includes('youtu')) {
const string_id = (this.isPlaylist ? '?list=' : '?v=')
const index_offset = (this.isPlaylist ? 6 : 3);
const end_index = this.file.url.indexOf(string_id) + index_offset;
this.name = this.file.url.substring(end_index, this.file.url.length);
}
}
deleteFile(blacklistMode = false) {