eonpatapon / mpDris2

MPRIS V2.1 support for mpd
GNU General Public License v3.0
212 stars 46 forks source link

get cover from url, not only file #97

Open prietus opened 7 years ago

prietus commented 7 years ago

it seems like mpDris2 fetches covers only from files (or it looks to me), so when the url is e.g current song = {'file': 'http://192.168.1.128:9999/get_song?id=Tqoxmtzickfk33l22pl5hcy2t64' it does not grab cover, even when it is possible the same way it does for files. I also tried recreating the album structure in the music_dir and putting a cover/front.jpg there with no success. I'm I right supposing the latter approach won't work? may you consider being able to grab the covers from http:// too? thanks in advance.

grawity commented 7 years ago

Wouldn't this mean mpDris has to download the whole song – which may be quite large and possibly even an infinite radio stream... Not sure if that's doable unless mpd itself learns how to export the cover image.

prietus commented 7 years ago

I made some tests and it looks like first 128 bytes are enough, something like http://ix.io/ADd/py . what about recreating album folder structure at music_dir? I tried doing it with a cover/front.jpg inside and it seems mpDris2 does not pick it, maybe I did it wrong. with the latter, mpdris2 shouldn't need to download tracks.

koflesinge commented 6 years ago

What about using something like this ? https://github.com/abarisain/dmix/wiki/Album-Art-on-your-LAN This is fairly current for mpd and mpdroid, and could be simpler to implement.

koflesinge commented 6 years ago

What about using something like this ? https://github.com/abarisain/dmix/wiki/Album-Art-on-your-LAN This is fairly current for mpd and mpdroid, and could be simpler to implement.

eonpatapon commented 6 years ago

If you set the music_dir, mpDris will try to find covers in it. This is the regex that its using: r'^(album|cover|\.?folder|front).*\.(gif|jpeg|jpg|png)$' It expects the cover to be in the song directory.

wvengen commented 6 years ago

I've been using these changes in the past, allowing one to specify a remote cover url.

kastdeur commented 4 years ago

@wvengen, I'm a big fan of your solution so I've rebased your work on the latest master in my branch remote-art. Care to make it a PR?

I do think this solves a different problem from @prietus , though.