Exemplo n.º 1
0
$disc = array_key_exists('disc', $_POST) ? $_POST['disc'] : 1;
$trackimage = array_key_exists('trackimage', $_POST) ? $_POST['trackimage'] : null;
if (substr($image, 0, 4) == "http") {
    $image = "getRemoteImage.php?url=" . $image;
}
$attributes = array_key_exists('attributes', $_POST) ? $_POST['attributes'] : null;
if (array_key_exists('attribute', $_POST) && array_key_exists('value', $_POST)) {
    debuglog("WARNING! Old-style attribute-value pair. Update the code!", "USERRATING", 2);
    $attributes = array(array("attribute" => $_POST['attribute'], "value" => $_POST['value']));
}
open_transaction();
switch ($_POST['action']) {
    case 'getplaylist':
        preparePlaylist();
    case 'repopulate':
        doPlaylist($_POST['playlist'], $_POST['numtracks']);
        break;
    case 'taglist':
        print json_encode(list_all_tag_data());
        break;
    case 'ratlist':
        print json_encode(list_all_rating_data());
        break;
    case 'metabackup':
        file_put_contents('prefs/tagbackup.json', json_encode(list_all_tag_data()));
        file_put_contents('prefs/ratbackup.json', json_encode(list_all_rating_data()));
        file_put_contents('prefs/plcbackup.json', json_encode(list_all_playcount_data()));
        print '<html></html>';
        break;
    case 'getbackupdata':
        $backup = array();
Exemplo n.º 2
0
function doRootPlaylists($p)
{
    //scan for m3us
    $sPath = $p . '/*.m3u';
    foreach (glob($sPath) as $m3u) {
        //proceed with one playlist
        doPlaylist($m3u);
    }
}