]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/videos.ts
Add tests for video downscale framerate matching
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / videos.ts
index 7a77a03addcddf3f81de80b3c6914f2161493c13..aa13273aef7f194e38d74f583f317787d32063d3 100644 (file)
@@ -607,15 +607,28 @@ async function videoUUIDToId (url: string, id: number | string) {
   return res.body.id
 }
 
-async function uploadVideoAndGetId (options: { server: ServerInfo, videoName: string, nsfw?: boolean, token?: string }) {
+async function uploadVideoAndGetId (options: {
+  server: ServerInfo,
+  videoName: string,
+  nsfw?: boolean,
+  privacy?: VideoPrivacy,
+  token?: string
+}) {
   const videoAttrs: any = { name: options.videoName }
   if (options.nsfw) videoAttrs.nsfw = options.nsfw
+  if (options.privacy) videoAttrs.privacy = options.privacy
 
   const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs)
 
   return { id: res.body.video.id, uuid: res.body.video.uuid }
 }
 
+async function getLocalIdByUUID (url: string, uuid: string) {
+  const res = await getVideo(url, uuid)
+
+  return res.body.id
+}
+
 // ---------------------------------------------------------------------------
 
 export {
@@ -645,5 +658,6 @@ export {
   completeVideoCheck,
   checkVideoFilesWereRemoved,
   getPlaylistVideos,
-  uploadVideoAndGetId
+  uploadVideoAndGetId,
+  getLocalIdByUUID
 }