diff options
author | zachir <zachir@librem.one> | 2025-08-30 01:09:18 -0500 |
---|---|---|
committer | zachir <zachir@librem.one> | 2025-08-30 01:09:18 -0500 |
commit | f28d694879239d5d9c319185a278236d317a49b6 (patch) | |
tree | 3f684e05c6372c8f0fc0b9f126a184f3aaad68d4 /video_download.sh | |
parent | 7d3cbe8f708772e40608260590b717dea6735908 (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-x | video_download.sh | 10 |
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 } |