aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-08-25 11:36:23 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-08-25 11:36:23 +0200
commit93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 (patch)
treeb0a1f77af7ab54dc5f58f569fcd1e9d84b04c533 /client/src/app/videos/shared
parent69f224587e99d56008e1fa129d0641840a486620 (diff)
downloadPeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.tar.gz
PeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.tar.zst
PeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.zip
Move video file metadata in their own table
Will be used for user video quotas and multiple video resolutions
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r--client/src/app/videos/shared/video.model.ts21
1 files changed, 14 insertions, 7 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index f0556343f..438791368 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -1,4 +1,4 @@
1import { Video as VideoServerModel } from '../../../../../shared' 1import { Video as VideoServerModel, VideoFile } from '../../../../../shared'
2import { User } from '../../shared' 2import { User } from '../../shared'
3 3
4export class Video implements VideoServerModel { 4export class Video implements VideoServerModel {
@@ -17,7 +17,6 @@ export class Video implements VideoServerModel {
17 id: number 17 id: number
18 uuid: string 18 uuid: string
19 isLocal: boolean 19 isLocal: boolean
20 magnetUri: string
21 name: string 20 name: string
22 podHost: string 21 podHost: string
23 tags: string[] 22 tags: string[]
@@ -29,6 +28,7 @@ export class Video implements VideoServerModel {
29 likes: number 28 likes: number
30 dislikes: number 29 dislikes: number
31 nsfw: boolean 30 nsfw: boolean
31 files: VideoFile[]
32 32
33 private static createByString (author: string, podHost: string) { 33 private static createByString (author: string, podHost: string) {
34 return author + '@' + podHost 34 return author + '@' + podHost
@@ -57,7 +57,6 @@ export class Video implements VideoServerModel {
57 id: number, 57 id: number,
58 uuid: string, 58 uuid: string,
59 isLocal: boolean, 59 isLocal: boolean,
60 magnetUri: string,
61 name: string, 60 name: string,
62 podHost: string, 61 podHost: string,
63 tags: string[], 62 tags: string[],
@@ -66,7 +65,8 @@ export class Video implements VideoServerModel {
66 views: number, 65 views: number,
67 likes: number, 66 likes: number,
68 dislikes: number, 67 dislikes: number,
69 nsfw: boolean 68 nsfw: boolean,
69 files: VideoFile[]
70 }) { 70 }) {
71 this.author = hash.author 71 this.author = hash.author
72 this.createdAt = new Date(hash.createdAt) 72 this.createdAt = new Date(hash.createdAt)
@@ -82,7 +82,6 @@ export class Video implements VideoServerModel {
82 this.id = hash.id 82 this.id = hash.id
83 this.uuid = hash.uuid 83 this.uuid = hash.uuid
84 this.isLocal = hash.isLocal 84 this.isLocal = hash.isLocal
85 this.magnetUri = hash.magnetUri
86 this.name = hash.name 85 this.name = hash.name
87 this.podHost = hash.podHost 86 this.podHost = hash.podHost
88 this.tags = hash.tags 87 this.tags = hash.tags
@@ -94,6 +93,7 @@ export class Video implements VideoServerModel {
94 this.likes = hash.likes 93 this.likes = hash.likes
95 this.dislikes = hash.dislikes 94 this.dislikes = hash.dislikes
96 this.nsfw = hash.nsfw 95 this.nsfw = hash.nsfw
96 this.files = hash.files
97 97
98 this.by = Video.createByString(hash.author, hash.podHost) 98 this.by = Video.createByString(hash.author, hash.podHost)
99 } 99 }
@@ -115,6 +115,13 @@ export class Video implements VideoServerModel {
115 return (this.nsfw && (!user || user.displayNSFW === false)) 115 return (this.nsfw && (!user || user.displayNSFW === false))
116 } 116 }
117 117
118 getDefaultMagnetUri () {
119 if (this.files === undefined || this.files.length === 0) return ''
120
121 // TODO: choose the original file
122 return this.files[0].magnetUri
123 }
124
118 patch (values: Object) { 125 patch (values: Object) {
119 Object.keys(values).forEach((key) => { 126 Object.keys(values).forEach((key) => {
120 this[key] = values[key] 127 this[key] = values[key]
@@ -132,7 +139,6 @@ export class Video implements VideoServerModel {
132 duration: this.duration, 139 duration: this.duration,
133 id: this.id, 140 id: this.id,
134 isLocal: this.isLocal, 141 isLocal: this.isLocal,
135 magnetUri: this.magnetUri,
136 name: this.name, 142 name: this.name,
137 podHost: this.podHost, 143 podHost: this.podHost,
138 tags: this.tags, 144 tags: this.tags,
@@ -140,7 +146,8 @@ export class Video implements VideoServerModel {
140 views: this.views, 146 views: this.views,
141 likes: this.likes, 147 likes: this.likes,
142 dislikes: this.dislikes, 148 dislikes: this.dislikes,
143 nsfw: this.nsfw 149 nsfw: this.nsfw,
150 files: this.files
144 } 151 }
145 } 152 }
146} 153}