FROM : Gregory Weston
DATE : Sun May 11 14:24:11 2008
Mr. Gecko wrote:
> Hello I am using this ID3 Framework for cocoa http://
> drewfamily.homemail.com.au/Cocoa_-_ID3Tag_framework.html
> and I want to add an image from the web which is an jpeg.
> I have already tried this.
> TagAPI *MP3 = [[TagAPI alloc] initWithGenreList:nil];
> [MP3 examineFile:MP3Path];
> NSBitmapImageRep *image = [[NSBitmapImageRep alloc] initWithData:
> [NSData dataWithContentsOfURL:[NSURL URLWithString:[object
> objectForKey:@"image"]]]];
> NSMutableDictionary *imageDict = [NSMutableDictionary dictionary];
> [imageDict setObject:image forKey:@"Image"];
> [imageDict setObject:@"jpeg" forKey:@"Picture Type"];
> [imageDict setObject:@"image/jpeg" forKey:@"Mime Type"];
> [imageDict setObject:@"Album Art" forKey:@"Description"];
> NSMutableArray *imageArr = [NSMutableArray new];
> [imageArr addObject:imageDict];
> [MP3 setImages:imageArr];
> [MP3 updateFile];
> and it did not work.
> can anyone give me an example?
>
> Thanks,
> Mr. Gecko
My first reaction is that this is probably a question for the author
of the framework rather than for the Cocoa list. The address for that
is apparently <email_removed>.
On looking through the code, I do have a couple of comments:
Your MP3 object is never released or autoreleased here. Not sure if
that's a leak or if you just didn't show the complete snippet.
Ditto image and imageArr.
There's a quirk in the fooWithContentsOfURL: methods in Cocoa whereby
you might get gzipped data instead of the actual content you're
expecting. It depends on the OS version and the URL scheme, so you
might want to split up that line a bit and make sure that what you're
actually getting back is sane.
DATE : Sun May 11 14:24:11 2008
Mr. Gecko wrote:
> Hello I am using this ID3 Framework for cocoa http://
> drewfamily.homemail.com.au/Cocoa_-_ID3Tag_framework.html
> and I want to add an image from the web which is an jpeg.
> I have already tried this.
> TagAPI *MP3 = [[TagAPI alloc] initWithGenreList:nil];
> [MP3 examineFile:MP3Path];
> NSBitmapImageRep *image = [[NSBitmapImageRep alloc] initWithData:
> [NSData dataWithContentsOfURL:[NSURL URLWithString:[object
> objectForKey:@"image"]]]];
> NSMutableDictionary *imageDict = [NSMutableDictionary dictionary];
> [imageDict setObject:image forKey:@"Image"];
> [imageDict setObject:@"jpeg" forKey:@"Picture Type"];
> [imageDict setObject:@"image/jpeg" forKey:@"Mime Type"];
> [imageDict setObject:@"Album Art" forKey:@"Description"];
> NSMutableArray *imageArr = [NSMutableArray new];
> [imageArr addObject:imageDict];
> [MP3 setImages:imageArr];
> [MP3 updateFile];
> and it did not work.
> can anyone give me an example?
>
> Thanks,
> Mr. Gecko
My first reaction is that this is probably a question for the author
of the framework rather than for the Cocoa list. The address for that
is apparently <email_removed>.
On looking through the code, I do have a couple of comments:
Your MP3 object is never released or autoreleased here. Not sure if
that's a leak or if you just didn't show the complete snippet.
Ditto image and imageArr.
There's a quirk in the fooWithContentsOfURL: methods in Cocoa whereby
you might get gzipped data instead of the actual content you're
expecting. It depends on the OS version and the URL scheme, so you
might want to split up that line a bit and make sure that what you're
actually getting back is sane.
| Related mails | Author | Date |
|---|---|---|
| Mr. Gecko | May 11, 06:28 | |
| Gregory Weston | May 11, 14:24 |






Cocoa mail archive

