diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-10 17:27:49 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch) | |
tree | e57173bcd0590d939c28952a29258fd02a281e35 /server/models/video | |
parent | 38fa2065831b5f55be0d7f30f19a62c967397208 (diff) | |
download | PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.gz PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.zst PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.zip |
Make it compile at least
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-channel.ts | 14 | ||||
-rw-r--r-- | server/models/video/video.ts | 72 |
2 files changed, 40 insertions, 46 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 93a611fa0..183ff3436 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | 2 | ||
3 | import { isVideoChannelNameValid, isVideoChannelDescriptionValid } from '../../helpers' | 3 | import { isVideoChannelNameValid, isVideoChannelDescriptionValid } from '../../helpers' |
4 | import { removeVideoChannelToFriends } from '../../lib' | ||
5 | 4 | ||
6 | import { addMethodsToModel, getSort } from '../utils' | 5 | import { addMethodsToModel, getSort } from '../utils' |
7 | import { | 6 | import { |
@@ -143,12 +142,13 @@ toFormattedJSON = function (this: VideoChannelInstance) { | |||
143 | 142 | ||
144 | toActivityPubObject = function (this: VideoChannelInstance) { | 143 | toActivityPubObject = function (this: VideoChannelInstance) { |
145 | const json = { | 144 | const json = { |
145 | type: 'VideoChannel' as 'VideoChannel', | ||
146 | id: this.url, | ||
146 | uuid: this.uuid, | 147 | uuid: this.uuid, |
148 | content: this.description, | ||
147 | name: this.name, | 149 | name: this.name, |
148 | description: this.description, | 150 | published: this.createdAt, |
149 | createdAt: this.createdAt, | 151 | updated: this.updatedAt |
150 | updatedAt: this.updatedAt, | ||
151 | ownerUUID: this.Account.uuid | ||
152 | } | 152 | } |
153 | 153 | ||
154 | return json | 154 | return json |
@@ -180,7 +180,7 @@ function afterDestroy (videoChannel: VideoChannelInstance) { | |||
180 | uuid: videoChannel.uuid | 180 | uuid: videoChannel.uuid |
181 | } | 181 | } |
182 | 182 | ||
183 | return removeVideoChannelToFriends(removeVideoChannelToFriendsParams) | 183 | // FIXME: send remove event to followers |
184 | } | 184 | } |
185 | 185 | ||
186 | return undefined | 186 | return undefined |
@@ -277,7 +277,7 @@ loadByUUIDOrUrl = function (uuid: string, url: string, t?: Sequelize.Transaction | |||
277 | { uuid }, | 277 | { uuid }, |
278 | { url } | 278 | { url } |
279 | ] | 279 | ] |
280 | }, | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | if (t !== undefined) query.transaction = t | 283 | if (t !== undefined) query.transaction = t |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index b5d333347..10ae5097c 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1,58 +1,52 @@ | |||
1 | import * as safeBuffer from 'safe-buffer' | ||
2 | const Buffer = safeBuffer.Buffer | ||
3 | import * as magnetUtil from 'magnet-uri' | ||
4 | import { map, maxBy, truncate } from 'lodash' | 1 | import { map, maxBy, truncate } from 'lodash' |
2 | import * as magnetUtil from 'magnet-uri' | ||
5 | import * as parseTorrent from 'parse-torrent' | 3 | import * as parseTorrent from 'parse-torrent' |
6 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import * as safeBuffer from 'safe-buffer' | ||
7 | import * as Sequelize from 'sequelize' | 6 | import * as Sequelize from 'sequelize' |
8 | 7 | import { VideoPrivacy, VideoResolution } from '../../../shared' | |
9 | import { TagInstance } from './tag-interface' | 8 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object' |
10 | import { | 9 | import { |
11 | logger, | 10 | createTorrentPromise, |
12 | isVideoNameValid, | 11 | generateImageFromVideoFile, |
12 | getActivityPubUrl, | ||
13 | getVideoFileHeight, | ||
13 | isVideoCategoryValid, | 14 | isVideoCategoryValid, |
14 | isVideoLicenceValid, | ||
15 | isVideoLanguageValid, | ||
16 | isVideoNSFWValid, | ||
17 | isVideoDescriptionValid, | 15 | isVideoDescriptionValid, |
18 | isVideoDurationValid, | 16 | isVideoDurationValid, |
17 | isVideoLanguageValid, | ||
18 | isVideoLicenceValid, | ||
19 | isVideoNameValid, | ||
20 | isVideoNSFWValid, | ||
19 | isVideoPrivacyValid, | 21 | isVideoPrivacyValid, |
20 | readFileBufferPromise, | 22 | logger, |
21 | unlinkPromise, | ||
22 | renamePromise, | 23 | renamePromise, |
23 | writeFilePromise, | ||
24 | createTorrentPromise, | ||
25 | statPromise, | 24 | statPromise, |
26 | generateImageFromVideoFile, | ||
27 | transcode, | 25 | transcode, |
28 | getVideoFileHeight, | 26 | unlinkPromise, |
29 | getActivityPubUrl | 27 | writeFilePromise |
30 | } from '../../helpers' | 28 | } from '../../helpers' |
31 | import { | 29 | import { |
30 | API_VERSION, | ||
32 | CONFIG, | 31 | CONFIG, |
32 | CONSTRAINTS_FIELDS, | ||
33 | PREVIEWS_SIZE, | ||
33 | REMOTE_SCHEME, | 34 | REMOTE_SCHEME, |
34 | STATIC_PATHS, | 35 | STATIC_PATHS, |
36 | THUMBNAILS_SIZE, | ||
35 | VIDEO_CATEGORIES, | 37 | VIDEO_CATEGORIES, |
36 | VIDEO_LICENCES, | ||
37 | VIDEO_LANGUAGES, | 38 | VIDEO_LANGUAGES, |
38 | THUMBNAILS_SIZE, | 39 | VIDEO_LICENCES, |
39 | PREVIEWS_SIZE, | ||
40 | CONSTRAINTS_FIELDS, | ||
41 | API_VERSION, | ||
42 | VIDEO_PRIVACIES | 40 | VIDEO_PRIVACIES |
43 | } from '../../initializers' | 41 | } from '../../initializers' |
44 | import { removeVideoToFriends } from '../../lib' | ||
45 | import { VideoResolution, VideoPrivacy } from '../../../shared' | ||
46 | import { VideoFileInstance, VideoFileModel } from './video-file-interface' | ||
47 | 42 | ||
48 | import { addMethodsToModel, getSort } from '../utils' | 43 | import { addMethodsToModel, getSort } from '../utils' |
49 | import { | ||
50 | VideoInstance, | ||
51 | VideoAttributes, | ||
52 | 44 | ||
53 | VideoMethods | 45 | import { TagInstance } from './tag-interface' |
54 | } from './video-interface' | 46 | import { VideoFileInstance, VideoFileModel } from './video-file-interface' |
55 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object' | 47 | import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' |
48 | |||
49 | const Buffer = safeBuffer.Buffer | ||
56 | 50 | ||
57 | let Video: Sequelize.Model<VideoInstance, VideoAttributes> | 51 | let Video: Sequelize.Model<VideoInstance, VideoAttributes> |
58 | let getOriginalFile: VideoMethods.GetOriginalFile | 52 | let getOriginalFile: VideoMethods.GetOriginalFile |
@@ -374,8 +368,8 @@ function afterDestroy (video: VideoInstance) { | |||
374 | } | 368 | } |
375 | 369 | ||
376 | tasks.push( | 370 | tasks.push( |
377 | video.removePreview(), | 371 | video.removePreview() |
378 | removeVideoToFriends(removeVideoToFriendsParams) | 372 | // FIXME: remove video for followers |
379 | ) | 373 | ) |
380 | 374 | ||
381 | // Remove physical files and torrents | 375 | // Remove physical files and torrents |
@@ -566,7 +560,7 @@ toActivityPubObject = function (this: VideoInstance) { | |||
566 | const { baseUrlHttp, baseUrlWs } = getBaseUrls(this) | 560 | const { baseUrlHttp, baseUrlWs } = getBaseUrls(this) |
567 | 561 | ||
568 | const tag = this.Tags.map(t => ({ | 562 | const tag = this.Tags.map(t => ({ |
569 | type: 'Hashtag', | 563 | type: 'Hashtag' as 'Hashtag', |
570 | name: t.name | 564 | name: t.name |
571 | })) | 565 | })) |
572 | 566 | ||
@@ -596,7 +590,7 @@ toActivityPubObject = function (this: VideoInstance) { | |||
596 | } | 590 | } |
597 | 591 | ||
598 | const videoObject: VideoTorrentObject = { | 592 | const videoObject: VideoTorrentObject = { |
599 | type: 'Video', | 593 | type: 'Video' as 'Video', |
600 | id: getActivityPubUrl('video', this.uuid), | 594 | id: getActivityPubUrl('video', this.uuid), |
601 | name: this.name, | 595 | name: this.name, |
602 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration | 596 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration |
@@ -604,15 +598,15 @@ toActivityPubObject = function (this: VideoInstance) { | |||
604 | uuid: this.uuid, | 598 | uuid: this.uuid, |
605 | tag, | 599 | tag, |
606 | category: { | 600 | category: { |
607 | id: this.category, | 601 | identifier: this.category + '', |
608 | label: this.getCategoryLabel() | 602 | name: this.getCategoryLabel() |
609 | }, | 603 | }, |
610 | licence: { | 604 | licence: { |
611 | id: this.licence, | 605 | identifier: this.licence + '', |
612 | name: this.getLicenceLabel() | 606 | name: this.getLicenceLabel() |
613 | }, | 607 | }, |
614 | language: { | 608 | language: { |
615 | id: this.language, | 609 | identifier: this.language + '', |
616 | name: this.getLanguageLabel() | 610 | name: this.getLanguageLabel() |
617 | }, | 611 | }, |
618 | views: this.views, | 612 | views: this.views, |