Playlist support?
097115 opened this issue · 2 comments
Great software, I'm really enjoying it, saves me from all the crap that youtube pages are full of ;)
But wouldn't it be also great to add something like ytools-chain
that would create a playlist of provided picks? And run it after ytools-search
like this:
mpv $(ytools-chain 2 3 4 6 8)
I'm happy to hear you enjoy ytools!
mpv
has support for *.m3u
files. You can write youtube URLs - each on it's own line - into a <playlist_name>.m3u
file and then run the playlist via mpv <playlist_name>.m3u
.
The following script would achieve something quite similar to what you described. If you name it ytools-chain
, you could call it like ytools-chain 1 2 5
after doing ytools-search
:
#!/usr/bin/env sh
tmp_file_no_suffix="$(mktemp)"
tmp_file="${tmp_file_no_suffix}.m3u"
mv "${tmp_file_no_suffix}" "${tmp_file}"
trap "rm -f ${tmp_file}" 0 2 3 15
for search_result in "$@"
do
ytools-pick "${search_result}" >> "${tmp_file}"
done
mpv --ytdl-format "bestaudio/best" --no-video \
--term-playing-msg='Title:${media-title}' "${tmp_file}"
Also take a look at ytpi
, ytpv
and ytpa
in the porcelain/
directory. I recently added those scripts to add basic support for playlists.
Let me know if this is what you were looking for, so that I can close this issue.
Thanks, that's superb (and TIL about signals)
:)