MVideoPlaylistFull,
MVideoPlaylistFullSummary,
MVideoPlaylistIdWithElements
-} from '../../typings/models/video/video-playlist'
-import { MThumbnail } from '../../typings/models/video/thumbnail'
+} from '../../types/models/video/video-playlist'
+import { MThumbnail } from '../../types/models/video/thumbnail'
+import { MAccountId, MChannelId } from '@server/types/models'
enum ScopeNames {
AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST',
})
}
- static listPublicUrlsOfForAP (accountId: number, start: number, count: number) {
+ static listPublicUrlsOfForAP (options: { account?: MAccountId, channel?: MChannelId }, start: number, count: number) {
+ const where = {
+ privacy: VideoPlaylistPrivacy.PUBLIC
+ }
+
+ if (options.account) {
+ Object.assign(where, { ownerAccountId: options.account.id })
+ }
+
+ if (options.channel) {
+ Object.assign(where, { videoChannelId: options.channel.id })
+ }
+
const query = {
attributes: [ 'url' ],
offset: start,
limit: count,
- where: {
- ownerAccountId: accountId,
- privacy: VideoPlaylistPrivacy.PUBLIC
- }
+ where
}
return VideoPlaylistModel.findAndCountAll(query)
return join(STATIC_PATHS.THUMBNAILS, this.Thumbnail.filename)
}
+ getWatchUrl () {
+ return WEBSERVER.URL + '/videos/watch/playlist/' + this.uuid
+ }
+
+ getEmbedStaticPath () {
+ return '/video-playlists/embed/' + this.uuid
+ }
+
setAsRefreshed () {
this.changed('updatedAt', true)
},
thumbnailPath: this.getThumbnailStaticPath(),
+ embedPath: this.getEmbedStaticPath(),
type: {
id: this.type,