dzr icon indicating copy to clipboard operation
dzr copied to clipboard

My setup, maybe some inspiration?

Open freijon opened this issue 2 years ago • 5 comments

Hi

In https://github.com/yne/dzr/issues/16 I requested to create a decryption proxy, which you promptly implemented (thanks again!). I figured to show my appreciation I'd share my setup and maybe it could be interesting for some people (you can add it to the wiki if you want).

I use this python script to export Deezer albums or playlists as m3u playlist.

Preparation

  • Export a playlist with dzr-export.py --playlist <playlist-id> (open a playlist in the Deezer Web-Client and copy the ID at the end of the URL. The playlist has to be public, so make sure to publish it first on Deezer)
  • Export an album with dzr-export.py --album <album-id> (open an album in the Deezer Web-Client and copy the ID at the end of the URL) An .m3u file will be created at the current location. Each entry will be in the format http://0.0.0.0:8000/cgi-bin/dzr?track_ID

Prepare dzr for streaming:

mkdir -p ./cgi-bin/ && install dzr* ./cgi-bin/
python3 -m http.server --cgi

Now you can open the playlist with mpv or the player of your choice.

To accelerate your workflow you can use tools like rofi, dmenu, fzf or any picker app of your choosing to load the .m3u's and/or to pick the track from the playlist. I use mpvc (my own project) to remote-control my mpv instance. And that's how I built myself a very lightweight Deezer client with playlist support and dzr as my backbone. I use it on a daily basis! Thank you again for this awesome tool.

freijon avatar Dec 18 '23 20:12 freijon

Always nice to see some good hacking!

I'll try to mainline this use-case, by preference order, either into:

  • dzr: add an "@save as m3u" entry next to "@play all", this allows artist/playlist/genre search and reuse existing API parsing code (preferred option)
  • dzr --m3u /type/id (code reuse, ugly switch, no search)
  • dzr-m3u (dzr-export.py but in pure sh)

I'll see what's the least complex option to implement

yne avatar Dec 18 '23 23:12 yne

I've made an (unfinished) massive refactor to dzr that you can try: https://github.com/yne/dzr/commit/m3u It can now be used as both CLI and standalone CGI (no more index.html needed)

Sending a GET with Accept: text/html now return an HTML page with the results (previously drawn by dialog) If no Accept: text/html is given (which is the case of curl and mpv), then results are sent as M3U:

curl http://0:8000/cgi-bin/dzr?/album/418281017/tracks
#EXTM3U
#EXTINF:0, Speak To Me (2023 Remaster) Pink Floyd
http://127.0.0.1:8000/cgi-bin/dzr?/track/2194260767
#EXTINF:0, Breathe (In The Air) (2023 Remaster) Pink Floyd
...

The interesting thing is that ALL listing endpoints returns M3U, so you can now play a "search" endpoint mpv http://0:8000/cgi-bin/dzr?/search/artist?q=pink%20floyd And mpv will recursively fetch all sub-endpoints

Playing: http://127.0.0.1:8000/cgi-bin/dzr?/artist/860
Playing: http://127.0.0.1:8000/cgi-bin/dzr?/artist/860/top?limit=50
Playing: http://127.0.0.1:8000/cgi-bin/dzr?/track/117581954

TODO:

  • re-add the play-all/shuf-all action (without being listed in M3U)
  • re-add dialog "cancel" = go up
  • check that "q" quit MPV

yne avatar Dec 28 '23 19:12 yne

Works like a charm! When opened in a browser it shows html like you said. When using mpv or curl it will output m3u. Maybe I'll figure out a way to "browse" search query results with any picker app and finally play the playlist with mpv. Thank you for your work so far, I appreciate it!

freijon avatar Dec 29 '23 06:12 freijon