Bug 3972 - Null-delimited lists in ID3v2.4 text frames
: Null-delimited lists in ID3v2.4 text frames
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Scanner
: 6.5b1
: PC Windows XP
: P2 enhancement with 1 vote (vote)
: ---
Assigned To: Chris Owens
http://www.hydrogenaudio.org/forums/i...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-19 21:44 UTC by windowshade
Modified: 2008-12-18 11:12 UTC (History)
5 users (show)

See Also:
Category: ---


Attachments
MP3 demonstrating null-delimited TPE1 in ID3v2.4 tag (128.54 KB, audio/x-mpeg)
2006-08-19 21:46 UTC, windowshade
Details
Patch for multi-value T??? fields. (3.25 KB, patch)
2006-11-12 11:12 UTC, Justin Fletcher
Details | Diff
Multi-text field support (3.23 KB, patch)
2006-11-20 15:40 UTC, Justin Fletcher
Details | Diff
trunk version (3.28 KB, patch)
2007-05-22 19:43 UTC, KDF
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description windowshade 2006-08-19 21:44:13 UTC
The ID3v2.4 informal standard (Native Frames document, section 4.2: http://www.id3.org/id3v2.4.0-frames.txt) indicates that, while text information frames must not be duplicated, null-delimited lists may be used to include multiple strings within a single frame. SlimServer currently supports this for GENRE (TCON), but not for other frames such as ARTIST (TPE1). I feel the same logic should apply to other text fields. 

A potential solution has been proposed by gerph: http://forums.slimdevices.com/attachment.php?attachmentid=1585&d=1156015617.

While the use of null separators in this context may seem obscure (only foobar2000 and mp3tag support it AFAIK), it offers the following advantages over text separators (such as '/' or ';'):

1. Graceful degradation to ID3v1. Only the first string in the null-separated list is written to the ID3v1 tag, reducing clutter (and its repercussions: split-up albums, i.e.) in legacy devices.
2. Smooth integration integration with foobar2000, a popular audio player for Windows.
3. Improved integration (or graceful degradation) with MusicMagic/MusicIP, which does not support text separators but ignores strings following the first null. (Currently, values in a text-delimited list appear 'mixable' from SlimServer but are not recognized by the MIP API, resulting in an empty mix. Trailing artists--for instance--in a null separated list will not appear mixable to begin with. That's how it works with Vorbis comments.)

I recognize that implementing this could be complex; thanks for considering it.
Comment 1 windowshade 2006-08-19 21:46:40 UTC
Created attachment 1453 [details]
MP3 demonstrating null-delimited TPE1 in ID3v2.4 tag
Comment 2 Chris Owens 2006-08-21 09:45:45 UTC
We are quite close to shipping 6.5, so I have to mark this as 'future' for now.
Comment 3 windowshade 2006-10-08 10:50:21 UTC
Is it appropriate to request a target milestone for this one now that 6.5.0 is out? I've been using gerph's patch for the past 6 weeks or so--stable, no problems with scanning MP3 files.
Comment 4 Chris Owens 2006-10-10 16:51:50 UTC
Perhaps Dan has an opinion on whether this can be added to 7.0.
Comment 5 Justin Fletcher 2006-11-12 11:12:59 UTC
Created attachment 1711 [details]
Patch for multi-value T??? fields.

This patch is the most recent of the changes that I've made to the MP3::Info processor. It is intended to ensure that fields with multiple values in them in 2.4 frames are supplied within an array to the requester.
Comment 6 Justin Fletcher 2006-11-20 15:40:08 UTC
Created attachment 1721 [details]
Multi-text field support

This is a diff against revision 10736. It provides support for...

... multiple nul-separated text fields as required by ID3v2.4.
... improved merging of duplicate tags. Not used by SlimServer. If the request is for both ID3v1 and ID3v2.4 then the fields may end up with nuls terminating the strings which causes the fields to differ and not be merged correctly - thus it may seem that the artist appears twice, once for ID3v1 and once for ID3v2.x. This is corrected.
Comment 7 Spies Steven 2007-04-30 16:05:20 UTC
*** Bug 4623 has been marked as a duplicate of this bug. ***
Comment 8 windowshade 2007-05-19 19:01:11 UTC
Just a note to say I've been using gerph's patch for about 8 months with no ill effects. Works like a charm, actually. Are there any barriers to implementing it into SlimServer?

--fb2k and mp3tag use id3v2.4 tags & null-delimited fields
--this practice is standards-compliant
--id3v2.4, admittedly a late bloomer, is gaining momentum
--gerph has done all the heavy lifting; the patch is already done
--and tested on a diverse library
Comment 9 Justin Fletcher 2007-05-20 13:56:05 UTC
(In reply to comment #8)
> --id3v2.4, admittedly a late bloomer, is gaining momentum

*finally* :-)

> --gerph has done all the heavy lifting; the patch is already done
> --and tested on a diverse library

I just wanted to say that whilst I appreciate the sentiment, a lot of the work had already been done to make multi-values work in the core design of SlimServer and I've merely utilised that facility with the ID3v2.4 multi-value frames. It would be nice to see it go in; sadly I've not upgraded my own slimserver here, so I can't check whether the patches work with a modern version. At some point I will upgrade to the more recent version and hopefully will be able to update my patches appropriately.
Comment 10 Jim McAtee 2007-05-20 17:41:41 UTC
This should be classified as a bug since SlimServer fails to meet the specification.  Maybe if someone at Slim Devices one day starts working again on scanning and database problems, then this fix could be considered.
Comment 11 Chris Owens 2007-05-21 10:12:52 UTC
I agree, Jim.  I'll make an executive decision that we should put this into 7, since 6.5.2 is out the door today (crossing fingers).
Comment 12 Jim McAtee 2007-05-22 13:22:43 UTC
I'd like to suggest that if Justin produces a patch for the 6.5.2 release and it passes preliminary user testing, that this could be targeted for 6.5.3.
Comment 13 Justin Fletcher 2007-05-22 14:16:15 UTC
(In reply to comment #12)
> I'd like to suggest that if Justin produces a patch for the 6.5.2 release and
> it passes preliminary user testing, that this could be targeted for 6.5.3.

You can suggest it, and I'll try my best to get a patch up in the next week or
so. I've not actually got 6.5.2 installed here; I'm using one of the beta 7's
from a while back at the moment. Shouldn't be hard to install and create a
patch for, though.
Comment 14 Justin Fletcher 2007-05-22 15:03:11 UTC
I've just used the most recent patch (2006-11-20) on lib/MP3/Info.pm in 6.5.2 and it applies straight off with no changes. So, it could be applied without any problems. I'll run it in 6.5.2 for a bit and see whether there are any problems, but I don't expect any as it's been running in the pre-7.0 version I've been running for some time (and windowshade's been using it for longer, but on a pre-6.5.2 version).
Comment 15 windowshade 2007-05-22 15:14:34 UTC
(In reply to comment #14)
> I've been running for some time (and windowshade's been using it for longer,
> but on a pre-6.5.2 version).
> 

I've been using 6.5.2 since early March 2007--absolutely no trouble with your patch. (And I've run about a thousand wipes/rescans playing with bug 4882.)
Comment 16 KDF 2007-05-22 19:43:32 UTC
Created attachment 2028 [details]
trunk version

trunk version only requires minor changes to one of the sections so that it will apply.  As this is a CPAN module, the patches should be forwarded as well
Comment 17 Chris Owens 2007-05-29 12:32:48 UTC
I'm ready to start testing this for the 6.5.3 release if someone will put it in the branch.
Comment 18 KDF 2007-05-29 23:25:45 UTC
added to 6.5.3 at change 12151, and trunk at change 12152

feel free to add this to the specs and test away.  reopen if there are any problems.
Comment 19 Adrian Smith 2007-07-20 12:36:35 UTC
I belive the patch included here is causing bug 5166 which can cause the server to crash.  

Please could the author of this patch validate the patch I've added to that bug.  The problem is that for the problem files this patch returns attribute arrays of the form:
          'ARTIST' => [
                        'Dr Lecter',
                        [
                          'The Police'
                        ]
                      ],

This causes the sql code to croak...
Comment 20 Justin Fletcher 2007-07-20 13:50:39 UTC
Eek; that sounds very bad. I don't really have the time to debug that now, but it doesn't seem too unbelievable that that would happen - surprising that it didn't get shown up in testing, though :-(
Comment 21 Justin Fletcher 2007-07-20 13:53:36 UTC
Turns out it's not a complicated fix and checking the patch in bug 5166 is pretty easy. That patch does appear to fix it. Really sorry that my code didn't work straight off :-(
Comment 22 Jim McAtee 2007-07-20 14:03:25 UTC
If you examine the mp3s in the other bug report that break the scanner, the problem turned up in id3v2.3 tags when there are two frames of the same name in the tag.  Apparently, some ripping or tagging program(s) are doing that.  So probably not surprising that it didn't turn up in testing with well-behaved files.
Comment 23 Justin Fletcher 2007-07-20 14:13:48 UTC
Curse me and my well-formed files! :-|
Comment 24 windowshade 2007-07-20 15:43:02 UTC
(In reply to comment #23)
> Curse me and my well-formed files! :-|
> 

Guilty as charged. Next time I test a patch, remind me to scan some illegal downloads or something. My hat is off to developers like Justin and Adrian--I don't know how you keep on top of everything (we) users might try!
Comment 25 Justin Fletcher 2007-07-20 15:48:49 UTC
(In reply to comment #24)
> (In reply to comment #23)
> > Curse me and my well-formed files! :-|
> > 
> 
> Guilty as charged. Next time I test a patch, remind me to scan some illegal
> downloads or something. My hat is off to developers like Justin and Adrian--I
> don't know how you keep on top of everything (we) users might try!

Nah; don't thank me - I'm the one that broke it and caused people pain trying when it crashed and in trying to debug. I should have probably tried malformed files but the multi-tagged files never even occurred to me when the specification stated explicitly what to do for multiple items... Mea culpa.