Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

Conflicts:
	airtime_mvc/application/models/Block.php
	airtime_mvc/public/css/styles.css
This commit is contained in:
Martin Konecny 2012-09-12 15:55:43 -04:00
commit 20f5fe6480
32 changed files with 5963 additions and 3894 deletions

View File

@ -8,33 +8,33 @@ class ApiController extends Zend_Controller_Action
$this->checkAuth();
/* Initialize action controller here */
$context = $this->_helper->getHelper('contextSwitch');
$context->addActionContext('version', 'json')
->addActionContext('recorded-shows', 'json')
->addActionContext('calendar-init', 'json')
->addActionContext('upload-file', 'json')
->addActionContext('upload-recorded', 'json')
->addActionContext('media-monitor-setup', 'json')
->addActionContext('media-item-status', 'json')
->addActionContext('reload-metadata', 'json')
->addActionContext('list-all-files', 'json')
->addActionContext('list-all-watched-dirs', 'json')
->addActionContext('add-watched-dir', 'json')
->addActionContext('remove-watched-dir', 'json')
->addActionContext('set-storage-dir', 'json')
->addActionContext('get-stream-setting', 'json')
->addActionContext('status', 'json')
->addActionContext('register-component', 'json')
->addActionContext('update-liquidsoap-status', 'json')
->addActionContext('live-chat', 'json')
->addActionContext('update-file-system-mount', 'json')
->addActionContext('handle-watched-dir-missing', 'json')
->addActionContext('rabbitmq-do-push', 'json')
->addActionContext('check-live-stream-auth', 'json')
->addActionContext('update-source-status', 'json')
->addActionContext('get-bootstrap-info', 'json')
->addActionContext('get-files-without-replay-gain', 'json')
->addActionContext('reload-metadata-group', 'json')
->addActionContext('notify-webstream-data', 'json')
$context->addActionContext('version' , 'json')
->addActionContext('recorded-shows' , 'json')
->addActionContext('calendar-init' , 'json')
->addActionContext('upload-file' , 'json')
->addActionContext('upload-recorded' , 'json')
->addActionContext('media-monitor-setup' , 'json')
->addActionContext('media-item-status' , 'json')
->addActionContext('reload-metadata' , 'json')
->addActionContext('list-all-files' , 'json')
->addActionContext('list-all-watched-dirs' , 'json')
->addActionContext('add-watched-dir' , 'json')
->addActionContext('remove-watched-dir' , 'json')
->addActionContext('set-storage-dir' , 'json')
->addActionContext('get-stream-setting' , 'json')
->addActionContext('status' , 'json')
->addActionContext('register-component' , 'json')
->addActionContext('update-liquidsoap-status' , 'json')
->addActionContext('live-chat' , 'json')
->addActionContext('update-file-system-mount' , 'json')
->addActionContext('handle-watched-dir-missing' , 'json')
->addActionContext('rabbitmq-do-push' , 'json')
->addActionContext('check-live-stream-auth' , 'json')
->addActionContext('update-source-status' , 'json')
->addActionContext('get-bootstrap-info' , 'json')
->addActionContext('get-files-without-replay-gain' , 'json')
->addActionContext('reload-metadata-group' , 'json')
->addActionContext('notify-webstream-data' , 'json')
->initContext();
}
@ -73,7 +73,8 @@ class ApiController extends Zend_Controller_Action
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion()));
$jsonStr = json_encode( array(
"version" => Application_Model_Preference::GetAirtimeVersion()));
echo $jsonStr;
}
@ -94,11 +95,11 @@ class ApiController extends Zend_Controller_Action
}
$this->view->calendarInit = array(
"timestamp" => time(),
"timestamp" => time(),
"timezoneOffset" => date("Z"),
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
);
}
@ -454,6 +455,8 @@ class ApiController extends Zend_Controller_Action
$showCanceled = true;
}
// TODO : the following is inefficient because it calls save on both
// fields
$file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder");
$file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id);
@ -481,11 +484,12 @@ class ApiController extends Zend_Controller_Action
public function dispatchMetadata($md, $mode)
{
// Replace this compound result in a hash with proper error handling later on
$return_hash = array();
Application_Model_Preference::SetImportTimestamp();
//Logging::info("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} ");
//Logging::info( $md );
// create also modifies the file if it exists
if ($mode == "create") {
$filepath = $md['MDATA_KEY_FILEPATH'];
$filepath = Application_Common_OsPath::normpath($filepath);
@ -513,11 +517,11 @@ class ApiController extends Zend_Controller_Action
$file->setMetadata($md);
}
} elseif ($mode == "moved") {
$md5 = $md['MDATA_KEY_MD5'];
$file = Application_Model_StoredFile::RecallByMd5($md5);
$file = Application_Model_StoredFile::RecallByFilepath(
$md['MDATA_KEY_ORIGINAL_PATH']);
if (is_null($file)) {
return "File doesn't exist in Airtime.";
$return_hash['error'] = 'File does not exist in Airtime';
} else {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
@ -549,7 +553,8 @@ class ApiController extends Zend_Controller_Action
return $return_hash;
}
$return_hash['fileid'] = $file->getId();
$return_hash['fileid'] = is_null($file) ? '-1' : $file->getId();
return $return_hash;
}
@ -604,100 +609,6 @@ class ApiController extends Zend_Controller_Action
die( json_encode($responses) );
}
public function reloadMetadataAction()
{
$request = $this->getRequest();
$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;
}
}
Logging::info( $md );
// update import timestamp
Application_Model_Preference::SetImportTimestamp();
if ($mode == "create") {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
//$filepath = str_replace("//", "/", $filepath);
$filepath = Application_Common_OsPath::normpath($filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) {
$file = Application_Model_StoredFile::Insert($md);
} else {
// path already exist
if ($file->getFileExistsFlag()) {
// file marked as exists
$this->view->error = "File already exists in Airtime.";
return;
} else {
// file marked as not exists
$file->setFileExistsFlag(true);
$file->setMetadata($md);
}
}
} elseif ($mode == "modify") {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
//File is not in database anymore.
if (is_null($file)) {
$this->view->error = "File does not exist in Airtime.";
return;
} else {
//Updating a metadata change.
$file->setMetadata($md);
}
} elseif ($mode == "moved") {
$md5 = $md['MDATA_KEY_MD5'];
$file = Application_Model_StoredFile::RecallByMd5($md5);
if (is_null($file)) {
$this->view->error = "File doesn't exist in Airtime.";
return;
} else {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$file->setFilePath($filepath);
}
} elseif ($mode == "delete") {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) {
$this->view->error = "File doesn't exist in Airtime.";
return;
} else {
$file->deleteByMediaMonitor();
}
} elseif ($mode == "delete_dir") {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath);
foreach ($files as $file) {
$file->deleteByMediaMonitor();
}
return;
}
$this->view->id = $file->getId();
}
public function listAllFilesAction()
{
$request = $this->getRequest();

View File

@ -50,7 +50,7 @@ class WebstreamController extends Zend_Controller_Action
//clear the session in case an old playlist was open: CC-4196
Application_Model_Library::changePlaylist(null, null);
$this->view->obj = new Application_Model_Webstream($webstream);
$this->view->obj = new Application_Model_Webstream($webstream->getDbId());
$this->view->action = "new";
$this->view->html = $this->view->render('webstream/webstream.phtml');
}
@ -68,7 +68,7 @@ class WebstreamController extends Zend_Controller_Action
if ($webstream) {
Application_Model_Library::changePlaylist($id, "stream");
}
$this->view->obj = new Application_Model_Webstream($webstream);
$this->view->obj = new Application_Model_Webstream($webstream->getDbId());
$this->view->action = "edit";
$this->view->html = $this->view->render('webstream/webstream.phtml');
}

View File

@ -202,7 +202,20 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$repeatShowEnd->add(new DateInterval("P".$daysAdd."D"));
}
while ($repeatShowStart->getTimestamp() < $populateUntilDateTime->getTimestamp()) {
$overlapping = Application_Model_Schedule::checkOverlappingShows($repeatShowStart, $repeatShowEnd, $update, $instanceId);
//need to get each repeating show's instance id
$qry = CcShowInstancesQuery::create()
->filterByDbStarts($repeatShowStart->format('Y-m-d H:i:s'))
->filterByDbEnds($repeatShowEnd->format('Y-m-d H:i:s'))
->find();
$count = $qry->count();
if ($count > 1) {
$overlapping = true;
} elseif ($count == 1) {
$instanceId = $qry->getFirst()->getDbId();
$overlapping = Application_Model_Schedule::checkOverlappingShows($repeatShowStart, $repeatShowEnd, $update, $instanceId);
} else {
$overlapping = false;
}
if ($overlapping) {
$valid = false;
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));

View File

@ -5,12 +5,12 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
0 => "Select criteria",
"album_title" => "Album",
"bit_rate" => "Bit Rate (Kbps)",
"bpm" => "Bpm",
"comments" => "Comments",
"bpm" => "BPM",
"composer" => "Composer",
"conductor" => "Conductor",
"copyright" => "Copyright",
"artist_name" => "Creator",
"disc_number" => "Disc Number",
"encoded_by" => "Encoded By",
"genre" => "Genre",
"isrc_number" => "ISRC",
"label" => "Label",
@ -18,44 +18,44 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"mtime" => "Last Modified",
"lptime" => "Last Played",
"length" => "Length",
"lyricist" => "Lyricist",
"mime" => "Mime",
"mood" => "Mood",
"name" => "Name",
"orchestra" => "Orchestra",
"rating" => "Rating",
"owner_id" => "Owner",
"replay_gain" => "Replay Gain",
"sample_rate" => "Sample Rate (kHz)",
"track_title" => "Title",
"track_number" => "Track Number",
"utime" => "Uploaded",
"info_url" => "Website",
"year" => "Year"
);
private $criteriaTypes = array(
0 => "",
"album_title" => "s",
"artist_name" => "s",
"bit_rate" => "n",
"bpm" => "n",
"comments" => "s",
"composer" => "s",
"conductor" => "s",
"copyright" => "s",
"artist_name" => "s",
"encoded_by" => "s",
"utime" => "n",
"mtime" => "n",
"lptime" => "n",
"disc_number" => "n",
"genre" => "s",
"isrc_number" => "s",
"label" => "s",
"language" => "s",
"length" => "n",
"lyricist" => "s",
"mime" => "s",
"mood" => "s",
"name" => "s",
"orchestra" => "s",
"rating" => "n",
"owner_id" => "s",
"replay_gain" => "n",
"sample_rate" => "n",
"track_title" => "s",
"track_number" => "n",
"info_url" => "s",
"year" => "n"
);
@ -382,23 +382,23 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"artist_name" => "DbArtistName",
"bit_rate" => "DbBitRate",
"bpm" => "DbBpm",
"comments" => "DbComments",
"composer" => "DbComposer",
"conductor" => "DbConductor",
"copyright" => "DbCopyright",
"encoded_by" => "DbEncodedBy",
"utime" => "DbUtime",
"mtime" => "DbMtime",
"lptime" => "DbLPtime",
"disc_number" => "DbDiscNumber",
"genre" => "DbGenre",
"info_url" => "DbInfoUrl",
"isrc_number" => "DbIsrcNumber",
"label" => "DbLabel",
"language" => "DbLanguage",
"length" => "DbLength",
"lyricist" => "DbLyricist",
"mime" => "DbMime",
"mood" => "DbMood",
"name" => "DbName",
"orchestra" => "DbOrchestra",
"rating" => "DbRating",
"owner_id" => "DbOwnerId",
"replay_gain" => "DbReplayGain",
"sample_rate" => "DbSampleRate",
"track_title" => "DbTrackTitle",
"track_number" => "DbTrackNumber",
@ -489,7 +489,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
}
}
} elseif ($column->getType() == PropelColumnTypes::INTEGER) {
} elseif ($column->getType() == PropelColumnTypes::INTEGER &&
$d['sp_criteria_field'] != 'owner_id') {
if (!is_numeric($d['sp_criteria_value'])) {
$element->addError("The value has to be numeric");
$isValid = false;

View File

@ -64,7 +64,8 @@ class Logging {
$function = $caller['function'];
$logger = self::getLogger();
$logger->info("[$file : $function() : line $line] [WARN] - ".self::toString($p_msg));
$logger->warn("[$file : $function() : line $line] - "
. self::toString($p_msg));
}
public static function debug($p_msg)

View File

@ -26,61 +26,61 @@ class Application_Model_Block implements Application_Model_LibraryEditable
* info needed to insert a new block element.
*/
private $blockItem = array(
"id" => "",
"pos" => "",
"id" => "",
"pos" => "",
"cliplength" => "",
"cuein" => "00:00:00",
"cueout" => "00:00:00",
"fadein" => "0.0",
"fadeout" => "0.0",
"cuein" => "00:00:00",
"cueout" => "00:00:00",
"fadein" => "0.0",
"fadeout" => "0.0",
);
//using propel's phpNames.
private $categories = array(
"dc:title" => "Name",
"dc:creator" => "Creator",
"dc:title" => "Name",
"dc:creator" => "Creator",
"dc:description" => "Description",
"dcterms:extent" => "Length"
);
private static $modifier2CriteriaMap = array(
"contains" => Criteria::ILIKE,
"contains" => Criteria::ILIKE,
"does not contain" => Criteria::NOT_ILIKE,
"is" => Criteria::EQUAL,
"is not" => Criteria::NOT_EQUAL,
"starts with" => Criteria::ILIKE,
"ends with" => Criteria::ILIKE,
"is greater than" => Criteria::GREATER_THAN,
"is less than" => Criteria::LESS_THAN,
"is in the range" => Criteria::CUSTOM);
"is" => Criteria::EQUAL,
"is not" => Criteria::NOT_EQUAL,
"starts with" => Criteria::ILIKE,
"ends with" => Criteria::ILIKE,
"is greater than" => Criteria::GREATER_THAN,
"is less than" => Criteria::LESS_THAN,
"is in the range" => Criteria::CUSTOM);
private static $criteria2PeerMap = array(
0 => "Select criteria",
"album_title" => "DbAlbumTitle",
"artist_name" => "DbArtistName",
"bit_rate" => "DbBitRate",
"bpm" => "DbBpm",
"comments" => "DbComments",
"composer" => "DbComposer",
"conductor" => "DbConductor",
"utime" => "DbUtime",
"mtime" => "DbMtime",
"lptime" => "DbLPtime",
"disc_number" => "DbDiscNumber",
"genre" => "DbGenre",
"isrc_number" => "DbIsrcNumber",
"label" => "DbLabel",
"language" => "DbLanguage",
"length" => "DbLength",
"lyricist" => "DbLyricist",
"mood" => "DbMood",
"name" => "DbName",
"orchestra" => "DbOrchestra",
"rating" => "DbRating",
"sample_rate" => "DbSampleRate",
"track_title" => "DbTrackTitle",
0 => "Select criteria",
"album_title" => "DbAlbumTitle",
"artist_name" => "DbArtistName",
"bit_rate" => "DbBitRate",
"bpm" => "DbBpm",
"composer" => "DbComposer",
"conductor" => "DbConductor",
"copyright" => "DbCopyright",
"encoded_by" => "DbEncodedBy",
"utime" => "DbUtime",
"mtime" => "DbMtime",
"lptime" => "DbLPtime",
"genre" => "DbGenre",
"info_url" => "DbInfoUrl",
"isrc_number" => "DbIsrcNumber",
"label" => "DbLabel",
"language" => "DbLanguage",
"length" => "DbLength",
"mime" => "DbMime",
"mood" => "DbMood",
"owner_id" => "DbOwnerId",
"replay_gain" => "DbReplayGain",
"sample_rate" => "DbSampleRate",
"track_title" => "DbTrackTitle",
"track_number" => "DbTrackNumber",
"year" => "DbYear"
"year" => "DbYear"
);
public function __construct($id=null, $con=null)
@ -191,14 +191,28 @@ class Application_Model_Block implements Application_Model_LibraryEditable
Logging::info("Getting contents for block {$this->id}");
$files = array();
$sql = <<<"EOT"
SELECT pc.id as id, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, bl.type, f.length as orig_length,
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path, f.mime as mime FROM cc_blockcontents AS pc
LEFT JOIN cc_files AS f ON pc.file_id=f.id
LEFT JOIN cc_block AS bl ON pc.block_id = bl.id
WHERE pc.block_id = :block_id
ORDER BY pc.position;
EOT;
$sql = <<<SQL
SELECT pc.id AS id,
pc.position,
pc.cliplength AS LENGTH,
pc.cuein,
pc.cueout,
pc.fadein,
pc.fadeout,
bl.type,
f.LENGTH AS orig_length,
f.id AS item_id,
f.track_title,
f.artist_name AS creator,
f.file_exists AS EXISTS,
f.filepath AS path,
f.mime as mime
FROM cc_blockcontents AS pc
LEFT JOIN cc_files AS f ON pc.file_id=f.id
LEFT JOIN cc_block AS bl ON pc.block_id = bl.id
WHERE pc.block_id = :block_id
ORDER BY pc.position;
SQL;
$rows = Application_Common_Database::prepareAndExecute($sql, array(':block_id'=>$this->id));
@ -290,20 +304,20 @@ EOT;
$hour = "00";
if ($modifier == "minutes") {
if ($value >59) {
$hour = intval($value/60);
$hour = intval($value/60);
$value = $value%60;
}
} elseif ($modifier == "hours") {
$mins = $value * 60;
if ($mins >59) {
$hour = intval($mins/60);
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$hour = intval($mins/60);
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$value = $mins%60;
}
}
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$value = str_pad($value, 2, "0", STR_PAD_LEFT);
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
$value = str_pad($value, 2, "0", STR_PAD_LEFT);
$length = $hour.":".$value.":00";
}
@ -315,7 +329,7 @@ EOT;
$result = CcBlockcriteriaQuery::create()->filterByDbBlockId($this->id)
->filterByDbCriteria('limit')->findOne();
$modifier = $result->getDbModifier();
$value = $result->getDbValue();
$value = $result->getDbValue();
return array($value, $modifier);
}
@ -323,10 +337,12 @@ EOT;
// this function returns sum of all track length under this block.
public function getStaticLength()
{
$sql = "SELECT SUM(cliplength) as length FROM cc_blockcontents WHERE block_id = :block_id";
$sql = <<<SQL
SELECT SUM(cliplength) AS LENGTH
FROM cc_blockcontents
WHERE block_id = :block_id
SQL;
$result = Application_Common_Database::prepareAndExecute($sql, array(':block_id'=>$this->id), 'all', PDO::FETCH_NUM);
Logging::info($result);
return $result[0][0];
}
@ -357,11 +373,11 @@ EOT;
$file = CcFilesQuery::create()->findPK($p_item, $this->con);
if (isset($file) && $file->getDbFileExists()) {
$entry = $this->blockItem;
$entry["id"] = $file->getDbId();
$entry["pos"] = $pos;
$entry = $this->blockItem;
$entry["id"] = $file->getDbId();
$entry["pos"] = $pos;
$entry["cliplength"] = $file->getDbLength();
$entry["cueout"] = $file->getDbLength();
$entry["cueout"] = $file->getDbLength();
return $entry;
} else {
@ -736,10 +752,10 @@ EOT;
throw new Exception("Block item does not exist.");
}
$oldCueIn = $row->getDBCuein();
$oldCueIn = $row->getDBCuein();
$oldCueOut = $row->getDbCueout();
$fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
$fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
$file = $row->getCcFiles($this->con);
$origLength = $file->getDbLength();
@ -1038,18 +1054,14 @@ EOT;
public function hasItemLimit()
{
list($value, $modifier) = $this->getLimitValueAndModifier();
if ($modifier == 'items') {
return true;
} else {
return false;
}
return ($modifier == 'items');
}
public function storeCriteriaIntoDb($p_criteriaData)
{
// delete criteria under $p_blockId
CcBlockcriteriaQuery::create()->findByDbBlockId($this->id)->delete();
Logging::info($p_criteriaData);
//Logging::info($p_criteriaData);
//insert modifier rows
if (isset($p_criteriaData['criteria'])) {
$critKeys = array_keys($p_criteriaData['criteria']);
@ -1114,12 +1126,12 @@ EOT;
public function getListOfFilesUnderLimit()
{
$info = $this->getListofFilesMeetCriteria();
$files = $info['files'];
$limit = $info['limit'];
$info = $this->getListofFilesMeetCriteria();
$files = $info['files'];
$limit = $info['limit'];
$insertList = array();
$totalTime = 0;
$totalTime = 0;
$totalItems = 0;
// this moves the pointer to the first element in the collection
@ -1145,32 +1157,32 @@ EOT;
public function getCriteria()
{
$criteriaOptions = array(
0 => "Select criteria",
"album_title" => "Album",
"bit_rate" => "Bit Rate",
"bpm" => "Bpm",
"comments" => "Comments",
"composer" => "Composer",
"conductor" => "Conductor",
"artist_name" => "Creator",
"disc_number" => "Disc Number",
"genre" => "Genre",
"isrc_number" => "ISRC",
"label" => "Label",
"language" => "Language",
"mtime" => "Last Modified",
"lptime" => "Last Played",
"length" => "Length",
"lyricist" => "Lyricist",
"mood" => "Mood",
"name" => "Name",
"orchestra" => "Orchestra",
"rating" => "Rating",
"sample_rate" => "Sample Rate",
"track_title" => "Title",
0 => "Select criteria",
"album_title" => "Album",
"bit_rate" => "Bit Rate (Kbps)",
"bpm" => "BPM",
"composer" => "Composer",
"conductor" => "Conductor",
"copyright" => "Copyright",
"artist_name" => "Creator",
"encoded_by" => "Encoded By",
"genre" => "Genre",
"isrc_number" => "ISRC",
"label" => "Label",
"language" => "Language",
"mtime" => "Last Modified",
"lptime" => "Last Played",
"length" => "Length",
"mime" => "Mime",
"mood" => "Mood",
"owner_id" => "Owner",
"replay_gain" => "Replay Gain",
"sample_rate" => "Sample Rate (kHz)",
"track_title" => "Title",
"track_number" => "Track Number",
"utime" => "Uploaded",
"year" => "Year"
"utime" => "Uploaded",
"info_url" => "Website",
"year" => "Year"
);
// Load criteria from db
@ -1200,12 +1212,13 @@ EOT;
$storedCrit = $this->getCriteria();
$qry = CcFilesQuery::create();
$qry->useFkOwnerQuery("subj", "left join");
if (isset($storedCrit["crit"])) {
foreach ($storedCrit["crit"] as $crit) {
$i = 0;
foreach ($crit as $criteria) {
$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
//$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
$spCriteria = $criteria['criteria'];
$spCriteriaModifier = $criteria['modifier'];
@ -1274,6 +1287,9 @@ EOT;
$spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
try {
if ($spCriteria == "owner_id") {
$spCriteria = "subj.login";
}
if ($i > 0) {
$qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier);
} else {

View File

@ -192,12 +192,8 @@ class Application_Model_Datatables
$r['length'] = $pl->getLength();
} elseif ($r['ftype'] == "block") {
$bl = new Application_Model_Block($r['id']);
if ($bl->isStatic()) {
$r['bl_type'] = 'static';
} else {
$r['bl_type'] = 'dynamic';
}
$r['length'] = $bl->getLength();
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
$r['length'] = $bl->getLength();
}
}
}

View File

@ -226,11 +226,7 @@ class Application_Model_Preference
public static function GetDefaultTransitionFade()
{
$transition_fade = self::getValue("default_transition_fade");
if ($transition_fade == "") {
$transition_fade = "00.000000";
}
return $transition_fade;
return ($transition_fade == "") ? "00.000000" : $transition_fade;
}
public static function SetStreamLabelFormat($type)
@ -332,11 +328,7 @@ class Application_Model_Preference
public static function GetAllow3rdPartyApi()
{
$val = self::getValue("third_party_api");
if (strlen($val) == 0) {
return "0";
} else {
return $val;
}
return (strlen($val) == 0 ) ? "0" : $val;
}
public static function SetPhone($phone)
@ -447,6 +439,8 @@ class Application_Model_Preference
$image = @file_get_contents($imagePath);
$image = base64_encode($image);
self::setValue("logoImage", $image);
} else {
Logging::warn("Attempting to set imagePath to empty string");
}
}
@ -786,11 +780,7 @@ class Application_Model_Preference
public static function GetWeekStartDay()
{
$val = self::getValue("week_start_day");
if (strlen($val) == 0) {
return "0";
} else {
return $val;
}
return (strlen($val) == 0) ? "0" : $val;
}
/**
@ -808,11 +798,7 @@ class Application_Model_Preference
public static function GetStreamUpdateTimestemp()
{
$update_time = self::getValue("stream_update_timestamp");
if ($update_time == null) {
$update_time = 0;
}
return $update_time;
return ($update_time == null) ? 0 : $update_time;
}
public static function GetClientId()
@ -824,6 +810,8 @@ class Application_Model_Preference
{
if (is_numeric($id)) {
self::setValue("client_id", $id);
} else {
Logging::warn("Attempting to set client_id to invalid value: $id");
}
}
@ -894,11 +882,7 @@ class Application_Model_Preference
public static function GetCalendarTimeInterval()
{
$val = self::getValue("calendar_time_interval", true /* user specific */);
if (strlen($val) == 0) {
$val = "30";
}
return $val;
return (strlen($val) == 0) ? "30" : $val;
}
public static function SetDiskQuota($value)
@ -909,11 +893,7 @@ class Application_Model_Preference
public static function GetDiskQuota()
{
$val = self::getValue("disk_quota");
if (strlen($val) == 0) {
$val = "0";
}
return $val;
return (strlen($val) == 0) ? 0 : $val;
}
public static function SetLiveSteamMasterUsername($value)
@ -944,11 +924,7 @@ class Application_Model_Preference
public static function GetSourceStatus($sourcename)
{
$value = self::getValue($sourcename);
if ($value == null || $value == "false") {
return false;
} else {
return true;
}
return !($value == null || $value == "false");
}
public static function SetSourceSwitchStatus($sourcename, $status)
@ -959,11 +935,7 @@ class Application_Model_Preference
public static function GetSourceSwitchStatus($sourcename)
{
$value = self::getValue($sourcename."_switch");
if ($value == null || $value == "off") {
return "off";
} else {
return "on";
}
return ($value == null || $value == "off") ? 'off' : 'on';
}
public static function SetMasterDJSourceConnectionURL($value)
@ -1036,12 +1008,7 @@ class Application_Model_Preference
public static function GetEnableSystemEmail()
{
$v = self::getValue("enable_system_email");
if ($v === "") {
return 0;
}
return $v;
return ($v === "") ? 0 : $v;
}
public static function SetSystemEmail($value)

View File

@ -10,10 +10,14 @@ class Application_Model_Schedule
public function IsFileScheduledInTheFuture($p_fileId)
{
global $CC_CONFIG;
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"]
." WHERE file_id = :file_id AND ends > NOW() AT TIME ZONE 'UTC'";
$count = Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$p_fileId), 'column');
$sql = <<<SQL
SELECT COUNT(*)
FROM cc_schedule
WHERE file_id = :file_id
AND ends > NOW() AT TIME ZONE 'UTC'
SQL;
$count = Application_Common_Database::prepareAndExecute( $sql, array(
':file_id'=>$p_fileId), 'column');
return (is_numeric($count) && ($count != '0'));
}
@ -177,7 +181,7 @@ SELECT ft.artist_name,
ft.track_title,
st.starts AS starts,
st.ends AS ends
FROM $CC_CONFIG[scheduleTable] st
FROM cc_schedule st
LEFT JOIN $CC_CONFIG[filesTable] ft ON st.file_id = ft.id
LEFT JOIN $CC_CONFIG[showInstances] sit ON st.instance_id = sit.id
-- this and the next line are necessary since we can overbook shows.
@ -559,16 +563,20 @@ SQL;
$dt->add(new DateInterval("PT24H"));
$range_end = $dt->format("Y-m-d H:i:s");
$predicates = " WHERE st.ends > :startTime1"
." AND st.starts < :rangeEnd"
." AND st.playout_status > 0"
." AND si.ends > :startTime2"
." ORDER BY st.starts"
." LIMIT 3";
$predicates = <<<SQL
WHERE st.ends > :startTime1
AND st.starts < :rangeEnd
AND st.playout_status > 0
AND si.ends > :startTime2
ORDER BY st.starts LIMIT 3
SQL;
$sql = $baseQuery.$predicates;
$sql = " ".$baseQuery.$predicates;
$rows = Application_Common_Database::prepareAndExecute($sql,
array(':startTime1'=>$p_startTime, ':rangeEnd'=>$range_end, ':startTime2'=>$p_startTime));
array(
':startTime1' => $p_startTime,
':rangeEnd' => $range_end,
':startTime2' => $p_startTime));
}
return $rows;
@ -626,21 +634,21 @@ SQL;
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri)
{
$start = self::AirtimeTimeToPypoTime($item["start"]);
$end = self::AirtimeTimeToPypoTime($item["end"]);
$end = self::AirtimeTimeToPypoTime($item["end"]);
$schedule_item = array(
'id' => $media_id,
'type' => 'file',
'row_id' => $item["id"],
'uri' => $uri,
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]),
'cue_in' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_out"]),
'start' => $start,
'end' => $end,
'show_name' => $item["show_name"],
'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"],
'id' => $media_id,
'type' => 'file',
'row_id' => $item["id"],
'uri' => $uri,
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]),
'cue_in' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_out"]),
'start' => $start,
'end' => $end,
'show_name' => $item["show_name"],
'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"],
'independent_event' => true
);
self::appendScheduleItem($data, $start, $schedule_item);
@ -649,7 +657,7 @@ SQL;
private static function createStreamScheduleEvent(&$data, $item, $media_id, $uri)
{
$start = self::AirtimeTimeToPypoTime($item["start"]);
$end = self::AirtimeTimeToPypoTime($item["end"]);
$end = self::AirtimeTimeToPypoTime($item["end"]);
//create an event to start stream buffering 5 seconds ahead of the streams actual time.
$buffer_start = new DateTime($item["start"], new DateTimeZone('UTC'));
@ -658,24 +666,24 @@ SQL;
$stream_buffer_start = self::AirtimeTimeToPypoTime($buffer_start->format("Y-m-d H:i:s"));
$schedule_item = array(
'start' => $stream_buffer_start,
'end' => $stream_buffer_start,
'uri' => $uri,
'row_id' => $item["id"],
'type' => 'stream_buffer_start',
'start' => $stream_buffer_start,
'end' => $stream_buffer_start,
'uri' => $uri,
'row_id' => $item["id"],
'type' => 'stream_buffer_start',
'independent_event' => true
);
self::appendScheduleItem($data, $start, $schedule_item);
$schedule_item = array(
'id' => $media_id,
'type' => 'stream_output_start',
'row_id' => $item["id"],
'uri' => $uri,
'start' => $start,
'end' => $end,
'show_name' => $item["show_name"],
'id' => $media_id,
'type' => 'stream_output_start',
'row_id' => $item["id"],
'uri' => $uri,
'start' => $start,
'end' => $end,
'show_name' => $item["show_name"],
'independent_event' => true
);
self::appendScheduleItem($data, $start, $schedule_item);
@ -688,19 +696,19 @@ SQL;
$stream_end = self::AirtimeTimeToPypoTime($dt->format("Y-m-d H:i:s"));
$schedule_item = array(
'start' => $stream_end,
'end' => $stream_end,
'uri' => $uri,
'type' => 'stream_buffer_end',
'start' => $stream_end,
'end' => $stream_end,
'uri' => $uri,
'type' => 'stream_buffer_end',
'independent_event' => true
);
self::appendScheduleItem($data, $stream_end, $schedule_item);
$schedule_item = array(
'start' => $stream_end,
'end' => $stream_end,
'uri' => $uri,
'type' => 'stream_output_end',
'start' => $stream_end,
'end' => $stream_end,
'uri' => $uri,
'type' => 'stream_output_end',
'independent_event' => true
);
self::appendScheduleItem($data, $stream_end, $schedule_item);
@ -942,7 +950,8 @@ SQL;
* Another clean-up is to move all the form manipulation to the proper form class.....
* -Martin
*/
public static function addUpdateShow($data, $controller, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null)
public static function addUpdateShow($data, $controller, $validateStartDate,
$originalStartDate=null, $update=false, $instanceId=null)
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
@ -1076,6 +1085,7 @@ SQL;
}
} else {
if ($isAdminOrPM) {
Logging::info( $data );
Application_Model_Show::create($data);
}
@ -1086,12 +1096,12 @@ SQL;
return true;
}
} else {
$controller->view->what = $formWhat;
$controller->view->when = $formWhen;
$controller->view->what = $formWhat;
$controller->view->when = $formWhen;
$controller->view->repeats = $formRepeats;
$controller->view->who = $formWho;
$controller->view->style = $formStyle;
$controller->view->live = $formLive;
$controller->view->who = $formWho;
$controller->view->style = $formStyle;
$controller->view->live = $formLive;
if (!$isSaas) {
$controller->view->rr = $formRecord;
@ -1104,47 +1114,52 @@ SQL;
}
}
public static function checkOverlappingShows($show_start, $show_end, $update=false, $instanceId=null)
public static function checkOverlappingShows($show_start, $show_end,
$update=false, $instanceId=null)
{
global $CC_CONFIG;
$overlapping = false;
$con = Propel::getConnection();
/* If a show is being edited, exclude it from the query
* In both cases (new and edit) we only grab shows that
* are scheduled 2 days prior
*/
//$se = $show_end->format('Y-m-d H:i:s');
if ($update) {
$stmt = $con->prepare("SELECT id, starts, ends FROM {$CC_CONFIG['showInstances']}
where (ends <= :show_end1
or starts <= :show_end2)
and date(starts) >= (date(:show_end3) - INTERVAL '2 days')
and modified_instance = false and id != :instanceId order by ends");
$stmt->execute(array(
':show_end1' => $show_end->format('Y-m-d H:i:s'),
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s'),
':instanceId' => $instanceId
));
$sql = <<<SQL
SELECT id,
starts,
ends
FROM cc_show_instances
WHERE (ends <= :show_end1
OR starts <= :show_end2)
AND date(starts) >= (date(:show_end3) - INTERVAL '2 days')
AND modified_instance = FALSE
AND id != :instanceId
ORDER BY ends
SQL;
$rows = Application_Common_Database::prepareAndExecute($sql, array(
':show_end1' => $show_end->format('Y-m-d H:i:s'),
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s'),
':instanceId' => $instanceId
), 'all');
} else {
$stmt = $con->prepare("SELECT id, starts, ends FROM
{$CC_CONFIG['showInstances']}
where (ends <= :show_end1 or starts <= :show_end2)
and date(starts) >= (date(:show_end3) - INTERVAL '2 days')
and modified_instance = false order by ends");
$sql = <<<SQL
SELECT id,
starts,
ends
FROM cc_show_instances
WHERE (ends <= :show_end1
OR starts <= :show_end2)
AND date(starts) >= (date(:show_end3) - INTERVAL '2 days')
AND modified_instance = FALSE
ORDER BY ends
SQL;
$stmt->execute(array(
':show_end1' => $show_end->format('Y-m-d H:i:s'),
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s')
));
$rows = Application_Common_Database::prepareAndExecute($sql, array(
':show_end1' => $show_end->format('Y-m-d H:i:s'),
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s')), 'all');
}
$rows = $stmt->fetchAll();
foreach ($rows as $row) {
$start = new DateTime($row["starts"], new DateTimeZone('UTC'));
$end = new DateTime($row["ends"], new DateTimeZone('UTC'));

View File

@ -129,17 +129,21 @@ class Application_Model_Show
{
$con = Propel::getConnection();
$sql = "SELECT first_name, last_name
FROM cc_show_hosts LEFT JOIN cc_subjs ON cc_show_hosts.subjs_id = cc_subjs.id
WHERE show_id = :show_id";
$sql = <<<SQL
SELECT first_name,
last_name
FROM cc_show_hosts
LEFT JOIN cc_subjs ON cc_show_hosts.subjs_id = cc_subjs.id
WHERE show_id = :show_id
SQL;
$hosts = Application_Common_Database::prepareAndExecute( $sql,
array( ':show_id' => $this->getId() ), 'all');
$res = array_map( function($host) {
return $host['first_name']." ".$host['last_name'];
}, $hosts);
$res = array();
foreach ($hosts as $host) {
$res[] = $host['first_name']." ".$host['last_name'];
}
return $res;
}
@ -147,9 +151,11 @@ class Application_Model_Show
{
$con = Propel::getConnection();
$sql = "SELECT subjs_id
FROM cc_show_hosts
WHERE show_id = :show_id";
$sql = <<<SQL
SELECT subjs_id
FROM cc_show_hosts
WHERE show_id = :show_id
SQL;
$hosts = Application_Common_Database::prepareAndExecute(
$sql, array( ':show_id' => $this->getId() ), 'all');
@ -281,11 +287,16 @@ SQL;
->filterByDbShowId($this->_showId)
->update(array('DbLastShow' => $timeinfo[0]));
$sql = "UPDATE cc_show_instances
SET modified_instance = TRUE
WHERE starts >= '{$day_timestamp}' AND show_id = {$this->_showId}";
$sql = <<<SQL
UPDATE cc_show_instances
SET modified_instance = TRUE
WHERE starts >= :dayTimestamp::TIMESTAMP
AND show_id = :showId
SQL;
$con->exec($sql);
Application_Common_Database::prepareAndExecute( $sql, array(
':dayTimestamp' => $day_timestamp,
':showId' => $this->getId()), 'execute');
// check if we can safely delete the show
$showInstancesRow = CcShowInstancesQuery::create()
@ -294,7 +305,9 @@ SQL;
->findOne();
if (is_null($showInstancesRow)) {
$sql = "DELETE FROM cc_show WHERE id = :show_id";
$sql = <<<SQL
DELETE FROM cc_show WHERE id = :show_id
SQL;
Application_Common_Database::prepareAndExecute(
$sql, array( 'show_id' => $this->_showId ), "execute");
$con->exec($sql);
@ -771,7 +784,7 @@ SQL;
$sql = <<<SQL
SELECT id
FROM cc_show_instances
WHERE show_id :showId
WHERE show_id = :showId
AND starts > :timestamp::TIMESTAMP
AND modified_instance != TRUE
SQL;
@ -779,9 +792,11 @@ SQL;
array( ':showId' => $this->getId(),
':timestamp' => gmdate("Y-m-d H:i:s")), "all");
return array_map( function($i) {
return $i['id'];
}, $rows);
$res = array();
foreach ($rows as $r) {
$res[] = $r['id'];
}
return $res;
}
/* Called when a show's duration is changed (edited).
@ -879,9 +894,11 @@ SQL;
{
$showDays = CcShowDaysQuery::create()->filterByDbShowId(
$this->getId())->find();
return array_map( function($showDay) {
return $showDay->getDbDay();
}, $showDays);
$res = array();
foreach ($showDays as $showDay) {
$res[] = $showDay->getDbDay();
}
return $res;
}
/* Only used for shows that aren't repeating.
@ -953,14 +970,14 @@ SQL;
$sql = <<<SQL
SELECT id
FROM cc_show_instances
WHERE date(starts) = date(TIMESTAMP :timestamp)
WHERE date(starts) = date(:timestamp::TIMESTAMP)
AND show_id = :showId
AND rebroadcast = 0;
SQL;
try {
$row = Application_Common_Database::prepareAndExecute( $sql,
array( 'showId' => $this->getId(),
':timestamp' => $timestamp ), 'column');
array( ':showId' => $this->getId(),
':timestamp' => $timestamp ), 'column');
return CcShowInstancesQuery::create()
->findPk($row);
} catch (Exception $e) {

View File

@ -43,7 +43,7 @@ class Application_Model_StoredFile
"bit_rate" => "DbBitRate",
"sample_rate" => "DbSampleRate",
"mime" => "DbMime",
"md5" => "DbMd5",
//"md5" => "DbMd5",
"ftype" => "DbFtype",
"language" => "DbLanguage",
"replay_gain" => "DbReplayGain",
@ -84,6 +84,12 @@ class Application_Model_StoredFile
$this->_file->save();
}
public static function createWithFile($f) {
$storedFile = new Application_Model_StoredFile();
$storedFile->_file = $f;
return $storedFile;
}
/**
* Set multiple metadata values using defined metadata constants.
*
@ -226,6 +232,7 @@ class Application_Model_StoredFile
return;
}
if (isset($this->_dbMD[$p_category])) {
// TODO : fix this crust -- RG
$propelColumn = $this->_dbMD[$p_category];
$method = "set$propelColumn";
$this->_file->$method($p_value);
@ -315,12 +322,13 @@ class Application_Model_StoredFile
*/
public function getPlaylists()
{
global $CC_CONFIG;
$con = Propel::getConnection();
$sql = "SELECT playlist_id "
." FROM cc_playlist"
." WHERE file_id = :file_id";
$sql = <<<SQL
SELECT playlist_id
FROM cc_playlist
WHERE file_id = :file_id
SQL;
$stmt = $con->prepare($sql);
$stmt->bindParam(':file_id', $this->id, PDO::PARAM_INT);
@ -332,14 +340,13 @@ class Application_Model_StoredFile
throw new Exception("Error: $msg");
}
$playlists = array();
if (is_array($ids) && count($ids) > 0) {
foreach ($ids as $id) {
$playlists[] = Application_Model_Playlist::Recall($id);
}
return array_map( function ($id) {
return Application_Model_Playlist::Recall($id);
}, $ids);
} else {
return array();
}
return $playlists;
}
/**
@ -533,81 +540,29 @@ class Application_Model_StoredFile
return $storedFile;
}
/**
* Fetch instance of StoreFile object.<br>
* Should be supplied with only ONE parameter, all the rest should
* be NULL.
*
* @param int $p_id
* local id
* @param string $p_gunid - TODO: Remove this!
* global unique id of file
* @param string $p_md5sum
* MD5 sum of the file
* @param boolean $exist
* When this is true, it check against only files with file_exist is 'true'
* @return Application_Model_StoredFile|NULL
* Return NULL if the object doesnt exist in the DB.
*/
public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null, $p_filepath=null, $exist=false)
{
if (isset($p_id)) {
$file = CcFilesQuery::create()->findPK(intval($p_id));
} elseif (isset($p_md5sum)) {
if ($exist) {
$file = CcFilesQuery::create()
->filterByDbMd5($p_md5sum)
->filterByDbFileExists(true)
->findOne();
} else {
$file = CcFilesQuery::create()
->filterByDbMd5($p_md5sum)
->findOne();
}
} elseif (isset($p_filepath)) {
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
if (is_null($path_info)) {
return null;
}
$music_dir = Application_Model_MusicDir::getDirByPath($path_info[0]);
$file = CcFilesQuery::create()
->filterByDbDirectory($music_dir->getId())
->filterByDbFilepath($path_info[1])
->findOne();
public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null,
$p_filepath=null) {
if( isset($p_id ) ) {
$f = CcFilesQuery::create()->findPK(intval($p_id));
return is_null($f) ? null : self::createWithFile($f);
} elseif ( isset($p_gunid) ) {
throw new Exception("You should never use gunid ($gunid) anymore");
} elseif ( isset($p_md5sum) ) {
throw new Exception("Searching by md5($p_md5sum) is disabled");
} elseif ( isset($p_filepath) ) {
return is_null($f) ? null : self::createWithFile(
Application_Model_StoredFile::RecallByFilepath($p_filepath));
} else {
return null;
}
if (isset($file)) {
$storedFile = new Application_Model_StoredFile();
$storedFile->_file = $file;
return $storedFile;
} else {
return null;
throw new Exception("No arguments passsed to Recall");
}
}
public function getName()
{
$info = pathinfo($this->getFilePath());
return $info['filename'];
}
/**
* Fetch the Application_Model_StoredFile by looking up the MD5 value.
*
* @param string $p_md5sum
* @return Application_Model_StoredFile|NULL
*/
public static function RecallByMd5($p_md5sum, $exist=false)
{
return Application_Model_StoredFile::Recall(null, null, $p_md5sum, null, $exist);
}
/**
* Fetch the Application_Model_StoredFile by looking up its filepath.
*
@ -616,7 +571,18 @@ class Application_Model_StoredFile
*/
public static function RecallByFilepath($p_filepath)
{
return Application_Model_StoredFile::Recall(null, null, null, $p_filepath);
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
if (is_null($path_info)) {
return null;
}
$music_dir = Application_Model_MusicDir::getDirByPath($path_info[0]);
$file = CcFilesQuery::create()
->filterByDbDirectory($music_dir->getId())
->filterByDbFilepath($path_info[1])
->findOne();
return is_null($file) ? null : self::createWithFile($file);
}
public static function RecallByPartialFilepath($partial_path)
@ -649,7 +615,7 @@ class Application_Model_StoredFile
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime",
"language", "filepath", "owner", "conductor", "replay_gain", "lptime"
"language", "filepath", "owner_id", "conductor", "replay_gain", "lptime"
);
//Logging::info($datatables);
@ -680,7 +646,7 @@ class Application_Model_StoredFile
$blSelect[] = "login AS ".$key;
$fileSelect[] = $key;
$streamSelect[] = "login AS ".$key;
} elseif ($key === "owner") {
} elseif ($key === "owner_id") {
$plSelect[] = "login AS ".$key;
$blSelect[] = "login AS ".$key;
$fileSelect[] = "sub.login AS $key";
@ -1024,11 +990,8 @@ class Application_Model_StoredFile
public static function getFileCount()
{
global $CC_CONFIG;
$con = Propel::getConnection();
$sql = "SELECT count(*) as cnt FROM cc_files WHERE file_exists";
return $con->query($sql)->fetchColumn(0);
}
@ -1101,10 +1064,14 @@ class Application_Model_StoredFile
try {
$con = Propel::getConnection();
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
." FROM CC_FILES"
." WHERE (id != -2 and id != -3) and"
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
$sql = <<<SQL
SELECT soundcloud_id AS id,
soundcloud_upload_time
FROM CC_FILES
WHERE (id != -2
AND id != -3)
AND (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))
SQL;
$rows = $con->query($sql)->fetchAll();

View File

@ -46,7 +46,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
return $di->format("%Hh %Im");
}
}
return "";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

View File

@ -1,132 +1,225 @@
.lib-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 0 0 10px;
cursor: pointer;
}
.lib-content .fg-toolbar ul li {
list-style-type: none;
float: left;
padding: 1px 2px;
margin-right: 5px;
}
.lib-selected.even {
background-color: rgba(240, 109, 53, 1);
}
.lib-selected.odd {
background-color: rgba(255, 136, 56, 1);
}
#library_content {
float: left;
width: 50%;
overflow: hidden;
}
#library_display {
/* for breaking up long strings that don't have delimiters */
table-layout:fixed;
}
#library_display th {
text-align: left;
}
#library_content #library_display {
width:100%;
}
#library_display td {
/* for breaking up long strings that don't have delimiters */
word-wrap: break-word;
}
#library_display th,
#library_display td,
.paginationControl {
font-size: 13px;
}
#library_content .ui-tabs-panel {
padding-top:16px;
}
.paginationControl {
font-size: 12px;
background-color: #9a9a9a;
background: -moz-linear-gradient(top, #ababab 0, #9a9a9a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #ababab), color-stop(100%, #9a9a9a));
border:1px solid #5b5b5b;
border-width:0 1px 1px 1px;
padding:12px 8px 8px 8px;
}
.paginationControl p {
color:#555555;
font-size:12px;
margin:2px 0 10px 0;
}
.paginationControl .ui-button-text-only .ui-button-text {
padding: 0.2em 1em;
}
#library_display td {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
.datatable_checkbox {
text-align: center;
}
.datatable_checkbox .DataTables_sort_wrapper {
text-align: center;
}
.library_year {
text-align: center;
}
td.library_track,
td.library_sr,
td.library_bitrate {
text-align: right;
}
.library_import {
padding-bottom: 5px;
}
.library_import img {
vertical-align: middle;
padding-left: 5px;
}
.file_type {
width:16px;
height:13px;
display:block;
background-image: url(images/filetype_icons.png);
background-repeat:no-repeat;
}
.file_type.audioclip {
background-position: 0 0;
}
a.file_type.audioclip:hover {
background-position: 0 -15px;
}
.file_type.playlist {
background-position: -20px 0;
}
a.file_type.playlist:hover {
background-position: -20px -15px;
}
.lib-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 0 0 10px;
cursor: pointer;
}
.lib-content .fg-toolbar ul li {
list-style-type: none;
float: left;
padding: 1px 2px;
margin-right: 5px;
}
.lib-content .fg-toolbar ul.dropdown-menu {
float: none;
padding: 5px 0;
margin: 2px 0 0;
cursor: default;
}
.lib-content .fg-toolbar ul.dropdown-menu li {
list-style-type: none;
float: none;
padding: 0;
margin-right: 0;
}
.lib-content .fg-toolbar ul.dropdown-menu li.nav-header {
padding-right: 20px;
padding-left: 20px;
}
.lib-selected.even {
background-color: rgba(240, 109, 53, 1);
}
.lib-selected.odd {
background-color: rgba(255, 136, 56, 1);
}
#library_content {
float: left;
width: 50%;
overflow: hidden;
}
#library_display {
/* for breaking up long strings that don't have delimiters */
table-layout:fixed;
}
#library_display th {
text-align: left;
}
#library_content #library_display {
width:100%;
}
#library_display td {
/* for breaking up long strings that don't have delimiters */
word-wrap: break-word;
}
#library_display th,
#library_display td,
.paginationControl {
font-size: 13px;
}
#library_content .ui-tabs-panel {
padding-top:16px;
}
.paginationControl {
font-size: 12px;
background-color: #9a9a9a;
background: -moz-linear-gradient(top, #ababab 0, #9a9a9a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #ababab), color-stop(100%, #9a9a9a));
border:1px solid #5b5b5b;
border-width:0 1px 1px 1px;
padding:12px 8px 8px 8px;
}
.paginationControl p {
color:#555555;
font-size:12px;
margin:2px 0 10px 0;
}
.paginationControl .ui-button-text-only .ui-button-text {
padding: 0.2em 1em;
}
#library_display td {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
.datatable_checkbox {
text-align: center;
}
.datatable_checkbox .DataTables_sort_wrapper {
text-align: center;
}
.library_year {
text-align: center;
}
td.library_track,
td.library_sr,
td.library_bitrate {
text-align: right;
}
.library_import {
padding-bottom: 5px;
}
.library_import img {
vertical-align: middle;
padding-left: 5px;
}
.file_type {
width:16px;
height:13px;
display:block;
background-image: url(images/filetype_icons.png);
background-repeat:no-repeat;
}
.file_type.audioclip {
background-position: 0 0;
}
a.file_type.audioclip:hover {
background-position: 0 -15px;
}
.file_type.playlist {
background-position: -20px 0;
}
a.file_type.playlist:hover {
background-position: -20px -15px;
}
.fg-toolbar .btn-toolbar {margin: 6px 5px 6px 2px;}
/* ///////////////////// ADVANCED SEARCH ///////////////////// */
.advanced_search {
margin-bottom: 0;
}
.advanced_search > div {
margin-bottom: 6px;
}
.lib-content fieldset {
border: 1px solid #9a9a9a;
margin: 0 0 8px 0;
padding: 8px;
}
.lib-content > div + fieldset {
margin-top:3px;
}
.lib-content fieldset.closed {
border-width: 1px 0 0;
margin-bottom: -6px;
margin-left: 1px;
}
.dataTables_filter input[type="text"], .dataTables_filter select {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 25px;
width:60%;
}
.dataTables_filter label {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: inline;
}
.search-criteria .criteria-element > div {
margin-bottom: 5px;
}
.search-criteria .criteria-element > div input[type="text"],
.search-criteria .criteria-element > div select {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 25px;
}
.search-criteria .criteria-element > div .btn-small {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 25px;
padding: 3px 6px;
}
.sb-timerange .btn-small {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 25px;
vertical-align: middle;
margin: 0 !important;
line-height: 16px;
}
.sb-timerange input {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: inline-block;
float: none !important;
margin: 0 !important;
height: 25px;
outline: none;
vertical-align: middle !important;
}

View File

@ -22,12 +22,12 @@
clear: left;
}
#side_playlist button {
/*#side_playlist button {
float: left;
font-size: 12px;
height: 28px;
margin: 0 7px 20px 0;
}
}*/
#side_playlist input,
#side_playlist textarea {
@ -48,11 +48,11 @@
margin-bottom:0;
}
#side_playlist li {
/*#side_playlist li {
width: 99.5%;
margin-bottom:-1px;
position:relative;
}
}*/
#side_playlist li div.list-item-container, #side_playlist li div.list-item-container.ui-state-active {
height:56px;
@ -479,3 +479,4 @@ div.helper li {
li.spl_empty {
height: 56px;
}

View File

@ -1,283 +1,280 @@
@CHARSET "UTF-8";
.sb-content {
overflow: hidden;
}
.sb-content .dataTables_scrolling {
overflow: auto;
}
.sb-content .dataTables_wrapper {
margin-left: -16px;
}
.sb-selected.even {
background-color: rgba(240, 109, 53, 1);
}
.sb-selected.odd {
background-color: rgba(255, 136, 56, 1);
}
.sb-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 0 0 10px;
cursor: pointer;
}
.sb-content .fg-toolbar ul li {
list-style-type: none;
float: left;
padding: 1px 2px;
margin-right: 5px;
}
.sb-padded {
/*
the padding is needed here so that the cursor arrows with a negative margin are displayable.
*/
padding-left: 16px;
}
.sb-content fieldset legend {
font-size: 13px;
white-space: nowrap;
width: 110px;
}
.sb-content fieldset label {
padding: 2px;
font-size: 12px;
}
.sb-content fieldset select {
margin-right: 10px;
}
.sb-content input[type="checkbox"] {
position: relative;
top: 3px;
}
.sb-content fieldset {
margin-bottom: 8px;
}
.sb-content fieldset.closed {
border-width: 1px 0 0;
margin-bottom: -16px;
margin-left:1px;
}
.sb-content fieldset.closed .sb-options-form {
display: none;
}
.sb-content th {
text-align: left;
}
.sb-content input.input_text.hasDatepicker {
width:95px;
}
.sb-content input.input_text.hasTimepicker {
width:60px;
}
div.sb-timerange {
position: relative;
}
div.sb-timerange div#sb_edit {
position:absolute;
padding: 3px;
}
div.sb-timerange div#sb_submit {
padding: 3px;
margin-left: 5px;
}
div.sb-timerange input {
vertical-align: top;
}
div.sb-timerange input#sb_date_start {
margin-left: 30px;
}
.sb-starts,
.sb-ends {
text-align: center;
}
.innerWrapper {
position:relative;
width:100%;
}
.marker {
background: url(images/tl-arrow.png) no-repeat scroll 3px 4px;
top: -14px;
display: block;
height: 9px;
left: -17px;
padding: 4px 0 4px 3px;
position: absolute;
width: 9px;
background-color: rgba(70, 70, 70, 0.35);
border-radius: 2px 0 0 2px;
cursor:pointer;
}
.marker:hover {
background-color: rgba(70, 70, 70, 0.95);
border-radius: 2px 0 0 2px;
}
tr.cursor-selected-row .marker {
background-color: rgba(215, 0, 0, 1);
}
table.datatable tr.cursor-selected-row td, table.datatable tr.cursor-selected-row th {
border-top: 1px solid rgba(215, 0, 0, 1) !important;
}
.sb-content .sb-past {
opacity: .6;
}
.sb-placeholder {
height: 35px;
padding: 5px;
}
.sb-boundry td.sb-image,
.sb-boundry td.sb-starts,
.sb-boundry td.sb-ends,
.sb-boundry td.sb-length,
.sb-boundry td.sb-title,
.sb-boundry td.sb-creator,
.sb-boundry td.sb-album,
.sb-boundry td.sb-cue-in,
.sb-boundry td.sb-cue-out,
.sb-boundry td.sb-fade-in,
.sb-boundry td.sb-fade-out {
background-color: rgba(230, 106, 49, 0.5);
}
.sb-over td.sb-image,
.sb-over td.sb-starts,
.sb-over td.sb-ends,
.sb-over td.sb-length,
.sb-over td.sb-title,
.sb-over td.sb-creator,
.sb-over td.sb-album,
.sb-over td.sb-cue-in,
.sb-over td.sb-cue-out,
.sb-over td.sb-fade-in,
.sb-over td.sb-fade-out {
background-color: rgba(255, 0, 0, 0.5);
}
.sb-now-playing td {
background-color: rgba(23, 235, 37, 1) !important;
}
.sb-content.padded {
padding: 8px 8px 8px 16px;
}
table.dataTable tr.sb-past,
table.dataTable tr.sb-header,
table.dataTable tr.sb-footer,
table.dataTable tr.sb-not-allowed {
cursor: auto;
}
table.dataTable td.sb-image {
cursor: pointer;
}
table.datatable tr.sb-header.odd td, table.datatable tr.sb-header.even td,
table.datatable tr.sb-header.odd:hover td, table.datatable tr.sb-header.even:hover td{
background: -moz-linear-gradient(top, #a4a4a4 0, #bcbcbc 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #a4a4a4), color-stop(100%, #bcbcbc));
background: linear-gradient(top, #a4a4a4 0, #bcbcbc 100%);
border-top-color:#6b6a6a !important;
}
.sb-content tr:last-child td {
border-bottom-width: 1px !important;
border-bottom-color:#6b6a6a !important;
}
.sb-header div.ui-state-default {
float: left;
}
.sb-content input.ui-button {
padding: 3px 1em;
}
.color-box {
position:absolute;
top:-5px;
bottom:-5px;
left:-5px;
width:27px;
background: rgba(140, 2, 140, 1);
}
.show-title, .show-time {
display:inline-block;
font-size:13px;
}
.show-title {
font-weight: bold;
margin: 0 8px;
}
.show-date {
font-size:12px;
color: #363636;
margin-left: 5px;
}
.show-time {
font-size:12px;
color: #363636;
margin: 0 5px;
}
.push-right {
float:right;
margin-right:5px;
}
/*
* keep the dialog css at the bottom so it can override previous rules if needed.
*/
.ui-dialog .wrapper {
margin: 0;
padding: 10px 0 0 0;
overflow: hidden;
}
.ui-dialog .lib_content {
margin: 0 10px 10px 0;
overflow: auto;
min-height: 0;
}
.ui-dialog .sb-content {
margin: 0 0 10px 0;
overflow: auto;
}
.ui-dialog .lib_content .padded {
padding: 5px 10px 5px 8px;
}
.ui-dialog .sb_content .padded {
padding: 5px 10px 5px 16px;
@CHARSET "UTF-8";
.sb-content {
overflow: hidden;
}
.sb-content .dataTables_scrolling {
overflow: auto;
}
.sb-content .dataTables_wrapper {
margin-left: -16px;
}
.sb-selected.even {
background-color: rgba(240, 109, 53, 1);
}
.sb-selected.odd {
background-color: rgba(255, 136, 56, 1);
}
.sb-content .fg-toolbar ul {
float: left;
padding: 0;
margin: 0.5em 0 0 10px;
cursor: pointer;
}
.sb-content .fg-toolbar ul li {
list-style-type: none;
float: left;
padding: 1px 2px;
margin-right: 5px;
}
.sb-padded {
/*
the padding is needed here so that the cursor arrows with a negative margin are displayable.
*/
padding-left: 16px;
}
.sb-content fieldset legend {
font-size: 13px;
white-space: nowrap;
width: 110px;
}
.sb-content fieldset label {
padding: 2px;
font-size: 12px;
}
.sb-content fieldset select {
margin-right: 10px;
}
.sb-content input[type="checkbox"] {
position: relative;
top: 3px;
}
.sb-content fieldset {
margin-bottom: 8px;
}
.sb-content fieldset.closed {
border-width: 1px 0 0;
margin-bottom: -16px;
margin-left:1px;
}
.sb-content fieldset.closed .sb-options-form {
display: none;
}
.sb-content th {
text-align: left;
}
.sb-content input.input_text.hasDatepicker {
width:95px;
}
.sb-content input.input_text.hasTimepicker {
width:60px;
}
div.sb-timerange {
position: relative;
}
div.sb-timerange div#sb_edit {
position:absolute;
padding: 3px;
}
div.sb-timerange div#sb_submit {
padding: 3px;
margin-left: 5px;
}
div.sb-timerange input#sb_date_start {
margin-left: 30px;
}
.sb-starts,
.sb-ends {
text-align: center;
}
.innerWrapper {
position:relative;
width:100%;
}
.marker {
background: url(images/tl-arrow.png) no-repeat scroll 3px 4px;
top: -14px;
display: block;
height: 9px;
left: -17px;
padding: 4px 0 4px 3px;
position: absolute;
width: 9px;
background-color: rgba(70, 70, 70, 0.35);
border-radius: 2px 0 0 2px;
cursor:pointer;
}
.marker:hover {
background-color: rgba(70, 70, 70, 0.95);
border-radius: 2px 0 0 2px;
}
tr.cursor-selected-row .marker {
background-color: rgba(215, 0, 0, 1);
}
table.datatable tr.cursor-selected-row td, table.datatable tr.cursor-selected-row th {
border-top: 1px solid rgba(215, 0, 0, 1) !important;
}
.sb-content .sb-past {
opacity: .6;
}
.sb-placeholder {
height: 35px;
padding: 5px;
}
.sb-boundry td.sb-image,
.sb-boundry td.sb-starts,
.sb-boundry td.sb-ends,
.sb-boundry td.sb-length,
.sb-boundry td.sb-title,
.sb-boundry td.sb-creator,
.sb-boundry td.sb-album,
.sb-boundry td.sb-cue-in,
.sb-boundry td.sb-cue-out,
.sb-boundry td.sb-fade-in,
.sb-boundry td.sb-fade-out {
background-color: rgba(230, 106, 49, 0.5);
}
.sb-over td.sb-image,
.sb-over td.sb-starts,
.sb-over td.sb-ends,
.sb-over td.sb-length,
.sb-over td.sb-title,
.sb-over td.sb-creator,
.sb-over td.sb-album,
.sb-over td.sb-cue-in,
.sb-over td.sb-cue-out,
.sb-over td.sb-fade-in,
.sb-over td.sb-fade-out {
background-color: rgba(255, 0, 0, 0.5);
}
.sb-now-playing td {
background-color: rgba(23, 235, 37, 1) !important;
}
.sb-content.padded {
padding: 8px 8px 8px 16px;
}
table.dataTable tr.sb-past,
table.dataTable tr.sb-header,
table.dataTable tr.sb-footer,
table.dataTable tr.sb-not-allowed {
cursor: auto;
}
table.dataTable td.sb-image {
cursor: pointer;
}
table.datatable tr.sb-header.odd td, table.datatable tr.sb-header.even td,
table.datatable tr.sb-header.odd:hover td, table.datatable tr.sb-header.even:hover td{
background: -moz-linear-gradient(top, #a4a4a4 0, #bcbcbc 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #a4a4a4), color-stop(100%, #bcbcbc));
background: linear-gradient(top, #a4a4a4 0, #bcbcbc 100%);
border-top-color:#6b6a6a !important;
}
.sb-content tr:last-child td {
border-bottom-width: 1px !important;
border-bottom-color:#6b6a6a !important;
}
.sb-header div.ui-state-default {
float: left;
}
.sb-content input.ui-button {
padding: 3px 1em;
}
.color-box {
position:absolute;
top:-5px;
bottom:-5px;
left:-5px;
width:27px;
background: rgba(140, 2, 140, 1);
}
.show-title, .show-time {
display:inline-block;
font-size:13px;
}
.show-title {
font-weight: bold;
margin: 0 8px;
}
.show-date {
font-size:12px;
color: #363636;
margin-left: 5px;
}
.show-time {
font-size:12px;
color: #363636;
margin: 0 5px;
}
.push-right {
float:right;
margin-right:5px;
}
/*
* keep the dialog css at the bottom so it can override previous rules if needed.
*/
.ui-dialog .wrapper {
margin: 0;
padding: 10px 0 0 0;
overflow: hidden;
}
.ui-dialog .lib_content {
margin: 0 10px 10px 0;
overflow: auto;
min-height: 0;
}
.ui-dialog .sb-content {
margin: 0 0 10px 0;
overflow: auto;
}
.ui-dialog .lib_content .padded {
padding: 5px 10px 5px 8px;
}
.ui-dialog .sb_content .padded {
padding: 5px 10px 5px 16px;
}

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,9 @@ defined('APPLICATION_PATH')
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
defined('VERBOSE_STACK_TRACE')
|| define('VERBOSE_STACK_TRACE', (getenv('VERBOSE_STACK_TRACE') ? getenv('VERBOSE_STACK_TRACE') : true));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
@ -67,6 +70,10 @@ try {
echo $e->getTraceAsString();
echo "</pre>";
Logging::info($e->getMessage());
Logging::info($e->getTraceAsString());
if (VERBOSE_STACK_TRACE) {
Logging::info($e->getTraceAsString());
} else {
Logging::info($e->getTrace());
}
}

View File

@ -36,7 +36,7 @@ var AIRTIME = (function(AIRTIME) {
"track_title" : "s",
"track_num" : "n",
"year" : "n",
"owner" : "s",
"owner_id" : "s",
"replay_gain" : "n"
};
@ -350,10 +350,21 @@ var AIRTIME = (function(AIRTIME) {
$.each(aoCols, function(i,ele){
if (ele.bSearchable) {
var currentColId = ele._ColReorder_iOrigCol;
var label = "";
if (ele.mDataProp == "bit_rate") {
label = " (bps)";
} else if (ele.mDataProp == "utime" || ele.mDataPro == "mtime" || ele.mDataPro == "lptime") {
label = " (yyyy-mm-dd)";
} else if (ele.mDataProp == "length") {
label = " (hh:mm:ss.t)";
} else if (ele.mDataProp == "sample_rate") {
label = " (Hz)";
}
if (ele.bVisible) {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"'><span>"+ele.sTitle+"</span> : <span id='"+ele.mDataProp+"'></span></div>");
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"'><span>"+ele.sTitle+label+"</span> : <span id='"+ele.mDataProp+"'></span></div>");
} else {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' style='display:none;'><span>"+ele.sTitle+"</span> : <span id='"+ele.mDataProp+"'></span></div>");
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' style='display:none;'><span>"+ele.sTitle+label+"</span> : <span id='"+ele.mDataProp+"'></span></div>");
}
if (criteriaTypes[ele.mDataProp] == "s") {
var obj = { sSelector: "#"+ele.mDataProp }
@ -392,32 +403,32 @@ var AIRTIME = (function(AIRTIME) {
"aoColumns": [
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_checkbox" } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
/* Title */ { "sTitle" : "Title" , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" } ,
/* Creator */ { "sTitle" : "Creator" , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
/* Creator */ { "sTitle" : "Creator" , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
/* Album */ { "sTitle" : "Album" , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" } ,
/* Genre */ { "sTitle" : "Genre" , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" } ,
/* Year */ { "sTitle" : "Year" , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" } ,
/* Length */ { "sTitle" : "Length" , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Upload Time */ { "sTitle" : "Uploaded" , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Last Modified */ { "sTitle" : "Last Modified" , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Last Played */ { "sTitle" : "Last Played " , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Track Number */ { "sTitle" : "Track" , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" } ,
/* Mood */ { "sTitle" : "Mood" , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" } ,
/* BPM */ { "sTitle" : "BPM" , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" } ,
/* Composer */ { "sTitle" : "Composer" , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" } ,
/* Website */ { "sTitle" : "Website" , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" } ,
/* Bit Rate */ { "sTitle" : "Bit Rate" , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" } ,
/* Sample Rate */ { "sTitle" : "Sample" , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" } ,
/* ISRC Number */ { "sTitle" : "ISRC" , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" } ,
/* BPM */ { "sTitle" : "BPM" , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" } ,
/* Composer */ { "sTitle" : "Composer" , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" } ,
/* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Copyright */ { "sTitle" : "Copyright" , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" } ,
/* Encoded */ { "sTitle" : "Encoded By" , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" } ,
/* Genre */ { "sTitle" : "Genre" , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" } ,
/* ISRC Number */ { "sTitle" : "ISRC" , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" } ,
/* Label */ { "sTitle" : "Label" , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" } ,
/* Copyright */ { "sTitle" : "Copyright" , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" } ,
/* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" } ,
/* Language */ { "sTitle" : "Language" , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "80px" }
/* Last Modified */ { "sTitle" : "Last Modified" , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Last Played */ { "sTitle" : "Last Played " , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Length */ { "sTitle" : "Length" , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" } ,
/* Mood */ { "sTitle" : "Mood" , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" } ,
/* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "80px" },
/* Sample Rate */ { "sTitle" : "Sample Rate" , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" } ,
/* Track Number */ { "sTitle" : "Track Number" , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" } ,
/* Upload Time */ { "sTitle" : "Uploaded" , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Website */ { "sTitle" : "Website" , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" } ,
/* Year */ { "sTitle" : "Year" , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
],
"bProcessing": true,
@ -1103,13 +1114,12 @@ var validationTypes = {
"mood" : "s",
"name" : "s",
"orchestra" : "s",
"owner" : "s",
"owner_id" : "s",
"rating" : "i",
"replay_gain" : "n",
"sample_rate" : "i",
"track_title" : "s",
"track_number" : "i",
"info_url" : "s",
"year" : "i",
"lptime" : "t"
"year" : "i"
};

View File

@ -3,13 +3,13 @@ $(document).ready(function() {
$("#plupload_files").pluploadQueue({
// General settings
runtimes : 'gears, html5, html4',
url : '/Plupload/upload/format/json',
chunk_size: '5mb',
unique_names: 'true',
runtimes : 'gears, html5, html4',
url : '/Plupload/upload/format/json',
chunk_size : '5mb',
unique_names : 'true',
multiple_queues : 'true',
filters : [
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,aac,wav"}
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,aac,wav,m4a"}
]
});

View File

@ -520,32 +520,32 @@ function disableLoadingIcon() {
}
var criteriaTypes = {
0 : "",
"album_title" : "s",
"artist_name" : "s",
"bit_rate" : "n",
"bpm" : "n",
"comments" : "s",
"composer" : "s",
"conductor" : "s",
"utime" : "n",
"mtime" : "n",
"lptime" : "n",
"disc_number" : "n",
"genre" : "s",
"isrc_number" : "s",
"label" : "s",
"language" : "s",
"length" : "n",
"lyricist" : "s",
"mood" : "s",
"name" : "s",
"orchestra" : "s",
"rating" : "n",
"sample_rate" : "n",
"track_title" : "s",
"track_num" : "n",
"year" : "n"
0 : "",
"album_title" : "s",
"bit_rate" : "n",
"bpm" : "n",
"composer" : "s",
"conductor" : "s",
"copyright" : "s",
"artist_name" : "s",
"encoded_by" : "s",
"utime" : "n",
"mtime" : "n",
"lptime" : "n",
"genre" : "s",
"isrc_number" : "s",
"label" : "s",
"language" : "s",
"length" : "n",
"mime" : "s",
"mood" : "s",
"owner_id" : "s",
"replay_gain" : "n",
"sample_rate" : "n",
"track_title" : "s",
"track_number" : "n",
"info_url" : "s",
"year" : "n"
};
var stringCriteriaOptions = {

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -15,8 +15,6 @@ ALTER TABLE cc_files
DROP TABLE cc_access;
DROP SEQUENCE cc_access_id_seq;
CREATE FUNCTION airtime_to_int(chartoconvert character varying) RETURNS integer
AS
'SELECT CASE WHEN trim($1) SIMILAR TO ''[0-9]+'' THEN CAST(trim($1) AS integer) ELSE NULL END;'

View File

@ -135,7 +135,7 @@ class AirtimeMessageReceiver(Loggable):
msg['directory'])
self.new_watch(msg)
else:
self.__reFalsequest_now_bootstrap( directory=msg['directory'],
self.__request_now_bootstrap( directory=msg['directory'],
all_files=restart)
self.manager.add_watch_directory(msg['directory'])

View File

@ -110,7 +110,7 @@ class BaseEvent(Loggable):
# nothing to see here, please move along
def morph_into(self, evt):
self.logger.info("Morphing %s into %s" % ( str(self), str(evt) ) )
self._raw_event = evt
self._raw_event = evt._raw_event
self.path = evt.path
self.__class__ = evt.__class__
# Clean up old hook and transfer the new events hook
@ -181,11 +181,14 @@ class MoveFile(BaseEvent, HasMetaData):
"""
def __init__(self, *args, **kwargs):
super(MoveFile, self).__init__(*args, **kwargs)
def old_path(self):
return self._raw_event.src_pathname
def pack(self):
req_dict = {}
req_dict['mode'] = u'moved'
req_dict = {}
req_dict['mode'] = u'moved'
req_dict['MDATA_KEY_ORIGINAL_PATH'] = self.old_path()
req_dict['MDATA_KEY_FILEPATH'] = unicode( self.path )
req_dict['MDATA_KEY_MD5'] = self.metadata.extract()['MDATA_KEY_MD5']
req_dict['MDATA_KEY_FILEPATH'] = unicode( self.path )
return [req_dict]
class ModifyFile(BaseEvent, HasMetaData):

View File

@ -231,6 +231,8 @@ class Manager(Loggable):
else:
self.logger.info("'%s' is not being watched, hence cannot be \
removed" % watch_dir)
self.logger.info("The directories we are watching now are:")
self.logger.info( self.__wd_path )
def loop(self):
"""

View File

@ -20,7 +20,9 @@ from configobj import ConfigObj
from media.monitor.exceptions import FailedToSetLocale, FailedToCreateDir
#supported_extensions = [u"mp3", u"ogg", u"oga"]
supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"wav"]
supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"wav",
u'm4a']
unicode_unknown = u'unknown'
path_md = ['MDATA_KEY_TITLE', 'MDATA_KEY_CREATOR', 'MDATA_KEY_SOURCE',