views:

279

answers:

1

Hi,

does someone know a library, that I can use to read MP3-Tags in Silverlight 3? In WPF I was using taglib, but obviously I cannot reference it in Silverlight projects.

Thanks, Andrej

+3  A: 

Taglib doesn't contain any unsafe code. Perhaps you can recompile it (with a few minor alterations maybe) to work in silverlight.

Have you tried just using Taglib's code? There's a decent chance it'll work without too much hassle.

Edit: Yes, I mean TagLib#. I just tried, and there are a few minor issues which were fixable in 15min. (You'll need to define ICloneable, remove a bunch of unnecessary Serialization constructors for exceptions, remove the last parameter on string.Split(char[],int) calls, that's about it.)

Note that unless someone else has fixed it, there's a minor bug in Taglib#'s Id3v2 unsynchronization code. You can ignore it and fail to parse a few id3v2 tags, or you can use the same workaround I did: https://bugzilla.gnome.org/show%5Fbug.cgi?id=593138#c4 - I know, I should submit a patch, but time and all...

Eamon Nerbonne
do you mean taglib#? because taglib is not a .NET library, so won't be usable from Silverlight
Mark Heath
Yes I mean taglib#. Is it open source? If so, I will have a look at the code...Still, hopefully somebody knows an existing SL library.
Andrej
I just tried to port the Code to Silverlight, but there are just too much incompatibilities, so that I would have to rewrite a lot :(
Andrej
I tried porting it to SL2 btw, and that worked without a hitch.
Eamon Nerbonne
The issues look complex, but really, they're not. If you can't figure it out, contact me again, and I'll mail you the updated code.
Eamon Nerbonne
You were right, I fixed everything and now I try creating a TagLib File from a stream via a TagLib Interface (per default I would have to pass an absolute path). If I still have problems I will contact you again. Thanks for your help.
Andrej
Eamon - did you post your updated code anywhere? Would love to see it.
Tim Heuer
Timing, timing - I just cleaned out my dev-experiments and deleted the above modifications three days ago; so no, I don't have the code anymore. It is, however, truly quite easily done - just set the output target to silverlight and fix the resulting compile errors. There are a bucketload; but almost all are trivial; the only slightly complex issues are mentioned above - define ICloneable, remove the last parameter from string.Split, and remove unsupported serialization constructors (which you don't need). That's it!
Eamon Nerbonne