diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-23 14:10:17 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-06-23 16:00:49 +0200 |
commit | 67ed6552b831df66713bac9e672738796128d33f (patch) | |
tree | 59c97d41e0b49d75a90aa3de987968ab9b1ff447 /client/src/app/shared/video-playlist/video-playlist.model.ts | |
parent | 0c4bacbff53bc732f5a2677d62a6ead7752e2405 (diff) | |
download | PeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.gz PeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.zst PeerTube-67ed6552b831df66713bac9e672738796128d33f.zip |
Reorganize client shared modules
Diffstat (limited to 'client/src/app/shared/video-playlist/video-playlist.model.ts')
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist.model.ts | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist.model.ts b/client/src/app/shared/video-playlist/video-playlist.model.ts deleted file mode 100644 index 6f27e7475..000000000 --- a/client/src/app/shared/video-playlist/video-playlist.model.ts +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | import { | ||
2 | VideoChannelSummary, | ||
3 | VideoConstant, | ||
4 | VideoPlaylist as ServerVideoPlaylist, | ||
5 | VideoPlaylistPrivacy, | ||
6 | VideoPlaylistType | ||
7 | } from '../../../../../shared/models/videos' | ||
8 | import { AccountSummary, peertubeTranslate } from '@shared/models' | ||
9 | import { Actor } from '@app/shared/actor/actor.model' | ||
10 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | ||
11 | |||
12 | export class VideoPlaylist implements ServerVideoPlaylist { | ||
13 | id: number | ||
14 | uuid: string | ||
15 | isLocal: boolean | ||
16 | |||
17 | displayName: string | ||
18 | description: string | ||
19 | privacy: VideoConstant<VideoPlaylistPrivacy> | ||
20 | |||
21 | thumbnailPath: string | ||
22 | |||
23 | videosLength: number | ||
24 | |||
25 | type: VideoConstant<VideoPlaylistType> | ||
26 | |||
27 | createdAt: Date | string | ||
28 | updatedAt: Date | string | ||
29 | |||
30 | ownerAccount: AccountSummary | ||
31 | videoChannel?: VideoChannelSummary | ||
32 | |||
33 | thumbnailUrl: string | ||
34 | |||
35 | ownerBy: string | ||
36 | ownerAvatarUrl: string | ||
37 | |||
38 | videoChannelBy?: string | ||
39 | videoChannelAvatarUrl?: string | ||
40 | |||
41 | private thumbnailVersion: number | ||
42 | private originThumbnailUrl: string | ||
43 | |||
44 | constructor (hash: ServerVideoPlaylist, translations: {}) { | ||
45 | const absoluteAPIUrl = getAbsoluteAPIUrl() | ||
46 | |||
47 | this.id = hash.id | ||
48 | this.uuid = hash.uuid | ||
49 | this.isLocal = hash.isLocal | ||
50 | |||
51 | this.displayName = hash.displayName | ||
52 | |||
53 | this.description = hash.description | ||
54 | this.privacy = hash.privacy | ||
55 | |||
56 | this.thumbnailPath = hash.thumbnailPath | ||
57 | |||
58 | if (this.thumbnailPath) { | ||
59 | this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath | ||
60 | this.originThumbnailUrl = this.thumbnailUrl | ||
61 | } else { | ||
62 | this.thumbnailUrl = window.location.origin + '/client/assets/images/default-playlist.jpg' | ||
63 | } | ||
64 | |||
65 | this.videosLength = hash.videosLength | ||
66 | |||
67 | this.type = hash.type | ||
68 | |||
69 | this.createdAt = new Date(hash.createdAt) | ||
70 | this.updatedAt = new Date(hash.updatedAt) | ||
71 | |||
72 | this.ownerAccount = hash.ownerAccount | ||
73 | this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) | ||
74 | this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount) | ||
75 | |||
76 | if (hash.videoChannel) { | ||
77 | this.videoChannel = hash.videoChannel | ||
78 | this.videoChannelBy = Actor.CREATE_BY_STRING(hash.videoChannel.name, hash.videoChannel.host) | ||
79 | this.videoChannelAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.videoChannel) | ||
80 | } | ||
81 | |||
82 | this.privacy.label = peertubeTranslate(this.privacy.label, translations) | ||
83 | |||
84 | if (this.type.id === VideoPlaylistType.WATCH_LATER) { | ||
85 | this.displayName = peertubeTranslate(this.displayName, translations) | ||
86 | } | ||
87 | } | ||
88 | |||
89 | refreshThumbnail () { | ||
90 | if (!this.originThumbnailUrl) return | ||
91 | |||
92 | if (!this.thumbnailVersion) this.thumbnailVersion = 0 | ||
93 | this.thumbnailVersion++ | ||
94 | |||
95 | this.thumbnailUrl = this.originThumbnailUrl + '?v' + this.thumbnailVersion | ||
96 | } | ||
97 | } | ||