owncloud / music

:notes: Music app for ownCloud
GNU Affero General Public License v3.0
566 stars 197 forks source link

music app selects the wrong image file as cover #633

Open greku opened 6 years ago

greku commented 6 years ago

For some reason, despite the sorting algorithm that is defined in the code regarding cover images. It ends up using the wrong image. for example one named "abcd-back-efg.jpg" although there are other images named "abcd-front-efg.jpg" and also "folder.jpg".

I have the issue while synchronizing new music folders through the owncloud client. The music app is open in my web browser at the same time. I have the feeling that it happens due to a set of circumstances. It might be that when the app searches for the cover, it takes is the only file available? and then the cover is not updated when the new additional images are synchronized. Does that make sense at all?

Edit: also it already happened previously, and re-scanning fixes the cover.

paulijar commented 6 years ago

Yes, you are right, the application is "reluctant" to change the image file used as cover once it has selected one image. When you are synchronizing a new folder, you are essentially uploading the files one-by-one. Each time a new image file is uploaded, the Music app checks if there are albums without a cover image in that folder; if such are found, the newly uploaded image is set as cover for those.

The case of re-scanning the library is different: there, the cover images are searched in the end of the process and all the possible cover images are already present in the folder. In that case, the sorting logic you mentioned kicks in and the app prefers using images with name starting with 'cover', 'albumart', 'front', or 'folder'.

The latter logic is not used every time an image file is uploaded for performance reasons. The worst case scenario would be that the user would be uploading a folder with thousands of audio and image files. If we would be running the image prioritization logic for each contained album after each uploaded image file, it would really start to slow down the upload. And whatever we do, we don't want to hinder the normal use of the cloud.

That being said, the problem you described is a real one. The system really hasn't been designed with the folder upload in mind, but rather for cases where the folder with album(s) exists and then the user decides to upload an image file there to be used as cover. The behavior could be fixed if we could somehow know that a folder is being uploaded and be notified when the whole folder is uploaded. In that case, we could postpone the cover image updating until when the folder upload is ready. But I'm afraid that the platform probably doesn't provide us this information as of today.

FadeFx commented 5 years ago

Why not give it a delay from the newest file timestamp til the scanning process starts?

paulijar commented 5 years ago

Why not give it a delay from the newest file timestamp til the scanning process starts?

This kind of delayed processing is somewhat problematic since we would then need to rely on some background cron task. As we cannot know how the server admin has set up the background tasks (if at all), there could be a lot of delay.