From 78701fb6f2d00c47d5ecb6bbe3adb1487d1fcf98 Mon Sep 17 00:00:00 2001 From: emma Date: Thu, 2 Nov 2023 22:50:57 -0600 Subject: [PATCH] made verify cache the title of non-archived videos --- yt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/yt b/yt index 5353ce9..3bd9452 100755 --- a/yt +++ b/yt @@ -51,6 +51,17 @@ cache() { # cache the video title for faster retrieval clone() { # clones a YouTube playlist in m3u format yt-dlp --flat-playlist "$1" --print url > "$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 @@ -80,7 +91,7 @@ pick() { # Pick a video to play from a list of videos 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 cache "$1" mpv "$1" @@ -122,6 +133,8 @@ verify() { # replaces videos with archived versions if they are not available printf '%s\n' "$content" >"$1" cache "$wayback_url" fi + else + cache "$video" fi done