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

My setup, maybe some inspiration? #36

Open
freijon opened this issue Dec 18, 2023 · 3 comments
Open

My setup, maybe some inspiration? #36

freijon opened this issue Dec 18, 2023 · 3 comments

Comments

@freijon
Copy link
Contributor

freijon commented Dec 18, 2023

Hi

In #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.

@yne
Copy link
Owner

yne commented Dec 18, 2023

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
Copy link
Owner

yne commented Dec 28, 2023

I've made an (unfinished) massive refactor to dzr that you can try: 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

@freijon
Copy link
Contributor Author

freijon commented Dec 29, 2023

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!

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