mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Refactor get_dirs
This commit is contained in:
parent
e67f29cb7b
commit
8d458f10ac
1 changed files with 8 additions and 7 deletions
|
@ -162,15 +162,16 @@ def process_dir(path, link):
|
||||||
def get_dirs(section, subsection, link='hard'):
|
def get_dirs(section, subsection, link='hard'):
|
||||||
to_return = []
|
to_return = []
|
||||||
|
|
||||||
|
watch_directory = core.CFG[section][subsection]['watch_dir']
|
||||||
|
directory = os.path.join(watch_directory, subsection)
|
||||||
|
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
directory = watch_directory
|
||||||
|
|
||||||
try:
|
try:
|
||||||
watch_dir = os.path.join(core.CFG[section][subsection]['watch_dir'], subsection)
|
to_return.extend(process_dir(directory, link))
|
||||||
if os.path.exists(watch_dir):
|
|
||||||
to_return.extend(process_dir(watch_dir, link))
|
|
||||||
elif os.path.exists(core.CFG[section][subsection]['watch_dir']):
|
|
||||||
to_return.extend(process_dir(core.CFG[section][subsection]['watch_dir'], link))
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Failed to add directories from {0} for post-processing: {1}'.format
|
logger.error('Failed to add directories from {0} for post-processing: {1}'.format(watch_directory, e))
|
||||||
(core.CFG[section][subsection]['watch_dir'], e))
|
|
||||||
|
|
||||||
if core.USELINK == 'move':
|
if core.USELINK == 'move':
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue