aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-16 16:25:53 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-18 13:38:09 +0100
commit90a8bd305de4153ec21137a73ff482dcc2e3e19b (patch)
tree2e35b5504ec11bc51579c92a70c77ed3d5ace816 /scripts
parent684cdacbbd775b5f404dd7b373e02dd21baf5ff0 (diff)
downloadPeerTube-90a8bd305de4153ec21137a73ff482dcc2e3e19b.tar.gz
PeerTube-90a8bd305de4153ec21137a73ff482dcc2e3e19b.tar.zst
PeerTube-90a8bd305de4153ec21137a73ff482dcc2e3e19b.zip
Dissociate video file names and video uuid
Diffstat (limited to 'scripts')
-rw-r--r--scripts/optimize-old-videos.ts6
-rwxr-xr-xscripts/update-host.ts8
2 files changed, 9 insertions, 5 deletions
diff --git a/scripts/optimize-old-videos.ts b/scripts/optimize-old-videos.ts
index d5696de67..8e2e7fcf4 100644
--- a/scripts/optimize-old-videos.ts
+++ b/scripts/optimize-old-videos.ts
@@ -34,7 +34,9 @@ async function run () {
34 34
35 const localVideos = await VideoModel.listLocal() 35 const localVideos = await VideoModel.listLocal()
36 36
37 for (const video of localVideos) { 37 for (const localVideo of localVideos) {
38 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(localVideo.id)
39
38 currentVideoId = video.id 40 currentVideoId = video.id
39 41
40 for (const file of video.VideoFiles) { 42 for (const file of video.VideoFiles) {
@@ -70,7 +72,7 @@ async function run () {
70 72
71 console.log('Failed to optimize %s, restoring original', basename(currentFile)) 73 console.log('Failed to optimize %s, restoring original', basename(currentFile))
72 await move(backupFile, currentFile, { overwrite: true }) 74 await move(backupFile, currentFile, { overwrite: true })
73 await createTorrentAndSetInfoHash(video, file) 75 await createTorrentAndSetInfoHash(video, video, file)
74 await file.save() 76 await file.save()
75 } 77 }
76 } 78 }
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index b030b21c3..d0a1b03cc 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -116,8 +116,10 @@ async function run () {
116 116
117 console.log('Updating video and torrent files.') 117 console.log('Updating video and torrent files.')
118 118
119 const videos = await VideoModel.listLocal() 119 const localVideos = await VideoModel.listLocal()
120 for (const video of videos) { 120 for (const localVideo of localVideos) {
121 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(localVideo.id)
122
121 console.log('Updating video ' + video.uuid) 123 console.log('Updating video ' + video.uuid)
122 124
123 video.url = getLocalVideoActivityPubUrl(video) 125 video.url = getLocalVideoActivityPubUrl(video)
@@ -125,7 +127,7 @@ async function run () {
125 127
126 for (const file of video.VideoFiles) { 128 for (const file of video.VideoFiles) {
127 console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid) 129 console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid)
128 await createTorrentAndSetInfoHash(video, file) 130 await createTorrentAndSetInfoHash(video, video, file)
129 } 131 }
130 132
131 for (const playlist of video.VideoStreamingPlaylists) { 133 for (const playlist of video.VideoStreamingPlaylists) {