diff --git a/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.mo index 833f4b180..f06c930fe 100644 Binary files a/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.mo and b/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.mo differ diff --git a/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.po b/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.po index 368321c48..cab178abf 100644 --- a/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.po @@ -11,7 +11,7 @@ msgstr "" "Project-Id-Version: Airtime\n" "Report-Msgid-Bugs-To: \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 \n" "Language-Team: German (Germany) (http://www.transifex.com/projects/p/airtime/language/de_DE/)\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 msgid "" "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 msgid "No result found" diff --git a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php index 0cb424778..8a7f54f1b 100644 --- a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php +++ b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php @@ -687,7 +687,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $ds->addTable('cc_show_hosts', 'select * from cc_show_hosts'); $this->assertDataSetsEqual( - $this->createXmlDataSet(dirname(__FILE__)."/datasets/test_createNoRepeatNoRRShow.xml"), + $this->createXmlDataSet(dirname(__FILE__)."/datasets/test_weeklyToNoRepeat.xml"), $ds ); } diff --git a/airtime_mvc/tests/application/services/database/datasets/test_weeklyToNoRepeat.xml b/airtime_mvc/tests/application/services/database/datasets/test_weeklyToNoRepeat.xml new file mode 100644 index 000000000..d1522d546 --- /dev/null +++ b/airtime_mvc/tests/application/services/database/datasets/test_weeklyToNoRepeat.xml @@ -0,0 +1,87 @@ + + + + id + name + url + genre + description + color + background_color + live_stream_using_airtime_auth + live_stream_using_custom_auth + live_stream_user + live_stream_pass + linked + is_linkable + + 1 + test show + + + + ffffff + 364492 + + + + + + 1 + +
+ + + id + first_show + last_show + start_time + timezone + duration + day + repeat_type + next_pop_date + show_id + record + + 2 + 2016-01-01 + + 00:00:00 + UTC + 01:00 + 5 + -1 + 2016-01-01 + 1 + 0 + +
+ + + id + starts + ends + show_id + record + rebroadcast + instance_id + modified_instance + + 1 + 2016-01-01 00:00:00 + 2016-01-01 01:00:00 + 1 + 0 + 0 + + + +
+ + +
+ + +
+
\ No newline at end of file diff --git a/airtime_mvc/tests/runtests.sh b/airtime_mvc/tests/runtests.sh index 31b8588dc..faf6628ef 100755 --- a/airtime_mvc/tests/runtests.sh +++ b/airtime_mvc/tests/runtests.sh @@ -27,5 +27,11 @@ export RABBITMQ_PASSWORD export RABBITMQ_VHOST 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 diff --git a/python_apps/pypo/pypoliquidsoap.py b/python_apps/pypo/pypoliquidsoap.py index 93647b3b6..74211fddd 100644 --- a/python_apps/pypo/pypoliquidsoap.py +++ b/python_apps/pypo/pypoliquidsoap.py @@ -117,76 +117,79 @@ class PypoLiquidsoap(): #independent_event: true #}, + try: + scheduled_now_files = \ + filter(lambda x: x["type"] == eventtypes.FILE, scheduled_now) - scheduled_now_files = \ - filter(lambda x: x["type"] == eventtypes.FILE, scheduled_now) + scheduled_now_webstream = \ + filter(lambda x: x["type"] == eventtypes.STREAM_OUTPUT_START, \ + scheduled_now) - scheduled_now_webstream = \ - filter(lambda x: x["type"] == eventtypes.STREAM_OUTPUT_START, \ - scheduled_now) + schedule_ids = set(map(lambda x: x["row_id"], scheduled_now_files)) - schedule_ids = set(map(lambda x: x["row_id"], scheduled_now_files)) - - 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 + row_id_map = {} + liq_queue_ids = set() 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 not self.is_media_item_finished(mi): + liq_queue_ids.add(mi["row_id"]) + row_id_map[mi["row_id"]] = mi - if to_be_added: - self.logger.info("Need to add items to Liquidsoap *now*: %s" % \ - to_be_added) + to_be_removed = set() + to_be_added = set() - for i in scheduled_now: - if i["row_id"] in to_be_added: - self.modify_cue_point(i) - self.play(i) + #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: + 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): self.telnet_liquidsoap.queue_remove(queue) @@ -200,8 +203,7 @@ class PypoLiquidsoap(): self.liq_queue_tracker[i] = None def modify_cue_point(self, link): - if not self.is_file(link): - return + assert self.is_file(link) tnow = datetime.utcnow() diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index 8a5600258..75079ca1f 100644 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -153,8 +153,10 @@ class PypoPush(Thread): self.telnet_lock.release() def run(self): - try: self.main() - except Exception, e: - top = traceback.format_exc() - self.logger.error('Pypo Push Exception: %s', top) + while True: + try: self.main() + except Exception, e: + top = traceback.format_exc() + self.logger.error('Pypo Push Exception: %s', top) + time.sleep(5)