Use SIGUSR1 to rescan library in musikcubed

This commit is contained in:
casey langen 2022-08-20 00:05:59 -07:00
parent 8d694c3680
commit 3998b759f7
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@
* fixed `musikdroid` app notification on Android 13 devices.
* updated `musikdroid` dependencies and tooling, fixed a few warnings.
* merged latest upstream `PDCurses` code for Windows builds.
* sending `musikcubed` a SIGUSR1 will trigger a library rescan.
--------------------------------------------------------------------------------

View File

@ -270,6 +270,12 @@ static void initUtf8() {
boost::filesystem::path::imbue(utf8Locale);
}
static void rescanHandler(int signal) {
debug::info("daemon", "received SIGUSR1, rescanning the library...");
auto library = LibraryFactory::Instance().DefaultLocalLibrary();
library->Indexer()->Schedule(IIndexer::SyncType::All);
}
int main(int argc, char** argv) {
initUtf8();
std::cout << "\n using lockfile at: " << getLockfileFn();
@ -280,6 +286,8 @@ int main(int argc, char** argv) {
srand((unsigned int) time(0));
std::signal(SIGUSR1, rescanHandler);
plugin::Init();
EvMessageQueue messageQueue;