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

Native Development

Reply
Developer
ankur_siwach
Posts: 142
Registered: ‎09-28-2012
My Device: Blackberry Developer
Accepted Solution

how to get albums name

How can i get the albums name and the numner of photo exist in every albums..


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Please use plain text.
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: how to get albums name

Hi

 

in each case you need a list of the files in a particular directory (e.g. shared/music). The documentation on "Working with the File System" should help you get started:

 

https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_syst...

 

So with this API you should be able to get a list of the photos in the shared/photos and shared/camera directories and do some counting.

 

I'll look into your other question which is about extracting meta data from MP3 files and post again.

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
ankur_siwach
Posts: 142
Registered: ‎09-28-2012
My Device: Blackberry Developer

Re: how to get albums name

thanx 


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Please use plain text.
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: how to get albums name

OK, I see what you mean.

 

No, there's no API like that.

 

Also, as things stand, accessing metadata in music files is not easy. There's a database on the device called /db/mmlibrary.db that contains the data you want (select * from albums) but you cannot open it as a SqlLite database directly due to permissions restrictions. If you copy the .db file to your application's data directory first however, then you can open it. 

 

https://developer.blackberry.com/native/documentation/cascades/ui/lists/lists_create_database_class....

 

Gives hints about this approach for database files in general.

 

I guess if the file is very large you may see a short delay during copying.

 

Aside from that the only other approach I can think of would involve porting a library like id3lib and using that to extract metadata from files in the shared/music folder via that API:

 

http://id3lib.sourceforge.net/

 

Hope this helps at least a little

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
ankur_siwach
Posts: 142
Registered: ‎09-28-2012
My Device: Blackberry Developer

Re: how to get albums name

ok i will try to implement that..

is  /db/mmlibrary.db for all to find out the number of albums in photos and media...


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Please use plain text.
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: how to get albums name

Yes, and you can copy it off your device using the Momentics IDE (information perspective, target file system browser) and then open it in a SQLite tool. There's a table called "albums" that contains album titles.

 

One word of warning if you go this approach. We reserve the right to change the database schema. This is not a public API, it's a work around that may or may not be suitable to your application.

 

Porting a library may be the better choice for you.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
ankur_siwach
Posts: 142
Registered: ‎09-28-2012
My Device: Blackberry Developer

Re: how to get albums name

[ Edited ]

I have done this by iterating the directory into the shared/photo folder...and get the number of album exist into the folder..

 

QDir dirPath = QDir(QDir::currentPath() + "/shared/photos");
QDirIterator iterator(dirPath.absolutePath(), QDirIterator::Subdirectories);
 
iterator.next();
if (iterator.fileInfo().isDir())
{
     //your code here
}

 


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Please use plain text.
Retired
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10

Re: how to get albums name

Thanks for sharing your solution with the community.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: how to get albums name

It's going to have to be a touch more sophisicated than this as you will need to merge photo's stored on the memory card as well.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.