aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/videos/videos.ts')
-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}