Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
4998a63a6a
16 changed files with 2785 additions and 84 deletions
|
@ -87,9 +87,6 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$hours;
|
|
||||||
$minutes;
|
|
||||||
|
|
||||||
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||||
$end_time = $formData['add_show_end_date_no_repeat']." ".$formData['add_show_end_time'];
|
$end_time = $formData['add_show_end_date_no_repeat']." ".$formData['add_show_end_time'];
|
||||||
|
|
||||||
|
|
|
@ -411,8 +411,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
// 3. validate formate according to DB column type
|
// 3. validate formate according to DB column type
|
||||||
$multiplier = 1;
|
$multiplier = 1;
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$errors = array();
|
|
||||||
$error = array();
|
|
||||||
|
|
||||||
// validation start
|
// validation start
|
||||||
if ($data['etc']['sp_limit_options'] == 'hours') {
|
if ($data['etc']['sp_limit_options'] == 'hours') {
|
||||||
|
@ -444,8 +442,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteriaFieldsUsed = array();
|
|
||||||
|
|
||||||
if (isset($data['criteria'])) {
|
if (isset($data['criteria'])) {
|
||||||
foreach ($data['criteria'] as $rowKey=>$row) {
|
foreach ($data['criteria'] as $rowKey=>$row) {
|
||||||
foreach ($row as $key=>$d) {
|
foreach ($row as $key=>$d) {
|
||||||
|
|
|
@ -190,7 +190,6 @@ class Application_Model_Block implements Application_Model_LibraryEditable
|
||||||
{
|
{
|
||||||
Logging::info("Getting contents for block {$this->id}");
|
Logging::info("Getting contents for block {$this->id}");
|
||||||
|
|
||||||
$files = array();
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT pc.id AS id,
|
SELECT pc.id AS id,
|
||||||
pc.position,
|
pc.position,
|
||||||
|
@ -640,8 +639,6 @@ SQL;
|
||||||
|
|
||||||
$this->con->beginTransaction();
|
$this->con->beginTransaction();
|
||||||
|
|
||||||
$errArray= array();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$row = CcBlockcontentsQuery::create()->findPK($id);
|
$row = CcBlockcontentsQuery::create()->findPK($id);
|
||||||
|
|
||||||
|
@ -1030,8 +1027,7 @@ SQL;
|
||||||
$blockType = $data['etc']['sp_type'] == 0 ? 'static':'dynamic';
|
$blockType = $data['etc']['sp_type'] == 0 ? 'static':'dynamic';
|
||||||
$this->saveType($blockType);
|
$this->saveType($blockType);
|
||||||
$this->storeCriteriaIntoDb($data);
|
$this->storeCriteriaIntoDb($data);
|
||||||
//get number of files that meet the criteria
|
|
||||||
$files = $this->getListofFilesMeetCriteria();
|
|
||||||
// if the block is dynamic, put null to the length
|
// if the block is dynamic, put null to the length
|
||||||
// as it cannot be calculated
|
// as it cannot be calculated
|
||||||
if ($blockType == 'dynamic') {
|
if ($blockType == 'dynamic') {
|
||||||
|
@ -1360,7 +1356,6 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($fieldName, $fieldNames)) {
|
if (in_array($fieldName, $fieldNames)) {
|
||||||
$rowNum = intval(substr($ele['name'], $index+1));
|
|
||||||
$output['criteria'][$critIndex][$lastChar][$fieldName] = trim($ele['value']);
|
$output['criteria'][$critIndex][$lastChar][$fieldName] = trim($ele['value']);
|
||||||
} else {
|
} else {
|
||||||
$output['etc'][$ele['name']] = $ele['value'];
|
$output['etc'][$ele['name']] = $ele['value'];
|
||||||
|
|
|
@ -116,7 +116,6 @@ class Application_Model_Datatables
|
||||||
$simpleWhere = array();
|
$simpleWhere = array();
|
||||||
|
|
||||||
foreach ($searchTerms as $term) {
|
foreach ($searchTerms as $term) {
|
||||||
$innerCond = array();
|
|
||||||
|
|
||||||
foreach ($searchCols as $col) {
|
foreach ($searchCols as $col) {
|
||||||
$simpleWhere['clause']["simple_".$col] = "{$col}::text ILIKE :simple_".$col;
|
$simpleWhere['clause']["simple_".$col] = "{$col}::text ILIKE :simple_".$col;
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Application_Model_Email
|
||||||
$mailServer = Application_Model_Preference::GetMailServer();
|
$mailServer = Application_Model_Preference::GetMailServer();
|
||||||
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
||||||
if (!empty($mailServerPort)) {
|
if (!empty($mailServerPort)) {
|
||||||
$port = Application_Model_Preference::GetMailServerPort();
|
$port = $mailServerPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mailServerRequiresAuth) {
|
if ($mailServerRequiresAuth) {
|
||||||
|
|
|
@ -75,7 +75,6 @@ class Application_Model_MusicDir
|
||||||
*/
|
*/
|
||||||
public function remove($userAddedWatchedDir=true)
|
public function remove($userAddedWatchedDir=true)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
$music_dir_id = $this->getId();
|
$music_dir_id = $this->getId();
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,6 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
|
||||||
public function getContents($filterFiles=false)
|
public function getContents($filterFiles=false)
|
||||||
{
|
{
|
||||||
Logging::info("Getting contents for playlist {$this->id}");
|
Logging::info("Getting contents for playlist {$this->id}");
|
||||||
$files = array();
|
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -614,8 +613,6 @@ SQL;
|
||||||
|
|
||||||
$this->con->beginTransaction();
|
$this->con->beginTransaction();
|
||||||
|
|
||||||
$errArray= array();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$row = CcPlaylistcontentsQuery::create()->findPK($id);
|
$row = CcPlaylistcontentsQuery::create()->findPK($id);
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ class Application_Model_Preference
|
||||||
public static function setValue($key, $value, $isUserValue = false)
|
public static function setValue($key, $value, $isUserValue = false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
//called from a daemon process
|
//called from a daemon process
|
||||||
if (!class_exists("Zend_Auth", false) || !Zend_Auth::getInstance()->hasIdentity()) {
|
if (!class_exists("Zend_Auth", false) || !Zend_Auth::getInstance()->hasIdentity()) {
|
||||||
$id = NULL;
|
$id = NULL;
|
||||||
|
@ -425,7 +423,6 @@ class Application_Model_Preference
|
||||||
{
|
{
|
||||||
self::setValue("timezone", $timezone);
|
self::setValue("timezone", $timezone);
|
||||||
date_default_timezone_set($timezone);
|
date_default_timezone_set($timezone);
|
||||||
$md = array("timezone" => $timezone);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetTimezone()
|
public static function GetTimezone()
|
||||||
|
|
|
@ -75,7 +75,6 @@ SQL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
$sql = "SELECT %%columns%% st.starts as starts, st.ends as ends,
|
$sql = "SELECT %%columns%% st.starts as starts, st.ends as ends,
|
||||||
st.media_item_played as media_item_played, si.ends as show_ends
|
st.media_item_played as media_item_played, si.ends as show_ends
|
||||||
%%tables%% WHERE ";
|
%%tables%% WHERE ";
|
||||||
|
@ -378,14 +377,19 @@ SQL;
|
||||||
|
|
||||||
public static function UpdateBrodcastedStatus($dateTime, $value)
|
public static function UpdateBrodcastedStatus($dateTime, $value)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
$now = $dateTime->format("Y-m-d H:i:s");
|
$now = $dateTime->format("Y-m-d H:i:s");
|
||||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
|
||||||
." SET broadcasted=$value"
|
|
||||||
." WHERE starts <= '$now' AND ends >= '$now'";
|
|
||||||
$retVal = $con->exec($sql);
|
|
||||||
|
|
||||||
|
$sql = <<<SQL
|
||||||
|
UPDATE cc_schedule
|
||||||
|
SET broadcasted=:broadcastedValue
|
||||||
|
WHERE starts <= :starts::TIMESTAMP
|
||||||
|
AND ends >= :ends::TIMESTAMP
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
$retVal = Application_Common_Database::prepareAndExecute($sql, array(
|
||||||
|
':broadcastedValue' => $value,
|
||||||
|
':starts' => $now,
|
||||||
|
':ends' => $now), 'execute');
|
||||||
return $retVal;
|
return $retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,41 +523,38 @@ SQL;
|
||||||
public static function getItems($p_startTime, $p_endTime)
|
public static function getItems($p_startTime, $p_endTime)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
$baseQuery = <<<SQL
|
||||||
|
SELECT st.file_id AS file_id,
|
||||||
|
st.id AS id,
|
||||||
|
st.instance_id AS instance_id,
|
||||||
|
st.starts AS start,
|
||||||
|
st.ends AS end,
|
||||||
|
st.cue_in AS cue_in,
|
||||||
|
st.cue_out AS cue_out,
|
||||||
|
st.fade_in AS fade_in,
|
||||||
|
st.fade_out AS fade_out,
|
||||||
|
si.starts AS show_start,
|
||||||
|
si.ends AS show_end,
|
||||||
|
s.name AS show_name,
|
||||||
|
f.id AS file_id,
|
||||||
|
f.replay_gain AS replay_gain,
|
||||||
|
ws.id AS stream_id,
|
||||||
|
ws.url AS url
|
||||||
|
FROM cc_schedule AS st
|
||||||
|
LEFT JOIN cc_show_instances AS si ON st.instance_id = si.id
|
||||||
|
LEFT JOIN cc_show AS s ON s.id = si.show_id
|
||||||
|
LEFT JOIN cc_files AS f ON st.file_id = f.id
|
||||||
|
LEFT JOIN cc_webstream AS ws ON st.stream_id = ws.id
|
||||||
|
SQL;
|
||||||
|
$predicates = <<<SQL
|
||||||
|
WHERE st.ends > :startTime1
|
||||||
|
AND st.starts < :endTime
|
||||||
|
AND st.playout_status > 0
|
||||||
|
AND si.ends > :startTime2
|
||||||
|
ORDER BY st.starts
|
||||||
|
SQL;
|
||||||
|
|
||||||
$baseQuery = "SELECT st.file_id AS file_id,"
|
$sql = $baseQuery." ".$predicates;
|
||||||
." st.id AS id,"
|
|
||||||
." st.instance_id AS instance_id,"
|
|
||||||
." st.starts AS start,"
|
|
||||||
." st.ends AS end,"
|
|
||||||
." st.cue_in AS cue_in,"
|
|
||||||
." st.cue_out AS cue_out,"
|
|
||||||
." st.fade_in AS fade_in,"
|
|
||||||
." st.fade_out AS fade_out,"
|
|
||||||
//." st.type AS type,"
|
|
||||||
." si.starts AS show_start,"
|
|
||||||
." si.ends AS show_end,"
|
|
||||||
." s.name AS show_name,"
|
|
||||||
." f.id AS file_id,"
|
|
||||||
." f.replay_gain AS replay_gain,"
|
|
||||||
." ws.id as stream_id,"
|
|
||||||
." ws.url as url"
|
|
||||||
." FROM cc_schedule AS st"
|
|
||||||
." LEFT JOIN cc_show_instances AS si"
|
|
||||||
." ON st.instance_id = si.id"
|
|
||||||
." LEFT JOIN cc_show as s"
|
|
||||||
." ON s.id = si.show_id"
|
|
||||||
." LEFT JOIN cc_files AS f"
|
|
||||||
." ON st.file_id = f.id"
|
|
||||||
." LEFT JOIN cc_webstream AS ws"
|
|
||||||
." ON st.stream_id = ws.id";
|
|
||||||
|
|
||||||
$predicates = " WHERE st.ends > :startTime1"
|
|
||||||
." AND st.starts < :endTime"
|
|
||||||
." AND st.playout_status > 0"
|
|
||||||
." AND si.ends > :startTime2"
|
|
||||||
." ORDER BY st.starts";
|
|
||||||
|
|
||||||
$sql = $baseQuery.$predicates;
|
|
||||||
|
|
||||||
$rows = Application_Common_Database::prepareAndExecute($sql,
|
$rows = Application_Common_Database::prepareAndExecute($sql,
|
||||||
array(':startTime1'=>$p_startTime, ':endTime'=>$p_endTime, ':startTime2'=>$p_startTime));
|
array(':startTime1'=>$p_startTime, ':endTime'=>$p_endTime, ':startTime2'=>$p_startTime));
|
||||||
|
@ -571,7 +572,7 @@ WHERE st.ends > :startTime1
|
||||||
ORDER BY st.starts LIMIT 3
|
ORDER BY st.starts LIMIT 3
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$sql = " ".$baseQuery.$predicates;
|
$sql = " ".$baseQuery." ".$predicates." ";
|
||||||
$rows = Application_Common_Database::prepareAndExecute($sql,
|
$rows = Application_Common_Database::prepareAndExecute($sql,
|
||||||
array(
|
array(
|
||||||
':startTime1' => $p_startTime,
|
':startTime1' => $p_startTime,
|
||||||
|
@ -718,8 +719,8 @@ SQL;
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
/* if $p_fromDateTime and $p_toDateTime function parameters are null, then set range
|
/* if $p_fromDateTime and $p_toDateTime function parameters are null,
|
||||||
* from "now" to "now + 24 hours". */
|
then set range * from "now" to "now + 24 hours". */
|
||||||
if (is_null($p_fromDateTime)) {
|
if (is_null($p_fromDateTime)) {
|
||||||
$t1 = new DateTime("@".time());
|
$t1 = new DateTime("@".time());
|
||||||
$range_start = $t1->format("Y-m-d H:i:s");
|
$range_start = $t1->format("Y-m-d H:i:s");
|
||||||
|
@ -809,7 +810,7 @@ SQL;
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=:file_id";
|
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=:file_id";
|
||||||
$res = Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createNewFormSections($p_view)
|
public static function createNewFormSections($p_view)
|
||||||
|
|
|
@ -613,7 +613,6 @@ class Application_Model_Scheduler
|
||||||
Logging::debug("inserting after removing gaps.");
|
Logging::debug("inserting after removing gaps.");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
|
|
||||||
$afterInstanceId = $afterInstance->getDbId();
|
|
||||||
$modified = array_keys($modifiedMap);
|
$modified = array_keys($modifiedMap);
|
||||||
//need to adjust shows we have moved items from.
|
//need to adjust shows we have moved items from.
|
||||||
foreach ($modified as $instanceId) {
|
foreach ($modified as $instanceId) {
|
||||||
|
|
|
@ -127,8 +127,6 @@ class Application_Model_Show
|
||||||
|
|
||||||
public function getHosts()
|
public function getHosts()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT first_name,
|
SELECT first_name,
|
||||||
last_name
|
last_name
|
||||||
|
@ -149,8 +147,6 @@ SQL;
|
||||||
|
|
||||||
public function getHostsIds()
|
public function getHostsIds()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT subjs_id
|
SELECT subjs_id
|
||||||
FROM cc_show_hosts
|
FROM cc_show_hosts
|
||||||
|
@ -331,8 +327,6 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function removeUncheckedDaysInstances($p_uncheckedDays)
|
public function removeUncheckedDaysInstances($p_uncheckedDays)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
//need to convert local doftw to UTC doftw (change made for 2.0 since shows are stored in UTC)
|
//need to convert local doftw to UTC doftw (change made for 2.0 since shows are stored in UTC)
|
||||||
$daysRemovedUTC = array();
|
$daysRemovedUTC = array();
|
||||||
|
|
||||||
|
@ -1348,13 +1342,10 @@ SQL;
|
||||||
*/
|
*/
|
||||||
private static function populateNonRepeatingShow($p_showRow, $p_populateUntilDateTime)
|
private static function populateNonRepeatingShow($p_showRow, $p_populateUntilDateTime)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
$show_id = $p_showRow["show_id"];
|
$show_id = $p_showRow["show_id"];
|
||||||
$first_show = $p_showRow["first_show"]; //non-UTC
|
$first_show = $p_showRow["first_show"]; //non-UTC
|
||||||
$start_time = $p_showRow["start_time"]; //non-UTC
|
$start_time = $p_showRow["start_time"]; //non-UTC
|
||||||
$duration = $p_showRow["duration"];
|
$duration = $p_showRow["duration"];
|
||||||
$day = $p_showRow["day"];
|
|
||||||
$record = $p_showRow["record"];
|
$record = $p_showRow["record"];
|
||||||
$timezone = $p_showRow["timezone"];
|
$timezone = $p_showRow["timezone"];
|
||||||
$start = $first_show." ".$start_time;
|
$start = $first_show." ".$start_time;
|
||||||
|
@ -1413,8 +1404,6 @@ SQL;
|
||||||
*/
|
*/
|
||||||
private static function populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, $p_interval)
|
private static function populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, $p_interval)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
$show_id = $p_showDaysRow["show_id"];
|
$show_id = $p_showDaysRow["show_id"];
|
||||||
$next_pop_date = $p_showDaysRow["next_pop_date"];
|
$next_pop_date = $p_showDaysRow["next_pop_date"];
|
||||||
$first_show = $p_showDaysRow["first_show"]; //non-UTC
|
$first_show = $p_showDaysRow["first_show"]; //non-UTC
|
||||||
|
|
|
@ -207,18 +207,18 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : properly implement this interface
|
||||||
public function setMetadata($key, $val)
|
public function setMetadata($key, $val)
|
||||||
{
|
{
|
||||||
|
throw new Exception("setMetadata is not imeplemented by WebStream yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
|
throw new Exception("setName is not imeplemented by WebStream yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLastPlayed($timestamp)
|
public function setLastPlayed($timestamp)
|
||||||
|
|
2707
airtime_mvc/public/css/bootstrap_custom.css
vendored
Normal file
2707
airtime_mvc/public/css/bootstrap_custom.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -204,6 +204,20 @@ function setSmartBlockEvents() {
|
||||||
/********** CRITERIA CHANGE **********/
|
/********** CRITERIA CHANGE **********/
|
||||||
form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){
|
form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){
|
||||||
var index = getRowIndex($(this).parent());
|
var index = getRowIndex($(this).parent());
|
||||||
|
//need to change the criteria value for any modifier rows
|
||||||
|
var critVal = $(this).val();
|
||||||
|
var divs = $(this).parent().nextAll(':visible');
|
||||||
|
$.each(divs, function(i, div){
|
||||||
|
var critSelect = $(div).children('select[id^="sp_criteria_field"]');
|
||||||
|
if (critSelect.hasClass('sp-invisible')) {
|
||||||
|
critSelect.val(critVal);
|
||||||
|
/* If the select box is visible we know the modifier rows
|
||||||
|
* have ended
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// disable extra field and hide the span
|
// disable extra field and hide the span
|
||||||
disableAndHideExtraField($(this), index);
|
disableAndHideExtraField($(this), index);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from kombu.messaging import Exchange, Queue, Consumer
|
from kombu.messaging import Exchange, Queue, Consumer
|
||||||
from kombu.connection import BrokerConnection
|
from kombu.connection import BrokerConnection
|
||||||
from os.path import normpath
|
from os.path import normpath
|
||||||
|
from mutagen.easymp4 import EasyMP4KeyError
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
@ -117,6 +118,10 @@ class AirtimeMessageReceiver(Loggable):
|
||||||
try: Metadata.write_unsafe(path=md_path, md=msg)
|
try: Metadata.write_unsafe(path=md_path, md=msg)
|
||||||
except BadSongFile as e:
|
except BadSongFile as e:
|
||||||
self.logger.info("Cannot find metadata file: '%s'" % e.path)
|
self.logger.info("Cannot find metadata file: '%s'" % e.path)
|
||||||
|
except EasyMP4KeyError as e:
|
||||||
|
self.logger.info("Metadata instance not supported for this file '%s'" \
|
||||||
|
% e.path)
|
||||||
|
self.logger.info(str(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# TODO : add md_path to problem path or something?
|
# TODO : add md_path to problem path or something?
|
||||||
self.fatal_exception("Unknown error when writing metadata to: '%s'"
|
self.fatal_exception("Unknown error when writing metadata to: '%s'"
|
||||||
|
|
|
@ -3,6 +3,7 @@ import mutagen
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import copy
|
import copy
|
||||||
|
from mutagen.easymp4 import EasyMP4KeyError
|
||||||
|
|
||||||
from media.monitor.exceptions import BadSongFile
|
from media.monitor.exceptions import BadSongFile
|
||||||
from media.monitor.log import Loggable
|
from media.monitor.log import Loggable
|
||||||
|
@ -150,12 +151,17 @@ class Metadata(Loggable):
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(path): raise BadSongFile(path)
|
if not os.path.exists(path): raise BadSongFile(path)
|
||||||
song_file = mutagen.File(path, easy=True)
|
song_file = mutagen.File(path, easy=True)
|
||||||
|
ex = None
|
||||||
for airtime_k, airtime_v in md.iteritems():
|
for airtime_k, airtime_v in md.iteritems():
|
||||||
if airtime_k in airtime2mutagen:
|
if airtime_k in airtime2mutagen:
|
||||||
# The unicode cast here is mostly for integers that need to be
|
# The unicode cast here is mostly for integers that need to be
|
||||||
# strings
|
# strings
|
||||||
|
try:
|
||||||
song_file[ airtime2mutagen[airtime_k] ] = unicode(airtime_v)
|
song_file[ airtime2mutagen[airtime_k] ] = unicode(airtime_v)
|
||||||
|
except EasyMP4KeyError as e:
|
||||||
|
ex = e
|
||||||
song_file.save()
|
song_file.save()
|
||||||
|
if ex: raise ex
|
||||||
|
|
||||||
def __init__(self, fpath):
|
def __init__(self, fpath):
|
||||||
# Forcing the unicode through
|
# Forcing the unicode through
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue