Exemplo n.º 1
0
        break;
    case 'gettags':
        print json_encode(list_tags());
        break;
    case 'getfaveartists':
        print json_encode(get_fave_artists());
        break;
    case 'getcharts':
        $charts = array();
        $charts['Artists'] = get_artist_charts();
        $charts['Albums'] = get_album_charts();
        $charts['Tracks'] = get_track_charts();
        print json_encode($charts);
        break;
    case 'geturis':
        $uris = getItemsToAdd($uri, "");
        print json_encode($uris);
        break;
    case 'geturisfordir':
        $uris = getDirItems($uri);
        print json_encode($uris);
        break;
}
close_transaction();
close_mpd();
debuglog("---------------------------END----------------------", "USERRATING", 4);
function forcedUriOnly($u, $d)
{
    // Some mopidy backends - YouTube and SoundCloud - can return the same artist/album/track info
    // for multiple different tracks.
    // This gives us a problem because find_item will think they're the same.
Exemplo n.º 2
0
     $newimage = md5('Playlist ' . $cmd[2]);
     if (file_exists('albumart/small/' . $oldimage . '.jpg')) {
         debuglog("Renaming playlist image for " . $cmd[1] . " to " . $cmd[2], "MPD");
         system('mv "albumart/small/' . $oldimage . '.jpg" "albumart/small/' . $newimage . '.jpg"');
         system('mv "albumart/asdownloaded/' . $oldimage . '.jpg" "albumart/asdownloaded/' . $newimage . '.jpg"');
     }
     $playlist_file = format_for_disc(rawurldecode($cmd[1]));
     $new_file = format_for_disc(rawurldecode($cmd[2]));
     system('mv "prefs/' . $playlist_file . '" "prefs/' . $new_file . '"');
     $cmds[] = join_command_string($cmd);
     break;
 case "playlistadd":
     require_once "backends/sql/backend.php";
     if (preg_match('/[ab]album\\d+|[ab]artist\\d+/', $cmd[2])) {
         $lengthnow = count($cmds);
         $cmds = array_merge($cmds, getItemsToAdd($cmd[2], $cmd[0] . ' "' . format_for_mpd($cmd[1]) . '"'));
         check_playlist_add_move($cmd, count($cmds) - $lengthnow);
     } else {
         $cmds[] = join_command_string(array($cmd[0], $cmd[1], $cmd[2]));
         check_playlist_add_move($cmd, 1);
     }
     break;
 case "playlistadddir":
     // TODO How do we move things into position?
     $thing = array('searchaddpl', $cmd[1], 'base', $cmd[2]);
     $cmds[] = join_command_string($thing);
     break;
 case 'save':
     $playlist_name = format_for_mpd($cmd[1]);
     $playlist_file = format_for_disc(rawurldecode($cmd[1]));
     clean_the_toilet($playlist_file);