示例#1
0
文件: backend.php 项目: cyrilix/rompr
function prepareCollectionUpdate()
{
    create_foundtracks();
    prepare_findtracks();
    open_transaction();
}
示例#2
0
$image = array_key_exists('image', $_POST) ? $_POST['image'] : null;
$album = array_key_exists('album', $_POST) ? $_POST['album'] : null;
$uri = array_key_exists('uri', $_POST) ? $_POST['uri'] : null;
$date = array_key_exists('date', $_POST) && $_POST['date'] != 0 ? getYear($_POST['date']) : null;
$urionly = array_key_exists('urionly', $_POST) ? true : false;
$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()));