Merge branch '2.2.x' into devel

This commit is contained in:
denise 2012-11-21 10:54:17 -05:00
commit f88a7bdb31
4 changed files with 17 additions and 7 deletions

View file

@ -467,9 +467,9 @@ SQL;
Logging::info("Adding to block"); Logging::info("Adding to block");
Logging::info("at position {$pos}"); Logging::info("at position {$pos}");
} }
foreach ($p_items as $ac) { foreach ($p_items as $ac) {
Logging::info("Adding audio file {$ac}"); Logging::info("Adding audio file {$ac[0]}");
try { try {
if (is_array($ac) && $ac[1] == 'audioclip') { if (is_array($ac) && $ac[1] == 'audioclip') {
$res = $this->insertBlockElement($this->buildEntry($ac[0], $pos)); $res = $this->insertBlockElement($this->buildEntry($ac[0], $pos));

View file

@ -206,7 +206,7 @@ class Application_Model_Preference
$fade = number_format($fade, 2); $fade = number_format($fade, 2);
//fades need 2 leading zeros for DateTime conversion //fades need 2 leading zeros for DateTime conversion
$fade = rtrim(str_pad($fade, 5, "0", STR_PAD_LEFT), "0"); $fade = str_pad($fade, 5, "0", STR_PAD_LEFT);
return $fade; return $fade;
} }

View file

@ -674,6 +674,12 @@ SQL;
$start = self::AirtimeTimeToPypoTime($item["start"]); $start = self::AirtimeTimeToPypoTime($item["start"]);
$end = self::AirtimeTimeToPypoTime($item["end"]); $end = self::AirtimeTimeToPypoTime($item["end"]);
list(,,,$start_hour,,) = explode("-", $start);
list(,,,$end_hour,,) = explode("-", $end);
$same_hour = $start_hour == $end_hour;
$independent_event = !$same_hour;
$schedule_item = array( $schedule_item = array(
'id' => $media_id, 'id' => $media_id,
'type' => 'file', 'type' => 'file',
@ -687,7 +693,7 @@ SQL;
'end' => $end, 'end' => $end,
'show_name' => $item["show_name"], 'show_name' => $item["show_name"],
'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"], 'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"],
'independent_event' => false 'independent_event' => $independent_event,
); );
self::appendScheduleItem($data, $start, $schedule_item); self::appendScheduleItem($data, $start, $schedule_item);
} }
@ -859,6 +865,8 @@ SQL;
$data = array(); $data = array();
$data["media"] = array(); $data["media"] = array();
//Harbor kick times *MUST* be ahead of schedule events, so that pypo
//executes them first.
self::createInputHarborKickTimes($data, $range_start, $range_end); self::createInputHarborKickTimes($data, $range_start, $range_end);
self::createScheduledEvents($data, $range_start, $range_end); self::createScheduledEvents($data, $range_start, $range_end);

View file

@ -8,6 +8,9 @@ import json
import shutil import shutil
import commands import commands
sys.path.append('/usr/lib/airtime/media-monitor/mm2/')
from media.monitor.pure import is_file_supported
# create logger # create logger
logger = logging.getLogger() logger = logging.getLogger()
@ -53,8 +56,7 @@ def copy_or_move_files_to(paths, dest, flag):
copy_or_move_files_to(sub_path, dest, flag) copy_or_move_files_to(sub_path, dest, flag)
elif(os.path.isfile(path)): elif(os.path.isfile(path)):
#copy file to dest #copy file to dest
ext = os.path.splitext(path)[1] if(is_file_supported(path)):
if( 'mp3' in ext or 'ogg' in ext ):
destfile = dest+os.path.basename(path) destfile = dest+os.path.basename(path)
if(flag == 'copy'): if(flag == 'copy'):
print "Copying %(src)s to %(dest)s..." % {'src':path, 'dest':destfile} print "Copying %(src)s to %(dest)s..." % {'src':path, 'dest':destfile}
@ -159,7 +161,7 @@ def WatchAddAction(option, opt, value, parser):
path = currentDir+path path = currentDir+path
path = apc.encode_to(path, 'utf-8') path = apc.encode_to(path, 'utf-8')
if(os.path.isdir(path)): if(os.path.isdir(path)):
os.chmod(path, 0765) #os.chmod(path, 0765)
res = api_client.add_watched_dir(path) res = api_client.add_watched_dir(path)
if(res is None): if(res is None):
exit("Unable to connect to the server.") exit("Unable to connect to the server.")