From c8ab2bc2f0a5f7525777466b4b762fb22bad6d58 Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 5 Aug 2022 16:18:12 +0200 Subject: [PATCH] Add option for fully synchronize a chnanel (#754) --- .../my-video-channel-syncs.component.ts | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts index 63f7e388f1e..9899d581a97 100644 --- a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts +++ b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core' import { AuthService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' -import { DropdownAction, VideoChannelSyncService } from '@app/shared/shared-main' +import { DropdownAction, VideoChannelService, VideoChannelSyncService } from '@app/shared/shared-main' import { HTMLServerConfig } from '@shared/models/server' import { VideoChannelSync, VideoChannelSyncState } from '@shared/models/videos' import { SortMeta } from 'primeng/api' @@ -32,7 +32,8 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit { private videoChannelsSyncService: VideoChannelSyncService, private serverService: ServerService, private notifier: Notifier, - private authService: AuthService + private authService: AuthService, + private videoChannelService: VideoChannelService ) { super() } @@ -46,6 +47,12 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit { label: $localize`Delete`, iconName: 'delete', handler: videoChannelSync => this.deleteSync(videoChannelSync) + }, + { + label: $localize`Fully synchronize the channel`, + description: $localize`This fetches any missing videos on the local channel`, + iconName: 'refresh', + handler: videoChannelSync => this.fullySynchronize(videoChannelSync) } ] ] @@ -76,11 +83,11 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit { return this.serverConfig.import.synchronization.enabled } - deleteSync (videoChannelsSync: VideoChannelSync) { - this.videoChannelsSyncService.deleteSync(videoChannelsSync.id) + deleteSync (videoChannelSync: VideoChannelSync) { + this.videoChannelsSyncService.deleteSync(videoChannelSync.id) .subscribe({ next: () => { - this.notifier.success($localize`Synchronization removed successfully for ${videoChannelsSync.channel.displayName}.`) + this.notifier.success($localize`Synchronization removed successfully for ${videoChannelSync.channel.displayName}.`) this.reloadData() }, error: (err) => { @@ -89,6 +96,18 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit { }) } + fullySynchronize (videoChannelSync: VideoChannelSync) { + this.videoChannelService.importVideos(videoChannelSync.channel.name, videoChannelSync.externalChannelUrl) + .subscribe({ + next: () => { + this.notifier.success($localize`Full synchronization requested successfully for ${videoChannelSync.channel.displayName}.`) + }, + error: (err) => { + this.error = err.message + } + }) + } + getVideoChannelCreateLink () { return '/my-library/video-channel-syncs/create' }