MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.19k stars 350 forks source link

Duplicate audio when storing metadata in cue file #1010

Open OVlasiuk opened 4 years ago

OVlasiuk commented 4 years ago

Bug report

This follows up on #992

Describe the bug

Suppose I have two files: a .flac (.ape, .wv, etc) without any metadata, containing an album, and a .cue file with metadata for this album. This causes duplication: the no-metadata file is listed as a single item, followed by the same audio split into tracks coming from the .cue file.

Expected Behavior

Only list the tracks once. This is what other popular players do as well.

Actual Behavior

As explained above, there is duplication in the audio added by e.g. mpc add [folder name]. Would it make sense to introduce an option of the sort "always prefer the metadata in cue files"?

Version

Music Player Daemon 0.22.3 (0.22.3)

Log

Log is not really relevant. Here is a sample output of mpc playlist after mpc add [folder name]. Notice the superfluous first item:

1  -  ()
2 Ensemble Organum - Introït: Salve sancta parens (1991)
3 Ensemble Organum - Kyrie (1991)
4 Ensemble Organum - Gloria in excelsis Deo (1991)
5 Ensemble Organum - Graduel: Benedicta et venerabilis (1991)
6 Ensemble Organum - Alleluia: Nobilis atque pia (1991)
7 Ensemble Organum - Alleluia: Ave Maria gratia plena (1991)
8 Ensemble Organum - Séquence: Ave mundi spes Maria (1991)
9 Ensemble Organum - Credo in unum Deum (1991)
10 Ensemble Organum - Offertoire: Felix namque es sacra virgo (1991)
11 Ensemble Organum - Préface - Sanctus (1991)
12 Ensemble Organum - Agnus Dei (1991)
13 Ensemble Organum - Communion: Beata viscera (1991)
14 Ensemble Organum - Ite missa est - Deo gratias - Motet (1991)
MPconta commented 3 years ago

Are you sure, the .flac does not contain any tags? I also use .flac +.cue, where the .cue contains the tags and in the .flac all tags are removed. With the current MPD version i do not have the problem of doubled entries. It seems, it is necessary to distinguish strictly between the possibilities where tags can be stored. When the tags are in the .cue, the .flac must not contain any tags.

hiqua commented 3 years ago

Are you sure, the .flac does not contain any tags? I also use .flac +.cue, where the .cue contains the tags and in the .flac all tags are removed. With the current MPD version i do not have the problem of doubled entries. It seems, it is necessary to distinguish strictly between the possibilities where tags can be stored. When the tags are in the .cue, the .flac must not contain any tags.

How do you add your tracks? Don't you have the problem if you add the folder containing both the .flac and the .cue?

MPconta commented 3 years ago

The folder contains 2 files. Just the plain .flac and the .cue . Both have the same filename.

You can check the database with

lsinfo [folder name]

The result should not show any tag-entry like "album" or "artist", but entries like Time, duration and a reference to the .cue .

OVlasiuk commented 3 years ago

@MPconta:

Are you sure, the .flac does not contain any tags?

Quite sure indeed: I have removed them with metaflac. I have also tried this on a .wv file, removing tags with wvtag; for both formats there is an empty item containing the entire album, as shown above. I wonder if the difference is in that you do mpc add [cue file] and not mpc add [folder], as @hiqua has suggested.

The folder contains 2 files. Just the plain .flac and the .cue . Both have the same filename.

Yep. Not sure how to tell mpd to lsinfo, so can't try out your suggestion though.

MPconta commented 3 years ago

Yep. Not sure how to tell mpd to lsinfo, so can't try out your suggestion though.

You can use telnet from another computer.

telnet [ip-adress] [port-number]

Btw. i use MPDroid and Gmpc as MPD-clients.

hiqua commented 3 years ago

@MPconta it could be that your clients solve this problem themselves. Maybe it would be better to solve these in mpc / ncmpc (and clients in general) instead of mpd. I assume the problem is the same with playlists: if you add a folder containing both a few tracks and a playlist with all the tracks, I guess they'll be added twice by mpc / ncmpc (I don't use playlists so I don't really know).

MPconta commented 3 years ago

@MPconta it could be that your clients solve this problem themselves.

Not really sure about that. To my understanding all clients have to revert to the MPD protocol-commands listed here: [https://www.musicpd.org/doc/html/protocol.html] So you can overview best whats happening, when using commands like lsinfo directly. But maybe i'm totally wrong?!

vvnull commented 3 years ago

I encounter this duplication as well. Both clients that I use (ncmpcpp and MPDroid) list <empty> and <no album> or (Unknown Artist) and (Unknown Album) respectively for these flac files, in addition to sourcing the cue appropriately. Previously I had solved this issue by simply putting *.cue in .mpdignore, but that required me to split the flacs every time. My current workaround has been to nest my audio into folders:

In each dir I keep an .mpdignore file; in flac_split it contains *.cue, and in flac_cue it contains *.flac. Thanks to this, the split files use their own tags and do not use the cue files (which I prefer to keep there for backup/reference), and the single flacs' tags (or lack thereof) are ignored, and only the cues are used. This satisfies both of my used clients, without needing to convert all files to one convention.