Compare commits
No commits in common. "78701fb6f2d00c47d5ecb6bbe3adb1487d1fcf98" and "5ebeac450675bf92455cef82b5b53e21859c5baf" have entirely different histories.
78701fb6f2
...
5ebeac4506
36
README
36
README
@ -1,36 +0,0 @@
|
|||||||
yt(1) is a helper script providing functions for use with mpv and yt-dlp for
|
|
||||||
viewing and interacting with YouTube videos.
|
|
||||||
|
|
||||||
Dependencies:
|
|
||||||
- curl(1)
|
|
||||||
- fzf(1)
|
|
||||||
- jq(1)
|
|
||||||
- mpv(1)
|
|
||||||
- yt-dlp(1)
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
yt add | clone | music | pick | play | verify
|
|
||||||
|
|
||||||
add uri file
|
|
||||||
- Adds a video by URI to a playlist
|
|
||||||
|
|
||||||
cache uri...
|
|
||||||
- Caches a video title
|
|
||||||
|
|
||||||
clone uri file
|
|
||||||
- Clones a YouTube playlist to a file
|
|
||||||
|
|
||||||
music uri...
|
|
||||||
- Downloads a video as audio, splitting it by chapter
|
|
||||||
|
|
||||||
pick file...
|
|
||||||
- Opens fzf(1) to a list of videos in a file
|
|
||||||
|
|
||||||
play uri...
|
|
||||||
- Plays a video, caching its title first
|
|
||||||
|
|
||||||
verify file...
|
|
||||||
- Verifies that all the videos in a playlist are existent on YouTube, and if
|
|
||||||
they aren’t, attempts to replace the URI with one from the Wayback Machine. If
|
|
||||||
the video isn’t available on the Wayback Machine, it comments the video link. It
|
|
||||||
then caches the title of the video.
|
|
15
yt
15
yt
@ -51,17 +51,6 @@ 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
|
||||||
@ -91,7 +80,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 video after caching its title
|
play() { # play a playlist or video after caching its title
|
||||||
while test -n "$1"; do
|
while test -n "$1"; do
|
||||||
cache "$1"
|
cache "$1"
|
||||||
mpv "$1"
|
mpv "$1"
|
||||||
@ -133,8 +122,6 @@ 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…
x
Reference in New Issue
Block a user