mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 10:36:52 -07:00
Merge branch 'clinton-hall/dev'
Added version_notify option, allows disabling of new version checks.
This commit is contained in:
commit
ef0dee7840
8 changed files with 29 additions and 27 deletions
|
@ -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 ###
|
||||
|
|
|
@ -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
|
||||
|
||||
#
|
||||
##############################################################################
|
||||
|
|
|
@ -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())
|
||||
exit(main())
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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())
|
|
@ -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
|
||||
|
|
|
@ -78,7 +78,7 @@ class autoProcessMusic:
|
|||
params = {}
|
||||
params['apikey'] = apikey
|
||||
params['cmd'] = "forceProcess"
|
||||
params['dir'] = urllib.quote(dirName)
|
||||
params['dir'] = dirName
|
||||
|
||||
url = baseURL
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue