function jump($action) { switch ($action) { case "add_album": do_add_album(); break; case "album_action": do_album_action(); break; case "album_update": do_album_update_action(); break; case "track_add": do_track_add(); break; case "track_update": do_track_update(); break; case "album_delete_confirm": delete_album(); break; case "track_delete_confirm": delete_track(); break; default: // default to show main page main_page(); } return; }
} break; case 'delete': $ttids = find_item($uri, null, null, null, null, true); if (count($ttids) == 0) { header('HTTP/1.1 400 Bad Request'); } else { delete_track(array_shift($ttids)); } break; case 'deletewl': $ttid = find_wishlist_item(html_entity_decode($artist), html_entity_decode($album), html_entity_decode($title)); if ($ttid == null) { header('HTTP/1.1 400 Bad Request'); } else { delete_track($ttid); } break; case 'cleanup': remove_cruft(); update_track_stats(); $returninfo = array(); $returninfo['stats'] = alistheader(get_stat('ArtistCount'), get_stat('AlbumCount'), get_stat('TrackCount'), format_time(get_stat('TotalTime'))); print json_encode($returninfo); break; case 'gettags': print json_encode(list_tags()); break; case 'getfaveartists': print json_encode(get_fave_artists()); break;