CC-1799 Put Airtime Storage into a Human Readable File Naming Convention
recursively copying the audio_samples directory.
This commit is contained in:
parent
35cbeffd4a
commit
ea21da6b61
11 changed files with 253 additions and 111 deletions
|
@ -408,7 +408,8 @@ class ApiController extends Zend_Controller_Action
|
|||
public function reloadMetadataAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
$api_key = $this->_getParam('api_key');
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
{
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
|
@ -416,8 +417,16 @@ class ApiController extends Zend_Controller_Action
|
|||
exit;
|
||||
}
|
||||
|
||||
$md = $this->_getParam('md');
|
||||
$mode = $this->_getParam('mode');
|
||||
$mode = $request->getParam('mode');
|
||||
$params = $request->getParams();
|
||||
|
||||
$md = array();
|
||||
//extract all file metadata params from the request.
|
||||
foreach ($params as $key => $value) {
|
||||
if (preg_match('/^MDATA_KEY/', $key)) {
|
||||
$md[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == "create") {
|
||||
$md5 = $md['MDATA_KEY_MD5'];
|
||||
|
|
|
@ -166,7 +166,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$data = $file->getMetadata();
|
||||
|
||||
RabbitMq::SendFileMetaData($data);
|
||||
RabbitMq::SendMessageToMediaMonitor("md_update", $data);
|
||||
|
||||
$this->_helper->redirector('index');
|
||||
}
|
||||
|
|
|
@ -15,32 +15,37 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
|
||||
$this->view->statusMsg = "";
|
||||
|
||||
|
||||
$form = new Application_Form_Preferences();
|
||||
|
||||
|
||||
if ($request->isPost()) {
|
||||
|
||||
|
||||
if ($form->isValid($request->getPost())) {
|
||||
|
||||
$values = $form->getValues();
|
||||
|
||||
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
|
||||
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
|
||||
|
||||
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
|
||||
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
|
||||
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
|
||||
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
|
||||
Application_Model_Preference::SetWatchedDirectory($values["preferences_general"]["watchedFolder"]);
|
||||
|
||||
Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||
Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||
Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]);
|
||||
Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]);
|
||||
Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]);
|
||||
Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]);
|
||||
Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]);
|
||||
Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]);
|
||||
Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]);
|
||||
|
||||
Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]);
|
||||
|
||||
$data = array();
|
||||
$data["directory"] = $values["preferences_general"]["watchedFolder"];
|
||||
RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
|
||||
|
||||
$this->view->statusMsg = "<div class='success'>Preferences updated.</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->view->form = $form;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,15 +33,15 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
'label' => 'Default Fade:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(array('regex', false,
|
||||
array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\.\d{1,6})?$/',
|
||||
'validators' => array(array('regex', false,
|
||||
array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\.\d{1,6})?$/',
|
||||
'messages' => 'enter a time 00:00:00{.000000}'))),
|
||||
'value' => $defaultFade,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$stream_format = new Zend_Form_Element_Radio('streamFormat');
|
||||
$stream_format->setLabel('Stream Label:');
|
||||
$stream_format->setMultiOptions(array("Artist - Title",
|
||||
|
@ -58,6 +58,18 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
||||
$third_party_api->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($third_party_api);
|
||||
|
||||
//Default station fade
|
||||
$this->addElement('text', 'watchedFolder', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'WatchedFolder:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetWatchedDirectory(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Application_Model_Preference
|
|||
else if(is_null($id)) {
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr)"
|
||||
." VALUES ('$key', '$value')";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
||||
." VALUES ($id, '$key', '$value')";
|
||||
|
@ -189,5 +189,13 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetWatchedDirectory($directory) {
|
||||
Application_Model_Preference::SetValue("watched_directory", $directory);
|
||||
}
|
||||
|
||||
public static function GetWatchedDirectory() {
|
||||
return Application_Model_Preference::GetValue("watched_directory");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,12 @@ class RabbitMq
|
|||
}
|
||||
}
|
||||
|
||||
public static function SendFileMetaData($md)
|
||||
public static function SendMessageToMediaMonitor($event_type, $md)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$md["event_type"] = $event_type;
|
||||
|
||||
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||
$CC_CONFIG["rabbitmq"]["port"],
|
||||
$CC_CONFIG["rabbitmq"]["user"],
|
||||
|
|
|
@ -73,6 +73,19 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="watchedFolder-label" class="block-display">
|
||||
<label class="required" for="watchedFolder"><?php echo $this->element->getElement('watchedFolder')->getLabel() ?></label>
|
||||
</dt>
|
||||
<dd id="watchedFolder-element" class="block-display">
|
||||
<?php echo $this->element->getElement('watchedFolder') ?>
|
||||
<?php if($this->element->getElement('watchedFolder')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('watchedFolder')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue