www.digitalmars.com         C & C++   DMDScript  

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

reply Walter Strom <walt.strom gmail.com> writes:
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

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
Jul 16 2011
parent reply 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

 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
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
You never said anything about what OS you're running, but I'll assume


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:
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


 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 parent reply 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
parent reply 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
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