Refactored hack

This commit is contained in:
Rudi Grinberg 2012-09-14 14:39:37 -04:00
parent 40bd5a0989
commit d0d9c5ecfc
2 changed files with 5 additions and 10 deletions

View File

@ -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

View File

@ -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