Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MusicBrainz: Extended metadata support (pre-gsoc2020) #2522

Merged
merged 11 commits into from
Mar 4, 2020
Merged

MusicBrainz: Extended metadata support (pre-gsoc2020) #2522

merged 11 commits into from
Mar 4, 2020

Conversation

uklotzde
Copy link
Contributor

@uklotzde uklotzde commented Feb 27, 2020

https://bugs.launchpad.net/mixxx/+bug/1581256
https://www.mixxx.org/wiki/doku.php/gsoc2020ideas

    QUuid artistId;
    QUuid albumArtistId;
    QUuid albumReleaseId;
    QUuid recordingId;
    QUuid releaseGroupId;
    QUuid trackReleaseId;

    QString title;
    QString artist;
    QString albumTitle;
    QString albumArtist;
    QString releaseGroupType;
    QString mediumFormat;
    QString trackNumber;
    QString trackTotal;
    QString discNumber;
    QString discTotal;
    QString date;
  • Fetch and store additional metadata from MusicBrainz
  • New MusicBrainz XML parser
    • the existing parser was really poor with no proper error handling
  • New networking micro-framework

This branch has undergone multiple transformations with intermediate steps since then. In order to get rid of obsolete code while moving to the new networking framework I had to recombine commits into larger chunks.

@uklotzde uklotzde changed the title MusicBrainz: Extended metadata support MusicBrainz: Extended metadata support (gsoc2020ideas) Feb 28, 2020
@Holzhaus
Copy link
Member

https://www.mixxx.org/wiki/doku.php/gsoc2020ideas

Are you planning to apply? 😆

@uklotzde
Copy link
Contributor Author

uklotzde commented Feb 28, 2020

https://www.mixxx.org/wiki/doku.php/gsoc2020ideas

Are you planning to apply? laughing

;) I have completed most of the work some time ago, but these changes have not yet been published. It's a prerequisite in case someone wants to continue working on extended topics, other than importing metadata.

The missing step was to rewrite the HTTP clients for AcoustID and MusicBrainz to reuse the recently finished infrastructure that is used for aoide. It is far more complicated and inconvenient than even legacy async Rust (i.e. with futures 0.1 from 2018/2019), but at least it allows to chain multiple requests.

@uklotzde uklotzde changed the title MusicBrainz: Extended metadata support (gsoc2020ideas) MusicBrainz: Extended metadata support (pre-gsoc2020) Feb 28, 2020
@uklotzde
Copy link
Contributor Author

Now the title should no longer be misleading.

@uklotzde
Copy link
Contributor Author

Also considered ready for 2.3.0.

The improvements around handling of network requests and of the XML parser alone are worth to include it. Only some additional fields (like album artist and track numbers) are imported from MusicBrainz if __EXTRA_METADATA__ is not set.

@uklotzde uklotzde added this to the 2.3.0 milestone Feb 29, 2020
Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some first comments.

namespace {

QStringList track2row(const Track& track) {
const auto trackNumbers = TrackNumbers::joinStrings(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads as if the return value is a QStringList. I think this is not the case so it is not a good use case for auto.

We should also consider to rename the function to makeNumberOfTotalString()
or something more intelligent.


namespace {

QStringList track2row(const Track& track) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 2row? Track2MetadataList.

It look like the underlying issue is, that the resultAvailable signal returning tracks.

It would be easier to understand and is probably more performant if it will directly return a custom track object containing the results (a single row) only. Can this be TrackRelease?

The string list solution here draws the column sorting into the management code which is also subobtimal. I think we should at least name the indexes of the list.

Thinking about all of this ... can't we deduplicate the results earlyer just after receiving them.

A custom deduplicate code, working in the temporary track objects would also be a solution.

Ideas?

Copy link
Contributor Author

@uklotzde uklotzde Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the dialog only as needed. I will not implements further improvements other than passing-through of mixxx::musicbrainz::TrackRelease as suggested.

PS: Performance doesn't matter here. I only changed the signal types, because the status quo of using QObjects for this purpose was wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dialogue needs to be extended anyway in the future. Whoever will do this can improve the deduplication logic and replace the QStringList. The deduplication currently depends on the displayed columns that are actually displayed and therefore must be done here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The simplistic deduplication logic before is really displaced and the code is difficult to follow. Now everything is co-located on the display layer were it actually matters. It's not optimal, but without a rationale for deduplication this is the best we could do for now.

importedMetadata.getTrackInfo().getMusicBrainzReleaseId()
);
}
if (!importedMetadata.getAlbumInfo().getMusicBrainzArtistId().isNull()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how the artist Id compared to the string representation. I think we need to handle them at once.
For example if the user changes the Artist, it does not match the string stored for this Id at music brains.
This can be an issue when handling Artist with special characters like Tiësto or P!ink or features like "Lena feat. Nico Santos"
For my feeling it is required to use the consolodated string when assigning the Artist ID.
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the recording id and the title? I will not make up a custom correlation logic without any foundation.

I can only offer to implement one of the following options:

  • Overwrite all fields unconditionally
  • Set single fields one-by-one conditionally (current version)

If someone knows how to correlate the fields in a consistent manner, please do so. I refuse to do it, because I am not able to come up with a solution that is supposed to be "correct".

DEBUG_ASSERT(reader.tokenType() != QXmlStreamReader::EndDocument);
DEBUG_ASSERT(reader.tokenType() != QXmlStreamReader::DTD);
DEBUG_ASSERT(reader.tokenType() != QXmlStreamReader::EntityReference);
// ignore other token types
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is Characters, Comment and ProcessingInstructions.

Please name them explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@daschuer
Copy link
Member

daschuer commented Mar 4, 2020

Thank you. I will do some manual test before merge.

Unfortunately CI build fails:

�[01m�[Ksrc/library/dlgtagfetcher.cpp:�[m�[K In member function ‘�[01m�[Kvoid DlgTagFetcher::apply()�[m�[K’:
�[01m�[Ksrc/library/dlgtagfetcher.cpp:162:25:�[m�[K �[01;31m�[Kerror: �[m�[Kqualified-id in declaration before ‘�[01m�[K(�[m�[K’ token
 void DlgTagFetcher::quit() {
�[01;32m�[K                         ^�[m�[K
�[01m�[Ksrc/library/dlgtagfetcher.cpp:167:37:�[m�[K �[01;31m�[Kerror: �[m�[Kqualified-id in declaration before ‘�[01m�[K(�[m�[K’ token
 void DlgTagFetcher::fetchTagProgress(QString text) {
�[01;32m�[K                                     ^�[m�[K

@daschuer daschuer closed this Mar 4, 2020
@uklotzde uklotzde reopened this Mar 4, 2020
@daschuer
Copy link
Member

daschuer commented Mar 4, 2020

Thank you, it Looks and works good.

@daschuer daschuer merged commit 1e0a1f5 into mixxxdj:master Mar 4, 2020
@uklotzde uklotzde deleted the musicbrainz branch March 4, 2020 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants