diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-16 16:35:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-16 16:35:32 +0100 |
commit | 6de36768980ef6063b8fcd730b59fa685dd2b99c (patch) | |
tree | a8e5a87b14013b33bf2d306552a380c407a1551d /client/src/app/shared/video | |
parent | b6a4fd6b099b3363ac59c06cfd81b54e1356d8bc (diff) | |
download | PeerTube-6de36768980ef6063b8fcd730b59fa685dd2b99c.tar.gz PeerTube-6de36768980ef6063b8fcd730b59fa685dd2b99c.tar.zst PeerTube-6de36768980ef6063b8fcd730b59fa685dd2b99c.zip |
Add ability to update thumbnail and preview on client
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r-- | client/src/app/shared/video/video-edit.model.ts | 6 | ||||
-rw-r--r-- | client/src/app/shared/video/video-thumbnail.component.html | 2 | ||||
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 17 |
3 files changed, 18 insertions, 7 deletions
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index b1c772217..c39252f46 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts | |||
@@ -12,6 +12,10 @@ export class VideoEdit { | |||
12 | commentsEnabled: boolean | 12 | commentsEnabled: boolean |
13 | channel: number | 13 | channel: number |
14 | privacy: VideoPrivacy | 14 | privacy: VideoPrivacy |
15 | thumbnailfile?: any | ||
16 | previewfile?: any | ||
17 | thumbnailUrl: string | ||
18 | previewUrl: string | ||
15 | uuid?: string | 19 | uuid?: string |
16 | id?: number | 20 | id?: number |
17 | 21 | ||
@@ -29,6 +33,8 @@ export class VideoEdit { | |||
29 | this.commentsEnabled = videoDetails.commentsEnabled | 33 | this.commentsEnabled = videoDetails.commentsEnabled |
30 | this.channel = videoDetails.channel.id | 34 | this.channel = videoDetails.channel.id |
31 | this.privacy = videoDetails.privacy | 35 | this.privacy = videoDetails.privacy |
36 | this.thumbnailUrl = videoDetails.thumbnailUrl | ||
37 | this.previewUrl = videoDetails.previewUrl | ||
32 | } | 38 | } |
33 | } | 39 | } |
34 | 40 | ||
diff --git a/client/src/app/shared/video/video-thumbnail.component.html b/client/src/app/shared/video/video-thumbnail.component.html index 8acfb3c41..4604d10e2 100644 --- a/client/src/app/shared/video/video-thumbnail.component.html +++ b/client/src/app/shared/video/video-thumbnail.component.html | |||
@@ -2,7 +2,7 @@ | |||
2 | [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name" | 2 | [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name" |
3 | class="video-thumbnail" | 3 | class="video-thumbnail" |
4 | > | 4 | > |
5 | <img [attr.src]="getImageUrl()" alt="video thumbnail" [ngClass]="{ 'blur-filter': nsfw }" /> | 5 | <img [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" /> |
6 | 6 | ||
7 | <div class="video-thumbnail-overlay"> | 7 | <div class="video-thumbnail-overlay"> |
8 | {{ video.durationLabel }} | 8 | {{ video.durationLabel }} |
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 01d32176b..2e7138cd1 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -18,6 +18,7 @@ import { SortField } from './sort-field.type' | |||
18 | import { VideoDetails } from './video-details.model' | 18 | import { VideoDetails } from './video-details.model' |
19 | import { VideoEdit } from './video-edit.model' | 19 | import { VideoEdit } from './video-edit.model' |
20 | import { Video } from './video.model' | 20 | import { Video } from './video.model' |
21 | import { objectToFormData } from '@app/shared/misc/utils' | ||
21 | 22 | ||
22 | @Injectable() | 23 | @Injectable() |
23 | export class VideoService { | 24 | export class VideoService { |
@@ -46,10 +47,10 @@ export class VideoService { | |||
46 | } | 47 | } |
47 | 48 | ||
48 | updateVideo (video: VideoEdit) { | 49 | updateVideo (video: VideoEdit) { |
49 | const language = video.language || null | 50 | const language = video.language || undefined |
50 | const licence = video.licence || null | 51 | const licence = video.licence || undefined |
51 | const category = video.category || null | 52 | const category = video.category || undefined |
52 | const description = video.description || null | 53 | const description = video.description || undefined |
53 | 54 | ||
54 | const body: VideoUpdate = { | 55 | const body: VideoUpdate = { |
55 | name: video.name, | 56 | name: video.name, |
@@ -60,10 +61,14 @@ export class VideoService { | |||
60 | privacy: video.privacy, | 61 | privacy: video.privacy, |
61 | tags: video.tags, | 62 | tags: video.tags, |
62 | nsfw: video.nsfw, | 63 | nsfw: video.nsfw, |
63 | commentsEnabled: video.commentsEnabled | 64 | commentsEnabled: video.commentsEnabled, |
65 | thumbnailfile: video.thumbnailfile, | ||
66 | previewfile: video.previewfile | ||
64 | } | 67 | } |
65 | 68 | ||
66 | return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, body) | 69 | const data = objectToFormData(body) |
70 | |||
71 | return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, data) | ||
67 | .map(this.restExtractor.extractDataBool) | 72 | .map(this.restExtractor.extractDataBool) |
68 | .catch(this.restExtractor.handleError) | 73 | .catch(this.restExtractor.handleError) |
69 | } | 74 | } |