Merge branch 'master' of dev.sourcefabric.org:airtime
This commit is contained in:
commit
414348dd11
5 changed files with 44 additions and 13 deletions
|
@ -632,7 +632,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$all = $request->getParam('all');
|
$all = $request->getParam('all');
|
||||||
|
|
||||||
$this->view->files =
|
$this->view->files =
|
||||||
Application_Model_StoredFile::listAllFiles($dir_id,$all);
|
Application_Model_StoredFile::listAllFiles($dir_id, $all);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listAllWatchedDirsAction()
|
public function listAllWatchedDirsAction()
|
||||||
|
@ -800,7 +800,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
||||||
// get all the files that is under $dirPath
|
// get all the files that is under $dirPath
|
||||||
$files = Application_Model_StoredFile::listAllFiles(
|
$files = Application_Model_StoredFile::listAllFiles(
|
||||||
$dir->getId(),$all=false, true);
|
$dir->getId(),$all=false);
|
||||||
foreach ($files as $f) {
|
foreach ($files as $f) {
|
||||||
// if the file is from this mount
|
// if the file is from this mount
|
||||||
if (substr($f->getFilePath(), 0, strlen($rd)) === $rd) {
|
if (substr($f->getFilePath(), 0, strlen($rd)) === $rd) {
|
||||||
|
|
|
@ -46,7 +46,25 @@ SQL;
|
||||||
$out[$r['mount_name']][] = $r;
|
$out[$r['mount_name']][] = $r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $out;
|
|
||||||
|
$enabledStreamIds = Application_Model_StreamSetting::getEnabledStreamIds();
|
||||||
|
$enabledOut = array();
|
||||||
|
|
||||||
|
foreach ($enabledStreamIds as $sId) {
|
||||||
|
|
||||||
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
|
." WHERE keyname = :key";
|
||||||
|
|
||||||
|
$result = Application_Common_Database::prepareAndExecute($sql, array('key' => $sId."_mount"), "single");
|
||||||
|
|
||||||
|
$enabledMountPoint = $result["value"];
|
||||||
|
|
||||||
|
if (isset($out[$enabledMountPoint])) {
|
||||||
|
$enabledOut[$enabledMountPoint] = $out[$enabledMountPoint];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $enabledOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function insertDataPoints($p_dataPoints) {
|
public static function insertDataPoints($p_dataPoints) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ SQL;
|
||||||
|
|
||||||
$exist_dir = self::getDirByPath($p_path);
|
$exist_dir = self::getDirByPath($p_path);
|
||||||
|
|
||||||
if ($exist_dir == NULL) {
|
if (is_null($exist_dir)) {
|
||||||
$temp_dir = new CcMusicDirs();
|
$temp_dir = new CcMusicDirs();
|
||||||
$dir = new Application_Model_MusicDir($temp_dir);
|
$dir = new Application_Model_MusicDir($temp_dir);
|
||||||
} else {
|
} else {
|
||||||
|
@ -228,7 +228,12 @@ SQL;
|
||||||
return array("code"=>1, "error"=>"$msg");
|
return array("code"=>1, "error"=>"$msg");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return array("code"=>1,
|
return array("code"=>1,
|
||||||
"error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list"), $p_path));
|
"error" => sprintf(
|
||||||
|
_("%s is already set as the current storage dir or in the".
|
||||||
|
" watched folders list"),
|
||||||
|
$p_path
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1071,7 +1071,7 @@ SQL;
|
||||||
* @param $dir_id - if this is not provided, it returns all files with full
|
* @param $dir_id - if this is not provided, it returns all files with full
|
||||||
* path constructed.
|
* path constructed.
|
||||||
*/
|
*/
|
||||||
public static function listAllFiles($dir_id=null, $all)
|
public static function listAllFiles($dir_id=null, $all=true)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
|
@ -1081,10 +1081,6 @@ FROM CC_FILES AS f
|
||||||
WHERE f.directory = :dir_id
|
WHERE f.directory = :dir_id
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
# TODO : the option $all is deprecated now and is always true.
|
|
||||||
# refactor code where it's still being passed
|
|
||||||
$all = true;
|
|
||||||
|
|
||||||
if (!$all) {
|
if (!$all) {
|
||||||
$sql .= " AND f.file_exists = 'TRUE'";
|
$sql .= " AND f.file_exists = 'TRUE'";
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,6 +284,7 @@ class Application_Model_StreamSetting
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$update_time = Application_Model_Preference::GetStreamUpdateTimestemp();
|
$update_time = Application_Model_Preference::GetStreamUpdateTimestemp();
|
||||||
|
|
||||||
if ($boot_time == null || $boot_time > $update_time) {
|
if ($boot_time == null || $boot_time > $update_time) {
|
||||||
$keyname = "s".$stream_id."_liquidsoap_error";
|
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||||
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
||||||
|
@ -468,7 +469,18 @@ class Application_Model_StreamSetting
|
||||||
|
|
||||||
public static function GetAllListenerStatErrors(){
|
public static function GetAllListenerStatErrors(){
|
||||||
$sql = "SELECT * FROM cc_stream_setting WHERE keyname like :p1";
|
$sql = "SELECT * FROM cc_stream_setting WHERE keyname like :p1";
|
||||||
return Application_Common_Database::prepareAndExecute($sql, array(':p1'=>'%_listener_stat_error'));
|
$mounts = Application_Common_Database::prepareAndExecute($sql, array(':p1'=>'%_mount'));
|
||||||
|
|
||||||
|
$mps = array();
|
||||||
|
|
||||||
|
foreach($mounts as $mount) {
|
||||||
|
$mps[] = "'" .$mount["value"] . "_listener_stat_error'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$in = implode(",", $mps);
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM cc_stream_setting WHERE keyname IN ( $in )";
|
||||||
|
return Application_Common_Database::prepareAndExecute($sql, array());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetListenerStatError($key, $v) {
|
public static function SetListenerStatError($key, $v) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue