aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clean/server/test.sh6
-rwxr-xr-xscripts/prune-storage.ts10
-rwxr-xr-xscripts/update-host.ts6
3 files changed, 15 insertions, 7 deletions
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh
index f85daf810..5c30c7639 100755
--- a/scripts/clean/server/test.sh
+++ b/scripts/clean/server/test.sh
@@ -20,9 +20,9 @@ dropRedis () {
20 port=$((9000+$1)) 20 port=$((9000+$1))
21 host="localhost" 21 host="localhost"
22 22
23 redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL 23 redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
24 redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL 24 redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
25 redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL 25 redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL
26} 26}
27 27
28seq=$(seq 1 6) 28seq=$(seq 1 6)
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index 9df80d503..12d78fdc6 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -15,7 +15,8 @@ import { ActorImageModel } from '../server/models/actor/actor-image'
15import { uniq, values } from 'lodash' 15import { uniq, values } from 'lodash'
16import { ThumbnailType } from '@shared/models' 16import { ThumbnailType } from '@shared/models'
17import { VideoFileModel } from '@server/models/video/video-file' 17import { VideoFileModel } from '@server/models/video/video-file'
18import { HLS_REDUNDANCY_DIRECTORY } from '@server/initializers/constants' 18import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
19import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
19 20
20run() 21run()
21 .then(() => process.exit(0)) 22 .then(() => process.exit(0))
@@ -40,6 +41,9 @@ async function run () {
40 41
41 toDelete = toDelete.concat( 42 toDelete = toDelete.concat(
42 await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesWebTorrentFileExist()), 43 await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesWebTorrentFileExist()),
44
45 await pruneDirectory(HLS_STREAMING_PLAYLIST_DIRECTORY, doesHLSPlaylistExist()),
46
43 await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesTorrentFileExist()), 47 await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesTorrentFileExist()),
44 48
45 await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist), 49 await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist),
@@ -94,6 +98,10 @@ function doesWebTorrentFileExist () {
94 return (filePath: string) => VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath)) 98 return (filePath: string) => VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath))
95} 99}
96 100
101function doesHLSPlaylistExist () {
102 return (hlsPath: string) => VideoStreamingPlaylistModel.doesOwnedHLSPlaylistExist(basename(hlsPath))
103}
104
97function doesTorrentFileExist () { 105function doesTorrentFileExist () {
98 return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath)) 106 return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath))
99} 107}
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index c6eb9d533..66c0137d9 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -17,7 +17,7 @@ import { VideoCommentModel } from '../server/models/video/video-comment'
17import { AccountModel } from '../server/models/account/account' 17import { AccountModel } from '../server/models/account/account'
18import { VideoChannelModel } from '../server/models/video/video-channel' 18import { VideoChannelModel } from '../server/models/video/video-channel'
19import { initDatabaseModels } from '../server/initializers/database' 19import { initDatabaseModels } from '../server/initializers/database'
20import { updateTorrentUrls } from '@server/helpers/webtorrent' 20import { updateTorrentMetadata } from '@server/helpers/webtorrent'
21import { getServerActor } from '@server/models/application/application' 21import { getServerActor } from '@server/models/application/application'
22 22
23run() 23run()
@@ -126,7 +126,7 @@ async function run () {
126 126
127 for (const file of video.VideoFiles) { 127 for (const file of video.VideoFiles) {
128 console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid) 128 console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid)
129 await updateTorrentUrls(video, file) 129 await updateTorrentMetadata(video, file)
130 130
131 await file.save() 131 await file.save()
132 } 132 }
@@ -135,7 +135,7 @@ async function run () {
135 for (const file of (playlist?.VideoFiles || [])) { 135 for (const file of (playlist?.VideoFiles || [])) {
136 console.log('Updating fragmented torrent file %s of video %s.', file.resolution, video.uuid) 136 console.log('Updating fragmented torrent file %s of video %s.', file.resolution, video.uuid)
137 137
138 await updateTorrentUrls(video, file) 138 await updateTorrentMetadata(playlist, file)
139 139
140 await file.save() 140 await file.save()
141 } 141 }