diff --git a/DeleteSamples.py b/DeleteSamples.py index f0aa24e1..386d26dc 100755 --- a/DeleteSamples.py +++ b/DeleteSamples.py @@ -3,10 +3,10 @@ # adds lib directory to system path import os import sys -from nzbtomedia.nzbToMediaConfig import config - sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))) +import nzbtomedia + # ############################################################################## ### NZBGET POST-PROCESSING SCRIPT ### diff --git a/ResetDateTime.py b/ResetDateTime.py index 2e4b582e..13e7227b 100755 --- a/ResetDateTime.py +++ b/ResetDateTime.py @@ -5,7 +5,7 @@ import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))) -from nzbtomedia.nzbToMediaConfig import config +import nzbtomedia # ############################################################################## diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 2870840e..d861b0d5 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -198,7 +198,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, result = autoProcessTV().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory) elif nzbtomedia.CFG['HeadPhones'][inputCategory]: logger.postprocess("Calling HeadPhones:" + inputCategory + " to post-process: %s", inputName) - result = autoProcessMusic().process(inputDirectory, inputName, status, clientAgent, inputCategory) + result = autoProcessMusic().process(outputDestination, inputName, status, clientAgent, inputCategory) elif nzbtomedia.CFG['Mylar'][inputCategory]: logger.postprocess("Calling Mylar:" + inputCategory + " to post-process: %s", inputName) result = autoProcessComics().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory) @@ -369,4 +369,4 @@ def main(): return result if __name__ == "__main__": - exit(main()) \ No newline at end of file + exit(main()) diff --git a/autoProcessMedia.cfg.spec b/autoProcessMedia.cfg.spec index 93c5626e..26a20a32 100644 --- a/autoProcessMedia.cfg.spec +++ b/autoProcessMedia.cfg.spec @@ -2,6 +2,7 @@ # For more information, visit https://github.com/clinton-hall/nzbToMedia/wiki [General] + verision_notify = 1 auto_update = 0 git_path = git_user = diff --git a/nzbToMedia.py b/nzbToMedia.py index 1cdb6b32..826224cf 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -439,12 +439,13 @@ def main(): if result == 0: logger.postprocess("The nzbToMedia script completed successfully.") if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11 - return nzbtomedia.NZBGET_POSTPROCESS_SUCCESS + sys.exit(nzbtomedia.NZBGET_POSTPROCESS_SUCCESS) else: logger.error("A problem was reported in the nzbToMedia script.") if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11 - return nzbtomedia.NZBGET_POSTPROCESS_ERROR + sys.exit(nzbtomedia.NZBGET_POSTPROCESS_ERROR) return result + if __name__ == '__main__': exit(main()) \ No newline at end of file diff --git a/nzbtomedia/__init__.py b/nzbtomedia/__init__.py index 6c2dabce..a47c3e6b 100644 --- a/nzbtomedia/__init__.py +++ b/nzbtomedia/__init__.py @@ -45,7 +45,7 @@ SYS_ARGV = None # version constants AUTO_UPDATE = None -NZBTOMEDIA_VERSION = None +NZBTOMEDIA_VERSION = '9.3' NZBTOMEDIA_BRANCH = None NEWEST_VERSION = None NEWEST_VERSION_STRING = None @@ -172,12 +172,16 @@ def initialize(): logger.info("Loading config from %s", CONFIG_FILE) CFG = config() - # check for newer version - AUTO_UPDATE = CFG['General']['auto_update'] - versionCheck.CheckVersion().find_installed_version() - logger.info('nzbToMedia Version:' + NZBTOMEDIA_VERSION + ' Branch:' + NZBTOMEDIA_BRANCH + ' (' + platform.system() + '; ' + platform.release() + ')') + # load git cfg info + VERSION_NOTIFY = int(CFG['General']['verision_notify']) + AUTO_UPDATE = int(CFG['General']['auto_update']) + GIT_PATH = CFG['General']['git_path'] + GIT_USER = CFG['General']['git_user'] + GIT_BRANCH = CFG['General']['git_branch'] + + # Check for updates via GitHUB if versionCheck.CheckVersion().check_for_new_version(): - if int(AUTO_UPDATE) == 1: + if AUTO_UPDATE == 1: logger.info("Auto-Updating nzbToMedia, Please wait ...") updated = versionCheck.CheckVersion().update() if updated: @@ -186,6 +190,9 @@ def initialize(): else: logger.error("Update wasn't successful, not restarting. Check your log for more information.") + # Display Current Version + logger.info('nzbToMedia Version:' + NZBTOMEDIA_VERSION + ' Branch:' + NZBTOMEDIA_BRANCH + ' (' + platform.system() + '; ' + platform.release() + ')') + WakeUp() CLIENTAGENT = CFG["Torrent"]["clientAgent"] # utorrent | deluge | transmission | rtorrent | other diff --git a/nzbtomedia/autoProcess/autoProcessMusic.py b/nzbtomedia/autoProcess/autoProcessMusic.py index f8f73d0c..a3a45d25 100644 --- a/nzbtomedia/autoProcess/autoProcessMusic.py +++ b/nzbtomedia/autoProcess/autoProcessMusic.py @@ -78,7 +78,7 @@ class autoProcessMusic: params = {} params['apikey'] = apikey params['cmd'] = "forceProcess" - params['dir'] = urllib.quote(dirName) + params['dir'] = dirName url = baseURL diff --git a/nzbtomedia/versionCheck.py b/nzbtomedia/versionCheck.py index 460e871c..2f47f7cf 100644 --- a/nzbtomedia/versionCheck.py +++ b/nzbtomedia/versionCheck.py @@ -62,9 +62,9 @@ class CheckVersion(): force: if true the VERSION_NOTIFY setting will be ignored and a check will be forced """ -# if not nzbtomedia.VERSION_NOTIFY and not force: -# logger.log(u"Version checking is disabled, not checking for the newest version") -# return False + if not nzbtomedia.VERSION_NOTIFY and not force: + logger.log(u"Version checking is disabled, not checking for the newest version") + return False logger.log(u"Checking if " + self.install_type + " needs an update") if not self.updater.need_update(): @@ -79,11 +79,6 @@ class CheckVersion(): if self.updater.need_update(): return self.updater.update() - def find_installed_version(self): - if self.updater._find_installed_version(): - nzbtomedia.NZBTOMEDIA_VERSION = self.updater._cur_commit_hash - nzbtomedia.NZBTOMEDIA_BRANCH = self.updater.branch - class UpdateManager(): def get_github_repo_user(self): repo_user = 'clinton-hall' @@ -95,7 +90,7 @@ class UpdateManager(): return 'nzbToMedia' def get_github_branch(self): - git_branch = 'master' + git_branch = 'dev' if nzbtomedia.GIT_BRANCH: git_branch = nzbtomedia.GIT_BRANCH return git_branch @@ -113,8 +108,7 @@ class GitUpdateManager(UpdateManager): self._num_commits_ahead = 0 def _git_error(self): - error_message = 'Unable to find your git executable - Set git_path in your autoProcessMedia.cfg OR delete your .git folder and run from source to enable updates.' - nzbtomedia.NEWEST_VERSION_STRING = error_message + logger.error('Unable to find your git executable - Set git_path in your autoProcessMedia.cfg OR delete your .git folder and run from source to enable updates.') def _find_working_git(self): test_cmd = 'version' @@ -159,8 +153,7 @@ class GitUpdateManager(UpdateManager): logger.log(u"Not using: " + cur_git, logger.DEBUG) # Still haven't found a working git - error_message = 'Unable to find your git executable - Set git_path in your autoProcessMedia.cfg OR delete your .git folder and run from source to enable updates.' - nzbtomedia.NEWEST_VERSION_STRING = error_message + logger.error('Unable to find your git executable - Set git_path in your autoProcessMedia.cfg OR delete your .git folder and run from source to enable updates.') return None