tehkillerbee / mopidy-tidal

Tidal Backend plugin for Mopidy
Apache License 2.0
93 stars 28 forks source link

How to extract cover-art - images from mopidy-tidal ? #47

Closed chicco64 closed 2 years ago

chicco64 commented 2 years ago

Hi ! I would need to know, if it is possible, to extract the cover-art images that mopidy-tidal displays through Mopidy-MusicBox-Webclient in jpg or bmp format, in a dedicated folder, when play songs. This for a possible use through Obs Studio (visual radio project). Also to execute the "mpc current" command to detect the title of the song being played exactly when it starts. very thank you

tehkillerbee commented 2 years ago

@chicco64 Good idea. I have previously looked at caching the cover-art images to a local folder to speed up the loading time.

"Also to execute the "mpc current" command to detect the title of the song being played exactly when it starts." Can you elaborate what you mean?

chicco64 commented 2 years ago

Hi ! I need to have, in a folder, an updated text file containing the "title - artist" of the song transmitted by mopidy (eg "madonna - vogue"); this file can be easily obtained by following the command "mpc current > \home\onair\onair.txt; I would like the execution of this command to occur every song change, and not tied to a simple cron (eg every minute). You could perhaps activate a watchdog that monitors "something" that changes every song change, and then executes the mpc current command. But maybe there is something simpler .... The same for the covers of the songs, obviously with a more complex command that I would ask you to elaborate, in a folder example \home\onair\cover_onair.bmp The name of the output file containing the updated cover should always remain the same. I look forward to your invaluable help.

xmalbertox commented 2 years ago

@chicco64 If you're on Linux (or similar) you can take a look at mopidy-mpris. Then you can use something like playerctl to extract the coverart uri. For Instance something like this:

path=folder/cover.png
link="$(playerctl metadata mpris:artUrl)"
curl -s "$link" --output $path
echo $path

A more elaborate bash script that maybe you could use as a starting point: coverart

tehkillerbee commented 2 years ago

Closing this issue due