cc-4421: Added special handling for files that mutagen returns None for.
This commit is contained in:
parent
4137602116
commit
8d08aa888b
|
@ -901,7 +901,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
foreach ($data as $pair) {
|
foreach ($data as $pair) {
|
||||||
list($id, $gain) = $pair;
|
list($id, $gain) = $pair;
|
||||||
|
// TODO : move this code into model -- RG
|
||||||
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
||||||
$file->setDbReplayGain($gain);
|
$file->setDbReplayGain($gain);
|
||||||
$file->save();
|
$file->save();
|
||||||
|
|
|
@ -178,14 +178,19 @@ class Metadata(Loggable):
|
||||||
return
|
return
|
||||||
# TODO : Simplify the way all of these rules are handled right not it's
|
# TODO : Simplify the way all of these rules are handled right not it's
|
||||||
# extremely unclear and needs to be refactored.
|
# extremely unclear and needs to be refactored.
|
||||||
if full_mutagen is None: raise BadSongFile(fpath)
|
#if full_mutagen is None: raise BadSongFile(fpath)
|
||||||
|
if full_mutagen is None: full_mutagen = {}
|
||||||
self.__metadata = Metadata.airtime_dict(full_mutagen)
|
self.__metadata = Metadata.airtime_dict(full_mutagen)
|
||||||
# Now we extra the special values that are calculated from the mutagen
|
# Now we extra the special values that are calculated from the mutagen
|
||||||
# object itself:
|
# object itself:
|
||||||
for special_key,f in airtime_special.iteritems():
|
for special_key,f in airtime_special.iteritems():
|
||||||
new_val = f(full_mutagen)
|
try:
|
||||||
if new_val is not None:
|
new_val = f(full_mutagen)
|
||||||
self.__metadata[special_key] = new_val
|
if new_val is not None:
|
||||||
|
self.__metadata[special_key] = new_val
|
||||||
|
except Exception:
|
||||||
|
self.logger.info("Could not get special key %s for %d" %
|
||||||
|
special_key, fpath)
|
||||||
# Finally, we "normalize" all the metadata here:
|
# Finally, we "normalize" all the metadata here:
|
||||||
self.__metadata = mmp.normalized_metadata(self.__metadata, fpath)
|
self.__metadata = mmp.normalized_metadata(self.__metadata, fpath)
|
||||||
# Now we must load the md5:
|
# Now we must load the md5:
|
||||||
|
|
Loading…
Reference in New Issue