Refactored hack
This commit is contained in:
parent
40bd5a0989
commit
d0d9c5ecfc
|
@ -8,6 +8,7 @@ from media.monitor.exceptions import BadSongFile
|
|||
from media.monitor.events import OrganizeFile
|
||||
from pydispatch import dispatcher
|
||||
from os.path import dirname
|
||||
import os.path
|
||||
|
||||
class Organizer(ReportHandler,Loggable):
|
||||
"""
|
||||
|
@ -55,11 +56,12 @@ class Organizer(ReportHandler,Loggable):
|
|||
# Do we need to "massage" the path using mmp.organized_path?
|
||||
target_path = self.recorded_path if event.metadata.is_recorded() \
|
||||
else self.target_path
|
||||
|
||||
# nasty hack do this properly
|
||||
owner_id = mmp.owner_id(event.path)
|
||||
mdata = event.metadata.extract()
|
||||
mdata['MDATA_KEY_OWNER_ID'] = owner_id # grooooooss
|
||||
if owner_id != -1:
|
||||
target_path = os.path.join(target_path, unicode(owner_id))
|
||||
|
||||
mdata = event.metadata.extract()
|
||||
new_path = mmp.organized_path(event.path, target_path, mdata)
|
||||
|
||||
# See hack in mmp.magic_move
|
||||
|
|
|
@ -343,13 +343,6 @@ def organized_path(old_path, root_path, orig_md):
|
|||
path = os.path.join(root_path, normal_md['MDATA_KEY_CREATOR'],
|
||||
normal_md['MDATA_KEY_SOURCE'])
|
||||
filepath = os.path.join(path, fname)
|
||||
|
||||
# nasty hack do this properly
|
||||
if normal_md['MDATA_KEY_OWNER_ID'] != -1:
|
||||
p, e = no_extension_basename(filepath), extension(filepath)
|
||||
filepath = os.path.join( unicode(normal_md['MDATA_KEY_OWNER_ID']),
|
||||
filepath)
|
||||
|
||||
return filepath
|
||||
|
||||
# TODO : Get rid of this function and every one of its uses. We no longer use
|
||||
|
|
Loading…
Reference in New Issue