Spaces:
Build error
Build error
Commit
·
6457a5e
1
Parent(s):
67bf9db
archive old videos
Browse files- scripts/archive_old_videos.sh +28 -0
- start.sh +5 -2
scripts/archive_old_videos.sh
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Directory containing .mp4 files
|
4 |
+
VIDEO_DIR=$WEBTV_VIDEO_STORAGE_PATH_CHANNEL_2
|
5 |
+
|
6 |
+
# Target directory for old files
|
7 |
+
ARCHIVE_DIR=$WEBTV_VIDEO_ARCHIVE_PATH_CHANNEL_2
|
8 |
+
|
9 |
+
# Calculate the number of .mp4 files
|
10 |
+
TOTAL_VIDEO_COUNT=$(ls -l ${VIDEO_DIR}*.mp4 | wc -l)
|
11 |
+
|
12 |
+
# Calculate the number of files to move (10%)
|
13 |
+
VIDEO_COUNT_TO_MOVE=$((TOTAL_VIDEO_COUNT / 10))
|
14 |
+
|
15 |
+
# If there are no videos to move then exit the script
|
16 |
+
if [ "$VIDEO_COUNT_TO_MOVE" -le 0 ]; then
|
17 |
+
echo "No videos to move. Exiting."
|
18 |
+
exit 0
|
19 |
+
fi
|
20 |
+
|
21 |
+
# List all .mp4 files in the directory, sorted by modification date, take the oldest 10%
|
22 |
+
FILES_TO_MOVE=$(ls -ltr ${VIDEO_DIR}*.mp4 | head -n ${VIDEO_COUNT_TO_MOVE})
|
23 |
+
|
24 |
+
# Move the old files to the archive directory
|
25 |
+
for file in $FILES_TO_MOVE
|
26 |
+
do
|
27 |
+
mv "${file}" "${ARCHIVE_DIR}"
|
28 |
+
done
|
start.sh
CHANGED
@@ -4,12 +4,15 @@
|
|
4 |
bash ./scripts/init.sh
|
5 |
|
6 |
# ------------ UPDATE MUSIC ------------
|
7 |
-
echo "skipping new music download"
|
8 |
-
|
9 |
|
10 |
# ---------- CONTENT ALIGNMENT ---------
|
11 |
bash scripts/censorship.sh
|
12 |
|
|
|
|
|
|
|
13 |
# ------ background processes ---------
|
14 |
|
15 |
bash scripts/interpolate.sh &
|
|
|
4 |
bash ./scripts/init.sh
|
5 |
|
6 |
# ------------ UPDATE MUSIC ------------
|
7 |
+
# echo "skipping new music download"
|
8 |
+
bash scripts/download_fresh_music.sh
|
9 |
|
10 |
# ---------- CONTENT ALIGNMENT ---------
|
11 |
bash scripts/censorship.sh
|
12 |
|
13 |
+
# ----------- ARCHIVE OLD, UNINTERESITNG VIDEOS -------
|
14 |
+
bash scripts/archive_old_videos.sh
|
15 |
+
|
16 |
# ------ background processes ---------
|
17 |
|
18 |
bash scripts/interpolate.sh &
|