From 458089a7732f635d3a545d5f76c442922bd0e46f Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 11 Sep 2012 11:19:44 -0400 Subject: [PATCH 1/4] cc-4359: Fixed without breaking anything else. Reverted bootrsrapping to default operation except for media monitor restart which uses a special bootstrap that respects file_exists settings. --- python_apps/media-monitor2/media/monitor/airtime.py | 9 ++++++--- python_apps/media-monitor2/mm2.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/airtime.py b/python_apps/media-monitor2/media/monitor/airtime.py index f6df354d4..1cd81b3dc 100644 --- a/python_apps/media-monitor2/media/monitor/airtime.py +++ b/python_apps/media-monitor2/media/monitor/airtime.py @@ -54,6 +54,8 @@ class AirtimeNotifier(Loggable): message.ack() self.logger.info("Received md from RabbitMQ: %s" % str(body)) m = json.loads(message.body) + # TODO : normalize any other keys that could be used to pass + # directories if 'directory' in m: m['directory'] = normpath(m['directory']) self.handler.message(m) @@ -121,7 +123,6 @@ class AirtimeMessageReceiver(Loggable): % md_path, e) def new_watch(self, msg, restart=False): - msg['directory'] = normpath(msg['directory']) self.logger.info("Creating watch for directory: '%s'" % msg['directory']) if not os.path.exists(msg['directory']): @@ -134,14 +135,14 @@ class AirtimeMessageReceiver(Loggable): msg['directory']) self.new_watch(msg) else: - self.__request_now_bootstrap( directory=msg['directory'], + self.__reFalsequest_now_bootstrap( directory=msg['directory'], all_files=restart) self.manager.add_watch_directory(msg['directory']) def remove_watch(self, msg): self.logger.info("Removing watch from directory: '%s'" % msg['directory']) - self.manager.remove_watch_directory(normpath(msg['directory'])) + self.manager.remove_watch_directory(msg['directory']) def rescan_watch(self, msg): self.logger.info("Trying to rescan watched directory: '%s'" % @@ -174,6 +175,8 @@ class AirtimeMessageReceiver(Loggable): Out of curiousity we will print some details.") self.logger.info(msg) return + # TODO : Add validation that we are deleting a file that's under our + # surveillance. We don't to delete some random system file. if os.path.exists(msg['filepath']): try: self.logger.info("Attempting to delete '%s'" % diff --git a/python_apps/media-monitor2/mm2.py b/python_apps/media-monitor2/mm2.py index a2f9bb7bd..17731cad8 100644 --- a/python_apps/media-monitor2/mm2.py +++ b/python_apps/media-monitor2/mm2.py @@ -113,7 +113,7 @@ def main(global_config, api_client_config, log_config, log.error("Could not create watch directory: '%s' \ (given from the database)." % watch_dir) if os.path.exists(watch_dir): - airtime_receiver.new_watch({ 'directory':watch_dir }) + airtime_receiver.new_watch({ 'directory':watch_dir }, restart=True) bs = Bootstrapper( db=sdb, watch_signal='watch' ) From 9b0e5a6b2fe9dc2a09cfc47719750e29e036f8ee Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 11 Sep 2012 11:53:36 -0400 Subject: [PATCH 2/4] removing unused file. --- .../application/models/airtime/Common.php | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 airtime_mvc/application/models/airtime/Common.php diff --git a/airtime_mvc/application/models/airtime/Common.php b/airtime_mvc/application/models/airtime/Common.php deleted file mode 100644 index 5845b2b29..000000000 --- a/airtime_mvc/application/models/airtime/Common.php +++ /dev/null @@ -1,19 +0,0 @@ -prepare($sql); - $stmt->bindValue(':f1', $time); - $stmt->bindValue(':p1', $row->getDbId()); - $stmt->execute(); - } -} From 8866a673d356853719a0b056d4aa678edd201349 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 11 Sep 2012 12:39:24 -0400 Subject: [PATCH 3/4] CC-4375: DB Upgrade Error, from 2.0.3 to 2.2 -fixed --- install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql index c2f8ba70b..4a86dc356 100644 --- a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql +++ b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql @@ -113,7 +113,7 @@ CREATE TABLE cc_webstream_metadata ( ALTER TABLE cc_files DROP COLUMN gunid, ADD COLUMN replay_gain character varying(16), - ADD COLUMN owner_id integer; + ADD COLUMN owner_id integer, ALTER COLUMN bpm TYPE integer using airtime_to_int(bpm) /* TYPE change - table: cc_files original: character varying(8) new: integer */; ALTER TABLE cc_playlistcontents From 63b1ead363cdc128eefdf064383485a79c4fda0c Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 11 Sep 2012 13:56:48 -0400 Subject: [PATCH 4/4] Undefined index error fixed by returning a default error if none is set in the database. --- airtime_mvc/application/models/Datatables.php | 5 ++--- airtime_mvc/application/models/Preference.php | 9 ++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/Datatables.php b/airtime_mvc/application/models/Datatables.php index a58a1fdb1..6560925de 100644 --- a/airtime_mvc/application/models/Datatables.php +++ b/airtime_mvc/application/models/Datatables.php @@ -73,13 +73,12 @@ class Application_Model_Datatables $orig2searchTerm[$index] = $d; } } - // map that maps current column position to original position - $current2orig = $librarySetting['ColReorder']; // map that maps dbname to searchTerm $dbname2searchTerm = array(); foreach ($current2dbname as $currentPos=>$dbname) { - $dbname2searchTerm[$dbname] = $orig2searchTerm[$current2orig[$currentPos]]; + $dbname2searchTerm[$dbname] = + $orig2searchTerm[$librarySetting($currentPos)]; } $where = array(); diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index d157bc9bf..44baf5575 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -1130,6 +1130,13 @@ class Application_Model_Preference public static function getCurrentLibraryTableSetting() { - return unserialize(self::getValue("library_datatable")); + $v = self::getValue("library_datatable"); + if( $v === '' ) { + return function ($x) { return $x; }; + } else { + $ds = unserialize($v); + return function ($x) use ($ds) { return $ds['ColReorder'][$x]; } ; + } + //return unserialize(self::getValue("library_datatable")); } }