cc-4105: slightly improved handling of paths
This commit is contained in:
parent
9d5f50d1f8
commit
ad12926af2
5 changed files with 23 additions and 6 deletions
|
@ -6,6 +6,7 @@ class SyncDB(Loggable):
|
|||
def __init__(self, apc):
|
||||
self.apc = apc
|
||||
dirs = self.apc.list_all_watched_dirs()
|
||||
|
||||
directories = None
|
||||
try:
|
||||
directories = dirs['dirs']
|
||||
|
@ -19,9 +20,23 @@ class SyncDB(Loggable):
|
|||
# Just in case anybody wants to lookup a directory by its id we haev
|
||||
self.id_lookup = directories
|
||||
|
||||
def reload_directories(self):
|
||||
# dirs_setup is a dict with keys:
|
||||
# u'watched_dirs' and u'stor' which point to lists of corresponding
|
||||
# dirs
|
||||
dirs_setup = self.apc.setup_media_monitor()
|
||||
self.base_storage = dirs_setup[u'stor']
|
||||
self.watched_directories = set(dirs_setup[u'watched_dirs'])
|
||||
|
||||
def organize_path(self): return os.path.join(self.base_storage, 'organize')
|
||||
def problem_path(self): return os.path.join(self.base_storage, 'problem_files')
|
||||
def import_path(self): return os.path.join(self.base_storage, 'imported')
|
||||
def recorded_path(self): return os.path.join(self.base_storage, 'recorded')
|
||||
|
||||
def list_directories(self):
|
||||
"""
|
||||
returns a list of all the watched directories in the datatabase.
|
||||
(Includes the imported directory)
|
||||
"""
|
||||
return self.directories.keys()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue