Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x
This commit is contained in:
commit
47040a57dd
|
@ -41,7 +41,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
//Open a jPlayer window and play the audio clip.
|
//Open a jPlayer window and play the audio clip.
|
||||||
$menu["play"] = array("name"=> "Play", "icon" => "play");
|
$menu["play"] = array("name"=> "Preview", "icon" => "play");
|
||||||
|
|
||||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,10 @@ class Application_Model_StoredFile {
|
||||||
throw new DeleteScheduledFileException();
|
throw new DeleteScheduledFileException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($filepath)) {
|
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||||
|
$type = $music_dir->getType();
|
||||||
|
|
||||||
|
if (file_exists($filepath) && $type == "stor") {
|
||||||
$data = array("filepath" => $filepath, "delete" => 1);
|
$data = array("filepath" => $filepath, "delete" => 1);
|
||||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,6 +321,10 @@ class AirtimeInstall
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
// we need to run php as commandline because we want to get the timezone in cli php.ini file
|
// we need to run php as commandline because we want to get the timezone in cli php.ini file
|
||||||
$defaultTimezone = exec("php -r 'echo date_default_timezone_get().PHP_EOL;'");
|
$defaultTimezone = exec("php -r 'echo date_default_timezone_get().PHP_EOL;'");
|
||||||
|
$defaultTimezone = trim($defaultTimezone);
|
||||||
|
if((!in_array($defaultTimezone, DateTimeZone::listIdentifiers()))){
|
||||||
|
$defaultTimezone = "UTC";
|
||||||
|
}
|
||||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
|
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
|
||||||
$result = $con->exec($sql);
|
$result = $con->exec($sql);
|
||||||
if ($result < 1) {
|
if ($result < 1) {
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
Python part of radio playout (pypo)
|
Python part of radio playout (pypo)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
import time
|
||||||
import sys
|
import sys
|
||||||
import signal
|
import signal
|
||||||
import logging
|
import logging
|
||||||
|
@ -124,6 +126,12 @@ if __name__ == '__main__':
|
||||||
logger.info('# Liquidsoap Scheduled Playout System #')
|
logger.info('# Liquidsoap Scheduled Playout System #')
|
||||||
logger.info('###########################################')
|
logger.info('###########################################')
|
||||||
|
|
||||||
|
#Although all of our calculations are in UTC, it is useful to know what timezone
|
||||||
|
#the local machine is, so that we have a reference for what time the actual
|
||||||
|
#log entries were made
|
||||||
|
logger.info("Timezone: %s" % time.tzname)
|
||||||
|
logger.info("UTC time: %s" % datetime.utcnow())
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, keyboardInterruptHandler)
|
signal.signal(signal.SIGINT, keyboardInterruptHandler)
|
||||||
|
|
||||||
# initialize
|
# initialize
|
||||||
|
|
|
@ -9,6 +9,8 @@ import telnetlib
|
||||||
import copy
|
import copy
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
|
from Queue import Empty
|
||||||
|
|
||||||
from api_clients import api_client
|
from api_clients import api_client
|
||||||
from std_err_override import LogWriter
|
from std_err_override import LogWriter
|
||||||
|
|
||||||
|
@ -171,8 +173,8 @@ class PypoFetch(Thread):
|
||||||
self.logger.debug('Getting information needed on bootstrap from Airtime')
|
self.logger.debug('Getting information needed on bootstrap from Airtime')
|
||||||
info = self.api_client.get_bootstrap_info()
|
info = self.api_client.get_bootstrap_info()
|
||||||
if info == None:
|
if info == None:
|
||||||
self.logger.error('Unable to get bootstrap info.. Existing pypo...')
|
self.logger.error('Unable to get bootstrap info.. Exiting pypo...')
|
||||||
sys.exit(0)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
self.logger.debug('info:%s', info)
|
self.logger.debug('info:%s', info)
|
||||||
for k, v in info['switch_status'].iteritems():
|
for k, v in info['switch_status'].iteritems():
|
||||||
|
@ -427,6 +429,7 @@ class PypoFetch(Thread):
|
||||||
fileExt = os.path.splitext(media_item['uri'])[1]
|
fileExt = os.path.splitext(media_item['uri'])[1]
|
||||||
dst = os.path.join(download_dir, media_item['id'] + fileExt)
|
dst = os.path.join(download_dir, media_item['id'] + fileExt)
|
||||||
media_item['dst'] = dst
|
media_item['dst'] = dst
|
||||||
|
media_item['started_copying'] = False
|
||||||
media_filtered[key] = media_item
|
media_filtered[key] = media_item
|
||||||
|
|
||||||
self.media_prepare_queue.put(copy.copy(media_filtered))
|
self.media_prepare_queue.put(copy.copy(media_filtered))
|
||||||
|
@ -492,6 +495,8 @@ class PypoFetch(Thread):
|
||||||
|
|
||||||
message = self.fetch_queue.get(block=True, timeout=self.listener_timeout)
|
message = self.fetch_queue.get(block=True, timeout=self.listener_timeout)
|
||||||
self.handle_message(message)
|
self.handle_message(message)
|
||||||
|
except Empty, e:
|
||||||
|
self.logger.info("Queue timeout. Fetching schedule manually")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
import traceback
|
import traceback
|
||||||
top = traceback.format_exc()
|
top = traceback.format_exc()
|
||||||
|
|
|
@ -70,6 +70,9 @@ class PypoFile(Thread):
|
||||||
if do_copy:
|
if do_copy:
|
||||||
self.logger.debug("copying from %s to local cache %s" % (src, dst))
|
self.logger.debug("copying from %s to local cache %s" % (src, dst))
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
media_item['started_copying'] = True
|
||||||
|
|
||||||
"""
|
"""
|
||||||
copy will overwrite dst if it already exists
|
copy will overwrite dst if it already exists
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -80,8 +80,7 @@ class PypoPush(Thread):
|
||||||
self.modify_cue_point(current_event_chain[0])
|
self.modify_cue_point(current_event_chain[0])
|
||||||
next_media_item_chain = current_event_chain
|
next_media_item_chain = current_event_chain
|
||||||
time_until_next_play = 0
|
time_until_next_play = 0
|
||||||
#sleep for 0.2 seconds to give pypo-file time to copy. This is a quick
|
#sleep for 0.2 seconds to give pypo-file time to copy.
|
||||||
#fix that will be improved in 2.1.1
|
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
else:
|
else:
|
||||||
media_chain = filter(lambda item: (item["type"] == "file"), current_event_chain)
|
media_chain = filter(lambda item: (item["type"] == "file"), current_event_chain)
|
||||||
|
@ -313,7 +312,20 @@ class PypoPush(Thread):
|
||||||
try:
|
try:
|
||||||
for media_item in event_chain:
|
for media_item in event_chain:
|
||||||
if media_item['type'] == "file":
|
if media_item['type'] == "file":
|
||||||
self.telnet_to_liquidsoap(media_item)
|
|
||||||
|
"""
|
||||||
|
Wait maximum 5 seconds (50 iterations) for file to become ready, otherwise
|
||||||
|
give up on it.
|
||||||
|
"""
|
||||||
|
iter_num = 0
|
||||||
|
while not media_item['started_copying'] and iter_num < 50:
|
||||||
|
time.sleep(0.1)
|
||||||
|
iter_num += 1
|
||||||
|
|
||||||
|
if media_item['started_copying']:
|
||||||
|
self.telnet_to_liquidsoap(media_item)
|
||||||
|
else:
|
||||||
|
self.logger.warn("File %s did not become ready in less than 5 seconds. Skipping...", media_item['dst'])
|
||||||
elif media_item['type'] == "event":
|
elif media_item['type'] == "event":
|
||||||
if media_item['event_type'] == "kick_out":
|
if media_item['event_type'] == "kick_out":
|
||||||
PypoFetch.disconnect_source(self.logger, self.telnet_lock, "live_dj")
|
PypoFetch.disconnect_source(self.logger, self.telnet_lock, "live_dj")
|
||||||
|
|
Loading…
Reference in New Issue