Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
5c3701c064
|
@ -1,4 +1,2 @@
|
||||||
.*
|
.*
|
||||||
*.pyc
|
*.pyc
|
||||||
/files
|
|
||||||
build/build.properties
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
"mood" => "Mood",
|
"mood" => "Mood",
|
||||||
"name" => "Name",
|
"name" => "Name",
|
||||||
"orchestra" => "Orchestra",
|
"orchestra" => "Orchestra",
|
||||||
"radio_station_name" => "Radio Station Name",
|
|
||||||
"rating" => "Rating",
|
"rating" => "Rating",
|
||||||
"sample_rate" => "Sample Rate",
|
"sample_rate" => "Sample Rate",
|
||||||
"track_title" => "Title",
|
"track_title" => "Title",
|
||||||
|
@ -60,7 +59,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
"mood" => "s",
|
"mood" => "s",
|
||||||
"name" => "s",
|
"name" => "s",
|
||||||
"orchestra" => "s",
|
"orchestra" => "s",
|
||||||
"radio_station_name" => "s",
|
|
||||||
"rating" => "n",
|
"rating" => "n",
|
||||||
"sample_rate" => "n",
|
"sample_rate" => "n",
|
||||||
"track_title" => "s",
|
"track_title" => "s",
|
||||||
|
|
|
@ -76,7 +76,6 @@ class Application_Model_Block
|
||||||
"mood" => "DbMood",
|
"mood" => "DbMood",
|
||||||
"name" => "DbName",
|
"name" => "DbName",
|
||||||
"orchestra" => "DbOrchestra",
|
"orchestra" => "DbOrchestra",
|
||||||
"radio_station_name" => "DbRadioStationName",
|
|
||||||
"rating" => "DbRating",
|
"rating" => "DbRating",
|
||||||
"sample_rate" => "DbSampleRate",
|
"sample_rate" => "DbSampleRate",
|
||||||
"track_title" => "DbTrackTitle",
|
"track_title" => "DbTrackTitle",
|
||||||
|
@ -1211,6 +1210,7 @@ EOT;
|
||||||
|
|
||||||
$insertList = array();
|
$insertList = array();
|
||||||
$totalTime = 0;
|
$totalTime = 0;
|
||||||
|
$totalItems = 0;
|
||||||
|
|
||||||
// this moves the pointer to the first element in the collection
|
// this moves the pointer to the first element in the collection
|
||||||
$files->getFirst();
|
$files->getFirst();
|
||||||
|
@ -1220,7 +1220,9 @@ EOT;
|
||||||
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
|
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
|
||||||
$insertList[$id] = $length;
|
$insertList[$id] = $length;
|
||||||
$totalTime += $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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1252,7 +1254,6 @@ EOT;
|
||||||
"mood" => "Mood",
|
"mood" => "Mood",
|
||||||
"name" => "Name",
|
"name" => "Name",
|
||||||
"orchestra" => "Orchestra",
|
"orchestra" => "Orchestra",
|
||||||
"radio_station_name" => "Radio Station Name",
|
|
||||||
"rating" => "Rating",
|
"rating" => "Rating",
|
||||||
"sample_rate" => "Sample Rate",
|
"sample_rate" => "Sample Rate",
|
||||||
"track_title" => "Title",
|
"track_title" => "Title",
|
||||||
|
|
|
@ -43,7 +43,7 @@ if ($item['type'] == 2) {
|
||||||
<span class="spl_offset"><?php echo $item["offset"]?></span>
|
<span class="spl_offset"><?php echo $item["offset"]?></span>
|
||||||
</div>
|
</div>
|
||||||
<?php //create the crossfade icon.
|
<?php //create the crossfade icon.
|
||||||
if ($i < count($items) -1):
|
if (($i < count($items) -1) && !($items[$i]['type'] == 2 && $items[$i+1]['type'])):
|
||||||
?>
|
?>
|
||||||
<div id="fade_<?php echo $i ?>" class="spl_fade_control ui-state-default"></div>
|
<div id="fade_<?php echo $i ?>" class="spl_fade_control ui-state-default"></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -62,7 +62,7 @@ if ($item['type'] == 2) {
|
||||||
|
|
||||||
<?php //create a fade editor box
|
<?php //create a fade editor box
|
||||||
//(fadeout of current position + fade in of next position)
|
//(fadeout of current position + fade in of next position)
|
||||||
if($i < count($items) -1):
|
if(($i < count($items) -1) && !($items[$i]['type'] == 2 && $items[$i+1]['type'])):
|
||||||
?>
|
?>
|
||||||
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none">
|
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none">
|
||||||
<?php echo $this->partial('playlist/set-fade.phtml', array(
|
<?php echo $this->partial('playlist/set-fade.phtml', array(
|
||||||
|
|
|
@ -590,7 +590,6 @@ var criteriaTypes = {
|
||||||
"mood" : "s",
|
"mood" : "s",
|
||||||
"name" : "s",
|
"name" : "s",
|
||||||
"orchestra" : "s",
|
"orchestra" : "s",
|
||||||
"radio_station_name" : "s",
|
|
||||||
"rating" : "n",
|
"rating" : "n",
|
||||||
"sample_rate" : "n",
|
"sample_rate" : "n",
|
||||||
"track_title" : "s",
|
"track_title" : "s",
|
||||||
|
|
|
@ -4,11 +4,16 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
def get_process_output(command):
|
def get_process_output(command):
|
||||||
"""
|
"""
|
||||||
Run subprocess and return stdout
|
Run subprocess and return stdout
|
||||||
"""
|
"""
|
||||||
|
logger.debug(command)
|
||||||
p = Popen(command, shell=True, stdout=PIPE)
|
p = Popen(command, shell=True, stdout=PIPE)
|
||||||
return p.communicate()[0].strip()
|
return p.communicate()[0].strip()
|
||||||
|
|
||||||
|
@ -61,14 +66,14 @@ def calculate_replay_gain(file_path):
|
||||||
search = None
|
search = None
|
||||||
temp_file_path = duplicate_file(file_path)
|
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:
|
if run_process("which mp3gain > /dev/null") == 0:
|
||||||
out = get_process_output('mp3gain -q "%s" 2> /dev/null' % temp_file_path)
|
out = get_process_output('mp3gain -q "%s" 2> /dev/null' % temp_file_path)
|
||||||
search = re.search(r'Recommended "Track" dB change: (.*)', out)
|
search = re.search(r'Recommended "Track" dB change: (.*)', out)
|
||||||
else:
|
else:
|
||||||
print "mp3gain not found"
|
print "mp3gain not found"
|
||||||
#Log warning
|
#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:
|
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)
|
run_process('vorbisgain -q -f "%s" 2>/dev/null >/dev/null' % temp_file_path)
|
||||||
out = get_process_output('ogginfo "%s"' % temp_file_path)
|
out = get_process_output('ogginfo "%s"' % temp_file_path)
|
||||||
|
@ -76,7 +81,7 @@ def calculate_replay_gain(file_path):
|
||||||
else:
|
else:
|
||||||
print "vorbisgain/ogginfo not found"
|
print "vorbisgain/ogginfo not found"
|
||||||
#Log warning
|
#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:
|
if run_process("which metaflac > /dev/null") == 0:
|
||||||
out = get_process_output('metaflac --show-tag=REPLAYGAIN_TRACK_GAIN "%s"' % temp_file_path)
|
out = get_process_output('metaflac --show-tag=REPLAYGAIN_TRACK_GAIN "%s"' % temp_file_path)
|
||||||
search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
|
search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
|
||||||
|
|
Loading…
Reference in New Issue