Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Folder Update
#8
Here's the code. Basically same as doing mpc stats which returns results instantly.

daemon/worker.php
Code:
// Check for library update complete
function chkLibraryUpdate() {
    //workerLog('chkLibraryUpdate');
    $sock = openMpdSock('localhost', 6600);
    $status = getMpdStatus($sock);
    $stats = getMpdStats($sock);
    closeMpdSock($sock);

    if (!isset($status['updating_db'])) {
        sendEngCmd('libupd_done');
        $GLOBALS['check_library_update'] = '0';
        workerLog('mpdindex: Done: indexed ' . $stats['artists'] . ' artists, ' . $stats['albums'] . ' albums, ' .  $stats['songs'] . ' songs');
        workerLog('worker: Job update_library done');
    }
}

inc/mpd.php
Code:
function getMpdStats($sock) {
    sendMpdCmd($sock, 'stats');
    $resp = readMpdResp($sock);
    return parseDelimFile($resp, ': ');
}
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
Folder Update - by Nuvera - 07-31-2022, 10:17 AM
RE: Folder Update - by Tim Curtis - 07-31-2022, 01:11 PM
RE: Folder Update - by Nuvera - 07-31-2022, 01:16 PM
RE: Folder Update - by Tim Curtis - 07-31-2022, 01:45 PM
RE: Folder Update - by Nuvera - 07-31-2022, 03:41 PM
RE: Folder Update - by Tim Curtis - 07-31-2022, 10:03 PM
RE: Folder Update - by TheOldPresbyope - 08-01-2022, 02:29 AM
RE: Folder Update - by Tim Curtis - 08-01-2022, 02:52 AM
RE: Folder Update - by patrik96 - 08-11-2022, 04:17 PM
RE: Folder Update - by Nuvera - 08-01-2022, 09:26 AM
RE: Folder Update - by TheOldPresbyope - 08-01-2022, 01:06 PM
RE: Folder Update - by Tim Curtis - 08-01-2022, 02:29 PM
RE: Folder Update - by Tim Curtis - 08-11-2022, 05:46 PM
RE: Folder Update - by patrik96 - 08-11-2022, 05:59 PM

Forum Jump: