Merge branch 'saas' of https://github.com/sourcefabric/Airtime into saas
This commit is contained in:
commit
016c89ea96
|
@ -28,6 +28,18 @@ class MetadataAnalyzer(Analyzer):
|
||||||
#Other fields we'll want to set for Airtime:
|
#Other fields we'll want to set for Airtime:
|
||||||
metadata["hidden"] = False
|
metadata["hidden"] = False
|
||||||
|
|
||||||
|
# Get file size and md5 hash of the file
|
||||||
|
metadata["filesize"] = os.path.getsize(filename)
|
||||||
|
|
||||||
|
with open(filename, 'rb') as fh:
|
||||||
|
m = hashlib.md5()
|
||||||
|
while True:
|
||||||
|
data = fh.read(8192)
|
||||||
|
if not data:
|
||||||
|
break
|
||||||
|
m.update(data)
|
||||||
|
metadata["md5"] = m.hexdigest()
|
||||||
|
|
||||||
# Mutagen doesn't handle WAVE files so we use a different package
|
# Mutagen doesn't handle WAVE files so we use a different package
|
||||||
mime_check = magic.from_file(filename, mime=True)
|
mime_check = magic.from_file(filename, mime=True)
|
||||||
metadata["mime"] = mime_check
|
metadata["mime"] = mime_check
|
||||||
|
@ -98,20 +110,6 @@ class MetadataAnalyzer(Analyzer):
|
||||||
#If we couldn't figure out the track_number or track_total, just ignore it...
|
#If we couldn't figure out the track_number or track_total, just ignore it...
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Get file size and md5 hash of the file
|
|
||||||
metadata["filesize"] = os.path.getsize(filename)
|
|
||||||
|
|
||||||
with open(filename, 'rb') as fh:
|
|
||||||
m = hashlib.md5()
|
|
||||||
while True:
|
|
||||||
data = fh.read(8192)
|
|
||||||
if not data:
|
|
||||||
break
|
|
||||||
m.update(data)
|
|
||||||
metadata["md5"] = m.hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#We normalize the mutagen tags slightly here, so in case mutagen changes,
|
#We normalize the mutagen tags slightly here, so in case mutagen changes,
|
||||||
#we find the
|
#we find the
|
||||||
mutagen_to_airtime_mapping = {
|
mutagen_to_airtime_mapping = {
|
||||||
|
|
Loading…
Reference in New Issue