MissingCore / Music

A Nothing inspired local music player.
GNU Affero General Public License v3.0
163 stars 9 forks source link

feat: Automated way of fixing noncompliant data #33

Closed cyanChill closed 2 months ago

cyanChill commented 2 months ago

Why

With any "breaking" changes or fixes to the code, there's bound to be some existing data that doesn't comply to those changes. For example, we previously changed how we create albums in order to fix album "fracturization" — we now use albumArtist instead of the artist value. The problem is that, any existing "fracturization" will remain unless the user basically clear the app storage & re-index everything.

This PR aims to fix this by adding some code to fix any "broken" data to comply with the new changes (ie: fix any pre-existing albums with "fracturization").

How

Currently, we have 2 "breaking" changes/fixes to: image saving & album "fracturization".

The code to fix image saving is pretty simple; we needed to set all the fetchedArt boolean values on the Track entry to false. In addition, we needed to adjust some code in saveArtwork() to skip attempting to save artwork for tracks with artwork populated, but fetchedArt = false.

Some other changes:

Test Plan

We'll install a dev version of v1.0.0-rc.9 to mimic the behavior when we eventually release v1.0.0-rc.10. We'll use the same 3 tracks used in #32 which were 3 tracks by different artists that belong in the same album. With v1.0.0-rc.9, we'll get 3 separate album entries.

When we open up the app when running the code in this PR, we should now see a new album entry containing all 3 of those tracks (and the different albums generated by those 3 tracks prior to be gone).

Checklist