cc-4105: fixed metadata formatting bug
This commit is contained in:
parent
6e9db647c1
commit
688d22e995
|
@ -561,6 +561,10 @@ class ApiController extends Zend_Controller_Action
|
|||
$info_json = json_decode($raw_json, $assoc=true);
|
||||
$recorded = $info_json["is_record"];
|
||||
unset( $info_json["is_record"] );
|
||||
unset( $info_json["MDATA_KEY_DURATION"] );
|
||||
unset( $info_json["MDATA_KEY_SAMPLERATE"] );
|
||||
unset( $info_json["MDATA_KEY_BITRATE"] );
|
||||
|
||||
if( !array_key_exists('mode', $info_json) ) { // Log invalid requests
|
||||
Logging::log("Received bad request(key=$k), no 'mode' parameter. Bad request is:");
|
||||
Logging::log( $info_json );
|
||||
|
@ -610,9 +614,6 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
Logging::log("MM request>>>>>>>");
|
||||
Logging::log( $md );
|
||||
|
||||
// update import timestamp
|
||||
Application_Model_Preference::SetImportTimestamp();
|
||||
if ($mode == "create") {
|
||||
|
|
|
@ -46,9 +46,9 @@ airtime2mutagen = {
|
|||
# airtime metadata object will skip the attribute outright.
|
||||
|
||||
airtime_special = {
|
||||
"MDATA_KEY_DURATION" : lambda m: getattr(m.info, "length", 0.0),
|
||||
"MDATA_KEY_DURATION" : lambda m: format_length(getattr(m.info, u'length', 0.0)),
|
||||
"MDATA_KEY_BITRATE" : lambda m: getattr(m.info, "bitrate", 0),
|
||||
"MDATA_KEY_SAMPLERATE" : lambda m: format_length(getattr(m.info, "sample_rate", 0)),
|
||||
"MDATA_KEY_SAMPLERATE" : lambda m: getattr(m.info, u'sample_rate', 0),
|
||||
"MDATA_KEY_MIME" : lambda m: m.mime[0] if len(m.mime) > 0 else u'',
|
||||
}
|
||||
mutagen2airtime = dict( (v,k) for k,v in airtime2mutagen.iteritems() if isinstance(v, str) )
|
||||
|
|
|
@ -145,10 +145,11 @@ def remove_whitespace(dictionary):
|
|||
nd = copy.deepcopy(dictionary)
|
||||
bad_keys = []
|
||||
for k,v in nd.iteritems():
|
||||
stripped = v.strip()
|
||||
# ghetto and maybe unnecessary
|
||||
if stripped == '' or stripped == u'':
|
||||
bad_keys.append(k)
|
||||
if hasattr(v,'strip'):
|
||||
stripped = v.strip()
|
||||
# ghetto and maybe unnecessary
|
||||
if stripped == '' or stripped == u'':
|
||||
bad_keys.append(k)
|
||||
for bad_key in bad_keys: del nd[bad_key]
|
||||
return nd
|
||||
|
||||
|
|
Loading…
Reference in New Issue