MM2: formatted some code
This commit is contained in:
parent
e15d345b4f
commit
12e4585410
|
@ -274,20 +274,24 @@ def organized_path(old_path, root_path, orig_md):
|
||||||
if key in dictionary: return len(dictionary[key]) == 0
|
if key in dictionary: return len(dictionary[key]) == 0
|
||||||
else: return True
|
else: return True
|
||||||
# We set some metadata elements to a default "unknown" value because we use
|
# We set some metadata elements to a default "unknown" value because we use
|
||||||
# these fields to create a path hence they cannot be empty
|
# these fields to create a path hence they cannot be empty Here "normal"
|
||||||
# Here "normal" means normalized only for organized path
|
# means normalized only for organized path
|
||||||
|
|
||||||
|
# MDATA_KEY_BITRATE is in bytes/second i.e. (256000) we want to turn this
|
||||||
|
# into 254kbps
|
||||||
normal_md = default_to_f(orig_md, path_md, unicode_unknown, default_f)
|
normal_md = default_to_f(orig_md, path_md, unicode_unknown, default_f)
|
||||||
if normal_md['MDATA_KEY_BITRATE']:
|
if normal_md['MDATA_KEY_BITRATE']:
|
||||||
formatted = str(int(normal_md['MDATA_KEY_BITRATE']) / 1000)
|
formatted = str(int(normal_md['MDATA_KEY_BITRATE']) / 1000)
|
||||||
normal_md['MDATA_KEY_BITRATE'] = formatted + 'kbps'
|
normal_md['MDATA_KEY_BITRATE'] = formatted + 'kbps'
|
||||||
else: normal_md['MDATA_KEY_BITRATE'] = unicode_unknown
|
else: normal_md['MDATA_KEY_BITRATE'] = unicode_unknown
|
||||||
|
|
||||||
if is_airtime_recorded(normal_md):
|
if is_airtime_recorded(normal_md):
|
||||||
title_re = re.match("(?P<show>\w+)-(?P<date>\d+-\d+-\d+-\d+:\d+:\d+)$",
|
title_re = re.match("(?P<show>\w+)-(?P<date>\d+-\d+-\d+-\d+:\d+:\d+)$",
|
||||||
normal_md['MDATA_KEY_TITLE'])
|
normal_md['MDATA_KEY_TITLE'])
|
||||||
show_name, = title_re.group('show'),
|
show_name, = title_re.group('show'),
|
||||||
date = title_re.group('date').replace(':','-')
|
date = title_re.group('date').replace(':','-')
|
||||||
yyyy, mm, _ = normal_md['MDATA_KEY_YEAR'].split('-',2)
|
yyyy, mm, _ = normal_md['MDATA_KEY_YEAR'].split('-',2)
|
||||||
fname_base = '%s-%s-%s.%s' % \
|
fname_base = '%s-%s-%s.%s' % \
|
||||||
(date, show_name, normal_md['MDATA_KEY_BITRATE'], ext)
|
(date, show_name, normal_md['MDATA_KEY_BITRATE'], ext)
|
||||||
filepath = os.path.join(root_path, yyyy, mm, fname_base)
|
filepath = os.path.join(root_path, yyyy, mm, fname_base)
|
||||||
elif len(normal_md['MDATA_KEY_TRACKNUMBER']) == 0:
|
elif len(normal_md['MDATA_KEY_TRACKNUMBER']) == 0:
|
||||||
|
|
Loading…
Reference in New Issue