Merge branch 'nightly' into dev

This commit is contained in:
clinton-hall 2015-01-19 09:51:08 +10:30
commit bc2bab95ee
16 changed files with 103 additions and 49 deletions

View file

@ -205,8 +205,10 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
result = nzbtomedia.autoProcessMovie().process(sectionName,outputDestination, inputName, status, clientAgent, inputHash, result = nzbtomedia.autoProcessMovie().process(sectionName,outputDestination, inputName, status, clientAgent, inputHash,
inputCategory) inputCategory)
elif sectionName in ['SickBeard','NzbDrone']: elif sectionName in ['SickBeard','NzbDrone']:
if inputHash:
inputHash = inputHash.upper()
result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent, result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent,
inputHash.upper(), inputCategory) inputHash, inputCategory)
elif sectionName == 'HeadPhones': elif sectionName == 'HeadPhones':
result = nzbtomedia.autoProcessMusic().process(sectionName,outputDestination, inputName, status, clientAgent, inputCategory) result = nzbtomedia.autoProcessMusic().process(sectionName,outputDestination, inputName, status, clientAgent, inputCategory)
elif sectionName == 'Mylar': elif sectionName == 'Mylar':
@ -220,6 +222,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
logger.error( logger.error(
"A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding") "A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding")
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName) nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName)
else: else:
if clientAgent != 'manual': if clientAgent != 'manual':
# update download status in our DB # update download status in our DB

View file

@ -1,5 +1,15 @@
Change_LOG / History Change_LOG / History
V10.9 19/01/2015
Prevent Errors when trying next release from CouchPotato (CouchPotato failed handling)
Prevent check for status change when using Manage scan (CouchPotato)
Better Tooltip for "host" in NZBGet settings.
Continue if failed to connect to Torrent Client.
Fixed resolution settings in Transcoder.
Make Windows Linking and extraction invisible.
V10.8 15/12/2014 V10.8 15/12/2014
Impacts All Impacts All

View file

@ -40,6 +40,8 @@
#cpsapikey= #cpsapikey=
# CouchPotato host. # CouchPotato host.
#
# The ipaddress for your CouchPotato server. e.g For the Same system use localhost or 127.0.0.1
#cpshost=localhost #cpshost=localhost
# CouchPotato port. # CouchPotato port.

View file

@ -36,6 +36,8 @@
#gzapikey= #gzapikey=
# Gamez host. # Gamez host.
#
# The ipaddress for your Gamez server. e.g For the Same system use localhost or 127.0.0.1
#gzhost=localhost #gzhost=localhost
# Gamez port. # Gamez port.

View file

@ -35,6 +35,8 @@
#hpapikey= #hpapikey=
# HeadPhones host. # HeadPhones host.
#
# The ipaddress for your HeadPhones server. e.g For the Same system use localhost or 127.0.0.1
#hphost=localhost #hphost=localhost
# HeadPhones port. # HeadPhones port.

View file

@ -40,6 +40,8 @@
#cpsapikey= #cpsapikey=
# CouchPotato host. # CouchPotato host.
#
# The ipaddress for your CouchPotato server. e.g For the Same system use localhost or 127.0.0.1
#cpshost=localhost #cpshost=localhost
# CouchPotato port. # CouchPotato port.
@ -83,6 +85,8 @@
#sbCategory=tv #sbCategory=tv
# SickBeard host. # SickBeard host.
#
# The ipaddress for your SickBeard/SickRage server. e.g For the Same system use localhost or 127.0.0.1
#sbhost=localhost #sbhost=localhost
# SickBeard port. # SickBeard port.
@ -137,6 +141,8 @@
#ndCategory=tv2 #ndCategory=tv2
# NzbDrone host. # NzbDrone host.
#
# The ipaddress for your NzbDrone/Sonarr server. e.g For the Same system use localhost or 127.0.0.1
#ndhost=localhost #ndhost=localhost
# NzbDrone port. # NzbDrone port.
@ -181,6 +187,8 @@
#hpapikey= #hpapikey=
# HeadPhones host. # HeadPhones host.
#
# The ipaddress for your HeadPhones server. e.g For the Same system use localhost or 127.0.0.1
#hphost=localhost #hphost=localhost
# HeadPhones port. # HeadPhones port.
@ -209,6 +217,8 @@
#myCategory=comics #myCategory=comics
# Mylar host. # Mylar host.
#
# The ipaddress for your Mylar server. e.g For the Same system use localhost or 127.0.0.1
#myhost=localhost #myhost=localhost
# Mylar port. # Mylar port.
@ -251,6 +261,8 @@
#gzapikey= #gzapikey=
# Gamez host. # Gamez host.
#
# The ipaddress for your Gamez server. e.g For the Same system use localhost or 127.0.0.1
#gzhost=localhost #gzhost=localhost
# Gamez port. # Gamez port.

View file

@ -33,6 +33,8 @@
#myCategory=comics #myCategory=comics
# Mylar host. # Mylar host.
#
# The ipaddress for your Mylar server. e.g For the Same system use localhost or 127.0.0.1
#myhost=localhost #myhost=localhost
# Mylar port. # Mylar port.

View file

@ -37,6 +37,8 @@
#ndCategory=tv2 #ndCategory=tv2
# NzbDrone host. # NzbDrone host.
#
# The ipaddress for your NzbDrone/Sonarr server. e.g For the Same system use localhost or 127.0.0.1
#ndhost=localhost #ndhost=localhost
# NzbDrone port. # NzbDrone port.

View file

@ -42,6 +42,8 @@
#sbCategory=tv #sbCategory=tv
# SickBeard host. # SickBeard host.
#
# The ipaddress for your SickBeard/SickRage server. e.g For the Same system use localhost or 127.0.0.1
#sbhost=localhost #sbhost=localhost
# SickBeard port. # SickBeard port.

View file

@ -281,7 +281,7 @@ def initialize(section=None):
nzbToMediaDB.upgradeDatabase(nzbToMediaDB.DBConnection(), mainDB.InitialSchema) nzbToMediaDB.upgradeDatabase(nzbToMediaDB.DBConnection(), mainDB.InitialSchema)
# Set Version and GIT variables # Set Version and GIT variables
NZBTOMEDIA_VERSION = '10.8' NZBTOMEDIA_VERSION = '10.9'
VERSION_NOTIFY = int(CFG['General']['version_notify']) VERSION_NOTIFY = int(CFG['General']['version_notify'])
AUTO_UPDATE = int(CFG['General']['auto_update']) AUTO_UPDATE = int(CFG['General']['auto_update'])
GIT_REPO = 'nzbToMedia' GIT_REPO = 'nzbToMedia'

View file

@ -211,10 +211,6 @@ class autoProcessMovie:
video2 = "%s.cp(%s)%s" % (videoName, imdbid, videoExt) video2 = "%s.cp(%s)%s" % (videoName, imdbid, videoExt)
logger.debug('Renaming: %s to: %s' % (video, video2)) logger.debug('Renaming: %s to: %s' % (video, video2))
os.rename(video, video2) os.rename(video, video2)
if method == "manage":
command = "/manage.update"
else:
command = "/renamer.scan"
params = {} params = {}
if download_id: if download_id:
@ -225,6 +221,12 @@ class autoProcessMovie:
if remote_path: if remote_path:
params['media_folder'] = remoteDir(dirName) params['media_folder'] = remoteDir(dirName)
if method == "manage":
command = "/manage.update"
params = {}
else:
command = "/renamer.scan"
url = "%s%s" % (baseURL, command) url = "%s%s" % (baseURL, command)
logger.debug("Opening URL: %s with PARAMS: %s" % (url, params), section) logger.debug("Opening URL: %s with PARAMS: %s" % (url, params), section)
@ -243,6 +245,8 @@ class autoProcessMovie:
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code)) ] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code)) ]
elif result['success']: elif result['success']:
logger.postprocess("SUCCESS: Finished %s scan for folder %s" % (method, dirName), section) logger.postprocess("SUCCESS: Finished %s scan for folder %s" % (method, dirName), section)
if method == "manage":
return [0, "%s: Successfully post-processed %s" % (section, inputName) ]
else: else:
logger.error("FAILED: %s scan was unable to finish for folder %s. exiting!" % (method, dirName), logger.error("FAILED: %s scan was unable to finish for folder %s. exiting!" % (method, dirName),
section) section)
@ -292,7 +296,7 @@ class autoProcessMovie:
logger.debug("Opening URL: %s" % (url), section) logger.debug("Opening URL: %s" % (url), section)
try: try:
r = requests.get(url, params={'media_id': media_id}) r = requests.get(url, params={'media_id': media_id}, verify=False)
except requests.ConnectionError: except requests.ConnectionError:
logger.error("Unable to open URL %s" % (url), section) logger.error("Unable to open URL %s" % (url), section)
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section) ] return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section) ]

View file

@ -1 +1 @@
start /wait wscript "%~dp0\invisible.vbs" %* start /B /wait wscript "%~dp0\invisible.vbs" %*

View file

@ -97,13 +97,18 @@ def extract(filePath, outputDestination):
pwd = os.getcwd() # Get our Present Working Directory pwd = os.getcwd() # Get our Present Working Directory
os.chdir(outputDestination) # Not all unpack commands accept full paths, so just extract into this directory os.chdir(outputDestination) # Not all unpack commands accept full paths, so just extract into this directory
devnull = open(os.devnull, 'w') devnull = open(os.devnull, 'w')
try: # now works same for nt and *nix try: # now works same for nt and *nix
info = None
cmd.append(filePath) # add filePath to final cmd arg. cmd.append(filePath) # add filePath to final cmd arg.
if platform.system() != 'Windows': if platform.system() == 'Windows':
info = subprocess.STARTUPINFO()
info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
else:
cmd = nzbtomedia.NICENESS + cmd cmd = nzbtomedia.NICENESS + cmd
cmd2 = cmd cmd2 = cmd
cmd2.append("-p-") # don't prompt for password. cmd2.append("-p-") # don't prompt for password.
p = Popen(cmd2, stdout=devnull, stderr=devnull) # should extract files fine. p = Popen(cmd2, stdout=devnull, stderr=devnull, startupinfo=info) # should extract files fine.
res = p.wait() res = p.wait()
if (res >= 0 and os.name == 'nt') or res == 0: # for windows chp returns process id if successful or -1*Error code. Linux returns 0 for successful. if (res >= 0 and os.name == 'nt') or res == 0: # for windows chp returns process id if successful or -1*Error code. Linux returns 0 for successful.
nzbtomedia.logger.info("EXTRACTOR: Extraction was successful for %s to %s" % (filePath, outputDestination)) nzbtomedia.logger.info("EXTRACTOR: Extraction was successful for %s to %s" % (filePath, outputDestination))
@ -117,7 +122,7 @@ def extract(filePath, outputDestination):
#append password here. #append password here.
passcmd = "-p" + password passcmd = "-p" + password
cmd2.append(passcmd) cmd2.append(passcmd)
p = Popen(cmd2, stdout=devnull, stderr=devnull) # should extract files fine. p = Popen(cmd2, stdout=devnull, stderr=devnull, startupinfo=info) # should extract files fine.
res = p.wait() res = p.wait()
if (res >= 0 and platform == 'Windows') or res == 0: if (res >= 0 and platform == 'Windows') or res == 0:
nzbtomedia.logger.info("EXTRACTOR: Extraction was successful for %s to %s using password: %s" % ( nzbtomedia.logger.info("EXTRACTOR: Extraction was successful for %s to %s using password: %s" % (

View file

@ -25,6 +25,9 @@ import subprocess
from subprocess import CalledProcessError from subprocess import CalledProcessError
import os import os
if os.name == 'nt':
info = subprocess.STARTUPINFO()
info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
# Prevent spaces from messing with us! # Prevent spaces from messing with us!
def _escape_param(param): def _escape_param(param):
@ -36,7 +39,7 @@ def _link_windows(src, dest):
try: try:
subprocess.check_output( subprocess.check_output(
'cmd /C mklink /H %s %s' % (_escape_param(dest), _escape_param(src)), 'cmd /C mklink /H %s %s' % (_escape_param(dest), _escape_param(src)),
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT, startupinfo=info)
except CalledProcessError as err: except CalledProcessError as err:
raise IOError(err.output.decode('utf-8')) raise IOError(err.output.decode('utf-8'))
@ -50,7 +53,7 @@ def _symlink_windows(src, dest):
try: try:
subprocess.check_output( subprocess.check_output(
'cmd /C mklink %s %s' % (_escape_param(dest), _escape_param(src)), 'cmd /C mklink %s %s' % (_escape_param(dest), _escape_param(src)),
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT, startupinfo=info)
except CalledProcessError as err: except CalledProcessError as err:
raise IOError(err.output.decode('utf-8')) raise IOError(err.output.decode('utf-8'))
@ -62,7 +65,7 @@ def _dirlink_windows(src, dest):
try: try:
subprocess.check_output( subprocess.check_output(
'cmd /C mklink /J %s %s' % (_escape_param(dest), _escape_param(src)), 'cmd /C mklink /J %s %s' % (_escape_param(dest), _escape_param(src)),
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT, startupinfo=info)
except CalledProcessError as err: except CalledProcessError as err:
raise IOError(err.output.decode('utf-8')) raise IOError(err.output.decode('utf-8'))
@ -74,7 +77,7 @@ def _junctionlink_windows(src, dest):
try: try:
subprocess.check_output( subprocess.check_output(
'cmd /C mklink /D %s %s' % (_escape_param(dest), _escape_param(src)), 'cmd /C mklink /D %s %s' % (_escape_param(dest), _escape_param(src)),
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT, startupinfo=info)
except CalledProcessError as err: except CalledProcessError as err:
raise IOError(err.output.decode('utf-8')) raise IOError(err.output.decode('utf-8'))

View file

@ -476,7 +476,10 @@ def parse_deluge(args):
inputName = args[2] inputName = args[2]
inputHash = args[1] inputHash = args[1]
inputID = args[1] inputID = args[1]
inputCategory = nzbtomedia.TORRENT_CLASS.core.get_torrent_status(inputID, ['label']).get()['label'] try:
inputCategory = nzbtomedia.TORRENT_CLASS.core.get_torrent_status(inputID, ['label']).get()['label']
except:
inputCategory = ''
return inputDirectory, inputName, inputCategory, inputHash, inputID return inputDirectory, inputName, inputCategory, inputHash, inputID
@ -734,42 +737,44 @@ def create_torrent_class(clientAgent):
def pause_torrent(clientAgent, inputHash, inputID, inputName): def pause_torrent(clientAgent, inputHash, inputID, inputName):
logger.debug("Stopping torrent %s in %s while processing" % (inputName, clientAgent)) logger.debug("Stopping torrent %s in %s while processing" % (inputName, clientAgent))
try:
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.stop(inputHash) nzbtomedia.TORRENT_CLASS.stop(inputHash)
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.stop_torrent(inputID) nzbtomedia.TORRENT_CLASS.stop_torrent(inputID)
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID]) nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID])
time.sleep(5)
time.sleep(5) except:
logger.warning("Failed to stop torrent %s in %s" % (inputName, clientAgent))
def resume_torrent(clientAgent, inputHash, inputID, inputName): def resume_torrent(clientAgent, inputHash, inputID, inputName):
logger.debug("Starting torrent %s in %s" % (inputName, clientAgent)) logger.debug("Starting torrent %s in %s" % (inputName, clientAgent))
try:
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.start(inputHash) nzbtomedia.TORRENT_CLASS.start(inputHash)
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.start_torrent(inputID) nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID]) nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
time.sleep(5)
time.sleep(5) except:
logger.warning("Failed to start torrent %s in %s" % (inputName, clientAgent))
def remove_torrent(clientAgent, inputHash, inputID, inputName): def remove_torrent(clientAgent, inputHash, inputID, inputName):
if nzbtomedia.DELETE_ORIGINAL == 1 or nzbtomedia.USELINK == 'move': if nzbtomedia.DELETE_ORIGINAL == 1 or nzbtomedia.USELINK == 'move':
logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent)) logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent))
try:
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.removedata(inputHash) nzbtomedia.TORRENT_CLASS.removedata(inputHash)
nzbtomedia.TORRENT_CLASS.remove(inputHash) nzbtomedia.TORRENT_CLASS.remove(inputHash)
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True) nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "": if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True) nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
time.sleep(5)
time.sleep(5) except:
logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent))
else: else:
resume_torrent(clientAgent, inputHash, inputID, inputName) resume_torrent(clientAgent, inputHash, inputID, inputName)

View file

@ -215,14 +215,14 @@ def buildCommands(file, newDir, movieName, bitbucket):
if nzbtomedia.VFRAMERATE and not (nzbtomedia.VFRAMERATE * 0.999 <= fr <= nzbtomedia.VFRAMERATE * 1.001): if nzbtomedia.VFRAMERATE and not (nzbtomedia.VFRAMERATE * 0.999 <= fr <= nzbtomedia.VFRAMERATE * 1.001):
video_cmd.extend(['-r', str(nzbtomedia.VFRAMERATE)]) video_cmd.extend(['-r', str(nzbtomedia.VFRAMERATE)])
if scale: if scale:
w_scale = width/int(scale.split(':')[0]) w_scale = width/float(scale.split(':')[0])
h_scale = height/int(scale.split(':')[1]) h_scale = height/float(scale.split(':')[1])
if w_scale > h_scale: # widescreen, Scale by width only. if w_scale > h_scale: # widescreen, Scale by width only.
scale = scale.split(':')[0] + ":trunc(ih/2)*2" scale = scale.split(':')[0] + ":" + str(int((height/w_scale)/2)*2)
if w_scale != 1: if w_scale != 1:
video_cmd.extend(['-vf', 'scale=' + scale]) video_cmd.extend(['-vf', 'scale=' + scale])
else: # lower or mathcing ratio, scale by height only. else: # lower or mathcing ratio, scale by height only.
scale = "trunc(iw/2)*2:" + scale.split(':')[1] scale = str(int((width/h_scale)/2)*2) + ":" + scale.split(':')[1]
if h_scale != 1: if h_scale != 1:
video_cmd.extend(['-vf', 'scale=' + scale]) video_cmd.extend(['-vf', 'scale=' + scale])
if nzbtomedia.VBITRATE: if nzbtomedia.VBITRATE: