CC-1665: Scheduled stream rebroadcasting and recording
-capture stream mime type and store in db.
This commit is contained in:
parent
8eea34dc39
commit
fe3f4ea678
10 changed files with 158 additions and 42 deletions
|
@ -132,29 +132,19 @@ class ApiController extends Zend_Controller_Action
|
|||
$file_base_name = substr($file_base_name, 1);
|
||||
}
|
||||
|
||||
// possibly use fileinfo module here in the future.
|
||||
// http://www.php.net/manual/en/book.fileinfo.php
|
||||
$ext = pathinfo($file_base_name, PATHINFO_EXTENSION);
|
||||
//Download user left clicks a track and selects Download.
|
||||
if ("true" == $this->_getParam('download')) {
|
||||
//path_info breaks up a file path into seperate pieces of informaiton.
|
||||
//We just want the basename which is the file name with the path
|
||||
//information stripped away. We are using Content-Disposition to specify
|
||||
//to the browser what name the file should be saved as.
|
||||
//
|
||||
// By james.moon:
|
||||
// I'm removing pathinfo() since it strips away UTF-8 characters.
|
||||
// Using manualy parsing
|
||||
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||
} else {
|
||||
//user clicks play button for track and downloads it.
|
||||
header('Content-Disposition: inline; filename="'.$file_base_name.'"');
|
||||
}
|
||||
if (strtolower($ext) === 'mp3') {
|
||||
$this->smartReadFile($filepath, 'audio/mpeg');
|
||||
} else {
|
||||
$this->smartReadFile($filepath, 'audio/'.$ext);
|
||||
}
|
||||
|
||||
$this->smartReadFile($filepath, $media->getPropelOrm()->getDbMime());
|
||||
exit;
|
||||
} else {
|
||||
header ("HTTP/1.1 404 Not Found");
|
||||
|
|
|
@ -52,13 +52,8 @@ class WebstreamController extends Zend_Controller_Action
|
|||
$hasPermission = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST));
|
||||
$id = $request->getParam("id");
|
||||
|
||||
if ($id == -1) {
|
||||
$webstream = new CcWebstream();
|
||||
} else {
|
||||
$webstream = CcWebstreamQuery::create()->findPK($id);
|
||||
}
|
||||
|
||||
if ($id != -1) {
|
||||
$webstream = CcWebstreamQuery::create()->findPK($id);
|
||||
//we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if ($webstream->getDbCreatorId() != $user->getId()) {
|
||||
|
@ -73,11 +68,14 @@ class WebstreamController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$analysis = Application_Model_Webstream::analyzeFormData($request);
|
||||
|
||||
if (Application_Model_Webstream::isValid($analysis)) {
|
||||
Application_Model_Webstream::save($request, $webstream);
|
||||
$this->view->statusMessage = "<div class='success'>Webstream saved.</div>";
|
||||
} else {
|
||||
try {
|
||||
if (Application_Model_Webstream::isValid($analysis)) {
|
||||
Application_Model_Webstream::save($request, $id);
|
||||
$this->view->statusMessage = "<div class='success'>Webstream saved.</div>";
|
||||
} else {
|
||||
throw new Exception();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->view->statusMessage = "<div class='errors'>Invalid form values.</div>";
|
||||
$this->view->analysis = $analysis;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue