Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10

Tell me if it's possible

Hi there,

I'm developing a PlayBook OS (not BB10) app using HTML5/Javascript (Sencha Touch).
Is it possible to extract the cover art picture of an mp3/aac and saved this picture on the file system ?

First I need to read and extract the mp3 bytes --> HTML5 file api 'readAsBinaryString'
Parse the bytes and find APIC tag --> ???
Create/save a picture file (.jpg or .png) from the APIC bytes --> blackberry.io.file.saveFile (path : String, data : Blob)

It's a technical challenge for me and I would like to know if it sounds possible before I spend my time on it ;o) Or maybe an other simpler way is possible ?

Thanks for your help,
Laurent

Twitter : @LaurentKP
My apps
BlackBerry Development Advisor
chadtatro
Posts: 620
Registered: ‎10-01-2009
My Device: Z10

Re: Tell me if it's possible

In theory it sounds possible.

 

I was parsing ID3 info from MP3's long ago with JavaScript, so I assume the same technique could be used to grab album art as well.

 

More info here, http://sveinbjorn.org/JavaScript_mp3_id3_data_album_artwork

 

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Developer
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: Tell me if it's possible

Oups Error 404 with your link http://sveinbjorn.org/JavaScript_mp3_id3_data_album_artwork

 

ID3 infos is a bit different because it's only characters. Here with album art I think it's more difficult to retrieve the bytes, then make a blob and finally the picture file. 

 

 

Twitter : @LaurentKP
My apps
BlackBerry Development Advisor
chadtatro
Posts: 620
Registered: ‎10-01-2009
My Device: Z10

Re: Tell me if it's possible

Here's an interesting approach, may be easier for you in the end.

 

http://stackoverflow.com/questions/11357906/album-art-work-api

 

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Developer
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: Tell me if it's possible

Thank you. You're probably right, the last.fm api seems easier to implement !

Twitter : @LaurentKP
My apps
Developer
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: Tell me if it's possible

Unfortunaltly, I can't use the last.fm api because my app will be a paid one and because of the artist rights you can't use the album arts...

 

Well, now I'm working with discogs.

The only limitation with this api is 1000 request per day per IP and 1 request/second.

Twitter : @LaurentKP
My apps