CC-1799 Put Airtime Storage into a Human Readable File Naming Convention
adding music dirs concept to Airtime. New cc_music_dirs table/class.
This commit is contained in:
parent
ea21da6b61
commit
b6888489e0
42 changed files with 3901 additions and 441 deletions
|
@ -464,6 +464,9 @@ class ApiController extends Zend_Controller_Action
|
|||
return;
|
||||
}
|
||||
else {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$filepath = str_replace("\\", "", $filepath);
|
||||
$file->setFilePath($filepath);
|
||||
$file->setMetadata($md);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,11 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('server-browse', 'json')
|
||||
->addActionContext('reload-watch-directory', 'json')
|
||||
->addActionContext('remove-watch-directory', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
@ -38,16 +42,94 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]);
|
||||
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;
|
||||
}
|
||||
|
||||
public function directoryConfigAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
|
||||
|
||||
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
||||
$watched_dirs_pref->setWatchedDirs();
|
||||
|
||||
$this->view->form = $watched_dirs_pref;
|
||||
}
|
||||
|
||||
public function serverBrowseAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$path = $request->getParam("path", null);
|
||||
|
||||
$result = array();
|
||||
|
||||
if(is_null($path))
|
||||
{
|
||||
$element = array();
|
||||
$element["name"] = "path should be specified";
|
||||
$element["isFolder"] = false;
|
||||
$element["isError"] = true;
|
||||
$result[$path] = $element;
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $path.'/';
|
||||
$handle = opendir($path);
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
//only show directories that aren't private.
|
||||
if (is_dir($path.$file) && substr($file, 0, 1) != ".") {
|
||||
$element = array();
|
||||
$element["name"] = $file;
|
||||
$element["isFolder"] = true;
|
||||
$element["isError"] = false;
|
||||
$result[$file] = $element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ksort($result);
|
||||
//returns format serverBrowse is looking for.
|
||||
die(json_encode($result));
|
||||
}
|
||||
|
||||
public function reloadWatchDirectoryAction()
|
||||
{
|
||||
$chosen = $this->getRequest()->getParam("dir");
|
||||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||
$watched_dirs_form->populate(array('watchedFolder' => $chosen));
|
||||
$bool = $watched_dirs_form->verifyChosenFolder();
|
||||
|
||||
if ($bool === true) {
|
||||
MusicDir::addWatchedDir($chosen);
|
||||
$data = array();
|
||||
$data["directory"] = $chosen;
|
||||
RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
|
||||
}
|
||||
|
||||
$watched_dirs_form->setWatchedDirs();
|
||||
|
||||
$this->view->subform = $watched_dirs_form->render();
|
||||
}
|
||||
|
||||
public function removeWatchDirectoryAction()
|
||||
{
|
||||
$chosen = $this->getRequest()->getParam("dir");
|
||||
|
||||
$dir = MusicDir::getDirByPath($chosen);
|
||||
$dir->remove();
|
||||
|
||||
$data = array();
|
||||
$data["directory"] = $chosen;
|
||||
RabbitMq::SendMessageToMediaMonitor("remove_watch", $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue