Added moronic hack to barely support multi user file storage
This commit is contained in:
parent
d55d3a55cc
commit
8a0c91fd44
|
@ -55,8 +55,12 @@ class Organizer(ReportHandler,Loggable):
|
||||||
# Do we need to "massage" the path using mmp.organized_path?
|
# Do we need to "massage" the path using mmp.organized_path?
|
||||||
target_path = self.recorded_path if event.metadata.is_recorded() \
|
target_path = self.recorded_path if event.metadata.is_recorded() \
|
||||||
else self.target_path
|
else self.target_path
|
||||||
new_path = mmp.organized_path(event.path, target_path,
|
|
||||||
event.metadata.extract())
|
owner_id = mmp.owner_id(event.path)
|
||||||
|
mdata = event.metadata.extract()
|
||||||
|
mdata['MDATA_KEY_OWNER_ID'] = owner_id # grooooooss
|
||||||
|
|
||||||
|
new_path = mmp.organized_path(event.path, target_path, mdata)
|
||||||
|
|
||||||
# See hack in mmp.magic_move
|
# See hack in mmp.magic_move
|
||||||
def new_dir_watch(d):
|
def new_dir_watch(d):
|
||||||
|
@ -68,7 +72,12 @@ class Organizer(ReportHandler,Loggable):
|
||||||
mmp.magic_move(event.path, new_path,
|
mmp.magic_move(event.path, new_path,
|
||||||
after_dir_make=new_dir_watch(dirname(new_path)))
|
after_dir_make=new_dir_watch(dirname(new_path)))
|
||||||
|
|
||||||
owners.add_file_owner(new_path, mmp.owner_id(event.path) )
|
# The reason we need to go around saving the owner in this ass
|
||||||
|
# backwards way is bewcause we are unable to encode the owner id
|
||||||
|
# into the file itself so that the StoreWatchListener listener can
|
||||||
|
# detect it from the file
|
||||||
|
owners.add_file_owner(new_path, owner_id )
|
||||||
|
|
||||||
self.logger.info('Organized: "%s" into "%s"' %
|
self.logger.info('Organized: "%s" into "%s"' %
|
||||||
(event.path, new_path))
|
(event.path, new_path))
|
||||||
except BadSongFile as e:
|
except BadSongFile as e:
|
||||||
|
|
|
@ -342,6 +342,14 @@ def organized_path(old_path, root_path, orig_md):
|
||||||
path = os.path.join(root_path, normal_md['MDATA_KEY_CREATOR'],
|
path = os.path.join(root_path, normal_md['MDATA_KEY_CREATOR'],
|
||||||
normal_md['MDATA_KEY_SOURCE'])
|
normal_md['MDATA_KEY_SOURCE'])
|
||||||
filepath = os.path.join(path, fname)
|
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(
|
||||||
|
os.path.dirname(p),
|
||||||
|
p + normal_md['MDATA_KEY_OWNER_ID'] + e )
|
||||||
|
|
||||||
return filepath
|
return filepath
|
||||||
|
|
||||||
# TODO : Get rid of this function and every one of its uses. We no longer use
|
# TODO : Get rid of this function and every one of its uses. We no longer use
|
||||||
|
|
Loading…
Reference in New Issue