From ce1a63f47d30d96c24d96f62d88a074eac056a48 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Sun, 15 Jul 2012 22:55:52 -0400 Subject: [PATCH] CC-430: Audio normalization (Replaygain Support) -small bug fixes --- .../application/controllers/ApiController.php | 1 + .../media/update/replaygainupdater.py | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 6ef4f963a..80feeba3e 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -976,6 +976,7 @@ class ApiController extends Zend_Controller_Action $file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm(); Logging::log("Setting $gain for file id $id"); $file->setDbReplayGain($gain); + $file->save(); } } } diff --git a/python_apps/media-monitor2/media/update/replaygainupdater.py b/python_apps/media-monitor2/media/update/replaygainupdater.py index de8a63e20..f144502ed 100644 --- a/python_apps/media-monitor2/media/update/replaygainupdater.py +++ b/python_apps/media-monitor2/media/update/replaygainupdater.py @@ -42,21 +42,17 @@ class ReplayGainUpdater(Thread): # return a list of pairs where the first value is the file's database row id # and the second value is the filepath files = self.api_client.get_files_without_replay_gain_value(dir_id) - self.logger.debug(files) for f in files: full_path = os.path.join(dir_path, f['fp']) processed_data.append((f['id'], replaygain.calculate_replay_gain(full_path))) - #finished = (len(files) == 0) - finished = True + self.api_client.update_replay_gain_values(processed_data) + finished = (len(files) == 0) - #send data here - self.api_client.update_replay_gain_values(processed_data) - print processed_data except Exception, e: - print e - print traceback.format_exc() + self.logger.error(e) + self.logger.debug(traceback.format_exc()) def run(self): try: self.main() except Exception, e: @@ -66,7 +62,7 @@ class ReplayGainUpdater(Thread): if __name__ == "__main__": try: rgu = ReplayGainUpdater(logging) - print rgu.main() + rgu.main() except Exception, e: print e print traceback.format_exc()