Fixes issue of metadata/lyrics not updating when switching tracks
The issue is due to TrackMetadataModel::trackData
not providing
track data for tracks with Database ID of 0, which are tracks that
are missing title metadata and are not added into elisaDatabase.db.
In the fix, we remove the ID check. This introduces another issue,
where in ContextView.qml
onDatabaseIdChanged
would not update the
metadata/lyrics because the ID of tracks without metadata would be
0, and it wouldn't trigger the refresh of tracks changing. To alleviate
this, we'll instead monitor the filename of the track playing, and
when that changes, we update trackdata by the file URL.
On top of that, ContextView.qml
now calls the proper function based on
whether the track has a database id or not.
Concern: Does calling metaDataModel.initializeByUrl
on onFileUrlChanged
reduce performance compared to previous when it was called by IdAndUrl?
A simple databaseId !== 0
check doesn't work here because the databaseId
is updated later than the onFileUrlChanged
is called, so you don't have the
databaseId of the current track, rather the previous. Maybe there's a way
to change the behaviour somewhere.
BUG: 436405