$type = $_GET['type'];
}
// Check for the path elements
$path = $_SERVER[PATH_INFO];
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    set_headers($type);
    if ($path_params[1] != null) {
        if ($path_params[1] == "current") {
            render_result(get_tracklist(), "playlists", $type);
            /* render current tracklist */
        } elseif ($path_params[2] != null) {
            $rowtitles = get_row_titles("playlist");
            // get rows of gd-table playlist
            if (in_array($path_params[2], $rowtitles)) {
                render_result(get_playlist($path_params[1], $path_params[2]), "playlists", $type);
                /* render explicit info of playlist given by id */
            } elseif ($path_params[2] == "tracks") {
                render_result(get_tracklist($path_params[1]), "playlists", $type);
                /* render tracklist from playlist given by id */
            } else {
                render_result(get_playlist($path_params[1]), "playlists", $type);
                /* render all infos of playlist given by id (if wrong info is ordered) */
            }
        } else {
            render_result(get_playlist($path_params[1]), "playlists", $type);
            /* render all infos of playlist given by id */
        }
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    set_headers($type);
    if ($path_params[1] != null) {
        if ($path_params[1] == "artists") {
            if ($path_params[2] != null) {
                render_result(get_artist("album", $path_params[2]), "artists", $type);
            } else {
                render_result(get_artist("album"), "artists", $type);
            }
        } else {
            if ($path_params[2] != null) {
                $rowtitles = get_row_titles("album");
                // get rows of gd-table album
                if (in_array($path_params[2], $rowtitles)) {
                    render_result(get_album($path_params[1], $path_params[2]), "albums", $type);
                    /* render explicit info of album given by cddbid */
                } elseif ($path_params[2] == "tracks") {
                    render_result(get_track(null, null, $path_params[1]), "albums", $type);
                    /* render tracklist from album given by cddbid */
                } else {
                    render_result(get_album($path_params[1]), "albums", $type);
                    /* render all infos of album given by cddbid (if wrong info is ordered) */
                }
            } else {
                render_result(get_album($path_params[1]), "albums", $type);
                /* render all infos of album given by cddbid */
            }
/ 
/
/* *************************************************/
require_once "include/includes.php";
$database = init_database();
if (isset($_GET['type'])) {
    $type = $_GET['type'];
}
// Check for the path elements
$path = $_SERVER[PATH_INFO];
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    if ($path_params[1] != null) {
        $rowtitles = get_row_titles("playerstate");
        // get rows of gd-table playerstate
        if (in_array($path_params[1], $rowtitles)) {
            render_result(get_playerstate($path_params[1]), "playerstate", $type);
            /* render explicit info of playerstate */
        } else {
            render_result(get_playerstate(), "playerstate", $type);
            /* render all infos of playerstate (wrong explicit info given) */
        }
    } else {
        render_result(get_playerstate(), "playerstate", $type);
        /* render all infos of playerstate */
    }
}
mysql_close($database);
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    set_headers($type);
    if ($path_params[1] != null) {
        if ($path_params[1] == "artists") {
            if ($path_params[2] != null) {
                render_result(get_artist("tracks", $path_params[2]), "artists", $type);
            } else {
                render_result(get_artist("tracks"), "artists", $type);
            }
        } else {
            if ($path_params[2] != null) {
                $rowtitles = get_row_titles("tracks");
                // get rows of gd-table tracks
                if (in_array($path_params[2], $rowtitles)) {
                    render_result(get_track($path_params[1], $path_params[2]), "tracks", $type);
                    /* render explicit info of track given by id */
                } elseif ($path_params[2] == "audio") {
                    get_audio_data($path_params[1]);
                    /* deliver binary audio-data of track given by id */
                } else {
                    render_result(get_track($path_params[1]), "tracks", $type);
                    /* render all infos of track given by id (if wrong info is ordered) */
                }
            } else {
                render_result(get_track($path_params[1]), "tracks", $type);
                /* render all infos of track given by id */
            }