function get_audio_data($track_id) { global $basedir; if ($track_id == "current") { $track_id = get_current_track_id(); } header('Content-Type: audio/mp3'); $t_artist = get_db_track_info("artist", $track_id); $t_title = get_db_track_info("title", $track_id); $filename = $t_artist . " - " . $t_title . ".mp3"; header("Content-Disposition: attachment; filename=\"" . $filename . "\""); // header("Content-Disposition: inline; filename=\"".$filename."\""); $ad_link = track_relative_path($track_id); $audio_file = $basedir . $ad_link; $fp = fopen($audio_file, "r"); $inhalt = fread($fp, filesize($audio_file)); fclose($fp); echo $inhalt; }
function get_current_source_id() { // used // returns the sourceid / cddbid (tracks->sourceid, same as albums->cddbid) of the currently playing (or stopped) track // (get linked to the current album) $track_id = get_current_track_id(); $query = "SELECT * FROM tracks WHERE id={$track_id}"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); return $row["sourceid"]; }