From 61e38381afb43b969b738626dc9d0703f9cc88a7 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 8 Aug 2012 11:46:48 -0400 Subject: [PATCH 1/5] CC-4176: Smart Playlist: Set implicit item limit when user uses time as a limit - done --- airtime_mvc/application/models/Block.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 5ff84a3d1..05459ee04 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -1211,6 +1211,7 @@ EOT; $insertList = array(); $totalTime = 0; + $totalItems = 0; // this moves the pointer to the first element in the collection $files->getFirst(); @@ -1220,7 +1221,9 @@ EOT; $length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength()); $insertList[$id] = $length; $totalTime += $length; - if ( !is_null($limit['items']) && $limit['items'] == count($insertList)) { + $totalItems++; + + if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500) { break; } From 762b8e1e46c562afbd2e1c5418c53eeef85c082d Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 8 Aug 2012 11:48:50 -0400 Subject: [PATCH 2/5] CC-4173: ReplayGain calculation fails on Ubuntu Lucid amd64 -added logging to see what exception could be -incorrectly using temp_file_path instead of original file_path to find extension --- .../airtimefilemonitor/replaygain.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/python_apps/media-monitor/airtimefilemonitor/replaygain.py b/python_apps/media-monitor/airtimefilemonitor/replaygain.py index bcb9cf6a7..e10b7a3f2 100644 --- a/python_apps/media-monitor/airtimefilemonitor/replaygain.py +++ b/python_apps/media-monitor/airtimefilemonitor/replaygain.py @@ -4,11 +4,16 @@ import os import sys import shutil import tempfile +import logging + + +logger = logging.getLogger() def get_process_output(command): """ Run subprocess and return stdout """ + logger.debug(command) p = Popen(command, shell=True, stdout=PIPE) return p.communicate()[0].strip() @@ -22,7 +27,7 @@ def run_process(command): def get_mime_type(file_path): """ Attempts to get the mime type but will return prematurely if the process - takes longer than 5 seconds. Note that this function should only be called + takes longer than 5 seconds. Note that this function should only be called for files which do not have a mp3/ogg/flac extension. """ @@ -48,27 +53,27 @@ def calculate_replay_gain(file_path): """ This function accepts files of type mp3/ogg/flac and returns a calculated ReplayGain value in dB. If the value cannot be calculated for some reason, then we default to 0 (Unity Gain). - + http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification """ try: """ Making a duplicate is required because the ReplayGain extraction utilities we use - make unwanted modifications to the file. + make unwanted modifications to the file. """ search = None temp_file_path = duplicate_file(file_path) - if re.search(r'mp3$', temp_file_path, re.IGNORECASE) or get_mime_type(temp_file_path) == "audio/mpeg": + if re.search(r'mp3$', file_path, re.IGNORECASE) or get_mime_type(temp_file_path) == "audio/mpeg": if run_process("which mp3gain > /dev/null") == 0: out = get_process_output('mp3gain -q "%s" 2> /dev/null' % temp_file_path) search = re.search(r'Recommended "Track" dB change: (.*)', out) else: print "mp3gain not found" #Log warning - elif re.search(r'ogg$', temp_file_path, re.IGNORECASE) or get_mime_type(temp_file_path) == "application/ogg": + elif re.search(r'og(g|a)$', file_path, re.IGNORECASE) or get_mime_type(temp_file_path) == "application/ogg": if run_process("which vorbisgain > /dev/null && which ogginfo > /dev/null") == 0: run_process('vorbisgain -q -f "%s" 2>/dev/null >/dev/null' % temp_file_path) out = get_process_output('ogginfo "%s"' % temp_file_path) @@ -76,7 +81,7 @@ def calculate_replay_gain(file_path): else: print "vorbisgain/ogginfo not found" #Log warning - elif re.search(r'flac$', temp_file_path, re.IGNORECASE) or get_mime_type(temp_file_path) == "audio/x-flac": + elif re.search(r'flac$', file_path, re.IGNORECASE) or get_mime_type(temp_file_path) == "audio/x-flac": if run_process("which metaflac > /dev/null") == 0: out = get_process_output('metaflac --show-tag=REPLAYGAIN_TRACK_GAIN "%s"' % temp_file_path) search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out) From 9eebdd7d500715e30f5e672f0aa35002573b4347 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 8 Aug 2012 11:52:17 -0400 Subject: [PATCH 3/5] remove useless entries in .gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index a14bfa6df..bc3c72ed9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ .* *.pyc -/files -build/build.properties From fd1628f971b066e1359a604867e534436906b5d3 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 8 Aug 2012 12:01:10 -0400 Subject: [PATCH 4/5] CC-4117: Smart Playlist: radio_station_name criteria doesnot take effect - removing radio_station_name from criteria list --- airtime_mvc/application/forms/SmartBlockCriteria.php | 8 +++----- airtime_mvc/application/models/Block.php | 2 -- .../public/js/airtime/playlist/smart_playlistbuilder.js | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index 0cb16205d..e3dc91c92 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -29,13 +29,12 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm "mood" => "Mood", "name" => "Name", "orchestra" => "Orchestra", - "radio_station_name" => "Radio Station Name", "rating" => "Rating", "sample_rate" => "Sample Rate", "track_title" => "Title", "track_number" => "Track Number", "utime" => "Uploaded", - "year" => "Year" + "year" => "Year" ); $criteriaTypes = array( @@ -60,7 +59,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm "mood" => "s", "name" => "s", "orchestra" => "s", - "radio_station_name" => "s", "rating" => "n", "sample_rate" => "n", "track_title" => "s", @@ -210,7 +208,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm /* This is where the additional modifier rows get defined * The additional row count starts at 0 and gets appended * to the parent field name - */ + */ } else if (count($storedCrit["crit"][$criteriaKeys[$i]]) > 1) { $n = $j - 1; $criteria = new Zend_Form_Element_Select("sp_criteria_field_".$i."_".$n); @@ -251,7 +249,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $this->addElement($criteriaExtra); } - }//for + }//for }//for diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 05459ee04..0078f6766 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -76,7 +76,6 @@ class Application_Model_Block "mood" => "DbMood", "name" => "DbName", "orchestra" => "DbOrchestra", - "radio_station_name" => "DbRadioStationName", "rating" => "DbRating", "sample_rate" => "DbSampleRate", "track_title" => "DbTrackTitle", @@ -1255,7 +1254,6 @@ EOT; "mood" => "Mood", "name" => "Name", "orchestra" => "Orchestra", - "radio_station_name" => "Radio Station Name", "rating" => "Rating", "sample_rate" => "Sample Rate", "track_title" => "Title", diff --git a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js index bfbe094ac..d9b00c694 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js @@ -562,7 +562,6 @@ var criteriaTypes = { "mood" : "s", "name" : "s", "orchestra" : "s", - "radio_station_name" : "s", "rating" : "n", "sample_rate" : "n", "track_title" : "s", From 83917ed894fbbf58dc265927c2db5371fe0e52b4 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 8 Aug 2012 12:23:07 -0400 Subject: [PATCH 5/5] CC-4166: Playlist Builder -> Regular Playlist : clicking Fade in/out button for a empty playlist will cause PHP Fatal Error - fixed --- .../application/views/scripts/playlist/update.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/views/scripts/playlist/update.phtml b/airtime_mvc/application/views/scripts/playlist/update.phtml index a389265ca..288b595e3 100644 --- a/airtime_mvc/application/views/scripts/playlist/update.phtml +++ b/airtime_mvc/application/views/scripts/playlist/update.phtml @@ -10,7 +10,7 @@ if ($item['type'] == 2) { } ?>
  • " unqid=""> -
    +
    "> @@ -39,11 +39,11 @@ if ($item['type'] == 2) {
    - +
    @@ -62,7 +62,7 @@ if ($item['type'] == 2) {