Help - Search - Members - Calendar
Full Version: Database refreshing/pruning
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
cwbowron
I was looking into mimicking the effects of preferences->Database->Remove Dead Entries and preferences->Database->Scan, but I wanted to see if I am thinking about this correctly...

Does playlist_oper::process_locations add files to the database if they are not there already? is metadb::user_requested_remove the way to go to remove dead entries?

Here's the functions as I envision them:

CODE

void database_scan_music_directory()
{
string8 music_path = g_music_directory;
ptr_list_t<const char> file_list;
metadb_handle_list handles;
file_list.add_item(music_path);
playlist_oper::get()->process_locations(file_list, handles);
handles.delete_all();
}


CODE

void database_prune_dead_entries()
{
metadb_handle_list handles;
metadb::get()->database_lock();
metadb::get()->get_all_entries(handles);

for (int i=0;i<handles.get_count();i++)
{
 const playable_location *play = handles[i]->handle_get_location();
 if (input::is_entry_dead(play))
 {
  metadb::get()->user_requested_remove(play);
 }
}
handles.delete_all();
metadb::get()->database_unlock();
}


Thanks
foosion
QUOTE(cwbowron @ Feb 24 2005, 07:09 PM)
Does playlist_oper::process_locations add files to the database if they are not there already?
*
Yes.
QUOTE(cwbowron @ Feb 24 2005, 07:09 PM)
is metadb::user_requested_remove the way to go to remove dead entries?
*
No, it is intented to remove live entries that the user explicitly requested to be removed. Use one of the following metadb methods to remove dead files from the database:
CODE
   virtual void file_removed(const char * src)=0;//use this to tell database that url [src] is dead
   virtual void entry_dead(const playable_location * entry)=0;//same as file_removed but taking playable_location

cwbowron
Thanks... appreciate it...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.