From 48a19708524622389dcd7463d53032d0faa6109c Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 4 Mar 2020 19:14:41 +0000 Subject: [PATCH] Fix NotifierFactory AttributeError on first run init. --- CHANGES.md | 7 ++++++- lib/sg_helpers.py | 7 +++---- sickbeard/helpers.py | 2 +- sickbeard/postProcessor.py | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 90637d0..0793dd9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,9 @@ -### 0.21.17 (2020-03-03 21:35:00 UTC) +### 0.21.18 (2020-03-04 19:20:00 UTC) + +* Fix NotifierFactory AttributeError on first run init + + +### 0.21.17 (2020-03-03 21:35:00 UTC) * Fix do not process magnet links in search results * Fix saving media process settings diff --git a/lib/sg_helpers.py b/lib/sg_helpers.py index 11ad797..f2cae55 100644 --- a/lib/sg_helpers.py +++ b/lib/sg_helpers.py @@ -465,13 +465,13 @@ def chmod_as_parent(child_path): logger.error(u'Failed to set permission for %s to %o' % (child_path, child_mode)) -def make_dirs(path, syno=True): +def make_dirs(path, syno=False): """ Creates any folders that are missing and assigns them the permissions of their parents :param path: path :type path: AnyStr - :param syno: + :param syno: whether to trigger a syno library update for path :type syno: bool :return: success :rtype: bool @@ -504,7 +504,6 @@ def make_dirs(path, syno=True): ek.ek(os.mkdir, sofar) # use normpath to remove end separator, otherwise checks permissions against itself chmod_as_parent(ek.ek(os.path.normpath, sofar)) - # todo: reenable if syno: # do the library update for synoindex NOTIFIERS.NotifierFactory().get('SYNOINDEX').addFolder(sofar) @@ -534,7 +533,7 @@ def write_file(filepath, # type: AnyStr """ result = False - if make_dirs(ek.ek(os.path.dirname, filepath), False): + if make_dirs(ek.ek(os.path.dirname, filepath)): try: if raw: with ek.ek(io.FileIO, filepath, 'wb') as fh: diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 7ce904c..625d7f4 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -598,7 +598,7 @@ def rename_ep_file(cur_path, new_path, old_path_length=0): # put the extension on the incoming file new_path += cur_file_ext - make_dirs(ek.ek(os.path.dirname, new_path)) + make_dirs(ek.ek(os.path.dirname, new_path), syno=True) # move the file try: diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index c68a7dd..9f1c61f 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -1141,7 +1141,7 @@ class PostProcessor(object): self._log(u'Destination folder for this episode is ' + dest_path, logger.DEBUG) # create any folders we need - if not helpers.make_dirs(dest_path): + if not helpers.make_dirs(dest_path, syno=True): raise exceptions_helper.PostProcessingFailed(u'Unable to create destination folder: ' + dest_path) # figure out the base name of the resulting episode file