GuardKenzie / miniplayer

A curses based mpd client with basic functionality and album art.
MIT License
120 stars 8 forks source link

Album art fetching from HTTP server #17

Closed bartkl closed 3 years ago

bartkl commented 3 years ago

Hi!

I love the miniplayer, but my album art isn't present in the files.

Instead, since I'm using the Android clients MPDroid and MAFA a lot, I've followed the instructions provided by the MPDroid wiki to set up an HTTP server that serves my album art for me. Both of these players support this exact implementation, and of course other users/developers can use it as well.

So, I forked your repository and altered and expanded on the code to make it support album art fetching from such an HTTP server.

If it interests you, I hope you will merge these changes to upstream. Of course I'm more than willing to change the code/approach where desired as well :).

If you do feel this is a worthy addition, here's a summary of what I did:

Two things I feel uncertain about is:

Let me hear what you think. No worries if you reject the feature altogether, I can maintain a fork if necessary :).

Thanks, Bart

GuardKenzie commented 3 years ago

This looks really good, thank you so much for your contribution! I love the changes you made, they really do clean up the code quite a bit.

Whatever the image is, it is always saved to the /tmp directory with a PNG file extension. Of course this should be an issue just as much with retrieving album art from files, and that seems to work fine. Also, I've tested with a JPG file from my HTTP server, and it seems to work just fine there too.

The .png file extension is really just a hint for ffmpeg so it knows I want the album art from the song file. The equivalent command in the terminal would be ffmpeg -i song.mp3 /tmp/aartminip.png. When you fetch the cover art files from your server, you are writing, for example, jpeg data (along with all it's identifiers) to a file that just happens to have the file extension .png. Since the libraries we are using to display the album art don't care about file names, just the actual file data, this does not cause issues.

bartkl commented 3 years ago

Sorry for the late response! I didn't get any notification from GitHub for some reason, and I was very busy also.

Thanks for the kind words. I'll take a closer look on your feedback and hopefully make the desired changes soon :).

Bart

bartkl commented 3 years ago

I added some code to handle the config compatibility issue. I think it ticks all the boxes you desire.

I'm working on my work laptop currently so I cannot test it yet, but maybe you can glance at these few lines of code and at least give me a sign if this is indeed in the direction you'd like.

Edit: I tested it now, and it seems to work fine on my end. Would be nice if someone (you?) could test it properly with music_directory, since I don't have that.

GuardKenzie commented 3 years ago

This is really good! Thank you so much for taking interest in the project!

Edit: New version now up on PyPi