scanMissingArtists function appears to be adding artists and albums that are not yet populated to the local DB.
It should be split to a scanMissingArtists and scanMissingAlbums function as those are two different things.
Further; it calls getTidalTracksUnordered, which fetches ALL tracks from the DB.
This is unnecessary.
select tt.* from tidal_tracks as tt left join tidal_artists as ta on tt.artist=ta.id where ta.id is NULL can be used to get tracks missing the artist
select tt.* from tidal_tracks as tt left join tidal_albums as ta on tt.album=ta.id where ta.id is NULL can be used to get tracks missing the album
scanMissingArtists function appears to be adding artists and albums that are not yet populated to the local DB.
It should be split to a scanMissingArtists and scanMissingAlbums function as those are two different things.
Further; it calls getTidalTracksUnordered, which fetches ALL tracks from the DB.
This is unnecessary.
select tt.* from tidal_tracks as tt left join tidal_artists as ta on tt.artist=ta.id where ta.id is NULLcan be used to get tracks missing the artistselect tt.* from tidal_tracks as tt left join tidal_albums as ta on tt.album=ta.id where ta.id is NULLcan be used to get tracks missing the album