Skip to content

Fixes issue of metadata/lyrics not updating when switching tracks

Yerrey Dev requested to merge yerrey/elisa:metadata-update-fix into master

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 onTrackTypeChanged now calls the proper function based on whether the track has a database id or not.

We change the order of the notifying of database id and filename in manageheaderbar.cpp, so we avoid the issue that the when the onFileUrlChanged is triggered, we actually have the database id of the current track, instead of the previous. This allows us to use the correct function knowing whether the track is in the database or not. (Hope this doesn't break any behaviour elsewhere)

Also a fix for metadata not updating when opening files through Files-browser, this was caused by files being opened as ElisaUtils::FileName TrackType instead of ElisaUtils::Track. In the fix we just allow ModelDataLoader::loadDataByDatabaseIdAndUrl to handle filenames.

BUG: 436405 BUG: 448043 BUG: 445382 BUG: 427289

Edited by Yerrey Dev

Merge request reports