cc-4105: cleaned up pure.py

This commit is contained in:
Rudi Grinberg 2012-08-14 15:40:10 -04:00
parent 26afdd8851
commit d3e6c57372
2 changed files with 39 additions and 41 deletions

View File

@ -221,8 +221,6 @@ def normalized_metadata(md, original_path):
# byproduct of formatting the track number to 2 digits.
'MDATA_KEY_TRACKNUMBER' : parse_int,
'MDATA_KEY_BITRATE' : lambda x: str(int(x) / 1000) + "kbps",
# note: you don't actually need the lambda here. It's only used for
# clarity
'MDATA_KEY_FILEPATH' : lambda x: os.path.normpath(x),
'MDATA_KEY_MIME' : lambda x: x.replace('-','/'),
'MDATA_KEY_BPM' : lambda x: x[0:8],
@ -294,7 +292,7 @@ def organized_path(old_path, root_path, normal_md):
def file_md5(path,max_length=100):
"""
Get md5 of file path (if it exists). Use only max_length characters to save
time and memory
time and memory. Pass max_length=-1 to read the whole file (like in mm1)
"""
if os.path.exists(path):
with open(path, 'rb') as f: