Updated playlist file selection to use recent videos component

Playlists are now file type agnostic

Updated translations
This commit is contained in:
Isaac Abadi
2022-06-19 23:09:30 -04:00
parent b5ee0d365c
commit 690cc38899
19 changed files with 121 additions and 198 deletions

View File

@@ -4,6 +4,7 @@ import { Router } from '@angular/router';
import { MatDialog } from '@angular/material/dialog';
import { CreatePlaylistComponent } from 'app/create-playlist/create-playlist.component';
import { ModifyPlaylistComponent } from 'app/dialogs/modify-playlist/modify-playlist.component';
import { Playlist } from 'api-types';
@Component({
selector: 'app-custom-playlists',
@@ -32,7 +33,7 @@ export class CustomPlaylistsComponent implements OnInit {
});
}
getAllPlaylists() {
getAllPlaylists(): void {
this.playlists_received = false;
// must call getAllFiles as we need to get category playlists as well
this.postsService.getPlaylists(true).subscribe(res => {
@@ -42,10 +43,10 @@ export class CustomPlaylistsComponent implements OnInit {
}
// creating a playlist
openCreatePlaylistDialog() {
openCreatePlaylistDialog(): void {
const dialogRef = this.dialog.open(CreatePlaylistComponent, {
data: {
}
minWidth: '90vw',
minHeight: '95vh'
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
@@ -57,7 +58,7 @@ export class CustomPlaylistsComponent implements OnInit {
});
}
goToPlaylist(info_obj) {
goToPlaylist(info_obj: { file: Playlist; }): void {
const playlist = info_obj.file;
const playlistID = playlist.id;
@@ -76,7 +77,7 @@ export class CustomPlaylistsComponent implements OnInit {
}
}
downloadPlaylist(playlist_id, playlist_name) {
downloadPlaylist(playlist_id: string, playlist_name: string): void {
this.downloading_content[playlist_id] = true;
this.postsService.downloadPlaylistFromServer(playlist_id).subscribe(res => {
this.downloading_content[playlist_id] = false;
@@ -86,11 +87,11 @@ export class CustomPlaylistsComponent implements OnInit {
}
deletePlaylist(args) {
deletePlaylist(args: { file: Playlist; index: number; }): void {
const playlist = args.file;
const index = args.index;
const playlistID = playlist.id;
this.postsService.removePlaylist(playlistID, playlist.type).subscribe(res => {
this.postsService.removePlaylist(playlistID).subscribe(res => {
if (res['success']) {
this.playlists.splice(index, 1);
this.postsService.openSnackBar('Playlist successfully removed.', '');
@@ -99,7 +100,7 @@ export class CustomPlaylistsComponent implements OnInit {
});
}
editPlaylistDialog(args) {
editPlaylistDialog(args: { playlist: Playlist; index: number; }): void {
const playlist = args.playlist;
const index = args.index;
const dialogRef = this.dialog.open(ModifyPlaylistComponent, {
@@ -109,7 +110,7 @@ export class CustomPlaylistsComponent implements OnInit {
}
});
dialogRef.afterClosed().subscribe(res => {
dialogRef.afterClosed().subscribe(() => {
// updates playlist in file manager if it changed
if (dialogRef.componentInstance.playlist_updated) {
this.playlists[index] = dialogRef.componentInstance.original_playlist;