mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -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
|
# adds lib directory to system path
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from nzbtomedia.nzbToMediaConfig import config
|
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib')))
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib')))
|
||||||
|
|
||||||
|
import nzbtomedia
|
||||||
|
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
### NZBGET POST-PROCESSING SCRIPT ###
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
|
|
@ -5,7 +5,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib')))
|
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)
|
result = autoProcessTV().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory)
|
||||||
elif nzbtomedia.CFG['HeadPhones'][inputCategory]:
|
elif nzbtomedia.CFG['HeadPhones'][inputCategory]:
|
||||||
logger.postprocess("Calling HeadPhones:" + inputCategory + " to post-process: %s", inputName)
|
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]:
|
elif nzbtomedia.CFG['Mylar'][inputCategory]:
|
||||||
logger.postprocess("Calling Mylar:" + inputCategory + " to post-process: %s", inputName)
|
logger.postprocess("Calling Mylar:" + inputCategory + " to post-process: %s", inputName)
|
||||||
result = autoProcessComics().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory)
|
result = autoProcessComics().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# For more information, visit https://github.com/clinton-hall/nzbToMedia/wiki
|
# For more information, visit https://github.com/clinton-hall/nzbToMedia/wiki
|
||||||
|
|
||||||
[General]
|
[General]
|
||||||
|
verision_notify = 1
|
||||||
auto_update = 0
|
auto_update = 0
|
||||||
git_path =
|
git_path =
|
||||||
git_user =
|
git_user =
|
||||||
|
|
|
@ -439,12 +439,13 @@ def main():
|
||||||
if result == 0:
|
if result == 0:
|
||||||
logger.postprocess("The nzbToMedia script completed successfully.")
|
logger.postprocess("The nzbToMedia script completed successfully.")
|
||||||
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
||||||
return nzbtomedia.NZBGET_POSTPROCESS_SUCCESS
|
sys.exit(nzbtomedia.NZBGET_POSTPROCESS_SUCCESS)
|
||||||
else:
|
else:
|
||||||
logger.error("A problem was reported in the nzbToMedia script.")
|
logger.error("A problem was reported in the nzbToMedia script.")
|
||||||
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
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
|
return result
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
exit(main())
|
exit(main())
|
|
@ -45,7 +45,7 @@ SYS_ARGV = None
|
||||||
|
|
||||||
# version constants
|
# version constants
|
||||||
AUTO_UPDATE = None
|
AUTO_UPDATE = None
|
||||||
NZBTOMEDIA_VERSION = None
|
NZBTOMEDIA_VERSION = '9.3'
|
||||||
NZBTOMEDIA_BRANCH = None
|
NZBTOMEDIA_BRANCH = None
|
||||||
NEWEST_VERSION = None
|
NEWEST_VERSION = None
|
||||||
NEWEST_VERSION_STRING = None
|
NEWEST_VERSION_STRING = None
|
||||||
|
@ -172,12 +172,16 @@ def initialize():
|
||||||
logger.info("Loading config from %s", CONFIG_FILE)
|
logger.info("Loading config from %s", CONFIG_FILE)
|
||||||
CFG = config()
|
CFG = config()
|
||||||
|
|
||||||
# check for newer version
|
# load git cfg info
|
||||||
AUTO_UPDATE = CFG['General']['auto_update']
|
VERSION_NOTIFY = int(CFG['General']['verision_notify'])
|
||||||
versionCheck.CheckVersion().find_installed_version()
|
AUTO_UPDATE = int(CFG['General']['auto_update'])
|
||||||
logger.info('nzbToMedia Version:' + NZBTOMEDIA_VERSION + ' Branch:' + NZBTOMEDIA_BRANCH + ' (' + platform.system() + '; ' + platform.release() + ')')
|
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 versionCheck.CheckVersion().check_for_new_version():
|
||||||
if int(AUTO_UPDATE) == 1:
|
if AUTO_UPDATE == 1:
|
||||||
logger.info("Auto-Updating nzbToMedia, Please wait ...")
|
logger.info("Auto-Updating nzbToMedia, Please wait ...")
|
||||||
updated = versionCheck.CheckVersion().update()
|
updated = versionCheck.CheckVersion().update()
|
||||||
if updated:
|
if updated:
|
||||||
|
@ -186,6 +190,9 @@ def initialize():
|
||||||
else:
|
else:
|
||||||
logger.error("Update wasn't successful, not restarting. Check your log for more information.")
|
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()
|
WakeUp()
|
||||||
|
|
||||||
CLIENTAGENT = CFG["Torrent"]["clientAgent"] # utorrent | deluge | transmission | rtorrent | other
|
CLIENTAGENT = CFG["Torrent"]["clientAgent"] # utorrent | deluge | transmission | rtorrent | other
|
||||||
|
|
|
@ -78,7 +78,7 @@ class autoProcessMusic:
|
||||||
params = {}
|
params = {}
|
||||||
params['apikey'] = apikey
|
params['apikey'] = apikey
|
||||||
params['cmd'] = "forceProcess"
|
params['cmd'] = "forceProcess"
|
||||||
params['dir'] = urllib.quote(dirName)
|
params['dir'] = dirName
|
||||||
|
|
||||||
url = baseURL
|
url = baseURL
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@ class CheckVersion():
|
||||||
force: if true the VERSION_NOTIFY setting will be ignored and a check will be forced
|
force: if true the VERSION_NOTIFY setting will be ignored and a check will be forced
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# if not nzbtomedia.VERSION_NOTIFY and not force:
|
if not nzbtomedia.VERSION_NOTIFY and not force:
|
||||||
# logger.log(u"Version checking is disabled, not checking for the newest version")
|
logger.log(u"Version checking is disabled, not checking for the newest version")
|
||||||
# return False
|
return False
|
||||||
|
|
||||||
logger.log(u"Checking if " + self.install_type + " needs an update")
|
logger.log(u"Checking if " + self.install_type + " needs an update")
|
||||||
if not self.updater.need_update():
|
if not self.updater.need_update():
|
||||||
|
@ -79,11 +79,6 @@ class CheckVersion():
|
||||||
if self.updater.need_update():
|
if self.updater.need_update():
|
||||||
return self.updater.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():
|
class UpdateManager():
|
||||||
def get_github_repo_user(self):
|
def get_github_repo_user(self):
|
||||||
repo_user = 'clinton-hall'
|
repo_user = 'clinton-hall'
|
||||||
|
@ -95,7 +90,7 @@ class UpdateManager():
|
||||||
return 'nzbToMedia'
|
return 'nzbToMedia'
|
||||||
|
|
||||||
def get_github_branch(self):
|
def get_github_branch(self):
|
||||||
git_branch = 'master'
|
git_branch = 'dev'
|
||||||
if nzbtomedia.GIT_BRANCH:
|
if nzbtomedia.GIT_BRANCH:
|
||||||
git_branch = nzbtomedia.GIT_BRANCH
|
git_branch = nzbtomedia.GIT_BRANCH
|
||||||
return git_branch
|
return git_branch
|
||||||
|
@ -113,8 +108,7 @@ class GitUpdateManager(UpdateManager):
|
||||||
self._num_commits_ahead = 0
|
self._num_commits_ahead = 0
|
||||||
|
|
||||||
def _git_error(self):
|
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.'
|
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.')
|
||||||
nzbtomedia.NEWEST_VERSION_STRING = error_message
|
|
||||||
|
|
||||||
def _find_working_git(self):
|
def _find_working_git(self):
|
||||||
test_cmd = 'version'
|
test_cmd = 'version'
|
||||||
|
@ -159,8 +153,7 @@ class GitUpdateManager(UpdateManager):
|
||||||
logger.log(u"Not using: " + cur_git, logger.DEBUG)
|
logger.log(u"Not using: " + cur_git, logger.DEBUG)
|
||||||
|
|
||||||
# Still haven't found a working git
|
# 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.'
|
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.')
|
||||||
nzbtomedia.NEWEST_VERSION_STRING = error_message
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue