From 88259f55a3b7ae564acf8ba89e4c4420852b17c7 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 20 Feb 2006 08:57:33 +0000 Subject: defunct file --- play/pupload.php | 234 ------------------------------------------------------- 1 file changed, 234 deletions(-) delete mode 100644 play/pupload.php diff --git a/play/pupload.php b/play/pupload.php deleted file mode 100644 index 192c8709..00000000 --- a/play/pupload.php +++ /dev/null @@ -1,234 +0,0 @@ -check("25", $_SERVER['REMOTE_ADDR'])) { - echo "Error: Access Denied, Invalid Source ADDR"; - if (conf('debug')) { - log_event('',' acl ',"Error: Access Denied to " . $_SERVER['REMOTE_ADDR'] . " due to ACL"); - } - exit(); - } - -} // access_control is enabled - -// Get site preferences -$site = new User(0); -$site->get_preferences(); - - -// require a uid and valid song -if ( isset( $uid ) ) { - // Create the user object if possible - $user = new User($uid); - - $song = $site->prefs['upload_dir'] . $song; - - if (!file_exists ( $song )) { echo "Error: No Song"; exit; } - if ($user->access === 'disabled') { echo "Error: User Disabled"; exit; } - if (!$user->username && !$user->is_xmlrpc()) { echo "Error: No User Found"; exit; } - -} -else { - exit; -} - -/* Get file info */ -$audio_info = new Audioinfo(); -$results = $audio_info->Info($song); - -$order = conf('id3tag_order'); - -// set the $key to the first found tag style (according to their prefs) -foreach($order as $key) { - if ($results[$key]) { break; } -} - -// Fetch Song Info -$artist_name = addslashes($results[$key]['artist']); -$album_name = addslashes($results[$key]['album']); -$title = addslashes($results[$key]['title']); -$song_time = intval($results['playing_time']); -$size = filesize($song); -preg_match('/\.([A-Za-z0-9]+)$/', $song,$results); - -$type = $results[1]; - -switch ($type) { - case "ogg": - $mime = "application/x-ogg"; - break; - case "mp3": - case "mpeg3": - $mime = "audio/mpeg"; - break; - case "rm": - $mime = "audio/x-realaudio"; - break; - default: - $mime = "audio/mpeg"; - break; -} // end switch type - - -if ( $_REQUEST['action'] == 'm3u' ) { - - if($temp_user->prefs['play_type'] == 'local_play') { - // Play the song locally using local play configuration - $song_name = $artist . " - " . $title . "." . $type; - $sess = $_COOKIE[libglue_param('sess_name')]; - //echo "Song Name: $song_name
\n"; - $url = escapeshellarg("$web_path/play/pupload.php?song=$song_nm&uid=$user->username&sid=$sess"); - $localplay_add = conf('localplay_add'); - $localplay_add = str_replace("%URL%", $url, $localplay_add); - //echo "Executing: $localplay_add
"; - exec($localplay_add); - header("Location: $web_path"); - - } - else - { - - if (conf('force_http_play')) { - $http_port = conf('http_port'); - $web_path = preg_replace("/https/","http",$web_path); - $web_path = preg_replace("/:\d+/",":$http_port",$web_path); - } - - // Send the client an m3u playlist - header("Cache-control: public"); - header("Content-Disposition: filename=playlist.m3u"); - header("Content-Type: audio/x-mpegurl;"); - echo "#EXTM3U\n"; - - $song_name = $song . " - " . $title . "." . $type; - $song_name = $artist . " - " . $title . "." . $song->type; - echo "#EXTINF:$song_time,$title\n"; - $sess = $_COOKIE[libglue_param('sess_name')]; - if($temp_user->prefs['down-sample'] == 'true') - $ds = $temp_user->prefs['sample_rate']; - echo "$web_path/play/pupload.php?song=" . rawurlencode($song_nm) . "&uid=$user->username&sid=$sess"; - - } - exit; -} -else -{ - // Check to see if we should be downsampling - $user->get_preferences(); - - if ($user->prefs['play_type'] == 'downsample') { - $ds = $user->prefs['sample_rate']; - } - - // make fread binary safe - set_magic_quotes_runtime(0); - - // don't abort the script if user skips this song because we need to update now_playing - ignore_user_abort(TRUE); - - // Build the Song Name - $song_name = $artist_name . " - " . $title . "." . $type; - - // Send headers - $browser->downloadHeaders($song_name, $mime, false, $size ); - header("Accept-Ranges: bytes" ); - - // Send file, possible at a byte offset - $fp = fopen($song, 'r'); - - $startArray = sscanf( $_SERVER[ "HTTP_RANGE" ], "bytes=%d-" ); - $start = $startArray[0]; - - // Prevent the script from timing out - set_time_limit(0); - - if ($ds) { - // FIXME:: $dsratio needs to be set - $ds = $user->prefs['sample_rate']; //ds hack - $dsratio = $ds/$song->bitrate*1000; //resample hack - $browser->downloadHeaders($song_name, $mime, false,$dsratio*$size); - $offset = ( $start*$song_time )/( $dsratio*$size ); - $offsetmm = floor($offset/60); - $offsetss = floor($offset-$offsetmm*60); - $offset = sprintf("%02d.%02d",$offsetmm,$offsetss); - $cmd = "mp3splt -qnf \"$song->file\" $offset EOF -o - | lame --mp3input -q 3 -b $ds -S - -"; - if (!$handle = fopen('/tmp/ampache.log', 'a')); - fwrite($handle,"$offset |"); - fclose($handle); - $fp = popen($cmd, 'r'); - $close='pclose'; - } // if downsampling - - elseif ($start) { - fseek( $fp, $start ); - header("Content-Range: bytes=$start-$size/$song"); - } - - while (!feof($fp) && (connection_status() == 0)) { - print(fread($fp, 8192)); - } - - fclose($fp); - -} - -?> -- cgit