made verify cache the title of non-archived videos
This commit is contained in:
parent
7204835592
commit
78701fb6f2
15
yt
15
yt
@ -51,6 +51,17 @@ cache() { # cache the video title for faster retrieval
|
|||||||
clone() { # clones a YouTube playlist in m3u format
|
clone() { # clones a YouTube playlist in m3u format
|
||||||
yt-dlp --flat-playlist "$1" --print url > "$2.m3u"
|
yt-dlp --flat-playlist "$1" --print url > "$2.m3u"
|
||||||
verify "$2.m3u"
|
verify "$2.m3u"
|
||||||
|
|
||||||
|
for line in $(cat "$2.m3u")
|
||||||
|
do
|
||||||
|
if test -n "$(printf '%s\n' "$line" \
|
||||||
|
| sed -n -e '/web\.archive\.org/p' -e '/^\#/p')"
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
archive "$line"
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
music() { # downloads a video, splitting by chapter and only saving the audio
|
music() { # downloads a video, splitting by chapter and only saving the audio
|
||||||
@ -80,7 +91,7 @@ pick() { # Pick a video to play from a list of videos
|
|||||||
test -n "$chosen" && mpv "$chosen"
|
test -n "$chosen" && mpv "$chosen"
|
||||||
}
|
}
|
||||||
|
|
||||||
play() { # play a playlist or video after caching its title
|
play() { # play a video after caching its title
|
||||||
while test -n "$1"; do
|
while test -n "$1"; do
|
||||||
cache "$1"
|
cache "$1"
|
||||||
mpv "$1"
|
mpv "$1"
|
||||||
@ -122,6 +133,8 @@ verify() { # replaces videos with archived versions if they are not available
|
|||||||
printf '%s\n' "$content" >"$1"
|
printf '%s\n' "$content" >"$1"
|
||||||
cache "$wayback_url"
|
cache "$wayback_url"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
cache "$video"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user