From 3b6b0f8b693d3bc738bce762a21ba9b746fbaa7c Mon Sep 17 00:00:00 2001 From: localizer Date: Wed, 2 Jul 2014 12:02:12 +0000 Subject: [PATCH 1/2] updated translation resources --- airtime_mvc/locale/az/LC_MESSAGES/airtime.mo | Bin 474 -> 474 bytes airtime_mvc/locale/az/LC_MESSAGES/airtime.po | 2 +- .../locale/de_AT/LC_MESSAGES/airtime.mo | Bin 67790 -> 67790 bytes .../locale/de_AT/LC_MESSAGES/airtime.po | 2 +- .../locale/en_GB/LC_MESSAGES/airtime.mo | Bin 62402 -> 62402 bytes .../locale/en_GB/LC_MESSAGES/airtime.po | 2 +- airtime_mvc/locale/hy/LC_MESSAGES/airtime.mo | Bin 471 -> 471 bytes airtime_mvc/locale/hy/LC_MESSAGES/airtime.po | 2 +- airtime_mvc/locale/ka/LC_MESSAGES/airtime.mo | Bin 464 -> 464 bytes airtime_mvc/locale/ka/LC_MESSAGES/airtime.po | 2 +- .../locale/pt_BR/LC_MESSAGES/airtime.mo | Bin 61980 -> 61980 bytes .../locale/pt_BR/LC_MESSAGES/airtime.po | 2 +- 12 files changed, 6 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/locale/az/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/az/LC_MESSAGES/airtime.mo index 8b114640cc68cfaeaa0f8cca059e6102e078f74d..7ea37474f741b47dbc2f2a95243b8e46b4577666 100644 GIT binary patch delta 21 ccmcb`e2aO)S}t>410w}PBP#>LjoXzO0ZyU@asU7T delta 21 ccmcb`e2aO)S}rqPLlXr<6DtFQjoXzO0ZzdNbpQYW diff --git a/airtime_mvc/locale/az/LC_MESSAGES/airtime.po b/airtime_mvc/locale/az/LC_MESSAGES/airtime.po index b53dce118..f37138f82 100644 --- a/airtime_mvc/locale/az/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/az/LC_MESSAGES/airtime.po @@ -8,7 +8,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-06-14 14:00+0000\n" +"PO-Revision-Date: 2014-07-02 12:01+0000\n" "Last-Translator: Daniel James \n" "Language-Team: Azerbaijani (http://www.transifex.com/projects/p/airtime/language/az/)\n" "MIME-Version: 1.0\n" diff --git a/airtime_mvc/locale/de_AT/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/de_AT/LC_MESSAGES/airtime.mo index 26d7f134785282a60c6b5686806189c6d4c31483..221ba9b4e7708678d9c79460c4aba5d442382177 100644 GIT binary patch delta 24 gcmX>%k>%V(mJJiPx# delta 24 gcmX>%k>%V(mJJi\n" "Language-Team: German (Austria) (http://www.transifex.com/projects/p/airtime/language/de_AT/)\n" "MIME-Version: 1.0\n" diff --git a/airtime_mvc/locale/en_GB/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/en_GB/LC_MESSAGES/airtime.mo index 30f46f726ff3f5709b3ba9137741e6af0bfcb23e..a51c6018b8cbf9089948c6aad8caeaf535ce61fd 100644 GIT binary patch delta 24 gcmX@~ocYjm<_#0)aGL8H7%3PUSs84eHAf>H0D}|>S^xk5 delta 24 gcmX@~ocYjm<_#0)aGL2F87mkXSs8DhHAf>H0E0UTUjP6A diff --git a/airtime_mvc/locale/en_GB/LC_MESSAGES/airtime.po b/airtime_mvc/locale/en_GB/LC_MESSAGES/airtime.po index bdb700c7f..a826f1ce5 100644 --- a/airtime_mvc/locale/en_GB/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/en_GB/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-06-23 12:31+0000\n" +"PO-Revision-Date: 2014-07-02 12:01+0000\n" "Last-Translator: Andrey Podshivalov\n" "Language-Team: English (United Kingdom) (http://www.transifex.com/projects/p/airtime/language/en_GB/)\n" "MIME-Version: 1.0\n" diff --git a/airtime_mvc/locale/hy/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/hy/LC_MESSAGES/airtime.mo index 62c3ca8fac4fa6b1d729b3df25d5b7d838526509..001dae0b93df9ec9c20ab1d1f92b8219a3e0fb39 100644 GIT binary patch delta 19 acmcc4e4Tm1dJZE~1w&IS1H+Bm6&L|SGzJX- delta 19 acmcc4e4Tm1dJaPa1tTLX1A~p*6&L|R-39~z diff --git a/airtime_mvc/locale/hy/LC_MESSAGES/airtime.po b/airtime_mvc/locale/hy/LC_MESSAGES/airtime.po index efb388027..17f62d28c 100644 --- a/airtime_mvc/locale/hy/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/hy/LC_MESSAGES/airtime.po @@ -8,7 +8,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-06-10 22:00+0000\n" +"PO-Revision-Date: 2014-06-25 15:01+0000\n" "Last-Translator: Daniel James \n" "Language-Team: Armenian (http://www.transifex.com/projects/p/airtime/language/hy/)\n" "MIME-Version: 1.0\n" diff --git a/airtime_mvc/locale/ka/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/ka/LC_MESSAGES/airtime.mo index be7d0012ad0edcb76da366652cecb54ae4c0a811..baa86c18702be9a04dabaaf5fe786d72c678405b 100644 GIT binary patch delta 21 ccmcb>e1UnwS}t>410w}PBP#>LjoT#|0Zje|Q~&?~ delta 21 ccmcb>e1UnwS}rqP15*V\n" "Language-Team: Georgian (http://www.transifex.com/projects/p/airtime/language/ka/)\n" "MIME-Version: 1.0\n" diff --git a/airtime_mvc/locale/pt_BR/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/pt_BR/LC_MESSAGES/airtime.mo index 00735f424c766bd7fa9b908775549304bff0929e..32e0474d40d78963648ac22dce5c20301e2c9a44 100644 GIT binary patch delta 24 gcmbR9gn7;r<_#w%aGL8H7%3PUSs84;IKev+0Dsg8ivR!s delta 24 gcmbR9gn7;r<_#w%aGL2F87mkXSs8D>IKev+0Dt=lkN^Mx diff --git a/airtime_mvc/locale/pt_BR/LC_MESSAGES/airtime.po b/airtime_mvc/locale/pt_BR/LC_MESSAGES/airtime.po index f6c04739e..84929b0b1 100644 --- a/airtime_mvc/locale/pt_BR/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/pt_BR/LC_MESSAGES/airtime.po @@ -9,7 +9,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-06-23 12:31+0000\n" +"PO-Revision-Date: 2014-07-02 12:01+0000\n" "Last-Translator: Andrey Podshivalov\n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/airtime/language/pt_BR/)\n" "MIME-Version: 1.0\n" From 7438ecd2b418387cd62a56d1251b07842de3c765 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 15 Jul 2014 16:32:48 -0400 Subject: [PATCH 2/2] Use track metadata from Airtime in playout engine * Resolves CC-5893: Metadata not updated on Airtime Pro * Report track metadata in the schedule API, and make pypo pass that along to Liquidsoap via annotations. * Move HTTP response sanitization for file metadata out of the REST module and into CcFiles * Slightly improved the terrible exception handling in pypo --- airtime_mvc/application/models/Schedule.php | 5 ++- .../application/models/airtime/CcFiles.php | 24 ++++++++++++ .../rest/controllers/MediaController.php | 37 ++++--------------- .../generate_liquidsoap_cfg.py | 3 ++ python_apps/pypo/telnetliquidsoap.py | 34 ++++++++++++----- 5 files changed, 62 insertions(+), 41 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 2641094a3..2552bf07e 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -738,13 +738,16 @@ SQL; $replay_gain = is_null($item["replay_gain"]) ? "0": $item["replay_gain"]; $replay_gain += Application_Model_Preference::getReplayGainModifier(); - if ( !Application_Model_Preference::GetEnableReplayGain() ) { + if (!Application_Model_Preference::GetEnableReplayGain() ) { $replay_gain = 0; } + $fileMetadata = CcFiles::sanitizeResponse(CcFilesQuery::create()->findPk($media_id)); + $schedule_item = array( 'id' => $media_id, 'type' => 'file', + 'metadata' => $fileMetadata, 'row_id' => $item["id"], 'uri' => $uri, 'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]), diff --git a/airtime_mvc/application/models/airtime/CcFiles.php b/airtime_mvc/application/models/airtime/CcFiles.php index f49c9154a..93ef491a8 100644 --- a/airtime_mvc/application/models/airtime/CcFiles.php +++ b/airtime_mvc/application/models/airtime/CcFiles.php @@ -13,6 +13,14 @@ */ class CcFiles extends BaseCcFiles { + //fields we should never expose through our RESTful API + private static $privateFields = array( + 'file_exists', + 'silan_check', + 'is_scheduled', + 'is_playlist' + ); + public function getCueLength() { $cuein = $this->getDbCuein(); @@ -46,4 +54,20 @@ class CcFiles extends BaseCcFiles { $this->save(); } + /** + * + * Strips out the private fields we do not want to send back in API responses + * @param $file a CcFiles object + */ + //TODO: rename this function? + public static function sanitizeResponse($file) + { + $response = $file->toArray(BasePeer::TYPE_FIELDNAME); + + foreach (self::$privateFields as $key) { + unset($response[$key]); + } + + return $response; + } } // CcFiles diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index 1604d1262..f03b3b7b2 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -4,7 +4,7 @@ class Rest_MediaController extends Zend_Rest_Controller { //fields that are not modifiable via our RESTful API - private $blackList = array( + private static $blackList = array( 'id', 'directory', 'filepath', @@ -18,14 +18,6 @@ class Rest_MediaController extends Zend_Rest_Controller 'is_playlist' ); - //fields we should never expose through our RESTful API - private $privateFields = array( - 'file_exists', - 'silan_check', - 'is_scheduled', - 'is_playlist' - ); - public function init() { $this->view->layout()->disableLayout(); @@ -41,7 +33,7 @@ class Rest_MediaController extends Zend_Rest_Controller $files_array = array(); foreach (CcFilesQuery::create()->find() as $file) { - array_push($files_array, $this->sanitizeResponse($file)); + array_push($files_array, CcFiles::sanitizeResponse($file)); } $this->getResponse() @@ -134,7 +126,7 @@ class Rest_MediaController extends Zend_Rest_Controller $this->getResponse() ->setHttpResponseCode(200) - ->appendBody(json_encode($this->sanitizeResponse($file))); + ->appendBody(json_encode(CcFiles::sanitizeResponse($file))); } else { $this->fileNotFoundResponse(); } @@ -201,7 +193,7 @@ class Rest_MediaController extends Zend_Rest_Controller $this->getResponse() ->setHttpResponseCode(201) - ->appendBody(json_encode($this->sanitizeResponse($file))); + ->appendBody(json_encode(CcFiles::sanitizeResponse($file))); } } @@ -265,7 +257,7 @@ class Rest_MediaController extends Zend_Rest_Controller $this->getResponse() ->setHttpResponseCode(200) - ->appendBody(json_encode($this->sanitizeResponse($file))); + ->appendBody(json_encode(CcFiles::sanitizeResponse($file))); } else { $file->setDbImportStatus(2)->save(); $this->fileNotFoundResponse(); @@ -490,30 +482,15 @@ class Rest_MediaController extends Zend_Rest_Controller * from outside of Airtime * @param array $data */ - private function removeBlacklistedFieldsFromRequestData($data) + private static function removeBlacklistedFieldsFromRequestData($data) { - foreach ($this->blackList as $key) { + foreach (self::$blackList as $key) { unset($data[$key]); } return $data; } - /** - * - * Strips out the private fields we do not want to send back in API responses - */ - //TODO: rename this function? - public function sanitizeResponse($file) - { - $response = $file->toArray(BasePeer::TYPE_FIELDNAME); - - foreach ($this->privateFields as $key) { - unset($response[$key]); - } - - return $response; - } private function removeEmptySubFolders($path) { diff --git a/python_apps/pypo/liquidsoap_scripts/generate_liquidsoap_cfg.py b/python_apps/pypo/liquidsoap_scripts/generate_liquidsoap_cfg.py index e0160181b..45bdb46f4 100644 --- a/python_apps/pypo/liquidsoap_scripts/generate_liquidsoap_cfg.py +++ b/python_apps/pypo/liquidsoap_scripts/generate_liquidsoap_cfg.py @@ -44,5 +44,8 @@ while not successful: logging.error("traceback: %s", traceback.format_exc()) sys.exit(1) else: + logging.error(str(e)) + logging.error("traceback: %s", traceback.format_exc()) + logging.info("Retrying in 3 seconds...") time.sleep(3) attempts += 1 diff --git a/python_apps/pypo/telnetliquidsoap.py b/python_apps/pypo/telnetliquidsoap.py index 44d97a13f..2f572ff13 100644 --- a/python_apps/pypo/telnetliquidsoap.py +++ b/python_apps/pypo/telnetliquidsoap.py @@ -3,17 +3,31 @@ from timeout import ls_timeout def create_liquidsoap_annotation(media): # We need liq_start_next value in the annotate. That is the value that controls overlap duration of crossfade. - return ('annotate:media_id="%s",liq_start_next="0",liq_fade_in="%s",' + \ + + filename = media['dst'] + annotation = ('annotate:media_id="%s",liq_start_next="0",liq_fade_in="%s",' + \ 'liq_fade_out="%s",liq_cue_in="%s",liq_cue_out="%s",' + \ - 'schedule_table_id="%s",replay_gain="%s dB":%s') % \ - (media['id'], - float(media['fade_in']) / 1000, - float(media['fade_out']) / 1000, - float(media['cue_in']), - float(media['cue_out']), - media['row_id'], - media['replay_gain'], - media['dst']) + 'schedule_table_id="%s",replay_gain="%s dB"') % \ + (media['id'], + float(media['fade_in']) / 1000, + float(media['fade_out']) / 1000, + float(media['cue_in']), + float(media['cue_out']), + media['row_id'], + media['replay_gain']) + + # Override the the artist/title that Liquidsoap extracts from a file's metadata + # with the metadata we get from Airtime. (You can modify metadata in Airtime's library, + # which doesn't get saved back to the file.) + if 'metadata' in media: + if 'artist_name' in media['metadata']: + annotation += ',artist="%s"' % (media['metadata']['artist_name']) + if 'track_title' in media['metadata']: + annotation += ',title="%s"' % (media['metadata']['track_title']) + + annotation += ":" + filename + + return annotation class TelnetLiquidsoap: