Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > arg! need id3 library

arg! need id3 library
Thread Tools
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Feb 28, 2002, 06:49 PM
 
ok, I give up, can someone out there point me in the direction of a good id3 library that has good documentation and will work with objective-c? I think that any C library should do fine, but not C++.
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Mar 1, 2002, 10:54 PM
 
what about your other post? didn't the id3lib from sourcefourge work?

for me, this would just be overkill, i just want to be able to get some basic id3 tags out of an mp3. i had a look at the specifications yesterday; id3v1 is a 5 minute 10 liner, but id3v2 looks a bit more complicated.

i haven't yet tackled it, so i don't know how hard this really is, but why re-invent the wheel?

itistoday, have you found anything?
     
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Mar 1, 2002, 11:31 PM
 
well seb2, the problem is, is that I can't find any good documentation for that library. How did you figure yours out? Just looked over the files? I did fine some, but it was for C++, and I don't think you can mix C++ with Obj-C, but you can mix C with Obj-C. They say the library works with C too, but I can't figure out how. Maybe you can help me out. So far, I haven't found any other library's, but now that the weekend has come, I'll keep looking.
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Mar 1, 2002, 11:58 PM
 
you can mix obj-c and c++... http://developer.apple.com/techpubs/...tes/Objective-
C++.html

id3v1 was so simple, i did this before looking at the id3lib. give me until tonight (have to get going now), i can post those few lines for id3v1, no big deal.

my problem with id3v2 is that i think the id3lib would just be overkill for my plans; i don't need to be able to edit tags, just want the artist and song title out of an mp3, that's all... guess i'll have to take a closer look at those libs. (as far as i'm concerned, i find it much harder to understand other people's code than to write my own...)
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Mar 2, 2002, 11:34 AM
 
ok, this is my first approach... might look a bit complicated when it comes to the encoding, but just using [NSString stringWithCString:[[fiHa readDataOfLength:30] bytes]] makes umlauts in my german mp3s unusable, this approach tweaks with the encoding a bit and actually works:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
#import &lt;string.h&gt;

...

- (void)getID3v1TagFromFileAtPath NSString *)path
{
NSString *tag, *title, *artist, *album;

NSData *data;

NSFileHandle *fiHa = [NSFileHandle fileHandleForReadingAtPath ath];

[fiHa seekToFileOffset [[[[NSFileManager defaultManager] fileAttributesAtPath ath traverseLink:NO] objectForKey:NSFileSize] intValue] - <font color = blue>128</font>)];

tag = [[[NSString alloc] initWithData:[fiHa readDataOfLength:<font color = blue>3</font>] encoding:NSASCIIStringEncoding] autorelease];

if ([[tag lowercaseString] isEqualToString:<font color = orange>@"tag"</font>])
{
data = [fiHa readDataOfLength:<font color = blue>30</font>];
title = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease];
title = [title substringWithRange:NSMakeRange(<font color = blue>0</font>, strlen([data bytes]))];

data = [fiHa readDataOfLength:<font color = blue>30</font>];
artist = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease];
artist = [artist substringWithRange:NSMakeRange(<font color = blue>0</font>, strlen([data bytes]))];

data = [fiHa readDataOfLength:<font color = blue>30</font>];
album = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease];
album = [album substringWithRange:NSMakeRange(<font color = blue>0</font>, strlen([data bytes]))];

NSLog(<font color = orange>@"Title: \<font color = red>"</font>%@\"</font>", title);
NSLog(<font color = orange>@"Artist: \<font color = red>"</font>%@\"</font>", artist);
NSLog(<font color = orange>@"Album: \<font color = red>"</font>%@\"</font>", album);
} else {
NSLog(<font color = orange>@"No valid ID3v1 tag"</font>);
}
}
</font>[/code]

it doesn't check whether the path actually exists, it's assumed it does.

any useful info on id3v2?
     
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Mar 3, 2002, 10:46 AM
 
Well, try reading this documentation. It's for C++ though, and I don't know C++. Maybe it'll help you figure out id3v2. Btw, the documentation is for id3lib.
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Mar 3, 2002, 08:09 PM
 
Originally posted by itistoday:
<STRONG>Well, try reading this documentation. It's for C++ though, and I don't know C++. Maybe it'll help you figure out id3v2. Btw, the documentation is for id3lib.</STRONG>
thanks, but this id3lib is kind of huge. -- i thought more about something the third of the size, if that's feasable...

i'll keep on trying. i've made some first steps to do id3v2 parsing myself. far from being done, but further away from zero than before.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:12 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2