Merge branch '2.5.x' of github.com:sourcefabric/Airtime into 2.5.x
This commit is contained in:
commit
d3f9492577
7 changed files with 168 additions and 71 deletions
Binary file not shown.
|
@ -11,7 +11,7 @@ msgstr ""
|
||||||
"Project-Id-Version: Airtime\n"
|
"Project-Id-Version: Airtime\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2013-12-13 12:58-0500\n"
|
"POT-Creation-Date: 2013-12-13 12:58-0500\n"
|
||||||
"PO-Revision-Date: 2014-02-12 10:53+0000\n"
|
"PO-Revision-Date: 2014-02-12 11:00+0000\n"
|
||||||
"Last-Translator: danielhjames <daniel@64studio.com>\n"
|
"Last-Translator: danielhjames <daniel@64studio.com>\n"
|
||||||
"Language-Team: German (Germany) (http://www.transifex.com/projects/p/airtime/language/de_DE/)\n"
|
"Language-Team: German (Germany) (http://www.transifex.com/projects/p/airtime/language/de_DE/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
|
@ -2211,7 +2211,7 @@ msgstr "Admin Benutzer und Passwort, wird zur Abfrage der Zuhörerdaten in Iceca
|
||||||
#: airtime_mvc/application/controllers/LocaleController.php:180
|
#: airtime_mvc/application/controllers/LocaleController.php:180
|
||||||
msgid ""
|
msgid ""
|
||||||
"Warning: You cannot change this field while the show is currently playing"
|
"Warning: You cannot change this field while the show is currently playing"
|
||||||
msgstr ""
|
msgstr "Warnung: Dieses Feld kann nicht geändert werden, während die Sendung wiedergegeben wird."
|
||||||
|
|
||||||
#: airtime_mvc/application/controllers/LocaleController.php:181
|
#: airtime_mvc/application/controllers/LocaleController.php:181
|
||||||
msgid "No result found"
|
msgid "No result found"
|
||||||
|
|
|
@ -687,7 +687,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
||||||
$ds->addTable('cc_show_hosts', 'select * from cc_show_hosts');
|
$ds->addTable('cc_show_hosts', 'select * from cc_show_hosts');
|
||||||
|
|
||||||
$this->assertDataSetsEqual(
|
$this->assertDataSetsEqual(
|
||||||
$this->createXmlDataSet(dirname(__FILE__)."/datasets/test_createNoRepeatNoRRShow.xml"),
|
$this->createXmlDataSet(dirname(__FILE__)."/datasets/test_weeklyToNoRepeat.xml"),
|
||||||
$ds
|
$ds
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<dataset>
|
||||||
|
<table name="cc_show">
|
||||||
|
<column>id</column>
|
||||||
|
<column>name</column>
|
||||||
|
<column>url</column>
|
||||||
|
<column>genre</column>
|
||||||
|
<column>description</column>
|
||||||
|
<column>color</column>
|
||||||
|
<column>background_color</column>
|
||||||
|
<column>live_stream_using_airtime_auth</column>
|
||||||
|
<column>live_stream_using_custom_auth</column>
|
||||||
|
<column>live_stream_user</column>
|
||||||
|
<column>live_stream_pass</column>
|
||||||
|
<column>linked</column>
|
||||||
|
<column>is_linkable</column>
|
||||||
|
<row>
|
||||||
|
<value>1</value>
|
||||||
|
<value>test show</value>
|
||||||
|
<null />
|
||||||
|
<null />
|
||||||
|
<null />
|
||||||
|
<value>ffffff</value>
|
||||||
|
<value>364492</value>
|
||||||
|
<value></value>
|
||||||
|
<value></value>
|
||||||
|
<null />
|
||||||
|
<null />
|
||||||
|
<value></value>
|
||||||
|
<value>1</value>
|
||||||
|
</row>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table name="cc_show_days">
|
||||||
|
<column>id</column>
|
||||||
|
<column>first_show</column>
|
||||||
|
<column>last_show</column>
|
||||||
|
<column>start_time</column>
|
||||||
|
<column>timezone</column>
|
||||||
|
<column>duration</column>
|
||||||
|
<column>day</column>
|
||||||
|
<column>repeat_type</column>
|
||||||
|
<column>next_pop_date</column>
|
||||||
|
<column>show_id</column>
|
||||||
|
<column>record</column>
|
||||||
|
<row>
|
||||||
|
<value>2</value>
|
||||||
|
<value>2016-01-01</value>
|
||||||
|
<null />
|
||||||
|
<value>00:00:00</value>
|
||||||
|
<value>UTC</value>
|
||||||
|
<value>01:00</value>
|
||||||
|
<value>5</value>
|
||||||
|
<value>-1</value>
|
||||||
|
<value>2016-01-01</value>
|
||||||
|
<value>1</value>
|
||||||
|
<value>0</value>
|
||||||
|
</row>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table name="cc_show_instances">
|
||||||
|
<column>id</column>
|
||||||
|
<column>starts</column>
|
||||||
|
<column>ends</column>
|
||||||
|
<column>show_id</column>
|
||||||
|
<column>record</column>
|
||||||
|
<column>rebroadcast</column>
|
||||||
|
<column>instance_id</column>
|
||||||
|
<column>modified_instance</column>
|
||||||
|
<row>
|
||||||
|
<value>1</value>
|
||||||
|
<value>2016-01-01 00:00:00</value>
|
||||||
|
<value>2016-01-01 01:00:00</value>
|
||||||
|
<value>1</value>
|
||||||
|
<value>0</value>
|
||||||
|
<value>0</value>
|
||||||
|
<null />
|
||||||
|
<value></value>
|
||||||
|
</row>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table name="cc_show_rebroadcast">
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table name="cc_show_hosts">
|
||||||
|
</table>
|
||||||
|
</dataset>
|
|
@ -27,5 +27,11 @@ export RABBITMQ_PASSWORD
|
||||||
export RABBITMQ_VHOST
|
export RABBITMQ_VHOST
|
||||||
|
|
||||||
export AIRTIME_UNIT_TEST="1"
|
export AIRTIME_UNIT_TEST="1"
|
||||||
|
|
||||||
|
#Change the working directory to this script's directory
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
#Run the unit tests
|
||||||
phpunit --log-junit test_results.xml
|
phpunit --log-junit test_results.xml
|
||||||
|
|
||||||
|
|
|
@ -117,76 +117,79 @@ class PypoLiquidsoap():
|
||||||
#independent_event: true
|
#independent_event: true
|
||||||
#},
|
#},
|
||||||
|
|
||||||
|
try:
|
||||||
|
scheduled_now_files = \
|
||||||
|
filter(lambda x: x["type"] == eventtypes.FILE, scheduled_now)
|
||||||
|
|
||||||
scheduled_now_files = \
|
scheduled_now_webstream = \
|
||||||
filter(lambda x: x["type"] == eventtypes.FILE, scheduled_now)
|
filter(lambda x: x["type"] == eventtypes.STREAM_OUTPUT_START, \
|
||||||
|
scheduled_now)
|
||||||
|
|
||||||
scheduled_now_webstream = \
|
schedule_ids = set(map(lambda x: x["row_id"], scheduled_now_files))
|
||||||
filter(lambda x: x["type"] == eventtypes.STREAM_OUTPUT_START, \
|
|
||||||
scheduled_now)
|
|
||||||
|
|
||||||
schedule_ids = set(map(lambda x: x["row_id"], scheduled_now_files))
|
row_id_map = {}
|
||||||
|
liq_queue_ids = set()
|
||||||
row_id_map = {}
|
|
||||||
liq_queue_ids = set()
|
|
||||||
for i in self.liq_queue_tracker:
|
|
||||||
mi = self.liq_queue_tracker[i]
|
|
||||||
if not self.is_media_item_finished(mi):
|
|
||||||
liq_queue_ids.add(mi["row_id"])
|
|
||||||
row_id_map[mi["row_id"]] = mi
|
|
||||||
|
|
||||||
to_be_removed = set()
|
|
||||||
to_be_added = set()
|
|
||||||
|
|
||||||
#Iterate over the new files, and compare them to currently scheduled
|
|
||||||
#tracks. If already in liquidsoap queue still need to make sure they don't
|
|
||||||
#have different attributes
|
|
||||||
#if replay gain changes, it shouldn't change the amplification of the currently playing song
|
|
||||||
for i in scheduled_now_files:
|
|
||||||
if i["row_id"] in row_id_map:
|
|
||||||
mi = row_id_map[i["row_id"]]
|
|
||||||
correct = mi['start'] == i['start'] and \
|
|
||||||
mi['end'] == i['end'] and \
|
|
||||||
mi['row_id'] == i['row_id']
|
|
||||||
|
|
||||||
if not correct:
|
|
||||||
#need to re-add
|
|
||||||
self.logger.info("Track %s found to have new attr." % i)
|
|
||||||
to_be_removed.add(i["row_id"])
|
|
||||||
to_be_added.add(i["row_id"])
|
|
||||||
|
|
||||||
|
|
||||||
to_be_removed.update(liq_queue_ids - schedule_ids)
|
|
||||||
to_be_added.update(schedule_ids - liq_queue_ids)
|
|
||||||
|
|
||||||
if to_be_removed:
|
|
||||||
self.logger.info("Need to remove items from Liquidsoap: %s" % \
|
|
||||||
to_be_removed)
|
|
||||||
|
|
||||||
#remove files from Liquidsoap's queue
|
|
||||||
for i in self.liq_queue_tracker:
|
for i in self.liq_queue_tracker:
|
||||||
mi = self.liq_queue_tracker[i]
|
mi = self.liq_queue_tracker[i]
|
||||||
if mi is not None and mi["row_id"] in to_be_removed:
|
if not self.is_media_item_finished(mi):
|
||||||
self.stop(i)
|
liq_queue_ids.add(mi["row_id"])
|
||||||
|
row_id_map[mi["row_id"]] = mi
|
||||||
|
|
||||||
if to_be_added:
|
to_be_removed = set()
|
||||||
self.logger.info("Need to add items to Liquidsoap *now*: %s" % \
|
to_be_added = set()
|
||||||
to_be_added)
|
|
||||||
|
|
||||||
for i in scheduled_now:
|
#Iterate over the new files, and compare them to currently scheduled
|
||||||
if i["row_id"] in to_be_added:
|
#tracks. If already in liquidsoap queue still need to make sure they don't
|
||||||
self.modify_cue_point(i)
|
#have different attributes
|
||||||
self.play(i)
|
#if replay gain changes, it shouldn't change the amplification of the currently playing song
|
||||||
|
for i in scheduled_now_files:
|
||||||
|
if i["row_id"] in row_id_map:
|
||||||
|
mi = row_id_map[i["row_id"]]
|
||||||
|
correct = mi['start'] == i['start'] and \
|
||||||
|
mi['end'] == i['end'] and \
|
||||||
|
mi['row_id'] == i['row_id']
|
||||||
|
|
||||||
|
if not correct:
|
||||||
|
#need to re-add
|
||||||
|
self.logger.info("Track %s found to have new attr." % i)
|
||||||
|
to_be_removed.add(i["row_id"])
|
||||||
|
to_be_added.add(i["row_id"])
|
||||||
|
|
||||||
|
|
||||||
|
to_be_removed.update(liq_queue_ids - schedule_ids)
|
||||||
|
to_be_added.update(schedule_ids - liq_queue_ids)
|
||||||
|
|
||||||
|
if to_be_removed:
|
||||||
|
self.logger.info("Need to remove items from Liquidsoap: %s" % \
|
||||||
|
to_be_removed)
|
||||||
|
|
||||||
|
#remove files from Liquidsoap's queue
|
||||||
|
for i in self.liq_queue_tracker:
|
||||||
|
mi = self.liq_queue_tracker[i]
|
||||||
|
if mi is not None and mi["row_id"] in to_be_removed:
|
||||||
|
self.stop(i)
|
||||||
|
|
||||||
|
if to_be_added:
|
||||||
|
self.logger.info("Need to add items to Liquidsoap *now*: %s" % \
|
||||||
|
to_be_added)
|
||||||
|
|
||||||
|
for i in scheduled_now_files:
|
||||||
|
if i["row_id"] in to_be_added:
|
||||||
|
self.modify_cue_point(i)
|
||||||
|
self.play(i)
|
||||||
|
|
||||||
|
#handle webstreams
|
||||||
|
current_stream_id = self.telnet_liquidsoap.get_current_stream_id()
|
||||||
|
if scheduled_now_webstream:
|
||||||
|
if int(current_stream_id) != int(scheduled_now_webstream[0]["row_id"]):
|
||||||
|
self.play(scheduled_now_webstream[0])
|
||||||
|
elif current_stream_id != "-1":
|
||||||
|
#something is playing and it shouldn't be.
|
||||||
|
self.telnet_liquidsoap.stop_web_stream_buffer()
|
||||||
|
self.telnet_liquidsoap.stop_web_stream_output()
|
||||||
|
except KeyError as e:
|
||||||
|
self.logger.error("Error: Malformed event in schedule. " + str(e))
|
||||||
|
|
||||||
#handle webstreams
|
|
||||||
current_stream_id = self.telnet_liquidsoap.get_current_stream_id()
|
|
||||||
if scheduled_now_webstream:
|
|
||||||
if int(current_stream_id) != int(scheduled_now_webstream[0]["row_id"]):
|
|
||||||
self.play(scheduled_now_webstream[0])
|
|
||||||
elif current_stream_id != "-1":
|
|
||||||
#something is playing and it shouldn't be.
|
|
||||||
self.telnet_liquidsoap.stop_web_stream_buffer()
|
|
||||||
self.telnet_liquidsoap.stop_web_stream_output()
|
|
||||||
|
|
||||||
def stop(self, queue):
|
def stop(self, queue):
|
||||||
self.telnet_liquidsoap.queue_remove(queue)
|
self.telnet_liquidsoap.queue_remove(queue)
|
||||||
|
@ -200,8 +203,7 @@ class PypoLiquidsoap():
|
||||||
self.liq_queue_tracker[i] = None
|
self.liq_queue_tracker[i] = None
|
||||||
|
|
||||||
def modify_cue_point(self, link):
|
def modify_cue_point(self, link):
|
||||||
if not self.is_file(link):
|
assert self.is_file(link)
|
||||||
return
|
|
||||||
|
|
||||||
tnow = datetime.utcnow()
|
tnow = datetime.utcnow()
|
||||||
|
|
||||||
|
|
|
@ -153,8 +153,10 @@ class PypoPush(Thread):
|
||||||
self.telnet_lock.release()
|
self.telnet_lock.release()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try: self.main()
|
while True:
|
||||||
except Exception, e:
|
try: self.main()
|
||||||
top = traceback.format_exc()
|
except Exception, e:
|
||||||
self.logger.error('Pypo Push Exception: %s', top)
|
top = traceback.format_exc()
|
||||||
|
self.logger.error('Pypo Push Exception: %s', top)
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue