Merge branch 'master' of dev.sourcefabric.org:airtime

This commit is contained in:
Paul Baranowski 2011-03-11 14:14:38 -05:00
commit b807fbbbf4
26 changed files with 232 additions and 194 deletions

View File

@ -71,6 +71,7 @@
<actionMethod actionName="editShow"/>
<actionMethod actionName="addShow"/>
<actionMethod actionName="cancelShow"/>
<actionMethod actionName="cancelCurrentShow"/>
</controllerFile>
<controllerFile controllerName="Api">
<actionMethod actionName="index"/>
@ -335,6 +336,9 @@
<viewControllerScriptsDirectory forControllerName="Recorder">
<viewScriptFile forActionName="getShowSchedule"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Schedule">
<viewScriptFile forActionName="cancelCurrentShow"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>

View File

@ -23,7 +23,7 @@ require_once 'Users.php';
global $CC_CONFIG, $CC_DBC;
$dsn = $CC_CONFIG['dsn'];
$CC_DBC = DB::connect($dsn, TRUE);
$CC_DBC = DB::connect($dsn, FALSE);
if (PEAR::isError($CC_DBC)) {
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
exit(1);

View File

@ -153,6 +153,15 @@ class ScheduleController extends Zend_Controller_Action
}
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params, 'callback' => 'window["buildContentDialog"]'),
'title' => 'Show Content');
if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) &&
strtotime($today_timestamp) < strtotime($show->getShowEnd())) {
$menu[] = array('action' => array('type' => 'fn',
//'url' => '/Schedule/cancel-current-show'.$params,
'callback' => "window['confirmCancelShow']($id)"),
'title' => 'Cancel Current Show');
}
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
if ($user->isAdmin()) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance');
@ -392,6 +401,19 @@ class ScheduleController extends Zend_Controller_Action
$show->cancelShow($showInstance->getShowStart());
}
}
public function cancelCurrentShowAction()
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if($user->isAdmin()) {
$showInstanceId = $this->_getParam('id');
$show = new ShowInstance($showInstanceId);
$show->clearShow();
$show->deleteShow();
}
}
}

View File

@ -82,10 +82,11 @@ class Application_Model_Nowplaying
$type = "n";
}
$over = "";
if (strtotime($item['item_ends']) > strtotime($item['show_ends']))
$type = "over";
$over = "x";
array_push($data, array($type, $item["item_starts"], $item["item_starts"], $item["item_ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], $item["album_title"], $item["playlist_name"], $item["show_name"], $item["instance_id"]));
array_push($data, array($type, $item["item_starts"], $item["item_starts"], $item["item_ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], $item["album_title"], $item["playlist_name"], $item["show_name"], $over, $item["instance_id"]));
}
}

View File

@ -733,7 +733,8 @@ class Schedule {
}
$result = array();
$result['status'] = array('range' => array('start' => $range_start, 'end' => $range_end), 'version' => "1.1");
$result['status'] = array('range' => array('start' => $range_start, 'end' => $range_end),
'version' => "1.1");
$result['playlists'] = $playlists;
$result['check'] = 1;

View File

@ -737,7 +737,7 @@ class Show_DAL{
$date = $timestamp[0];
$time = $timestamp[1];
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id"
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record"
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
." WHERE si.show_id = s.id"
." AND si.starts <= TIMESTAMP '$timeNow'"

View File

@ -9,13 +9,17 @@
</div>
<div class="text-row next-song"><strong>Next:</strong> <span id='next'></span> <span id='next-length'></span></div>
</div>
<div class="show-block">
<div class="text-row">&nbsp;</div>
<div class="now-playing-info show"> <span id='playlist'></span> <span class="length" id="show-length"></span> </div>
<div class="progressbar">
<div class="progress-show" id='progress-show' style="width:0%;"></div>
<div class="show-block">
<div class="text-row">&nbsp;</div>
<div class="now-playing-info show">
<div class="recording-show" style="display: none;"></div>
<span id="playlist"></span>
<span class="lenght">00:00</span>
</div>
<div class="progressbar">
<div class="progress-show" id='progress-show' style="width:0%;"></div>
</div>
</div>
</div>
<div class="on-air-block">
<div class="on-air-info off" id="on-air-info">ON AIR</div>
</div>

View File

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>cancelCurrentShow</b></center>

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://doctrine-project.org/schemas/migrations/configuration
http://doctrine-project.org/schemas/migrations/configuration.xsd">
<name>Doctrine Sandbox Migrations</name>
<name>Airtime 1.7 Database Upgrade</name>
<migrations-namespace>DoctrineMigrations</migrations-namespace>

View File

@ -41,6 +41,7 @@ installPostgresScriptingLanguage();
echo "* Creating Database Tables".PHP_EOL;
createAirtimeDatabaseTables();
doctrineMigrateTables(__DIR__);
echo "* Storage Directory Setup".PHP_EOL;
storageDirectorySetup($CC_CONFIG);

View File

@ -22,15 +22,6 @@ checkIfRoot();
echo "******************************* Uninstall Begin ********************************".PHP_EOL;
function airtime_uninstall_delete_files($p_path)
{
$command = "rm -rf $p_path";
exec($command);
}
//------------------------------------------------------------------------
// Delete the database
// Note: Do not put a call to airtime_db_connect()
@ -48,142 +39,26 @@ $command = "sudo -u postgres dropdb {$CC_CONFIG['dsn']['database']} 2> /dev/null
if ($dbDeleteFailed) {
echo " * Couldn't delete the database, so deleting all the DB tables...".PHP_EOL;
airtime_db_connect(true);
if (!PEAR::isError($CC_DBC)) {
if (airtime_db_table_exists($CC_CONFIG['prefTable'])) {
echo " * Removing database table ".$CC_CONFIG['prefTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['prefTable'];
airtime_install_query($sql, false);
$CC_DBC->dropSequence($CC_CONFIG['prefTable']."_id");
if (!PEAR::isError($CC_DBC)) {
$sql = "select * from pg_tables where tableowner = 'airtime'";
$rows = airtime_get_query($sql);
foreach ($rows as $row){
$tablename = $row["tablename"];
echo " * Removing database table $tablename...";
if (airtime_db_table_exists($tablename)){
$sql = "DROP TABLE $tablename CASCADE";
airtime_install_query($sql, false);
$CC_DBC->dropSequence($tablename."_id");
}
echo "done.".PHP_EOL;
} else {
echo " * Skipping: database table $CC_CONFIG[prefTable]".PHP_EOL;
}
}
if (airtime_db_table_exists($CC_CONFIG['transTable'])) {
echo " * Removing database table ".$CC_CONFIG['transTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['transTable'];
airtime_install_query($sql, false);
$CC_DBC->dropSequence($CC_CONFIG['transTable']."_id");
echo "done.".PHP_EOL;
} else {
echo " * Skipping: database table $CC_CONFIG[transTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['filesTable'])) {
echo " * Removing database table ".$CC_CONFIG['filesTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['filesTable']." CASCADE";
airtime_install_query($sql);
$CC_DBC->dropSequence($CC_CONFIG['filesTable']."_id");
} else {
echo " * Skipping: database table $CC_CONFIG[filesTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['playListTable'])) {
echo " * Removing database table ".$CC_CONFIG['playListTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['playListTable']." CASCADE";
airtime_install_query($sql);
$CC_DBC->dropSequence($CC_CONFIG['playListTable']."_id");
} else {
echo " * Skipping: database table $CC_CONFIG[playListTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['playListContentsTable'])) {
echo " * Removing database table ".$CC_CONFIG['playListContentsTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['playListContentsTable'];
airtime_install_query($sql);
$CC_DBC->dropSequence($CC_CONFIG['playListContentsTable']."_id");
} else {
echo " * Skipping: database table $CC_CONFIG[playListContentsTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['accessTable'])) {
echo " * Removing database table ".$CC_CONFIG['accessTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['accessTable'];
airtime_install_query($sql);
} else {
echo " * Skipping: database table $CC_CONFIG[accessTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['permTable'])) {
echo " * Removing database table ".$CC_CONFIG['permTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['permTable'];
airtime_install_query($sql, false);
$CC_DBC->dropSequence($CC_CONFIG['permTable']."_id");
echo "done.".PHP_EOL;
} else {
echo " * Skipping: database table $CC_CONFIG[permTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['sessTable'])) {
echo " * Removing database table ".$CC_CONFIG['sessTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['sessTable'];
airtime_install_query($sql);
} else {
echo " * Skipping: database table $CC_CONFIG[sessTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['subjTable'])) {
echo " * Removing database table ".$CC_CONFIG['subjTable']."...";
$CC_DBC->dropSequence($CC_CONFIG['subjTable']."_id");
$sql = "DROP TABLE ".$CC_CONFIG['subjTable']." CASCADE";
airtime_install_query($sql, false);
echo "done.".PHP_EOL;
} else {
echo " * Skipping: database table $CC_CONFIG[subjTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['smembTable'])) {
echo " * Removing database table ".$CC_CONFIG['smembTable']."...";
$sql = "DROP TABLE ".$CC_CONFIG['smembTable'];
airtime_install_query($sql, false);
$CC_DBC->dropSequence($CC_CONFIG['smembTable']."_id");
echo "done.".PHP_EOL;
} else {
echo " * Skipping: database table $CC_CONFIG[smembTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['scheduleTable'])) {
echo " * Removing database table ".$CC_CONFIG['scheduleTable']."...";
airtime_install_query("DROP TABLE ".$CC_CONFIG['scheduleTable']);
} else {
echo " * Skipping: database table $CC_CONFIG[scheduleTable]".PHP_EOL;
}
if (airtime_db_table_exists($CC_CONFIG['backupTable'])) {
echo " * Removing database table ".$CC_CONFIG['backupTable']."...";
airtime_install_query("DROP TABLE ".$CC_CONFIG['backupTable']);
} else {
echo " * Skipping: database table $CC_CONFIG[backupTable]".PHP_EOL;
}
}
//Delete Database
//system("dropdb -h localhost -U airtime -W airtime");
//select * from pg_stat_activity where datname='airtime';
/*
$rows = airtime_get_query("select procpid from pg_stat_activity where datname='airtime'");
$rowsCount = count($rows);
for ($i=0; $i<$rowsCount; $i++){
$command = "kill -2 {$rows[$i]['procpid']}";
echo $command.PHP_EOL;
system($command);
}
echo "still here!";
system("dropdb -h localhost -U airtime -W airtime");
exit;
*/
//------------------------------------------------------------------------
// Delete the user
//------------------------------------------------------------------------

View File

@ -188,3 +188,9 @@ function doctrineMigrateTables($dir){
$command = "php $dir/../library/doctrine/migrations/doctrine-migrations.phar --configuration=$dir/DoctrineMigrations/migrations.xml --db-configuration=$dir/../library/doctrine/migrations/migrations-db.php --no-interaction migrations:migrate";
system($command);
}
function airtime_uninstall_delete_files($p_path)
{
$command = "rm -rf $p_path";
exec($command);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -142,6 +142,9 @@ select {
color:#969696;
padding-right:12px;
}
.text-row.rebroadcast, #master-panel .text-row.rebroadcast {
color:#969696;
}
.now-playing-info {
height:25px;
background:#3a3a3a url(images/playinfo_bg.png) repeat-x 0 0;
@ -157,10 +160,6 @@ select {
overflow:hidden;
margin-bottom:3px;
}
.now-playing-info .time-flow {
float:right;
margin-right:6px;
}
.time-elapsed {
color:#9b9b9b;
padding-right:6px;
@ -443,7 +442,7 @@ dl.inline-list dd {
.datatable tr.odd.selected td {
background-color: #c5deeb;
}
.datatable tr:hover td {
.datatable tr.odd:hover td, .datatable tr.even:hover td {
background-color: #95d5f7 !important;
}
@ -1198,10 +1197,12 @@ button, input {
height:25px;
margin-right:6px
}
.button-bar-top .input_text.hasDatepicker {
.button-bar-top .input_text.hasDatepicker, .input_text.hasDatepicker {
background:url(images/input_with_calendar_bg.png) no-repeat right 0;
}
.input_text.hasTimepicker {
background:url(images/input_with_time_bg.png) no-repeat right 0;
}
ul.errors {
display:block;
clear:left;
@ -1298,8 +1299,8 @@ ul.errors li {
}
/*---//////////////////// NOW PLAYING COLORS ////////////////////---*/
.playing-song {
background-color:#ff753c;
.playing-song, .datatable tr.playing-song:hover td {
background-color:#ff753c !important;
}
.playing-list {
background-color:#b0dcf2;
@ -1307,9 +1308,15 @@ ul.errors li {
.odd.playing-list {
background-color:#bfe5f8;
}
.gap {
background-color:#da5454;
.gap, .datatable tr.gap:hover td {
background-color:#da5454 !important;
}
.group, tr td.group {
background-color:#0aa2be;
color:#FFF;
}
/*---//////////////////// END NOW PLAYING COLORS ////////////////////---*/
.icon-link, .ui-widget-content a.icon-link {
color: #646464;
@ -1412,4 +1419,62 @@ ul.errors li {
}
.gray-logo {
margin:5px 0 0 20px;
}
}
.formrow-repeat {
list-style-type:none;
margin:0;
padding:0;
}
.formrow-repeat li {
list-style-type:none;
margin:0 0 7px 0;
padding:0;
height:26px;
display:block;
}
.formrow-repeat li .ui-button-icon-only {
width:1.8em;
}
.formrow-repeat li .ui-button-icon-only .ui-button-text, .formrow-repeat li .ui-button-icons-only .ui-button-text {
padding: 3px 3px 4px;
}
.formrow-repeat li .ui-button-icon-only .ui-icon {
left: 48%;
margin-top: -9px;
position: absolute;
top: 50%;
}
.formrow-repeat li .ui-button .ui-button-text {
display: block;
line-height: 110%;
}
.formrow-repeat li .inline-text {
color: #666666;
padding: 0 6px 0 0;
}
.formrow-repeat li .input_text, .formrow-repeat li .input_select {
margin-right:6px;
}
.formrow-repeat li .hasDatepicker, .formrow-repeat li .input_select {
width:160px;
}
.formrow-repeat li .hasTimepicker {
width:80px;
}
.recording-show {
float: right;
background:url(images/record_icon.png) no-repeat 0 0;
width:23px;
height:23px;
}
.datatable td .info-icon {
margin:-4px 3px -3px 0;
float:right;
}
.time-flow {
float:right;
margin-right:4px;
}

View File

@ -155,6 +155,16 @@ function makeScheduleDialog(dialog, json) {
setScheduleDialogEvents(dialog);
}
function confirmCancelShow(show_instance_id){
if(confirm('Erase current show and stop playback?')){
var url = "/Schedule/cancel-current-show/id/"+show_instance_id;
$.ajax({
url: url,
success: function(data){scheduleRefetchEvents();}
});
}
}
function buildContentDialog(json){
var dialog = $(json.dialog);

View File

@ -50,6 +50,14 @@ function notifyShowStart(show){
updateDataTable();
}
function statusColumn(obj) {
var sReturn = obj.aData[ obj.iDataColumn ];
if ( sReturn == "x" ) {
sReturn = '<img class="info-icon" src="/css/images/icon_overlap.png" width="51" height="15" alt="" />';
}
return sReturn;
}
var columns = [{"sTitle": "type", "bVisible":false},
{"sTitle":"Date"},
{"sTitle":"Start"},
@ -60,6 +68,7 @@ var columns = [{"sTitle": "type", "bVisible":false},
{"sTitle":"Album"},
{"sTitle":"Playlist"},
{"sTitle":"Show"},
{"sTitle":"Status", "fnRender":statusColumn},
{"sTitle":"instance_id", "bVisible":false}];
function getDateString(){

View File

@ -165,9 +165,13 @@ function updatePlaybar(){
/* Column 1 update */
$('#playlist').text("Current Show:");
if (currentShow.length > 0)
if (currentShow.length > 0){
$('#playlist').text(currentShow[0].name);
var recElem = $('.recording-show');
currentShow[0].record ? recElem.show(): recElem.hide();
}
$('#show-length').empty();
if (currentShow.length > 0){
$('#show-length').text(convertDateToHHMM(currentShow[0].showStartPosixTime) + " - " + convertDateToHHMM(currentShow[0].showEndPosixTime));

View File

@ -115,7 +115,6 @@ class AirTimeApiClient(ApiClientInterface):
url = url.replace("%%api_key%%", self.config["api_key"])
try:
logger.debug("Trying to contact %s", url)
response = urllib.urlopen(url)
data = response.read()
logger.debug("Data: %s", data)
@ -278,7 +277,7 @@ class AirTimeApiClient(ApiClientInterface):
logger.info("API-Message %s", response['message'])
except Exception, e:
logger.critical("Unable to connect - %s", e)
logger.error("Unable to connect - %s", e)
return response
@ -304,7 +303,7 @@ class AirTimeApiClient(ApiClientInterface):
logger.info("API-Message %s", response['message'])
except Exception, e:
logger.critical("Exception: %s", e)
logger.error("Exception: %s", e)
return response
@ -475,7 +474,7 @@ class ObpApiClient():
except Exception, e:
print e
api_status = False
logger.critical("Unable to connect to the OBP API - %s", e)
logger.error("Unable to connect to the OBP API - %s", e)
return response
@ -510,7 +509,7 @@ class ObpApiClient():
except Exception, e:
print e
api_status = False
logger.critical("Unable to connect to the OBP API - %s", e)
logger.error("Unable to connect to the OBP API - %s", e)
return response
@ -530,7 +529,7 @@ class ObpApiClient():
except Exception, e:
print e
api_status = False
logger.critical("Unable to handle the OBP API request - %s", e)
logger.error("Unable to handle the OBP API request - %s", e)
return response

View File

@ -42,7 +42,7 @@ cache_for = 24 #how long to hold the cache, in hours
# the time you expect to "lock-in" your schedule. So if your schedule is set
# 24 hours in advance, this can be set to poll every 12 hours.
#
poll_interval = 30 # in seconds.
poll_interval = 5 # in seconds.
# Push interval in seconds.
@ -52,7 +52,7 @@ poll_interval = 30 # in seconds.
#
# It's hard to imagine a situation where this should be more than 1 second.
#
push_interval = 1 # in seconds
push_interval = 2 # in seconds
# 'pre' or 'otf'. 'pre' cues while playlist preparation
# while 'otf' (on the fly) cues while loading into ls

View File

@ -15,7 +15,7 @@ def remove_path(path):
os.system("rm -rf " + path)
def remove_user(username):
os.system("killall -u " + username)
os.system("killall -u %s 2>&1 1>/dev/null" % username)
#allow all process to be completely closed before we attempt to delete user
print "Waiting for processes to close..."

View File

@ -67,8 +67,7 @@ logging.config.fileConfig("logging.cfg")
try:
config = ConfigObj('config.cfg')
POLL_INTERVAL = float(config['poll_interval'])
PUSH_INTERVAL = 0.5
#PUSH_INTERVAL = float(config['push_interval'])
PUSH_INTERVAL = float(config['push_interval'])
LS_HOST = config['ls_host']
LS_PORT = config['ls_port']
except Exception, e:

View File

@ -91,14 +91,15 @@ class PypoFetch:
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
#encode in latin-1 due to this bug: http://bugs.python.org/issue1772794
#encode in latin-1 due to telnet protocol not supporting utf-8
tn.write(('vars.stream_metadata_type %s\n' % stream_metadata['format']).encode('latin-1'))
tn.write(('vars.station_name %s\n' % stream_metadata['station_name']).encode('latin-1'))
tn.write('exit\n')
logger.debug(tn.read_all())
except Exception, e:
logger.critical("Exception %s", e)
logger.error("Exception %s", e)
status = 0
return status

View File

@ -36,8 +36,8 @@ class PypoPush:
gives the number of seconds of the window of opportunity for the scheduler
to catch when a playlist is to be played.
"""
self.push_ahead = 15
self.push_ahead2 = 10
self.push_ahead = 10
self.push_ahead2 = self.push_ahead -5
def set_export_source(self, export_source):
self.export_source = export_source
@ -59,23 +59,30 @@ class PypoPush:
tcoming = time.localtime(time.time() + self.push_ahead)
tcoming2 = time.localtime(time.time() + self.push_ahead2)
tnow = time.localtime(time.time())
str_tcoming_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming[0], tcoming[1], tcoming[2], tcoming[3], tcoming[4], tcoming[5])
str_tcoming2_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming2[0], tcoming2[1], tcoming2[2], tcoming2[3], tcoming2[4], tcoming2[5])
currently_on_air = False
if self.schedule == None:
logger.warn('Unable to loop schedule - maybe write in progress?')
logger.warn('Will try again in next loop.')
else:
for pkey in self.schedule:
plstart = pkey[0:19]
start = self.schedule[pkey]['start']
end = self.schedule[pkey]['end']
playedFlag = (pkey in playedItems) and playedItems[pkey].get("played", 0)
if pkey[0:19] == str_tcoming_s or (pkey[0:19] < str_tcoming_s and pkey[0:19] > str_tcoming2_s and not playedFlag):
if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s and not playedFlag):
logger.debug('Preparing to push playlist scheduled at: %s', pkey)
playlist = self.schedule[pkey]
ptype = playlist['subtype']
currently_on_air = True
# We have a match, replace the current playlist and
# force liquidsoap to refresh.
@ -95,6 +102,23 @@ class PypoPush:
logger.debug("Doing callback to server to update 'played' status.")
self.api_client.notify_scheduled_item_start_playing(pkey, self.schedule)
if self.schedule != None:
tnow = time.localtime(time.time())
str_tnow_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tnow[0], tnow[1], tnow[2], tnow[3], tnow[4], tnow[5])
for pkey in self.schedule:
start = self.schedule[pkey]['start']
end = self.schedule[pkey]['end']
if start <= str_tnow_s and str_tnow_s < end:
currently_on_air = True
if not currently_on_air:
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
tn.write('source.skip\n'.encode('latin-1'))
tn.write('exit\n')
tn.read_all()
#logger.info('source.skip')
#logger.debug(tn.read_all())
def push_liquidsoap(self, pkey, schedule, ptype):
logger = logging.getLogger()

View File

@ -42,8 +42,19 @@ end
def add_skip_command(s)
# A command to skip
def skip(_)
source.skip(s)
"Done!"
# get playing (active) queue and flush it
l = list.hd(server.execute("queue.secondary_queue"))
l = string.split(separator=" ",l)
list.iter(fun (rid) -> ignore(server.execute("queue.ignore #{rid}")), l)
l = list.hd(server.execute("queue.primary_queue"))
l = string.split(separator=" ", l)
if list.length(l) > 0 then
source.skip(s)
"Skipped"
else
"Not skipped"
end
end
# Register the command:
server.register(namespace="source",

View File

@ -4,8 +4,9 @@
set("log.file.path", log_file)
set("log.stdout", true)
set("server.telnet", true)
set("server.telnet.port", 1234)
queue = request.queue(id="queue", conservative=true)
queue = request.queue(id="queue", length=0.5)
queue = audio_to_stereo(queue)
pypo_data = ref '0'
@ -31,22 +32,22 @@ s = fallback(track_sensitive=false, [queue, default])
s = on_metadata(notify, s)
s = crossfade(s)
# Attach a skip command to the source s:
add_skip_command(s)
web_stream_source = input.http(id="web_stream", autostart = false, buffer=0.5, max=20., "")
#web_stream_source = input.http(id="web_stream", autostart = false, buffer=0.5, max=20., "")
#once the stream is started, give it a sink so that liquidsoap doesn't
#create buffer overflow warnings in the log file.
output.dummy(fallible=true, web_stream_source)
#output.dummy(fallible=true, web_stream_source)
s = switch(track_sensitive = false,
transitions=[to_live,to_live],
[
({ !web_stream_enabled }, web_stream_source),
({ true }, s)
]
)
#s = switch(track_sensitive = false,
# transitions=[to_live,to_live],
# [
# ({ !web_stream_enabled }, web_stream_source),
# ({ true }, s)
# ]
#)
add_skip_command(s)
s = map_metadata(append_title, s)