Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playlist support? #1

Closed
097115 opened this issue Apr 9, 2019 · 2 comments
Closed

Playlist support? #1

097115 opened this issue Apr 9, 2019 · 2 comments

Comments

@097115
Copy link

097115 commented Apr 9, 2019

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)
@codesoap
Copy link
Owner

codesoap commented Apr 9, 2019

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.

@097115
Copy link
Author

097115 commented Apr 9, 2019

Thanks, that's superb (and TIL about signals)

:)

@097115 097115 closed this as completed Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants