Fix extracting of some properties to match what was written
ClosedPublic

Authored by astippich on Apr 14 2019, 8:43 AM.

Details

Summary

Currently, one can write and read through taglib extractor and writer
plugins. Unfortunately, some "smart" transformation on the data are
applied when reading them. This does not allow to read exactly what was
written.

BUG: 408532

Test Plan

New automatic test is OK, no regressions.

Diff Detail

Repository
R286 KFileMetaData
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mgallien created this revision.Apr 14 2019, 8:43 AM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptApr 14 2019, 8:43 AM
Restricted Application added subscribers: Baloo, kde-frameworks-devel. · View Herald Transcript
mgallien requested review of this revision.Apr 14 2019, 8:43 AM

IMHO for searching, the separation from a single string into multiple entries is the best thing to do, from a metadata editing point of view not so much.
How about inserting the TStringList entry by entry, without using the contactsFromString method? That would maintain the exact representation of metadata tags also for the baloo database.

bruns added a comment.Apr 14 2019, 2:08 PM

IMHO for searching, the separation from a single string into multiple entries is the best thing to do, from a metadata editing point of view not so much.
How about inserting the TStringList entry by entry, without using the contactsFromString method? That would maintain the exact representation of metadata tags also for the baloo database.

When searching is left to baloo, it already splits up strings at whitespace etc., so you can provide the string as is.

As far as I can see, in some cases (e.g. "ARTIST"), the Taglib::StringList PropertyMap::operator[] is first joined (.toString(';')) and then split again. How about avoiding that in the first place?

astippich requested changes to this revision.Apr 14 2019, 2:25 PM

IMHO for searching, the separation from a single string into multiple entries is the best thing to do, from a metadata editing point of view not so much.
How about inserting the TStringList entry by entry, without using the contactsFromString method? That would maintain the exact representation of metadata tags also for the baloo database.

When searching is left to baloo, it already splits up strings at whitespace etc., so you can provide the string as is.

Great, that we don't have to worry about that.

As far as I can see, in some cases (e.g. "ARTIST"), the Taglib::StringList PropertyMap::operator[] is first joined (.toString(';')) and then split again. How about avoiding that in the first place?

That's what I meant. That was the easy way before because of the contactsFromString function, but if KFM individually adds each entry of the TStringList returned from TagLib's PropertyMap, all will be fine.
Please also adjust "Conductor", "Arranger", "Performer and "Author" for consistency

This revision now requires changes to proceed.Apr 14 2019, 2:25 PM
ngraham edited the summary of this revision. (Show Details)Jun 22 2019, 10:07 AM

@mgallien Are you going to update? There are bug reports which will also be fixed by this, so it would be nice to get this in.
Or do you mind if I take over?

@mgallien Are you going to update? There are bug reports which will also be fixed by this, so it would be nice to get this in.
Or do you mind if I take over?

I would like but I am quite busy with real life. If you feel like working on this, that would be really great.

astippich commandeered this revision.Jun 22 2019, 12:19 PM
astippich edited reviewers, added: mgallien; removed: astippich.
astippich updated this revision to Diff 60334.Jun 22 2019, 12:19 PM
  • remove usage of contactsFromString entirely
astippich retitled this revision from fix extracting of some properties to match what was writen to Fix extracting of some properties to match what was written.Jun 22 2019, 12:20 PM
astippich edited the summary of this revision. (Show Details)
astippich edited the summary of this revision. (Show Details)Jun 29 2019, 2:15 PM
bruns added inline comments.Jun 29 2019, 3:35 PM
autotests/taglibwritertest.cpp
557
const map<Property, QString> properties = { {Artist, "Artist", ...};
for (property : properties) {
  data.add(...);
}

write(data);
exxtractResult(...);

for (property: properties) {
  QCOMPARE(...);
}
579

fileExtension

src/extractors/taglibextractor.cpp
169

There is a small mismatch between this one (and all others below) and e.g. "LYRICS" above - one uses trimmed(), the other does not.

IMHO, all properties should be trimmed (though we risk not being roundtrip-save).

354

is this always just one value, or a list as well?

astippich updated this revision to Diff 60842.Jun 29 2019, 6:27 PM
astippich marked an inline comment as done.
  • add trimmed(), adjust test
  • fileExtension
astippich added inline comments.Jun 29 2019, 6:27 PM
src/extractors/taglibextractor.cpp
354

as far as I know, asf only allows single entry tags, so just a single value

astippich marked 2 inline comments as done.Jul 1 2019, 4:36 PM

friendly ping, I would like to get this into 5.60

bruns accepted this revision.Jul 5 2019, 7:56 PM
This revision is now accepted and ready to land.Jul 5 2019, 7:56 PM
This revision was automatically updated to reflect the committed changes.