blob: ffbc4f792968a33715ac444b581b3332a3bc094c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/sh
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"
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"
yt-dlp "$(cat url.txt)"
done
}
if [ ! -f "${LAST_FILE}.video.txt" ] || [ "$(tail -1 "${LAST_FILE}.video.txt")" -lt "$(find "${VIDE_DIR}url.txt" -printf '%Cs\n')" ]; then
get_videos
fi
if [ ! -f "${LAST_FILE}.playlist.txt" ] || [ "$(tail -1 "${LAST_FILE}.playlist.txt")" -lt "$(find "${PLAY_DIR}" -name 'url.txt' -printf '%Cs\n' | sort -n | tail -1)" ]; then
get_playlists
fi
|