From a96aed15188174c50885dda0df3164a67295e11f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Oct 2017 14:58:28 +0200 Subject: Add ability to download a video from direct link or torrent file --- .../+video-watch/video-download.component.html | 30 ++++++++++++++++++++++ .../+video-watch/video-download.component.ts | 28 ++++++++++++++++++++ .../+video-watch/video-magnet.component.html | 20 --------------- .../videos/+video-watch/video-magnet.component.ts | 27 ------------------- .../videos/+video-watch/video-watch.component.html | 6 ++--- .../videos/+video-watch/video-watch.component.ts | 8 +++--- .../app/videos/+video-watch/video-watch.module.ts | 4 +-- 7 files changed, 67 insertions(+), 56 deletions(-) create mode 100644 client/src/app/videos/+video-watch/video-download.component.html create mode 100644 client/src/app/videos/+video-watch/video-download.component.ts delete mode 100644 client/src/app/videos/+video-watch/video-magnet.component.html delete mode 100644 client/src/app/videos/+video-watch/video-magnet.component.ts (limited to 'client/src/app/videos/+video-watch') diff --git a/client/src/app/videos/+video-watch/video-download.component.html b/client/src/app/videos/+video-watch/video-download.component.html new file mode 100644 index 000000000..ddc57e999 --- /dev/null +++ b/client/src/app/videos/+video-watch/video-download.component.html @@ -0,0 +1,30 @@ + diff --git a/client/src/app/videos/+video-watch/video-download.component.ts b/client/src/app/videos/+video-watch/video-download.component.ts new file mode 100644 index 000000000..22149aa6b --- /dev/null +++ b/client/src/app/videos/+video-watch/video-download.component.ts @@ -0,0 +1,28 @@ +import { Component, Input, ViewChild } from '@angular/core' + +import { ModalDirective } from 'ngx-bootstrap/modal' + +import { Video } from '../shared' + +@Component({ + selector: 'my-video-download', + templateUrl: './video-download.component.html', + styles: [ '.resolution-block { margin-top: 20px; }' ] +}) +export class VideoDownloadComponent { + @Input() video: Video = null + + @ViewChild('modal') modal: ModalDirective + + constructor () { + // empty + } + + show () { + this.modal.show() + } + + hide () { + this.modal.hide() + } +} diff --git a/client/src/app/videos/+video-watch/video-magnet.component.html b/client/src/app/videos/+video-watch/video-magnet.component.html deleted file mode 100644 index 484280c45..000000000 --- a/client/src/app/videos/+video-watch/video-magnet.component.html +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/client/src/app/videos/+video-watch/video-magnet.component.ts b/client/src/app/videos/+video-watch/video-magnet.component.ts deleted file mode 100644 index f9432e92c..000000000 --- a/client/src/app/videos/+video-watch/video-magnet.component.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Component, Input, ViewChild } from '@angular/core' - -import { ModalDirective } from 'ngx-bootstrap/modal' - -import { Video } from '../shared' - -@Component({ - selector: 'my-video-magnet', - templateUrl: './video-magnet.component.html' -}) -export class VideoMagnetComponent { - @Input() video: Video = null - - @ViewChild('modal') modal: ModalDirective - - constructor () { - // empty - } - - show () { - this.modal.show() - } - - hide () { - this.modal.hide() - } -} diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index 88863131a..5d5827344 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html @@ -71,8 +71,8 @@
  • - - Magnet + + Download
  • @@ -179,6 +179,6 @@ - + diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index bd98e877c..651298c14 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -10,7 +10,7 @@ import { MetaService } from '@ngx-meta/core' import { NotificationsService } from 'angular2-notifications' import { AuthService, ConfirmService } from '../../core' -import { VideoMagnetComponent } from './video-magnet.component' +import { VideoDownloadComponent } from './video-download.component' import { VideoShareComponent } from './video-share.component' import { VideoReportComponent } from './video-report.component' import { Video, VideoService } from '../shared' @@ -23,7 +23,7 @@ import { UserVideoRateType, VideoRateType } from '../../../../../shared' styleUrls: [ './video-watch.component.scss' ] }) export class VideoWatchComponent implements OnInit, OnDestroy { - @ViewChild('videoMagnetModal') videoMagnetModal: VideoMagnetComponent + @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent @ViewChild('videoShareModal') videoShareModal: VideoShareComponent @ViewChild('videoReportModal') videoReportModal: VideoReportComponent @@ -160,9 +160,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.videoShareModal.show() } - showMagnetUriModal (event: Event) { + showDownloadModal (event: Event) { event.preventDefault() - this.videoMagnetModal.show() + this.videoDownloadModal.show() } isUserLoggedIn () { diff --git a/client/src/app/videos/+video-watch/video-watch.module.ts b/client/src/app/videos/+video-watch/video-watch.module.ts index 5f20b171e..c6c1344ce 100644 --- a/client/src/app/videos/+video-watch/video-watch.module.ts +++ b/client/src/app/videos/+video-watch/video-watch.module.ts @@ -7,7 +7,7 @@ import { SharedModule } from '../../shared' import { VideoWatchComponent } from './video-watch.component' import { VideoReportComponent } from './video-report.component' import { VideoShareComponent } from './video-share.component' -import { VideoMagnetComponent } from './video-magnet.component' +import { VideoDownloadComponent } from './video-download.component' @NgModule({ imports: [ @@ -18,7 +18,7 @@ import { VideoMagnetComponent } from './video-magnet.component' declarations: [ VideoWatchComponent, - VideoMagnetComponent, + VideoDownloadComponent, VideoShareComponent, VideoReportComponent ], -- cgit v1.2.3