taglib-devel Digest, Vol 112, Issue 1
Duke Yin
yindesu at gmail.com
Sat Oct 5 20:00:37 UTC 2013
I see... I did not realize I need to cast ID3v2::Frames to
TextIdentificationFrames in order to accept StringLists.
On Sat, Oct 5, 2013 at 8:00 AM, <taglib-devel-request at kde.org> wrote:
> Send taglib-devel mailing list submissions to
> taglib-devel at kde.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.kde.org/mailman/listinfo/taglib-devel
> or, via email, send a message with subject or body 'help' to
> taglib-devel-request at kde.org
>
> You can reach the person managing the list at
> taglib-devel-owner at kde.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of taglib-devel digest..."
>
>
> Today's Topics:
>
> 1. How to write multiple values to one ID3v2.4 frame? (Duke Yin)
> 2. Re: How to write multiple values to one ID3v2.4 frame?
> (Michael Helmling)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 4 Oct 2013 22:07:41 -0400
> From: Duke Yin <yindesu at gmail.com>
> To: taglib-devel at kde.org
> Subject: How to write multiple values to one ID3v2.4 frame?
> Message-ID:
> <CADzCEdet9DK2u7dXWivxhMAVnQxCXSTxBcQC1KpA0x7AFWrt=
> g at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I'm trying to figure out how to write multiple values to an ID3v2.4 tag.
> ID3v2.4 spec is to have a single frame where all values are joined
> together with a null character. (By contrast, ID3v2.3 uses a backslash
> instead of null. XiphComment uses multiple frames instead of a single
> frame with a delimiting character.) I couldn't find any code examples for
> ID3v2.4, so I tried two approaches which failed.
>
> Approach 1: add a new frame for each value
> > // for each string {
> > TagLib::ID3v2::TextIdentificationFrame *frame = new
> TagLib::ID3v2::TextIdentificationFrame(keyStr, TagLib::String::UTF8);
> > id3v2->addFrame(frame);
> > frame->setText(str);
> > // } close for loop
> Result 1: incorrect - multiple frames instead of a single frame.
>
> Approach 2: manually separate the values with the null character
> > TagLib::StringList values;
> > // { for each string, append the string to "values" }
> > TagLib::ID3v2::TextIdentificationFrame *frame = new
> TagLib::ID3v2::TextIdentificationFrame(keyStr, TagLib::String::UTF8);
> > id3v2->addFrame(frame);
> > frame->setText(values.toString('\0'));
>
> Result 2: wrong and inconsistent behaviors:
> - All values can be read by foobar2000
> - The last value can't be read by Mp3tag, apparently because the text
> encoding size is double what Mp3tag would write with the same input
> - All values except the first can't be read by TagLib when the file is
> opened again with code similar to https://gist.github.com/Horrendus/622816.
>
> I'm not sure if I'm using the null character correctly in Approach 2 given
> how many apps it breaks (although foobar2000 handles it). I'm hoping
> there's an easy way to write multiple values to ID3v2.4 that I missed.
> What is the correct way to do this?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.kde.org/pipermail/taglib-devel/attachments/20131004/84040af0/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Sat, 05 Oct 2013 11:19:12 +0200
> From: Michael Helmling <michaelhelmling at posteo.de>
> To: taglib-devel at kde.org
> Subject: Re: How to write multiple values to one ID3v2.4 frame?
> Message-ID: <524FD990.8040701 at posteo.de>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> Simply use
> frame->setText(values)
> which is also declared with a StringList argument.
>
> Regards,
> Michael
> Am 05.10.2013 04:07, schrieb Duke Yin:
> > I'm trying to figure out how to write multiple values to an ID3v2.4
> > tag. ID3v2.4 spec is to have a single frame where all values are
> > joined together with a null character. (By contrast, ID3v2.3 uses a
> > backslash instead of null. XiphComment uses multiple frames instead
> > of a single frame with a delimiting character.) I couldn't find any
> > code examples for ID3v2.4, so I tried two approaches which failed.
> >
> > Approach 1: add a new frame for each value
> > > // for each string {
> > > TagLib::ID3v2::TextIdentificationFrame *frame = new
> > TagLib::ID3v2::TextIdentificationFrame(keyStr, TagLib::String::UTF8);
> > > id3v2->addFrame(frame);
> > > frame->setText(str);
> > > // } close for loop
> > Result 1: incorrect - multiple frames instead of a single frame.
> >
> > Approach 2: manually separate the values with the null character
> > > TagLib::StringList values;
> > > // { for each string, append the string to "values" }
> > > TagLib::ID3v2::TextIdentificationFrame *frame = new
> > TagLib::ID3v2::TextIdentificationFrame(keyStr, TagLib::String::UTF8);
> > > id3v2->addFrame(frame);
> > > frame->setText(values.toString('\0'));
> >
> > Result 2: wrong and inconsistent behaviors:
> > - All values can be read by foobar2000
> > - The last value can't be read by Mp3tag, apparently because the text
> > encoding size is double what Mp3tag would write with the same input
> > - All values except the first can't be read by TagLib when the file is
> > opened again with code similar to
> > https://gist.github.com/Horrendus/622816 .
> >
> > I'm not sure if I'm using the null character correctly in Approach 2
> > given how many apps it breaks (although foobar2000 handles it). I'm
> > hoping there's an easy way to write multiple values to ID3v2.4 that I
> > missed. What is the correct way to do this?
> >
> >
> > _______________________________________________
> > taglib-devel mailing list
> > taglib-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/taglib-devel
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.kde.org/pipermail/taglib-devel/attachments/20131005/dd6bc714/attachment-0001.html
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: signature.asc
> Type: application/pgp-signature
> Size: 555 bytes
> Desc: OpenPGP digital signature
> URL: <
> http://mail.kde.org/pipermail/taglib-devel/attachments/20131005/dd6bc714/attachment-0001.sig
> >
>
> ------------------------------
>
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
>
> End of taglib-devel Digest, Vol 112, Issue 1
> ********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20131005/3b2b0af2/attachment.html>
More information about the taglib-devel
mailing list