mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-07 12:00:01 +03:00
Fixed issue where navigating from one sub to another didn't cause the new one to load
Fixed subscription downloading as zip Minor code cleanuip
This commit is contained in:
@@ -1456,18 +1456,14 @@ app.post('/api/downloadFileFromServer', optionalJwt, async (req, res) => {
|
||||
}
|
||||
|
||||
// generate zip
|
||||
file_path_to_download = await utils.createContainerZipFile(playlist, playlist_files_to_download);
|
||||
file_path_to_download = await utils.createContainerZipFile(playlist['name'], playlist_files_to_download);
|
||||
} else if (sub_id && !uid) {
|
||||
zip_file_generated = true;
|
||||
const sub_files_to_download = [];
|
||||
const sub = subscriptions_api.getSubscription(sub_id, uuid);
|
||||
for (let i = 0; i < sub['videos'].length; i++) {
|
||||
const sub_file = sub['videos'][i];
|
||||
sub_files_to_download.push(sub_file);
|
||||
}
|
||||
const sub = await db_api.getRecord('subscriptions', {id: sub_id});
|
||||
const sub_files_to_download = await db_api.getRecords('files', {sub_id: sub_id});
|
||||
|
||||
// generate zip
|
||||
file_path_to_download = await utils.createContainerZipFile(sub, sub_files_to_download);
|
||||
file_path_to_download = await utils.createContainerZipFile(sub['name'], sub_files_to_download);
|
||||
} else {
|
||||
const file_obj = await db_api.getVideo(uid, uuid, sub_id)
|
||||
file_path_to_download = file_obj.path;
|
||||
|
||||
@@ -58,13 +58,13 @@ async function getDownloadedFilesByType(basePath, type, full_metadata = false) {
|
||||
return files;
|
||||
}
|
||||
|
||||
async function createContainerZipFile(container_obj, container_file_objs) {
|
||||
async function createContainerZipFile(file_name, container_file_objs) {
|
||||
const container_files_to_download = [];
|
||||
for (let i = 0; i < container_file_objs.length; i++) {
|
||||
const container_file_obj = container_file_objs[i];
|
||||
container_files_to_download.push(container_file_obj.path);
|
||||
}
|
||||
return await createZipFile(path.join('appdata', container_obj.name + '.zip'), container_files_to_download);
|
||||
return await createZipFile(path.join('appdata', file_name + '.zip'), container_files_to_download);
|
||||
}
|
||||
|
||||
async function createZipFile(zip_file_path, file_paths) {
|
||||
|
||||
@@ -45,8 +45,6 @@ import { VgBufferingModule } from '@videogular/ngx-videogular/buffering';
|
||||
import { VgOverlayPlayModule } from '@videogular/ngx-videogular/overlay-play';
|
||||
import { VgCoreModule } from '@videogular/ngx-videogular/core';
|
||||
import { InputDialogComponent } from './input-dialog/input-dialog.component';
|
||||
import { LazyLoadImageModule, IsVisibleProps } from 'ng-lazyload-image';
|
||||
import { audioFilesMouseHovering, videoFilesMouseHovering, audioFilesOpened, videoFilesOpened } from './main/main.component';
|
||||
import { CreatePlaylistComponent } from './create-playlist/create-playlist.component';
|
||||
import { SubscriptionsComponent } from './subscriptions/subscriptions.component';
|
||||
import { SubscribeDialogComponent } from './dialogs/subscribe-dialog/subscribe-dialog.component';
|
||||
@@ -94,10 +92,6 @@ import { RestoreDbDialogComponent } from './dialogs/restore-db-dialog/restore-db
|
||||
|
||||
registerLocaleData(es, 'es');
|
||||
|
||||
export function isVisible({ event, element, scrollContainer, offset }: IsVisibleProps<any>) {
|
||||
return (element.id === 'video' ? videoFilesMouseHovering || videoFilesOpened : audioFilesMouseHovering || audioFilesOpened);
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
@@ -190,7 +184,6 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible
|
||||
VgControlsModule,
|
||||
VgOverlayPlayModule,
|
||||
VgBufferingModule,
|
||||
LazyLoadImageModule.forRoot({ isVisible }),
|
||||
RouterModule,
|
||||
AppRoutingModule,
|
||||
],
|
||||
|
||||
@@ -49,8 +49,8 @@ export class SubscriptionComponent implements OnInit, OnDestroy {
|
||||
constructor(private postsService: PostsService, private route: ActivatedRoute, private router: Router, private dialog: MatDialog) { }
|
||||
|
||||
ngOnInit() {
|
||||
if (this.route.snapshot.paramMap.get('id')) {
|
||||
this.id = this.route.snapshot.paramMap.get('id');
|
||||
this.route.params.subscribe(params => {
|
||||
this.id = params['id'];
|
||||
|
||||
this.postsService.service_initialized.subscribe(init => {
|
||||
if (init) {
|
||||
@@ -59,7 +59,7 @@ export class SubscriptionComponent implements OnInit, OnDestroy {
|
||||
this.sub_interval = setInterval(() => this.getSubscription(true), 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// set filter property to cached
|
||||
const cached_filter_property = localStorage.getItem('filter_property');
|
||||
|
||||
Reference in New Issue
Block a user