aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-10 10:11:28 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-01-28 11:35:26 +0100
commitb764380ac23f4e9d4677d08acdc3474c2931a16d (patch)
tree0d2c440ed8b56c35e47f2274586a11da63852086 /shared/extra-utils/videos
parent3ae0bbd23c6f1b2790975328d8eae6a8317c223d (diff)
downloadPeerTube-b764380ac23f4e9d4677d08acdc3474c2931a16d.tar.gz
PeerTube-b764380ac23f4e9d4677d08acdc3474c2931a16d.tar.zst
PeerTube-b764380ac23f4e9d4677d08acdc3474c2931a16d.zip
Add ability to list redundancies
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r--shared/extra-utils/videos/videos.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 7a77a03ad..aa13273ae 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -607,15 +607,28 @@ async function videoUUIDToId (url: string, id: number | string) {
607 return res.body.id 607 return res.body.id
608} 608}
609 609
610async function uploadVideoAndGetId (options: { server: ServerInfo, videoName: string, nsfw?: boolean, token?: string }) { 610async function uploadVideoAndGetId (options: {
611 server: ServerInfo,
612 videoName: string,
613 nsfw?: boolean,
614 privacy?: VideoPrivacy,
615 token?: string
616}) {
611 const videoAttrs: any = { name: options.videoName } 617 const videoAttrs: any = { name: options.videoName }
612 if (options.nsfw) videoAttrs.nsfw = options.nsfw 618 if (options.nsfw) videoAttrs.nsfw = options.nsfw
619 if (options.privacy) videoAttrs.privacy = options.privacy
613 620
614 const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs) 621 const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs)
615 622
616 return { id: res.body.video.id, uuid: res.body.video.uuid } 623 return { id: res.body.video.id, uuid: res.body.video.uuid }
617} 624}
618 625
626async function getLocalIdByUUID (url: string, uuid: string) {
627 const res = await getVideo(url, uuid)
628
629 return res.body.id
630}
631
619// --------------------------------------------------------------------------- 632// ---------------------------------------------------------------------------
620 633
621export { 634export {
@@ -645,5 +658,6 @@ export {
645 completeVideoCheck, 658 completeVideoCheck,
646 checkVideoFilesWereRemoved, 659 checkVideoFilesWereRemoved,
647 getPlaylistVideos, 660 getPlaylistVideos,
648 uploadVideoAndGetId 661 uploadVideoAndGetId,
662 getLocalIdByUUID
649} 663}