Merge branch 'airtime-1.6.1' of dev.sourcefabric.org:campcaster into airtime-1.6.1

This commit is contained in:
naomiaro 2011-02-24 11:06:49 -05:00
commit 810aa3845b
8 changed files with 555 additions and 548 deletions

View File

@ -149,25 +149,12 @@ class ApiController extends Zend_Controller_Action
$schedule_group_id = $this->_getParam("schedule_id");
$media_id = $this->_getParam("media_id");
$f = StoredFile::RecallByGunid($media_id);
$result = Schedule::UpdateMediaPlayedStatus($media_id);
if (is_numeric($schedule_group_id)) {
$sg = new ScheduleGroup($schedule_group_id);
if ($sg->exists()) {
$result = $sg->notifyMediaItemStartPlay($f->getId());
if (!PEAR::isError($result)) {
echo json_encode(array("status"=>1, "message"=>""));
exit;
} else {
echo json_encode(array("status"=>0, "message"=>"DB Error:".$result->getMessage()));
exit;
}
} else {
echo json_encode(array("status"=>0, "message"=>"Schedule group does not exist: ".$schedule_group_id));
exit;
}
if (!PEAR::isError($result)) {
echo json_encode(array("status"=>1, "message"=>""));
} else {
echo json_encode(array("status"=>0, "message" => "Incorrect or non-numeric arguments given."));
echo json_encode(array("status"=>0, "message"=>"DB Error:".$result->getMessage()));
}
}

View File

@ -400,8 +400,8 @@ class Schedule {
." SUM(clip_length) AS clip_length,"
." MIN(file_id) AS file_id, COUNT(*) as count,"
." MIN(playlist_id) AS playlist_id, MIN(starts) AS starts, MAX(ends) AS ends"
." FROM ".$CC_CONFIG["scheduleTable"]
." LEFT JOIN ".$CC_CONFIG["playListTable"]." ON playlist_id = ".$CC_CONFIG["playListTable"].".id"
." FROM $CC_CONFIG[scheduleTable]"
." LEFT JOIN $CC_CONFIG[playListTable] ON playlist_id = $CC_CONFIG[playListTable].id"
." WHERE (starts >= TIMESTAMP '$p_fromDateTime') AND (ends <= TIMESTAMP '$p_toDateTime')"
." GROUP BY group_id"
." ORDER BY starts";
@ -473,7 +473,7 @@ class Schedule {
public static function Get_Scheduled_Item_Data($timeStamp, $timePeriod=0, $count = 0, $interval="0 hours"){
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, show.name as show_name, st.instance_id"
$sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.media_item_played, st.group_id, show.name as show_name, st.instance_id"
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show"
." WHERE st.playlist_id = pt.id"
." AND st.file_id = ft.id"
@ -499,6 +499,14 @@ class Schedule {
return $rows;
}
public static function UpdateMediaPlayedStatus($id){
global $CC_CONFIG, $CC_DBC;
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
." SET media_item_played=TRUE"
." WHERE id=$id";
return $CC_DBC->query($sql);
}
/**
* Convert a time string in the format "YYYY-MM-DD HH:mm:SS"
@ -663,7 +671,8 @@ class Schedule {
$cueOut = Schedule::WallTimeToMillisecs($item["cue_out"]);
}
$medias[] = array(
'id' => $storedFile->getGunid(), //$item["file_id"],
'row_id' => $item["id"],
'id' => $storedFile->getGunid(),
'uri' => $uri,
'fade_in' => Schedule::WallTimeToMillisecs($item["fade_in"]),
'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),

View File

@ -52,7 +52,9 @@ function newSongStart(){
nextSongPrepare = true;
currentSong[0] = nextSongs.shift();
notifySongStart();
if (typeof notifySongStart == "function")
notifySongStart();
}
function nextShowStart(){
@ -60,7 +62,8 @@ function nextShowStart(){
currentShow[0] = nextShow.shift();
//call function in nowplayingdatagrid.js
notifyShowStart(currentShow[0]);
if (typeof notifyShowStart == "function")
notifyShowStart(currentShow[0]);
}
/* Called every "uiUpdateInterval" mseconds. */
@ -82,7 +85,10 @@ function updateProgressBarValue(){
songPercentDone = 0;
currentSong = new Array();
} else {
$('#on-air-info').attr("class", "on-air-info on");
if (currentSong[0].media_item_played == "t")
$('#on-air-info').attr("class", "on-air-info on");
else
$('#on-air-info').attr("class", "on-air-info off");
$('#progress-show').attr("class", "progress-show");
}
} else {

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,6 @@ qualname="process"
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
@ -41,7 +40,7 @@ args=("./debug.log",)
class=FileHandler
level=DEBUG
formatter=simpleFormatter
args=("/tmp/sessionlog_null.log",)
args=("/dev/null",)
[formatter_simpleFormatter]

View File

@ -383,8 +383,10 @@ class Playout:
fsize = 0
if fsize > 0:
pl_entry = 'annotate:export_source="%s",media_id="%s",liq_start_next="%s",liq_fade_in="%s",liq_fade_out="%s":%s' % \
(str(media['export_source']), media['id'], 0, str(float(media['fade_in']) / 1000), str(float(media['fade_out']) / 1000), dst)
pl_entry = \
'annotate:export_source="%s",media_id="%s",liq_start_next="%s",liq_fade_in="%s",liq_fade_out="%s",schedule_table_id="%s":%s'\
% (str(media['export_source']), media['id'], 0, str(float(media['fade_in']) / 1000), \
str(float(media['fade_out']) / 1000), media['row_id'],dst)
logger.debug(pl_entry)
@ -686,6 +688,14 @@ class Playout:
time.sleep(sleep_time)
tn = telnetlib.Telnet(LS_HOST, 1234)
# Get any extra information for liquidsoap (which will be sent back to us)
liquidsoap_data = self.api_client.get_liquidsoap_data(pkey, schedule)
logger.debug("Sending additional data to liquidsoap: "+str(liquidsoap_data["schedule_id"]))
#Sending JSON string. Example: {"schedule_id":"13"}
tn.write("vars.pypo_data %s\n"%(str(liquidsoap_data["schedule_id"])))
for line in pl_file.readlines():
line = line.strip()

View File

@ -80,7 +80,7 @@ class Notify:
logger.debug('#################################################')
logger.debug('data = '+ str(data))
response = self.api_client.notify_media_item_start_playing(data, media_id)
logger.debug("Response: "+str(response))
logger.debug("Response: "+json.dumps(response))
if __name__ == '__main__':

View File

@ -10,9 +10,10 @@ queue = audio_to_stereo(queue)
pypo_data = ref '0'
#def notify(m)
# print("./notify.sh --data='#{!pypo_data}' --media-id=#{m['media_id']}")
#end
def notify(m)
system("./notify.sh --data='#{!pypo_data}' --media-id=#{m['schedule_table_id']}")
print("./notify.sh --data='#{!pypo_data}' --media-id=#{m['schedule_table_id']}")
end
def crossfade(s)
s = fade.in(type="log", s)
@ -28,7 +29,7 @@ default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default)
s = fallback(track_sensitive=false, [queue, default])
#s = on_metadata(notify, s)
s = on_metadata(notify, s)
s = crossfade(s)
if output_sound_device then