CC-1960: Internationalize Airtime / Support translations

-added gettext wrapper to all strings in models
This commit is contained in:
denise 2012-11-15 15:52:51 -05:00
parent d7495c6937
commit ef626a71b1
9 changed files with 102 additions and 101 deletions

View File

@ -30,7 +30,7 @@ class Application_Model_Auth
$e_link_port = $_SERVER['SERVER_PORT'];
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
$message = "Hi {$user->getDbLogin()}, \n\nClick this link to reset your password: ";
$message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin());
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());

View File

@ -754,7 +754,7 @@ SQL;
try {
if (is_null($cueIn) && is_null($cueOut)) {
$errArray["error"] = "Cue in and cue out are null.";
$errArray["error"] = _("Cue in and cue out are null.");
return $errArray;
}
@ -789,7 +789,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
$errArray["error"] = "Can't set cue out to be greater than file length.";
$errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}
@ -800,7 +800,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
$errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
@ -821,7 +821,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
$errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
@ -845,7 +845,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
$errArray["error"] = "Can't set cue out to be greater than file length.";
$errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}
@ -856,7 +856,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
$errArray["error"] = _("Can't set cue out to be smaller than cue in.");
return $errArray;
}
@ -1204,32 +1204,32 @@ SQL;
public function getCriteria()
{
$criteriaOptions = array(
0 => "Select criteria",
"album_title" => "Album",
"bit_rate" => "Bit Rate (Kbps)",
"bpm" => "BPM",
"composer" => "Composer",
"conductor" => "Conductor",
"copyright" => "Copyright",
"artist_name" => "Creator",
"encoded_by" => "Encoded By",
"genre" => "Genre",
"isrc_number" => "ISRC",
"label" => "Label",
"language" => "Language",
"mtime" => "Last Modified",
"lptime" => "Last Played",
"length" => "Length",
"mime" => "Mime",
"mood" => "Mood",
"owner_id" => "Owner",
"replay_gain" => "Replay Gain",
"sample_rate" => "Sample Rate (kHz)",
"track_title" => "Title",
"track_number" => "Track Number",
"utime" => "Uploaded",
"info_url" => "Website",
"year" => "Year"
0 => _("Select criteria"),
"album_title" => _("Album"),
"bit_rate" => _("Bit Rate (Kbps)"),
"bpm" => _("BPM"),
"composer" => _("Composer"),
"conductor" => _("Conductor"),
"copyright" => _("Copyright"),
"artist_name" => _("Creator"),
"encoded_by" => _("Encoded By"),
"genre" => _("Genre"),
"isrc_number" => _("ISRC"),
"label" => _("Label"),
"language" => _("Language"),
"mtime" => _("Last Modified"),
"lptime" => _("Last Played"),
"length" => _("Length"),
"mime" => _("Mime"),
"mood" => _("Mood"),
"owner_id" => _("Owner"),
"replay_gain" => _("Replay Gain"),
"sample_rate" => _("Sample Rate (kHz)"),
"track_title" => _("Title"),
"track_number" => _("Track Number"),
"utime" => _("Uploaded"),
"info_url" => _("Website"),
"year" => _("Year")
);
// Load criteria from db

View File

@ -157,15 +157,15 @@ SQL;
$diff = strlen($dir) - strlen($p_path);
if ($diff == 0) {
if ($dir == $p_path) {
throw new NestedDirectoryException("'$p_path' is already watched.");
throw new NestedDirectoryException(sprintf(_("%s is already watched."), $p_path));
}
} elseif ($diff > 0) {
if (self::isAncestorDir($p_path, $dir)) {
throw new NestedDirectoryException("'$p_path' contains nested watched directory: '$dir'");
throw new NestedDirectoryException(sprintf(_("%s contains nested watched directory: %s"), $p_path, $dir));
}
} else { /* diff < 0*/
if (self::isAncestorDir($dir, $p_path)) {
throw new NestedDirectoryException("'$p_path' is nested within existing watched directory: '$dir'");
throw new NestedDirectoryException(sprintf(_("%s is nested within existing watched directory: %s"), $p_path, $dir));
}
}
}
@ -186,7 +186,7 @@ SQL;
public static function addDir($p_path, $p_type, $userAddedWatchedDir=true, $nestedWatch=false)
{
if (!is_dir($p_path)) {
return array("code"=>2, "error"=>"'$p_path' is not a valid directory.");
return array("code"=>2, "error"=>sprintf(_("%s is not a valid directory."), $p_path));
}
$real_path = Application_Common_OsPath::normpath($p_path)."/";
if ($real_path != "/") {
@ -227,7 +227,8 @@ SQL;
return array("code"=>1, "error"=>"$msg");
} catch (Exception $e) {
return array("code"=>1, "error"=>"'$p_path' is already set as the current storage dir or in the watched folders list");
return array("code"=>1,
"error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list"), $p_path));
}
}
@ -359,7 +360,7 @@ SQL;
// path should always ends with trailing '/'
$p_dir = Application_Common_OsPath::normpath($p_dir)."/";
if (!is_dir($p_dir)) {
return array("code"=>2, "error"=>"'$p_dir' is not a valid directory.");
return array("code"=>2, "error"=>sprintf(_("%s is not a valid directory."), $p_dir));
} elseif (Application_Model_Preference::GetImportTimestamp()+10 > time()) {
return array("code"=>3, "error"=>"Airtime is currently importing files. Please wait until this is complete before changing the storage directory.");
}
@ -376,7 +377,8 @@ SQL;
return array("code"=>0);
} else {
return array("code"=>1, "error"=>"'$p_dir' is already set as the current storage dir or in the watched folders list.");
return array("code"=>1,
"error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list."), $p_dir));
}
}
@ -419,7 +421,7 @@ SQL;
}
$dir = Application_Model_MusicDir::getDirByPath($p_dir);
if (is_null($dir)) {
return array("code"=>1, "error"=>"'$p_dir' doesn't exist in the watched list.");
return array("code"=>1, "error"=>sprintf(_("%s doesn't exist in the watched list."), $p_dir));
} else {
$dir->remove($userAddedWatchedDir);
$data = array();

View File

@ -721,7 +721,7 @@ SQL;
try {
if (is_null($cueIn) && is_null($cueOut)) {
$errArray["error"] = "Cue in and cue out are null.";
$errArray["error"] = _("Cue in and cue out are null.");
return $errArray;
}
@ -751,14 +751,14 @@ SQL;
$sql = "SELECT :cueIn::INTERVAL > :cueOut::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':cueOut'=>$cueOut), 'column')) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
$errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
$sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) {
$errArray["error"] = "Can't set cue out to be greater than file length.";
$errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}
@ -774,7 +774,7 @@ SQL;
$sql = "SELECT :cueIn::INTERVAL > :oldCueOut::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut), 'column')) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
$errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
@ -792,14 +792,14 @@ SQL;
$sql = "SELECT :cueOut::INTERVAL < :oldCueIn::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn), 'column')) {
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
$errArray["error"] = _("Can't set cue out to be smaller than cue in.");
return $errArray;
}
$sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) {
$errArray["error"] = "Can't set cue out to be greater than file length.";
$errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}

View File

@ -79,12 +79,12 @@ class Application_Model_Scheduler
//an item has been deleted
if (count($schedIds) !== count($schedItems)) {
throw new OutDatedScheduleException("The schedule you're viewing is out of date! (sched mismatch)");
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (sched mismatch)"));
}
//a show has been deleted
if (count($instanceIds) !== count($showInstances)) {
throw new OutDatedScheduleException("The schedule you're viewing is out of date! (instance mismatch)");
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (instance mismatch)"));
}
foreach ($schedItems as $schedItem) {
@ -92,7 +92,7 @@ class Application_Model_Scheduler
$instance = $schedItem->getCcShowInstances($this->con);
if (intval($schedInfo[$id]) !== $instance->getDbId()) {
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
}
@ -102,24 +102,24 @@ class Application_Model_Scheduler
$show = $instance->getCcShow($this->con);
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
throw new Exception(sprintf(_("You are not allowed to schedule show %s."), $show->getDbName()));
}
if ($instance->getDbRecord()) {
throw new Exception("You cannot add files to recording shows.");
throw new Exception(_("You cannot add files to recording shows."));
}
$showEndEpoch = floatval($instance->getDbEnds("U.u"));
if ($showEndEpoch < $nowEpoch) {
throw new OutDatedScheduleException("The show {$show->getDbName()} is over and cannot be scheduled.");
throw new OutDatedScheduleException(sprintf(_("The show %s is over and cannot be scheduled."), $show->getDbName()));
}
$ts = intval($instanceInfo[$id]);
$lastSchedTs = intval($instance->getDbLastScheduled("U")) ? : 0;
if ($ts < $lastSchedTs) {
Logging::info("ts {$ts} last sched {$lastSchedTs}");
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
throw new OutDatedScheduleException(sprintf(_("The show %s has been previously updated!"), $show->getDbName()));
}
}
}
@ -138,7 +138,7 @@ class Application_Model_Scheduler
$file = CcFilesQuery::create()->findPK($id, $this->con);
if (is_null($file) || !$file->visible()) {
throw new Exception("A selected File does not exist!");
throw new Exception(_("A selected File does not exist!"));
} else {
$data = $this->fileInfo;
$data["id"] = $id;
@ -219,7 +219,7 @@ class Application_Model_Scheduler
$stream = CcWebstreamQuery::create()->findPK($id, $this->con);
if (is_null($stream) /* || !$file->visible() */) {
throw new Exception("A selected File does not exist!");
throw new Exception(_("A selected File does not exist!"));
} else {
$data = $this->fileInfo;
$data["id"] = $id;
@ -343,7 +343,7 @@ class Application_Model_Scheduler
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
if (is_null($instance)) {
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
$itemStartDT = $instance->getDbStarts(null);

View File

@ -177,7 +177,7 @@ SQL;
$con = Propel::getConnection();
if ($deltaDay > 0) {
return "Shows can have a max length of 24 hours.";
return _("Shows can have a max length of 24 hours.");
}
$utc = new DateTimeZone("UTC");
@ -208,7 +208,7 @@ SQL;
$newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin);
if ($newEndsDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
return "End date/time cannot be in the past";
return _("End date/time cannot be in the past");
}
//convert our new starts/ends to UTC.
@ -219,8 +219,8 @@ SQL;
$newStartsDateTime, $newEndsDateTime, true, $si->getDbId());
if ($overlapping) {
return "Cannot schedule overlapping shows.\nNote: Resizing a repeating show ".
"affects all of its repeats.";
return _("Cannot schedule overlapping shows.\nNote: Resizing a repeating show ".
"affects all of its repeats.");
}
}

View File

@ -242,7 +242,7 @@ SQL;
public function moveShow($deltaDay, $deltaMin)
{
if ($this->getShow()->isRepeating()) {
return "Can't drag and drop repeating shows";
return _("Can't drag and drop repeating shows");
}
$today_timestamp = time();
@ -250,7 +250,7 @@ SQL;
$endsDateTime = new DateTime($this->getShowInstanceEnd(), new DateTimeZone("UTC"));
if ($today_timestamp > $startsDateTime->getTimestamp()) {
return "Can't move a past show";
return _("Can't move a past show");
}
//the user is moving the show on the calendar from the perspective of local time.
@ -267,13 +267,13 @@ SQL;
$newEndsDateTime->setTimezone(new DateTimeZone("UTC"));
if ($today_timestamp > $newStartsDateTime->getTimestamp()) {
return "Can't move show into past";
return _("Can't move show into past");
}
//check if show is overlapping
$overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime, $newEndsDateTime, true, $this->getShowInstanceId());
if ($overlapping) {
return "Cannot schedule overlapping shows";
return _("Cannot schedule overlapping shows");
}
if ($this->isRecorded()) {
@ -287,7 +287,7 @@ SQL;
->find();
if (count($rebroadcasts) > 0) {
return "Can't move a recorded show less than 1 hour before its rebroadcasts.";
return _("Can't move a recorded show less than 1 hour before its rebroadcasts.");
}
}
@ -300,14 +300,14 @@ SQL;
catch (Exception $e) {
$this->_showInstance->delete();
return "Show was deleted because recorded show does not exist!";
return _("Show was deleted because recorded show does not exist!");
}
$recordEndDateTime = new DateTime($recordedShow->getShowInstanceEnd(), new DateTimeZone("UTC"));
$newRecordEndDateTime = self::addDeltas($recordEndDateTime, 0, 60);
if ($newStartsDateTime->getTimestamp() < $newRecordEndDateTime->getTimestamp()) {
return "Must wait 1 hour to rebroadcast.";
return _("Must wait 1 hour to rebroadcast.");
}
}
@ -339,7 +339,7 @@ SQL;
$ends = $this->getShowInstanceEnd();
if (strtotime($today_timestamp) > strtotime($starts)) {
return "can't resize a past show";
return _("can't resize a past show");
}
//$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
@ -361,7 +361,7 @@ SQL;
if (count($overlap) > 0) {
// TODO : fix ghetto error handling -- RG
return "Should not overlap shows";
return _("Should not overlap shows");
}
}
//with overbooking no longer need to check already scheduled content still fits.

View File

@ -794,14 +794,14 @@ SQL;
// ugly
if ($type == "au") {
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<img title="Track preview" src="'.$baseUrl.'/css/images/icon_audioclip.png">';
$row['image'] = '<img title="'._("Track preview").'" src="'.$baseUrl.'/css/images/icon_audioclip.png">';
} elseif ($type == "pl") {
$row['image'] = '<img title="Playlist preview" src="'.$baseUrl.'/css/images/icon_playlist.png">';
$row['image'] = '<img title="'._("Playlist preview").'" src="'.$baseUrl.'/css/images/icon_playlist.png">';
} elseif ($type == "st") {
$row['audioFile'] = $row['id'];
$row['image'] = '<img title="Webstream preview" src="'.$baseUrl.'/css/images/icon_webstream.png">';
$row['image'] = '<img title="'._("Webstream preview").'" src="'.$baseUrl.'/css/images/icon_webstream.png">';
} elseif ($type == "bl") {
$row['image'] = '<img title="Smart Block" src="'.$baseUrl.'/css/images/icon_smart-block.png">';
$row['image'] = '<img title="'._("Smart Block").'" src="'.$baseUrl.'/css/images/icon_smart-block.png">';
}
}
@ -853,7 +853,7 @@ SQL;
closedir($dir);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": _("Failed to open temp directory.")}, "id" : "id"}');
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
@ -880,14 +880,14 @@ SQL;
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}');
fclose($out);
unlink($_FILES['file']['tmp_name']);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": _("Failed to open output stream.")}, "id" : "id"}');
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": _("Failed to move uploaded file.")}, "id" : "id"}');
} else {
// Open temp file
$out = fopen($tempFilePath, $chunk == 0 ? "wb" : "ab");
@ -899,11 +899,11 @@ SQL;
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}');
fclose($out);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": _("Failed to open output stream.")}, "id" : "id"}');
}
return $tempFilePath;
@ -934,7 +934,7 @@ SQL;
if (!mkdir($stor."/organize", 0777)) {
return array(
"code" => 109,
"message" => "Failed to create 'organize' directory.");
"message" => _("Failed to create 'organize' directory."));
}
}
@ -947,17 +947,17 @@ SQL;
$freeSpace = disk_free_space($stor);
return array("code" => 107,
"message" => "The file was not uploaded, there is
".$freeSpace."MB of disk space left and the file you are
uploading has a size of ".$fileSize."MB.");
"message" => sprintf(_("The file was not uploaded, there is "
."%s MB of disk space left and the file you are "
."uploading has a size of %s MB."), $freeSpace, $fileSize));
}
// Check if liquidsoap can play this file
if (!self::liquidsoapFilePlayabilityTest($audio_file)) {
return array(
"code" => 110,
"message" => "This file appears to be corrupted and will not
be added to media library.");
"message" => _("This file appears to be corrupted and will not "
."be added to media library."));
}
// Did all the checks for real, now trying to copy
@ -992,10 +992,9 @@ SQL;
return array(
"code" => 108,
"message" => "
The file was not uploaded, this error can occur if the computer
hard drive does not have enough disk space or the stor
directory does not have correct write permissions.");
"message" => _("The file was not uploaded, this error can occur if the computer "
."hard drive does not have enough disk space or the stor "
."directory does not have correct write permissions."));
}
// Now that we successfully added this file, we will add another tag
// file that will identify the user that owns it

View File

@ -154,12 +154,12 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
if ($totalMinutes == 0) {
$valid['length'][0] = false;
$valid['length'][1] = 'Length needs to be greater than 0 minutes';
$valid['length'][1] = _('Length needs to be greater than 0 minutes');
}
} else {
$valid['length'][0] = false;
$valid['length'][1] = 'Length should be of form "00h 00m"';
$valid['length'][1] = _('Length should be of form "00h 00m"');
}
$url = $parameters["url"];
@ -172,16 +172,16 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$mediaUrl = null;
if ($result == 0) {
$valid['url'][0] = false;
$valid['url'][1] = 'URL should be of form "http://domain"';
$valid['url'][1] = _('URL should be of form "http://domain"');
} elseif (strlen($url) > 512) {
$valid['url'][0] = false;
$valid['url'][1] = 'URL should be 512 characters or less';
$valid['url'][1] = _('URL should be 512 characters or less');
} else {
try {
list($mime, $content_length_found) = self::discoverStreamMime($url);
if (is_null($mime)) {
throw new Exception("No MIME type found for webstream.");
throw new Exception(_("No MIME type found for webstream."));
}
$mediaUrl = self::getMediaUrl($url, $mime, $content_length_found);
@ -197,7 +197,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$name = $parameters["name"];
if (strlen($name) == 0) {
$valid['name'][0] = false;
$valid['name'][1] = 'Webstream name cannot be empty';
$valid['name'][1] = _('Webstream name cannot be empty');
}
$id = $parameters["id"];
@ -266,7 +266,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
}
}
throw new Exception("Could not parse XSPF playlist");
throw new Exception(_("Could not parse XSPF playlist"));
}
private static function getPlsUrl($url)
@ -278,7 +278,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
return $ini["playlist"]["File1"];
}
throw new Exception("Could not parse PLS playlist");
throw new Exception(_("Could not parse PLS playlist"));
}
private static function getM3uUrl($url)
@ -297,7 +297,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
return $lines[0];
}
throw new Exception("Could not parse M3U playlist");
throw new Exception(_("Could not parse M3U playlist"));
}
private static function getMediaUrl($url, $mime, $content_length_found)
@ -311,11 +311,11 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$media_url = self::getPlsUrl($url);
} elseif (preg_match("/(mpeg|ogg)/", $mime)) {
if ($content_length_found) {
throw new Exception("Invalid webstream - This appears to be a file download.");
throw new Exception(_("Invalid webstream - This appears to be a file download."));
}
$media_url = $url;
} else {
throw new Exception("Unrecognized stream type: $mime");
throw new Exception(sprintf(_("Unrecognized stream type: %s"), $mime));
}
return $media_url;