Temporary fix to make enclosure urls iTunes compatible

This commit is contained in:
Duncan Sommerville 2015-11-17 21:06:51 -05:00
parent ef87ad8a51
commit eae8c7b638
4 changed files with 25 additions and 8 deletions

View file

@ -535,13 +535,13 @@ class ApiController extends Zend_Controller_Action
$mime_type = finfo_buffer($f, $blob, FILEINFO_MIME_TYPE);
finfo_close($f);
header("Content-type: " . $mime_type);
header("Content-Type: " . $mime_type);
echo $blob;
} else {
header('HTTP/1.0 401 Unauthorized');
print _('You are not allowed to access this resource. ');
print _('You are not allowed to access this resource.');
exit;
}
}
}
public function scheduleAction()

View file

@ -31,8 +31,11 @@ class PodcastEpisodes extends BasePodcastEpisodes
$podcast = StationPodcastQuery::create()->findOneByDbPodcastId($podcastId);
if ($podcast) {
$fileId = $this->getDbFileId();
// FIXME: this is an interim solution until we can do better...
$file = CcFilesQuery::create()->findPk($fileId);
$ext = FileDataHelper::getAudioMimeTypeArray()[$file->getDbMime()];
$key = Application_Model_Preference::getStationPodcastDownloadKey();
return Application_Common_HTTPHelper::getStationUrl(false)."rest/media/$fileId/download/$key";
return Application_Common_HTTPHelper::getStationUrl(false)."rest/media/$fileId/download/$key.$ext";
}
return parent::getDbDownloadUrl();
}

View file

@ -60,19 +60,33 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
/** MediaController Routes **/
$downloadRoute = new Zend_Controller_Router_Route(
'rest/media/:id/download/:download_key',
'rest/media/:id/download',
array(
'controller' => 'media',
'action' => 'download',
'module' => 'rest'
),
array(
'id' => '\d+',
'download_key' => '\w*'
'id' => '\d+'
)
);
$router->addRoute('download', $downloadRoute);
$podcastEpisodeDownloadRoute = new Zend_Controller_Router_Route_Regex(
'rest/media/(?<id>\d+)/download/(?<download_key>.+)\.(?<file_ext>\w+)',
array(
'controller' => 'media',
'action' => 'download',
'module' => 'rest'
),
array(
1 => "id",
2 => "download_key",
3 => "file_ext"
)
);
$router->addRoute('podcast-episode-download', $podcastEpisodeDownloadRoute);
$clearLibraryRoute = new Zend_Controller_Router_Route(
'rest/media/clear',
array(

View file

@ -16,7 +16,7 @@
$logoImg = $this->element->getView()->logoImg;
$src = "data:image/png;base64,".$logoImg;
?>
<img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();$('[id^=stationLogoRemove]').each(function(i,v){v.style.width=v.style.height=v.style.margin=v.style.padding='0px';});" id="logo-img" onload='resizeImg(this, 450, 450);' src="<?php echo $src ?>" />
<img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();$('[id^=stationLogoRemove]').each(function(i,v){v.style.width=v.style.height=v.style.margin=v.style.padding='0px';});" id="logo-img" onload='/*resizeImg(this, 450, 450);*/' src="<?php echo $src ?>" />
</div>
<?php echo $this->element->getElement('locale')->render() ?>