Open leso-kn opened 2 years ago
Updated Fixed linter warnings and added unit tests to cover protocol.album_art
.
@djmattyg007 Test coverage is finalized, should now be ready to be merged :)
I tested this code an ran into a lot of issues. Problems are in the script album_art.py:
The good news is that when issues 1-3 are corrected the images are successfully downloaded via the MPD protocol. However, as explained in issue 5 the images are wrong when downloaded from a library list.
As a follow up on yesterdays comments I tried to improve the album_art.py code, see commit https://github.com/gvc0/mopidy-mpd/commit/59bb77c6d57c90f661c944e17bc43e996d8cfea3 . It's working fine in Home Assistant (web GUI as well as mobile app). It now also works fine in MAFA, a solid and well maintained Android MPD client which offers more advanced MPD functionality than Home Assistant.
This is my first attempt at developing code for Mopidy so all feedback is welcome. I also would like to have some advice please on how to translate an image uri retrieved from the database to a uri type and absolute file path. For now I hard coded it, see line 69, as I couldn't figure out how to deal with this.
What I need is:
/local/e8fb302a1e79c5b6edf72d06ccbd1941-500x500.jpeg >>> file:///media/Data1/Mopidy/Data/local/images/e8fb302a1e79c5b6edf72d06ccbd1941-500x500.jpeg
Note: I also tested some other MPD clients and noticed most use uri's in their albumart requests in a different format than Mopidy uses. If we want to support all these variations we'll need to implement a request uri normalization function. I didn't get to it yet because I didn't find another MPD client yet worth the effort.
I finished my work on album_art.py and I think it's ready for a first release. Made a lot of improvements and tested with different clients, all looks fine. I created a pull requests (on branch @leso-kn). As I don't have any experience with Mopidy development and it's release process, please let me know if anything more is required from me.
Update: Added @gvc0's changes for file://-support and improved exception handling.
Note: :warning: There currently seems to be an issue with the Github Actions configuration of mopidy-mpd.
The code introduced by this PR (test_albumart.py
respectively) is not affected by the issue and passes in all configured jobs (accessible when reviewing the pipeline logs). The remaining unit-tests succeed as well, when run in a clean (e.g. container) environment as described in !17.
Rebase on master for fixed tests. Sorry about that.
No worries, thanks for the quick fix :) Rebase done, all tests pass through Github Actions on my side now! Should run through here now once triggered by a maintainer.
I'll try and carve out some time to go through this in the next few days.
I also would like to have some advice please on how to translate an image uri retrieved from the database to a uri type and absolute file path. For now I hard coded it, see line 69, as I couldn't figure out how to deal with this.
You want a reverse lookup? This isn't possible. This is/was the blocking problem IIRC. I'll have to look closer.
I also would like to have some advice please on how to translate an image uri retrieved from the database to a uri type and absolute file path. For now I hard coded it, see line 69, as I couldn't figure out how to deal with this.
You want a reverse lookup? This isn't possible. This is/was the blocking problem IIRC. I'll have to look closer.
Don't bother, I solved that already months ago (before I commented my code was finished). Nothing hard coded anymore, altough I think you might be able to improve my way of accessing Mopidy config.
Update: Coverage raised to 94% (patch coverage). Should pass codecov now.
Update
mopidy-local
-integration for the moment as suggested in discussion 57#110856.Do you want to open a new pull request for leso-kn:feature/album-art ?
Oh, you force pushed it here, that's fine. ignore me
Included in this PR:
albumart
command, making it possible to fetch album artwork for any media source that provides an artwork url