Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Q: how to use Media Library? (Read 3775 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Q: how to use Media Library?

I'm trying to develop something similar to facet interface for remote access.
I thought there is SDK implementation which categorize all music folder contents, but I can't find one.
Do I have to read files manually?
And Media Library components(Album List, Facets) are not open source.

My idea is...
1. get "Music folders" from related configuration variable (c:\music, d:\music_2, ...)
2. scan all music files in music folders (mp3, cue, flac, ...)
3. read tag informations
4. build data structure to categorize tags in genre, artists, album, ...
Am I on the right track?

Are there any help implementations to read music library folders?
It seems quite complex and redundant job to handle all types of tags.

Thanks.

Sean

Q: how to use Media Library?

Reply #1
1. get "Music folders" from related configuration variable (c:\music, d:\music_2, ...)
2. scan all music files in music folders (mp3, cue, flac, ...)
The first two points can be handled like this:

Code: [Select]
metadb_handle_list handles;
static_api_ptr_t<library_manager_v3>()->get_all_items(handles);

There is no need to deal with the files and folders directly.

3. read tag informations
4. build data structure to categorize tags in genre, artists, album, ...
Am I on the right track?

For these two points you should have a look at the interface classes metadb_handle and file_info

Edit reason : code correction.

Q: how to use Media Library?

Reply #2
library_manager.h ?


Q: how to use Media Library?

Reply #4
Thanks you guys!!
and I have another question

/*******************
  metadb_handle_list handles;
  static_api_ptr_t<library_manager_v3>()->get_all_items(handles);;
  char str[10];
  pfc::float_to_string(str, 10, handles.get_count(), 2, false);
  popup_message::g_show(str, "hi");
********************/

I tried it but I got always zero from get_count()
I found out why...

I'm using "CreateThread" windows API to run http server for remote access.
And code above that running in the separate thread gives zero!!
Running them in main thread gives correct result.

Is it possible to use non-main thread with foobar API??

Thanks

Sean

 

Q: how to use Media Library?

Reply #5
Quote
All methods are valid from main thread only, unless noted otherwise.
(see library_manager)

You can use the main_thread_callback_manager in a worker thread to execute a task in the main thread that retrieves the content of the media library. Access to the meta data of tracks is possible from any thread.