cc-4421: Added for wav length
This commit is contained in:
parent
12e27e659a
commit
6c75a086e1
|
@ -200,6 +200,11 @@ class Metadata(Loggable):
|
||||||
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:
|
||||||
|
|
||||||
|
# Hickity Hackity for .wav files. Properly do this later
|
||||||
|
if mmp.extension(fpath) == 'wav':
|
||||||
|
full_mutagen.set_length(mmp.read_wave_duration(fpath))
|
||||||
|
|
||||||
for special_key,f in airtime_special.iteritems():
|
for special_key,f in airtime_special.iteritems():
|
||||||
try:
|
try:
|
||||||
new_val = f(full_mutagen)
|
new_val = f(full_mutagen)
|
||||||
|
@ -209,11 +214,6 @@ class Metadata(Loggable):
|
||||||
self.logger.info("Could not get special key %s for %s" %
|
self.logger.info("Could not get special key %s for %s" %
|
||||||
(special_key, fpath))
|
(special_key, fpath))
|
||||||
self.logger.info(str(e))
|
self.logger.info(str(e))
|
||||||
|
|
||||||
# Hickity Hackity for .wav files. Properly do this later
|
|
||||||
if mmp.extension(fpath) == 'wav':
|
|
||||||
full_mutagen.set_length(mmp.read_wave_duration(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:
|
||||||
|
|
|
@ -362,7 +362,7 @@ def file_md5(path,max_length=100):
|
||||||
# whatever it was able to read which is acceptable behaviour
|
# whatever it was able to read which is acceptable behaviour
|
||||||
m.update(f.read(max_length))
|
m.update(f.read(max_length))
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
else: raise ValueError("'%s' must exist to find its md5")
|
else: raise ValueError("'%s' must exist to find its md5" % path)
|
||||||
|
|
||||||
def encode_to(obj, encoding='utf-8'):
|
def encode_to(obj, encoding='utf-8'):
|
||||||
# TODO : add documentation + unit tests for this function
|
# TODO : add documentation + unit tests for this function
|
||||||
|
|
Loading…
Reference in New Issue