From 83d79907f0b6c95b16e1f531e787c6c37c98caf7 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 5 Sep 2012 15:51:38 -0400 Subject: [PATCH 1/7] CC-4356: Improved method of detecting RabbitMQ PID -fixed --- utils/rabbitmq-update-pid.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/rabbitmq-update-pid.sh b/utils/rabbitmq-update-pid.sh index d5360b2fe..a756c0d1c 100755 --- a/utils/rabbitmq-update-pid.sh +++ b/utils/rabbitmq-update-pid.sh @@ -5,8 +5,7 @@ pid_found="$?" if [ "$pid_found" == "0" ]; then #PID is available in the status message - rabbitmqstatus=`/etc/init.d/rabbitmq-server status | grep "\[{pid"` - rabbitmqpid=`echo $rabbitmqstatus | sed "s/.*,\(.*\)\}.*/\1/"` + rabbitmqpid=`/etc/init.d/rabbitmq-server status | grep "\[{pid" | sed "s/.*,\(.*\)\}.*/\1/"` else #PID should be available from file rabbitmqpid=`sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids` From 27bd22f10c505d42ca745aee4020ee0f421cd1aa Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 5 Sep 2012 16:02:23 -0400 Subject: [PATCH 2/7] CC-4348: Prepared statements - part 4 -Syntax error --- airtime_mvc/application/models/Show.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index d9c6c834c..6f50a5823 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -2012,9 +2012,10 @@ SELECT si.starts AS start_timestamp, s.url, starts, ends -FROM cc_show_instances, - cc_show -WHERE si.show_id = s.id" +FROM cc_show_instances si + LEFT JOIN cc_show s + ON si.instance_id = s.id +WHERE si.show_id = s.id AND si.starts >= :timeStart::timestamp AND si.starts < :timeEnd::timestamp AND modified_instance != TRUE From 4fdf3c1b77349c8129c408483bac5623d61963ad Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 5 Sep 2012 16:04:11 -0400 Subject: [PATCH 3/7] MM2: Removed assertion in favor of warning. --- .../media-monitor2/media/monitor/eventcontractor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/eventcontractor.py b/python_apps/media-monitor2/media/monitor/eventcontractor.py index f9ff96dd7..ececfb846 100644 --- a/python_apps/media-monitor2/media/monitor/eventcontractor.py +++ b/python_apps/media-monitor2/media/monitor/eventcontractor.py @@ -48,8 +48,12 @@ class EventContractor(Loggable): # checked against the newest event 'evt' in this case self.unregister( old_e ) evt.add_safe_pack_hook( lambda : self.__unregister(evt) ) - assert evt.path not in self.store, \ - "Clean up should have been called by '%s'" % evt + + if evt.path in self.store: + self.logger.warn("Clean up should have been called by '%s'" % + str(evt)) + self.logger.warn("Overwriting event for '%s'" % evt.path) + self.store[ evt.path ] = evt return True # We actually added something, hence we return true. From 272840eb5a3d04aeeae05b296ba4b986e79e6817 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 5 Sep 2012 16:04:28 -0400 Subject: [PATCH 4/7] Added logging for liquidsoap run command. --- python_apps/media-monitor2/media/monitor/pure.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index 77a725941..3116fa3fd 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -477,10 +477,11 @@ def file_playable(pathname): #between them. We run the command as pypo because otherwise the target file #is opened with write permissions, and this causes an inotify ON_CLOSE_WRITE #event to be fired :/ - return True command = ("airtime-liquidsoap -c 'output.dummy" + \ "(audio_to_stereo(single(\"%s\")))' > /dev/null 2>&1") % \ pathname.replace("'", "'\\''") + print(command) + return True return_code = subprocess.call(command, shell=True) return (return_code == 0) From 0798d67b2dd852c9ca7ed7df63258e063c9ebbf2 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 5 Sep 2012 16:04:59 -0400 Subject: [PATCH 5/7] cc-4350: Possible fix. --- python_apps/media-monitor2/media/monitor/events.py | 6 +++--- python_apps/media-monitor2/media/monitor/metadata.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/events.py b/python_apps/media-monitor2/media/monitor/events.py index 660ff4c40..1941ea5b1 100644 --- a/python_apps/media-monitor2/media/monitor/events.py +++ b/python_apps/media-monitor2/media/monitor/events.py @@ -113,9 +113,9 @@ class BaseEvent(Loggable): self._raw_event = evt self.path = evt.path self.__class__ = evt.__class__ - # We don't transfer the _pack_hook over to the new event - # TODO : perhaps we should call the old events pack_hook just to make - # sure everything is done cleanly? + # Clean up old hook and transfer the new events hook + self.reset_hook() + self.add_safe_pack_hook( evt._pack_hook ) return self def assign_owner(self,req): diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index 7405d3b12..6f45ab8f1 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -172,6 +172,7 @@ class Metadata(Loggable): return # TODO : Simplify the way all of these rules are handled right not it's # extremely unclear and needs to be refactored. + if full_mutagen is None: full_mutagen = {} self.__metadata = Metadata.airtime_dict(full_mutagen) # Now we extra the special values that are calculated from the mutagen # object itself: From bc5cc9ff4801fa33a3a3d2caad7fb43201f34b14 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 5 Sep 2012 16:06:10 -0400 Subject: [PATCH 6/7] remove cartesian cross-product on some SQL queries --- airtime_mvc/application/models/Show.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 6f50a5823..9fcaee13e 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1833,7 +1833,8 @@ SELECT si.starts AS start_timestamp, starts, ends FROM cc_show_instances si, - cc_show s + LEFT JOIN cc_show s + ON si.instance_id = s.id WHERE si.show_id = s.id AND si.starts <= :timeNow1::timestamp AND si.ends > :timeNow2::timestamp @@ -1875,7 +1876,8 @@ SELECT si.starts AS start_timestamp, starts, ends FROM cc_show_instances si, - cc_show s + LEFT JOIN cc_show s + ON si.instance_id = s.id WHERE si.show_id = s.id AND si.starts > :timeNow1::timestamp - INTERVAL '2 days' AND si.ends < :timeNow2::timestamp + INTERVAL '2 days' From 8a5333fa7f86949821f5b7b1232f2cb399094676 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 5 Sep 2012 16:09:29 -0400 Subject: [PATCH 7/7] Removed supported for files that mutagen cannot read --- python_apps/media-monitor2/media/monitor/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index 6f45ab8f1..e2af483bd 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -172,7 +172,7 @@ class Metadata(Loggable): return # TODO : Simplify the way all of these rules are handled right not it's # extremely unclear and needs to be refactored. - if full_mutagen is None: full_mutagen = {} + if full_mutagen is None: raise BadSongFile(fpath) self.__metadata = Metadata.airtime_dict(full_mutagen) # Now we extra the special values that are calculated from the mutagen # object itself: