summaryrefslogtreecommitdiff
path: root/video_download.sh
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2025-08-30 01:09:18 -0500
committerzachir <zachir@librem.one>2025-08-30 01:09:18 -0500
commitf28d694879239d5d9c319185a278236d317a49b6 (patch)
tree3f684e05c6372c8f0fc0b9f126a184f3aaad68d4 /video_download.sh
parent7d3cbe8f708772e40608260590b717dea6735908 (diff)
Make sh scrips POSIX compliant
Using shellcheck, I went through all of them to make them standards compliant. I also tested as many as I could.
Diffstat (limited to 'video_download.sh')
-rwxr-xr-xvideo_download.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/video_download.sh b/video_download.sh
index ffbc4f7..acf52c9 100755
--- a/video_download.sh
+++ b/video_download.sh
@@ -3,20 +3,18 @@
VIDE_DIR="/var/tank/videos/Videos/"
PLAY_DIR="/var/tank/videos/Playlists/"
-PLAY_SUBS="$(ls -1 ${PLAY_DIR})"
-
LAST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/video_download"
get_videos () {
- cd "$VIDE_DIR"
+ cd "$VIDE_DIR" || exit 1
yt-dlp "$(cat url.txt)"
date '+%s' > "${LAST_FILE}.video.txt"
}
get_playlists () {
- cd "$PLAY_DIR"
- ls -1 | while read subdir; do
- cd "$PLAY_DIR/$subdir"
+ cd "$PLAY_DIR" || exit 1
+ find ./* -maxdepth 1 -type d | while read -r subdir; do
+ cd "$PLAY_DIR/$subdir" || exit 1
yt-dlp "$(cat url.txt)"
done
}