www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ID3 library wrapper (taglib, id3lib, anything)

reply Walter Strom <walt.strom gmail.com> writes:
--0022159f025e99cb0d04a8305950
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

There are no ID3 (audio tags, 'artist', 'title' et al editing) projects for
D. There was one called id3, but it was halted 3 years ago at alpha / ID3v1=
.

And there are mature Taglib & Id3lib, both written C++, but both with C
wrapper options.

I've tried to make a D wrapper around Taglib, but all it outputs for now ar=
e
the words "You are a shameful idiot, mister", which I put into the failure
condition without being aware of how much it'd hurt after a hundred runs.

That C wrapper looks easy =E2=80=94 3 same kind struct typedefs, 2 same kin=
d enum
typedefs, and a bunch of simple funcs that only seem to require a type name=
s
replacement and extern (C).

I've tried, but surely not doing it right:

Original C: typedef struct { int foo; } Bar;
I tried:    struct Bar { int foo; }
and also:   struct Wrp { struct { int foo; } } alias Wrp Bar;

Original C: typedef enum { foo, etc } Bar;
I tried:    enum Bar { foo, etc };
and also:   enum { foo, etc } alias int Bar;

In addition to my noobish translations, I might also be using it all wrong,
as I've discovered D a week ago :(.

It would be so amazing if there was someone in the group who wants / finds
potentially useful ID3 editing, but isn't a D virgin. It's a pity Taglib ha=
s
simple bindings from C# to Ruby, and the guy who's doing D's is being
insulted by his own code.

If anyone has guts: http://developer.kde.org/~wheeler/taglib.html
The c wrapper: bindings/c/tag_c.h
The example using it: examples/tagreader_c.c

Just to make it clear, it's a mere hope there is someone interested, but
more mature than me, and is not in any way a request-like stuff.

Long live D,
Walt

--0022159f025e99cb0d04a8305950
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

There are no ID3 (audio tags, &#39;artist&#39;, &#39;title&#39; et al editi=
ng) projects for D. There was one called id3, but it was halted 3 years ago=
 at alpha / ID3v1.<br><br>And there are mature Taglib &amp; Id3lib, both wr=
itten C++, but both with C wrapper options.<br>

<br>I&#39;ve tried to make a D wrapper around Taglib, but all it outputs fo=
r now are the words &quot;You are a shameful idiot, mister&quot;, which I p=
ut into the failure condition without being aware of how much it&#39;d hurt=
 after a hundred runs.<br>

<br>That C wrapper looks easy =E2=80=94 3 same kind struct typedefs, 2 same=
 kind enum typedefs, and a bunch of simple funcs that only seem to require =
a type names replacement and extern (C).<br><br>I&#39;ve tried, but surely =
not doing it right:<br>

<br>Original C: typedef struct { int foo; } Bar;<br>I tried:=C2=A0=C2=A0=C2=
=A0 struct Bar { int foo; }<br>and also:=C2=A0=C2=A0 struct Wrp { struct { =
int foo; } } alias Wrp Bar;<br><br>Original C: typedef enum { foo, etc } Ba=
r;<br>I tried:=C2=A0=C2=A0=C2=A0 enum Bar { foo, etc };<br>

and also:=C2=A0=C2=A0 enum { foo, etc } alias int Bar;<br><br>In addition t=
o my noobish translations, I might also be using it all wrong, as I&#39;ve =
discovered D a week ago :(.<br><br>It would be so amazing if there was some=
one in the group who wants / finds potentially useful ID3 editing, but isn&=
#39;t a D virgin. It&#39;s a pity Taglib has simple bindings from C# to Rub=
y, and the guy who&#39;s doing D&#39;s is being insulted by his own code.<b=
r>
<br>If anyone has guts: <a href=3D"http://developer.kde.org/~wheeler/taglib=
.html">http://developer.kde.org/~wheeler/taglib.html</a><br>The c wrapper: =
bindings/c/tag_c.h<br>The example using it: examples/tagreader_c.c<br><br>
Just to make it clear, it&#39;s a mere hope there is someone interested, bu=
t more mature than me, and is not in any way a request-like stuff.<br><br>L=
ong live D,<br>Walt<br><br><br>

--0022159f025e99cb0d04a8305950--
Jul 16 2011
next sibling parent Christian Manning <cmanning999 gmail.com> writes:
Walter Strom wrote:

 There are no ID3 (audio tags, 'artist', 'title' et al editing) projects
 for D. There was one called id3, but it was halted 3 years ago at alpha /
 ID3v1.
 
 And there are mature Taglib & Id3lib, both written C++, but both with C
 wrapper options.
 
 I've tried to make a D wrapper around Taglib, but all it outputs for now
 are the words "You are a shameful idiot, mister", which I put into the
 failure condition without being aware of how much it'd hurt after a
 hundred runs.
 
 That C wrapper looks easy — 3 same kind struct typedefs, 2 same kind enum
 typedefs, and a bunch of simple funcs that only seem to require a type
 names replacement and extern (C).
 
 I've tried, but surely not doing it right:
 
 Original C: typedef struct { int foo; } Bar;
 I tried:    struct Bar { int foo; }
 and also:   struct Wrp { struct { int foo; } } alias Wrp Bar;
 
 Original C: typedef enum { foo, etc } Bar;
 I tried:    enum Bar { foo, etc };
 and also:   enum { foo, etc } alias int Bar;
 
 In addition to my noobish translations, I might also be using it all
 wrong, as I've discovered D a week ago :(.
 
 It would be so amazing if there was someone in the group who wants / finds
 potentially useful ID3 editing, but isn't a D virgin. It's a pity Taglib
 has simple bindings from C# to Ruby, and the guy who's doing D's is being
 insulted by his own code.
 
 If anyone has guts: http://developer.kde.org/~wheeler/taglib.html
 The c wrapper: bindings/c/tag_c.h
 The example using it: examples/tagreader_c.c
 
 Just to make it clear, it's a mere hope there is someone interested, but
 more mature than me, and is not in any way a request-like stuff.
 
 Long live D,
 Walt

I've actually been working on an audio metadata library from scratch in D! Right now it doesn't support ID3 of any kind, but that will probably be coming soon. The thing is I don't really want to add support for loads of metadata formats at the moment because I keep changing things (quite drastically) and it would be way too much effort to modify all these formats. Once I get it more stable I can add support for other formats. Before you ask, I haven't released this anywhere yet :) Chris
Jul 16 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
You never said anything about what OS you're running, but I'll assume
you're on Windows since you're mentioning C#.

Ask and you shall receive:
https://github.com/AndrejMitrovic/DTagLib

It took about 30 minutes of work. The sample application works for me,
here's an example:

D:\dev\projects\DTagLib>tagreader "E:\My Music\Pushmipulyu - 05 - wake you.mp3"
******************** "E:\My Music\Pushmipulyu - 05 - wake you.mp3"
********************

-- TAG --
title   - "wake you"
artist  - "Pushmipulyu"
album   - "133 Thursdays"
year    - "2006"
comment - ""
track   - "5"
genre   - "Electronica"
-- AUDIO --

bitrate     - 233
sample rate - 44100
channels    - 2
length      - 7:45
Jul 16 2011
prev sibling next sibling parent Walter Strom <walt.strom gmail.com> writes:
--20cf3001b821640e3504a838b2fc
Content-Type: text/plain; charset=UTF-8

Huge thank you, Andrej!

The fact that you even wrote a full readme made me want to write the
previous sentence in all caps with a row exclamation marks.

I see now where I went wrong with it, and it's a good learning.

...ah, hell with it... THANK YOU




On 16 July 2011 23:26, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:

 You never said anything about what OS you're running, but I'll assume
 you're on Windows since you're mentioning C#.

 Ask and you shall receive:
 https://github.com/AndrejMitrovic/DTagLib

 It took about 30 minutes of work. The sample application works for me,
 here's an example:

 D:\dev\projects\DTagLib>tagreader "E:\My Music\Pushmipulyu - 05 - wake
 you.mp3"
 ******************** "E:\My Music\Pushmipulyu - 05 - wake you.mp3"
 ********************

 -- TAG --
 title   - "wake you"
 artist  - "Pushmipulyu"
 album   - "133 Thursdays"
 year    - "2006"
 comment - ""
 track   - "5"
 genre   - "Electronica"
 -- AUDIO --

 bitrate     - 233
 sample rate - 44100
 channels    - 2
 length      - 7:45

--20cf3001b821640e3504a838b2fc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Huge thank you, Andrej! <br><br>The fact that you even wrote a full readme = made me want to write the previous sentence in all caps with a row exclamat= ion marks.<br><br>I see now where I went wrong with it, and it&#39;s a good= learning.<br> <br>...ah, hell with it... THANK YOU<br><br><br><span class=3D"gD" style=3D= "color:#790619"></span><br><br><div class=3D"gmail_quote">On 16 July 2011 2= 3:26, Andrej Mitrovic <span dir=3D"ltr">&lt;<a href=3D"mailto:andrej.mitrov= ich gmail.com">andrej.mitrovich gmail.com</a>&gt;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex;">You never said anything about what OS you&#= 39;re running, but I&#39;ll assume<br> you&#39;re on Windows since you&#39;re mentioning C#.<br> <br> Ask and you shall receive:<br> <a href=3D"https://github.com/AndrejMitrovic/DTagLib" target=3D"_self">http= s://github.com/AndrejMitrovic/DTagLib</a><br> <br> It took about 30 minutes of work. The sample application works for me,<br> here&#39;s an example:<br> <br> D:\dev\projects\DTagLib&gt;tagreader &quot;E:\My Music\Pushmipulyu - 05 - w= ake you.mp3&quot;<br> ******************** &quot;E:\My Music\Pushmipulyu - 05 - wake you.mp3&quot= ;<br> ********************<br> <br> -- TAG --<br> title =C2=A0 - &quot;wake you&quot;<br> artist =C2=A0- &quot;Pushmipulyu&quot;<br> album =C2=A0 - &quot;133 Thursdays&quot;<br> year =C2=A0 =C2=A0- &quot;2006&quot;<br> comment - &quot;&quot;<br> track =C2=A0 - &quot;5&quot;<br> genre =C2=A0 - &quot;Electronica&quot;<br> -- AUDIO --<br> <br> bitrate =C2=A0 =C2=A0 - 233<br> sample rate - 44100<br> channels =C2=A0 =C2=A0- 2<br> length =C2=A0 =C2=A0 =C2=A0- 7:45<br> </blockquote></div><br> --20cf3001b821640e3504a838b2fc--
Jul 16 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I've just built a wrapper library for TagLib. Not that this is still
the Abstract API that's used. The full API is written in C++ and this
would be very difficult to wrap in D. I'll make an announcement
shortly.
Jul 18 2011
prev sibling next sibling parent Johannes Pfau <spam example.com> writes:
Andrej Mitrovic wrote:
I've just built a wrapper library for TagLib. Not that this is still
the Abstract API that's used. The full API is written in C++ and this
would be very difficult to wrap in D. I'll make an announcement
shortly.

I've started a SWIG wrapper for TagLib some time ago, but more to learn how to use swig than for the TagLib library. Most classes are wrapped, but there are lots of warnings (not properly wrapped overloaded functions, etc). I won't work on it for some time, it's actually quite frustrating: You can do almost everything with the abstract API and the effort to create a complete wrapper is huge. But for some planned projects I'll need custom tags, which are not supported in the abstract API. Anyway for those interested in swig/d it could be useful: https://github.com/jpf91/TagLibD/tree/ -- Johannes Pfau
Jul 19 2011
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
That might be a cool thing to look into if I ever get around to
playing with SWIG. Thanks for putting it online.
Jul 19 2011