+
Streaming-only mode
diff --git a/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts b/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts
index b1d2dd4..19ff03b 100644
--- a/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts
+++ b/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts
@@ -61,9 +61,13 @@ export class EditSubscriptionDialogComponent implements OnInit {
];
constructor(@Inject(MAT_DIALOG_DATA) public data: any, private dialog: MatDialog, private postsService: PostsService) {
- this.sub = this.data.sub;
+ this.sub = JSON.parse(JSON.stringify(this.data.sub));
this.new_sub = JSON.parse(JSON.stringify(this.sub));
+ // ignore videos to keep requests small
+ delete this.sub['videos'];
+ delete this.new_sub['videos'];
+
this.audioOnlyMode = this.sub.type === 'audio';
this.download_all = !this.sub.timerange;
diff --git a/src/app/dialogs/modify-playlist/modify-playlist.component.html b/src/app/dialogs/modify-playlist/modify-playlist.component.html
index d35db91..69f4cad 100644
--- a/src/app/dialogs/modify-playlist/modify-playlist.component.html
+++ b/src/app/dialogs/modify-playlist/modify-playlist.component.html
@@ -8,14 +8,24 @@
+
+
+ Normal order
+ Reverse order
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
+
diff --git a/src/app/dialogs/modify-playlist/modify-playlist.component.scss b/src/app/dialogs/modify-playlist/modify-playlist.component.scss
index 84d3c54..0be9a78 100644
--- a/src/app/dialogs/modify-playlist/modify-playlist.component.scss
+++ b/src/app/dialogs/modify-playlist/modify-playlist.component.scss
@@ -30,11 +30,6 @@ border: none;
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}
-.add-content-button {
-margin-top: 15px;
-margin-bottom: 10px;
-}
-
.remove-item-button {
right: 10px;
position: absolute;
diff --git a/src/app/dialogs/modify-playlist/modify-playlist.component.ts b/src/app/dialogs/modify-playlist/modify-playlist.component.ts
index 18db662..414fc92 100644
--- a/src/app/dialogs/modify-playlist/modify-playlist.component.ts
+++ b/src/app/dialogs/modify-playlist/modify-playlist.component.ts
@@ -15,6 +15,7 @@ export class ModifyPlaylistComponent implements OnInit {
available_files = [];
all_files = [];
playlist_updated = false;
+ reverse_order = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any,
private postsService: PostsService,
@@ -26,6 +27,8 @@ export class ModifyPlaylistComponent implements OnInit {
this.original_playlist = JSON.parse(JSON.stringify(this.data.playlist));
this.getFiles();
}
+
+ this.reverse_order = localStorage.getItem('default_playlist_order_reversed') === 'true';
}
getFiles() {
@@ -72,11 +75,23 @@ export class ModifyPlaylistComponent implements OnInit {
}
removeContent(index) {
+ if (this.reverse_order) {
+ index = this.playlist.fileNames.length - 1 - index;
+ }
this.playlist.fileNames.splice(index, 1);
this.processFiles();
}
+ togglePlaylistOrder() {
+ this.reverse_order = !this.reverse_order;
+ localStorage.setItem('default_playlist_order_reversed', '' + this.reverse_order);
+ }
+
drop(event: CdkDragDrop
) {
+ if (this.reverse_order) {
+ event.previousIndex = this.playlist.fileNames.length - 1 - event.previousIndex;
+ event.currentIndex = this.playlist.fileNames.length - 1 - event.currentIndex;
+ }
moveItemInArray(this.playlist.fileNames, event.previousIndex, event.currentIndex);
}
diff --git a/src/app/dialogs/subscription-info-dialog/subscription-info-dialog.component.html b/src/app/dialogs/subscription-info-dialog/subscription-info-dialog.component.html
index 1ebff5a..4517a47 100644
--- a/src/app/dialogs/subscription-info-dialog/subscription-info-dialog.component.html
+++ b/src/app/dialogs/subscription-info-dialog/subscription-info-dialog.component.html
@@ -1,4 +1,4 @@
-{{sub.name}}
+{{sub.name}} (Paused)
diff --git a/src/app/dialogs/video-info-dialog/video-info-dialog.component.html b/src/app/dialogs/video-info-dialog/video-info-dialog.component.html
index 7323385..e62d1c9 100644
--- a/src/app/dialogs/video-info-dialog/video-info-dialog.component.html
+++ b/src/app/dialogs/video-info-dialog/video-info-dialog.component.html
@@ -25,6 +25,10 @@
Upload Date:
{{file.upload_date ? file.upload_date : 'N/A'}}
+
+
Category:
+
{{file.category.name}}N/A
+
diff --git a/src/app/http.interceptor.ts b/src/app/http.interceptor.ts
new file mode 100644
index 0000000..edde22b
--- /dev/null
+++ b/src/app/http.interceptor.ts
@@ -0,0 +1,34 @@
+import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { MatSnackBar } from '@angular/material/snack-bar';
+import { Router } from '@angular/router';
+import { Observable, throwError } from 'rxjs';
+import { catchError } from 'rxjs/operators';
+
+@Injectable()
+export class H401Interceptor implements HttpInterceptor {
+
+ constructor(private router: Router, private snackBar: MatSnackBar) { }
+
+ intercept(request: HttpRequest, next: HttpHandler): Observable> {
+ return next.handle(request).pipe(catchError(err => {
+ if (err.status === 401) {
+ localStorage.setItem('jwt_token', null);
+ if (this.router.url !== '/login') {
+ this.router.navigate(['/login']).then(() => {
+ this.openSnackBar('Login expired, please login again.');
+ });
+ }
+ }
+
+ const error = err.error.message || err.statusText;
+ return throwError(error);
+ }));
+ }
+
+ public openSnackBar(message: string, action: string = '') {
+ this.snackBar.open(message, action, {
+ duration: 2000,
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/app/main/main.component.html b/src/app/main/main.component.html
index 59956c8..9cb905e 100644
--- a/src/app/main/main.component.html
+++ b/src/app/main/main.component.html
@@ -187,92 +187,3 @@
Custom playlists
-
-
\ No newline at end of file
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts
index 013d0f3..30694bf 100644
--- a/src/app/main/main.component.ts
+++ b/src/app/main/main.component.ts
@@ -8,7 +8,6 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { saveAs } from 'file-saver';
import { YoutubeSearchService, Result } from '../youtube-search.service';
import { Router, ActivatedRoute } from '@angular/router';
-import { CreatePlaylistComponent } from 'app/create-playlist/create-playlist.component';
import { Platform } from '@angular/cdk/platform';
import { v4 as uuid } from 'uuid';
import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component';
@@ -244,13 +243,6 @@ export class MainComponent implements OnInit {
this.useDefaultDownloadingAgent = this.postsService.config['Advanced']['use_default_downloading_agent'];
this.customDownloadingAgent = this.postsService.config['Advanced']['custom_downloading_agent'];
-
-
- if (this.fileManagerEnabled) {
- this.getMp3s();
- this.getMp4s();
- }
-
if (this.youtubeSearchEnabled && this.youtubeAPIKey) {
this.youtubeSearch.initializeAPI(this.youtubeAPIKey);
this.attachToInput();
@@ -335,61 +327,6 @@ export class MainComponent implements OnInit {
this.setCols();
}
- // file manager stuff
-
- getMp3s() {
- this.postsService.getMp3s().subscribe(result => {
- const mp3s = result['mp3s'];
- const playlists = result['playlists'];
- // if they are different
- if (JSON.stringify(this.mp3s) !== JSON.stringify(mp3s)) { this.mp3s = mp3s };
- this.playlists.audio = playlists;
-
- // get thumbnail url by using first video. this is a temporary hack
- for (let i = 0; i < this.playlists.audio.length; i++) {
- const playlist = this.playlists.audio[i];
- let videoToExtractThumbnail = null;
- for (let j = 0; j < this.mp3s.length; j++) {
- if (this.mp3s[j].id === playlist.fileNames[0]) {
- // found the corresponding file
- videoToExtractThumbnail = this.mp3s[j];
- }
- }
-
- if (videoToExtractThumbnail) { this.playlist_thumbnails[playlist.id] = videoToExtractThumbnail.thumbnailURL; }
- }
- }, error => {
- console.log(error);
- });
- }
-
- getMp4s() {
- this.postsService.getMp4s().subscribe(result => {
- const mp4s = result['mp4s'];
- const playlists = result['playlists'];
- // if they are different
- if (JSON.stringify(this.mp4s) !== JSON.stringify(mp4s)) { this.mp4s = mp4s };
- this.playlists.video = playlists;
-
- // get thumbnail url by using first video. this is a temporary hack
- for (let i = 0; i < this.playlists.video.length; i++) {
- const playlist = this.playlists.video[i];
- let videoToExtractThumbnail = null;
- for (let j = 0; j < this.mp4s.length; j++) {
- if (this.mp4s[j].id === playlist.fileNames[0]) {
- // found the corresponding file
- videoToExtractThumbnail = this.mp4s[j];
- }
- }
-
- if (videoToExtractThumbnail) { this.playlist_thumbnails[playlist.id] = videoToExtractThumbnail.thumbnailURL; }
- }
- },
- error => {
- console.log(error);
- });
- }
-
public setCols() {
if (window.innerWidth <= 350) {
this.files_cols = 1;
@@ -437,44 +374,6 @@ export class MainComponent implements OnInit {
return null;
}
- public removeFromMp3(name: string) {
- for (let i = 0; i < this.mp3s.length; i++) {
- if (this.mp3s[i].id === name || this.mp3s[i].id + '.mp3' === name) {
- this.mp3s.splice(i, 1);
- }
- }
- this.getMp3s();
- }
-
- public removePlaylistMp3(playlistID, index) {
- this.postsService.removePlaylist(playlistID, 'audio').subscribe(res => {
- if (res['success']) {
- this.playlists.audio.splice(index, 1);
- this.openSnackBar('Playlist successfully removed.', '');
- }
- this.getMp3s();
- });
- }
-
- public removeFromMp4(name: string) {
- for (let i = 0; i < this.mp4s.length; i++) {
- if (this.mp4s[i].id === name || this.mp4s[i].id + '.mp4' === name) {
- this.mp4s.splice(i, 1);
- }
- }
- this.getMp4s();
- }
-
- public removePlaylistMp4(playlistID, index) {
- this.postsService.removePlaylist(playlistID, 'video').subscribe(res => {
- if (res['success']) {
- this.playlists.video.splice(index, 1);
- this.openSnackBar('Playlist successfully removed.', '');
- }
- this.getMp4s();
- });
- }
-
// download helpers
downloadHelperMp3(name, uid, is_playlist = false, forceView = false, new_download = null, navigate_mode = false) {
@@ -504,16 +403,6 @@ export class MainComponent implements OnInit {
// remove download from current downloads
this.removeDownloadFromCurrentDownloads(new_download);
-
- // reloads mp3s
- if (this.fileManagerEnabled) {
- this.getMp3s();
- setTimeout(() => {
- this.audioFileCards.forEach(filecard => {
- filecard.onHoverResponse();
- });
- }, 200);
- }
}
downloadHelperMp4(name, uid, is_playlist = false, forceView = false, new_download = null, navigate_mode = false) {
@@ -543,16 +432,6 @@ export class MainComponent implements OnInit {
// remove download from current downloads
this.removeDownloadFromCurrentDownloads(new_download);
-
- // reloads mp4s
- if (this.fileManagerEnabled) {
- this.getMp4s();
- setTimeout(() => {
- this.videoFileCards.forEach(filecard => {
- filecard.onHoverResponse();
- });
- }, 200);
- }
}
// download click handler
@@ -745,8 +624,6 @@ export class MainComponent implements OnInit {
if (!this.fileManagerEnabled) {
// tell server to delete the file once downloaded
this.postsService.deleteFile(name, 'video').subscribe(delRes => {
- // reload mp3s
- this.getMp3s();
});
}
});
@@ -762,8 +639,6 @@ export class MainComponent implements OnInit {
if (!this.fileManagerEnabled) {
// tell server to delete the file once downloaded
this.postsService.deleteFile(name, 'audio').subscribe(delRes => {
- // reload mp4s
- this.getMp4s();
});
}
});
@@ -1110,25 +985,6 @@ export class MainComponent implements OnInit {
}
}
- // creating a playlist
- openCreatePlaylistDialog(type) {
- const dialogRef = this.dialog.open(CreatePlaylistComponent, {
- data: {
- filesToSelectFrom: (type === 'audio') ? this.mp3s : this.mp4s,
- type: type
- }
- });
- dialogRef.afterClosed().subscribe(result => {
- if (result) {
- if (type === 'audio') { this.getMp3s() };
- if (type === 'video') { this.getMp4s() };
- this.openSnackBar('Successfully created playlist!', '');
- } else if (result === false) {
- this.openSnackBar('ERROR: failed to create playlist!', '');
- }
- });
- }
-
// modify custom args
openArgsModifierDialog() {
const dialogRef = this.dialog.open(ArgModifierDialogComponent, {
diff --git a/src/app/player/player.component.css b/src/app/player/player.component.css
index 42247ef..202b80d 100644
--- a/src/app/player/player.component.css
+++ b/src/app/player/player.component.css
@@ -37,10 +37,8 @@
}
.spinner {
- width: 50px;
- height: 50px;
- bottom: 3px;
- left: 3px;
+ bottom: 1px;
+ left: 2px;
position: absolute;
}
diff --git a/src/app/player/player.component.html b/src/app/player/player.component.html
index 53fad9b..6aaa7b0 100644
--- a/src/app/player/player.component.html
+++ b/src/app/player/player.component.html
@@ -8,20 +8,49 @@