Bug 436405 - MetaData isn't updated while there is not metadata at all
Summary: MetaData isn't updated while there is not metadata at all
Status: RESOLVED FIXED
Alias: None
Product: Elisa
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Matthieu Gallien
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-30 14:09 UTC by hanyoung
Modified: 2022-01-27 15:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hanyoung 2021-04-30 14:09:38 UTC
SUMMARY
I traced down to DatabaseInterface::internalTrackIdFromFileName returns zero for track that has no metadata at all. This caused lyric not updated while switching from track has lyric to track that doesn't have any metadata.

STEPS TO REPRODUCE
1. One track with lyric, one track with no metadata
2. play track with lyric
3. switch to track with no metadata

OBSERVED RESULT
the lyric is not updated

EXPECTED RESULT
lyric should be empty

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2021-04-30 17:40:07 UTC
Interesting. Wanna submit a merge request? :)
Comment 2 hanyoung 2021-05-01 05:52:58 UTC
(In reply to Nate Graham from comment #1)
> Interesting. Wanna submit a merge request? :)

I'd like to fix it.
I found seems like songs without metadata's ID in database is nil. Can you point me to the related files?
Comment 3 hanyoung 2021-05-01 10:24:57 UTC
Tracks without metadata isn't present in Tracks table but exist in TracksData table. I don't know which class is responsible for insert new tracks to database.
Comment 5 Bug Janitor Service 2022-01-26 14:58:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/multimedia/elisa/-/merge_requests/322
Comment 6 Yerrey Dev 2022-01-27 15:23:24 UTC
Git commit db4720e7fa9e294a3916941749a83a0c3845e344 by Yerrey Dev.
Committed on 27/01/2022 at 12:01.
Pushed by ngraham into branch 'master'.

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.

M  +1    -3    src/models/trackmetadatamodel.cpp
M  +3    -3    src/qml/ContextView.qml

https://invent.kde.org/multimedia/elisa/commit/db4720e7fa9e294a3916941749a83a0c3845e344
Comment 7 Yerrey Dev 2022-01-27 15:23:33 UTC
Git commit f0d279478935bbda2de2ead40176938cee6d71e1 by Yerrey Dev.
Committed on 27/01/2022 at 12:01.
Pushed by ngraham into branch 'master'.

Fix metadata view not updating when switching tabs

We need to check whether to call initializeByUrl or initializeByIdAndUrl
based on whether the track has database id, fixes the issue of
the metadata view being blank after switching tabs.

Also onTrackTypeChanged needs the same check so metadata is properly
updated when switching for example from radio to a track without
metadata.

M  +15   -7    src/qml/ContextView.qml

https://invent.kde.org/multimedia/elisa/commit/f0d279478935bbda2de2ead40176938cee6d71e1
Comment 8 hanyoung 2022-01-27 15:24:56 UTC
thanks a lot, I didn't manage to figure out what caused this back then.