krateng / maloja

Self-hosted music scrobble database to create personal listening statistics and charts
https://maloja.krateng.ch
GNU General Public License v3.0
1.17k stars 67 forks source link

Maloja not deleting old cover art #173

Open gBasil opened 1 year ago

gBasil commented 1 year ago

When you upload a new image image via the /addpicture endpoint, Maloja adds an image to a folder but doesn't (to my knowledge) delete the old image. I'd like to write a script or something to periodically automatically update all of the cover art, as I have those stored in a different place, but I'm worried that the images will start to pile up over time if I don't also implement behavior to delete the old images.

I'm honestly curious as to why this is the default behavior. Is it to prevent accidental, irreversible overwrites?

Alternatively, and this is probably out of the scope of Maloja, it would be neat to allow users the ability to set a custom image URL instead of uploading it. A project of mine have serves images on an endpoint, such as /api/cover/786, on a different domain. This would sidestep the requirement to upload custom covers entirely. I completely understand if that's out of scope for Maloja.

image

Thank you for your time!

krateng commented 1 year ago

The reason for not deleting old uploads is because Maloja supports cycling between multiple artworks and the assumed wanted behaviour is to add any new image to the pool and still cycle between them. I could simply add a setting to always delete the old ones though, I'll have a look at that when I find some time.

Having a custom API for external images is actually not half bad an idea, but that API would need to be able to parse the specific artist / track name. Or does your custom server actually get the track / artist IDs from Maloja itself?

gBasil commented 1 year ago

The reason for not deleting old uploads is because Maloja supports cycling between multiple artworks

Oh, I never new that! Where exactly is that done?

Or does your custom server actually get the track / artist IDs from Maloja itself?

I'm not too sure what you mean by that. It stores all of the data outside of Maloja, if that answers your question. My scrobbling implementation is here: https://github.com/gBasil/boombox/blob/main/src/utils/server/scrobble.ts

krateng commented 1 year ago

The cycling happens automatically, but you can set the frequency in the settings.

Above you said that your custom API serves an image under e.g. /api/cover/786. Is that 786 the track ID you extracted from Maloja? Or does your API have its own numbering?

gBasil commented 1 year ago

It has custom numbering, I'm not sure how Maloja does it.

gBasil commented 1 year ago

The cycling happens automatically, but you can set the frequency in the settings.

I see.

krateng commented 1 year ago

In order to support a custom API, Maloja would obviously need to know how to find the right artwork. So if I implement this, the API endpoint would probably have the full artist and track name in it or something.

gBasil commented 1 year ago

That would work for my case.