diff --git a/airtime_mvc/application/views/scripts/library/get-file-metadata.ajax.phtml b/airtime_mvc/application/views/scripts/library/get-file-metadata.ajax.phtml
index d882eb9c9..ca14ac39f 100644
--- a/airtime_mvc/application/views/scripts/library/get-file-metadata.ajax.phtml
+++ b/airtime_mvc/application/views/scripts/library/get-file-metadata.ajax.phtml
@@ -84,10 +84,13 @@
if (strlen($crit["display_name"]) > $critMaxStrLen) {
$crit["display_name"] = substr($crit["display_name"], 0, 12)."...";
}
+ if (strlen($crit["modifier"]) > $critMaxStrLen) {
+ $crit["modifier"] = substr($crit["modifier"], 0, 12)."...";
+ }
?>
|
- |
+ |
to |
diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css
index f4948dab8..b4a398055 100644
--- a/airtime_mvc/public/css/styles.css
+++ b/airtime_mvc/public/css/styles.css
@@ -451,7 +451,7 @@ table.library-get-file-md.table-small{
}
.file-md-qtip-criteria-width-mod{
- width:60px;
+ width:70px;
}
.file-md-qtip-criteria-width{
diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js
index d67d96fbe..90787fabb 100644
--- a/airtime_mvc/public/js/airtime/library/spl.js
+++ b/airtime_mvc/public/js/airtime/library/spl.js
@@ -341,6 +341,7 @@ var AIRTIME = (function(AIRTIME){
// functions in smart_playlistbuilder.js
setupUI();
appendAddButton();
+ appendModAddButton();
removeButtonCheck();
}
diff --git a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js
index 8c537770d..b3f761961 100644
--- a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js
+++ b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js
@@ -17,6 +17,7 @@ function setSmartPlaylistEvents() {
$(this).hide();
}
appendAddButton();
+ appendModAddButton();
removeButtonCheck();
});
@@ -87,6 +88,8 @@ function setSmartPlaylistEvents() {
var count = list_length - curr_pos;
var next = curr.next();
var item_to_hide;
+ var prev;
+ var index;
//remove error message from current row, if any
var error_element = curr.find('span[class="errors sp-errors"]');
@@ -94,10 +97,13 @@ function setSmartPlaylistEvents() {
error_element.remove();
}
- /* assign next row to current row for all rows below and including
- * the row getting removed
- */
- for (var i=0; i')
- .attr('value', key)
- .text(value));
- });
- } else {
- $.each(numericCriteriaOptions, function(key, value){
- div.append($('')
- .attr('value', key)
- .text(value));
- });
- }
+ $.each(divs, function(i, div){
+ $(div).children().remove();
+
+ if (criteria_type == 's') {
+ $.each(stringCriteriaOptions, function(key, value){
+ $(div).append($('')
+ .attr('value', key)
+ .text(value));
+ });
+ } else {
+ $.each(numericCriteriaOptions, function(key, value){
+ $(div).append($('')
+ .attr('value', key)
+ .text(value));
+ });
+ }
+ });
}
function getCriteriaOptionType(e) {
diff --git a/python_apps/media-monitor/airtimefilemonitor/replaygain.py b/python_apps/media-monitor/airtimefilemonitor/replaygain.py
index e10b7a3f2..ef3d51039 100644
--- a/python_apps/media-monitor/airtimefilemonitor/replaygain.py
+++ b/python_apps/media-monitor/airtimefilemonitor/replaygain.py
@@ -40,7 +40,7 @@ def duplicate_file(file_path):
fsrc = open(file_path, 'r')
fdst = tempfile.NamedTemporaryFile(delete=False)
- print "Copying %s to %s" % (file_path, fdst.name)
+ logger.info("Copying %s to %s" % (file_path, fdst.name))
shutil.copyfileobj(fsrc, fdst)
@@ -49,6 +49,26 @@ def duplicate_file(file_path):
return fdst.name
+def get_file_type(file_path):
+ file_type = None
+ if re.search(r'mp3$', file_path, re.IGNORECASE):
+ file_type = 'mp3'
+ elif re.search(r'og(g|a)$', file_path, re.IGNORECASE):
+ file_type = 'vorbis'
+ elif re.search(r'flac$', file_path, re.IGNORECASE):
+ file_type = 'flac'
+ else:
+ mime_type = get_mime_type(file_path) == "audio/mpeg"
+ if 'mpeg' in mime_type:
+ file_type = 'mp3'
+ elif 'ogg' in mime_type:
+ file_type = 'vorbis'
+ elif 'flac' in mime_type:
+ file_type = 'flac'
+
+ return file_type
+
+
def calculate_replay_gain(file_path):
"""
This function accepts files of type mp3/ogg/flac and returns a calculated ReplayGain value in dB.
@@ -66,36 +86,35 @@ def calculate_replay_gain(file_path):
search = None
temp_file_path = duplicate_file(file_path)
- 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)
+ file_type = get_file_type(file_path)
+
+ if file_type:
+ if file_type == 'mp3':
+ 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:
+ logger.warn("mp3gain not found")
+ elif file_type == 'vorbis':
+ 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)
+ search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
+ else:
+ logger.warn("vorbisgain/ogginfo not found")
+ elif file_type == '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)
+ else:
+ logger.warn("metaflac not found")
else:
- print "mp3gain not found"
- #Log warning
- 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)
- search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
- else:
- print "vorbisgain/ogginfo not found"
- #Log warning
- 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)
- else:
- print "metaflac not found"
- #Log warning
- else:
- pass
- #Log unknown file type.
+ pass
#no longer need the temp, file simply remove it.
os.remove(temp_file_path)
except Exception, e:
- print e
+ logger.error(str(e))
replay_gain = 0
if search: