mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 13:53:15 -07:00
Merge branch 'nightly' into dev
This commit is contained in:
commit
bc2bab95ee
16 changed files with 103 additions and 49 deletions
|
@ -205,8 +205,10 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
|||
result = nzbtomedia.autoProcessMovie().process(sectionName,outputDestination, inputName, status, clientAgent, inputHash,
|
||||
inputCategory)
|
||||
elif sectionName in ['SickBeard','NzbDrone']:
|
||||
if inputHash:
|
||||
inputHash = inputHash.upper()
|
||||
result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent,
|
||||
inputHash.upper(), inputCategory)
|
||||
inputHash, inputCategory)
|
||||
elif sectionName == 'HeadPhones':
|
||||
result = nzbtomedia.autoProcessMusic().process(sectionName,outputDestination, inputName, status, clientAgent, inputCategory)
|
||||
elif sectionName == 'Mylar':
|
||||
|
@ -220,6 +222,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
|||
logger.error(
|
||||
"A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding")
|
||||
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
|
||||
else:
|
||||
if clientAgent != 'manual':
|
||||
# update download status in our DB
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
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
|
||||
|
||||
Impacts All
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#cpsapikey=
|
||||
|
||||
# CouchPotato host.
|
||||
#
|
||||
# The ipaddress for your CouchPotato server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#cpshost=localhost
|
||||
|
||||
# CouchPotato port.
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#gzapikey=
|
||||
|
||||
# Gamez host.
|
||||
#
|
||||
# The ipaddress for your Gamez server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#gzhost=localhost
|
||||
|
||||
# Gamez port.
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#hpapikey=
|
||||
|
||||
# HeadPhones host.
|
||||
#
|
||||
# The ipaddress for your HeadPhones server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#hphost=localhost
|
||||
|
||||
# HeadPhones port.
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#cpsapikey=
|
||||
|
||||
# CouchPotato host.
|
||||
#
|
||||
# The ipaddress for your CouchPotato server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#cpshost=localhost
|
||||
|
||||
# CouchPotato port.
|
||||
|
@ -83,6 +85,8 @@
|
|||
#sbCategory=tv
|
||||
|
||||
# SickBeard host.
|
||||
#
|
||||
# The ipaddress for your SickBeard/SickRage server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#sbhost=localhost
|
||||
|
||||
# SickBeard port.
|
||||
|
@ -137,6 +141,8 @@
|
|||
#ndCategory=tv2
|
||||
|
||||
# NzbDrone host.
|
||||
#
|
||||
# The ipaddress for your NzbDrone/Sonarr server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#ndhost=localhost
|
||||
|
||||
# NzbDrone port.
|
||||
|
@ -181,6 +187,8 @@
|
|||
#hpapikey=
|
||||
|
||||
# HeadPhones host.
|
||||
#
|
||||
# The ipaddress for your HeadPhones server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#hphost=localhost
|
||||
|
||||
# HeadPhones port.
|
||||
|
@ -209,6 +217,8 @@
|
|||
#myCategory=comics
|
||||
|
||||
# Mylar host.
|
||||
#
|
||||
# The ipaddress for your Mylar server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#myhost=localhost
|
||||
|
||||
# Mylar port.
|
||||
|
@ -251,6 +261,8 @@
|
|||
#gzapikey=
|
||||
|
||||
# Gamez host.
|
||||
#
|
||||
# The ipaddress for your Gamez server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#gzhost=localhost
|
||||
|
||||
# Gamez port.
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#myCategory=comics
|
||||
|
||||
# Mylar host.
|
||||
#
|
||||
# The ipaddress for your Mylar server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#myhost=localhost
|
||||
|
||||
# Mylar port.
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#ndCategory=tv2
|
||||
|
||||
# NzbDrone host.
|
||||
#
|
||||
# The ipaddress for your NzbDrone/Sonarr server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#ndhost=localhost
|
||||
|
||||
# NzbDrone port.
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#sbCategory=tv
|
||||
|
||||
# SickBeard host.
|
||||
#
|
||||
# The ipaddress for your SickBeard/SickRage server. e.g For the Same system use localhost or 127.0.0.1
|
||||
#sbhost=localhost
|
||||
|
||||
# SickBeard port.
|
||||
|
|
|
@ -281,7 +281,7 @@ def initialize(section=None):
|
|||
nzbToMediaDB.upgradeDatabase(nzbToMediaDB.DBConnection(), mainDB.InitialSchema)
|
||||
|
||||
# Set Version and GIT variables
|
||||
NZBTOMEDIA_VERSION = '10.8'
|
||||
NZBTOMEDIA_VERSION = '10.9'
|
||||
VERSION_NOTIFY = int(CFG['General']['version_notify'])
|
||||
AUTO_UPDATE = int(CFG['General']['auto_update'])
|
||||
GIT_REPO = 'nzbToMedia'
|
||||
|
|
|
@ -211,10 +211,6 @@ class autoProcessMovie:
|
|||
video2 = "%s.cp(%s)%s" % (videoName, imdbid, videoExt)
|
||||
logger.debug('Renaming: %s to: %s' % (video, video2))
|
||||
os.rename(video, video2)
|
||||
if method == "manage":
|
||||
command = "/manage.update"
|
||||
else:
|
||||
command = "/renamer.scan"
|
||||
|
||||
params = {}
|
||||
if download_id:
|
||||
|
@ -225,6 +221,12 @@ class autoProcessMovie:
|
|||
if remote_path:
|
||||
params['media_folder'] = remoteDir(dirName)
|
||||
|
||||
if method == "manage":
|
||||
command = "/manage.update"
|
||||
params = {}
|
||||
else:
|
||||
command = "/renamer.scan"
|
||||
|
||||
url = "%s%s" % (baseURL, command)
|
||||
|
||||
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)) ]
|
||||
elif result['success']:
|
||||
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:
|
||||
logger.error("FAILED: %s scan was unable to finish for folder %s. exiting!" % (method, dirName),
|
||||
section)
|
||||
|
@ -292,7 +296,7 @@ class autoProcessMovie:
|
|||
logger.debug("Opening URL: %s" % (url), section)
|
||||
|
||||
try:
|
||||
r = requests.get(url, params={'media_id': media_id})
|
||||
r = requests.get(url, params={'media_id': media_id}, verify=False)
|
||||
except requests.ConnectionError:
|
||||
logger.error("Unable to open URL %s" % (url), section)
|
||||
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section) ]
|
||||
|
|
|
@ -1 +1 @@
|
|||
start /wait wscript "%~dp0\invisible.vbs" %*
|
||||
start /B /wait wscript "%~dp0\invisible.vbs" %*
|
|
@ -97,13 +97,18 @@ def extract(filePath, outputDestination):
|
|||
pwd = os.getcwd() # Get our Present Working Directory
|
||||
os.chdir(outputDestination) # Not all unpack commands accept full paths, so just extract into this directory
|
||||
devnull = open(os.devnull, 'w')
|
||||
|
||||
try: # now works same for nt and *nix
|
||||
info = None
|
||||
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
|
||||
cmd2 = cmd
|
||||
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()
|
||||
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))
|
||||
|
@ -117,7 +122,7 @@ def extract(filePath, outputDestination):
|
|||
#append password here.
|
||||
passcmd = "-p" + password
|
||||
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()
|
||||
if (res >= 0 and platform == 'Windows') or res == 0:
|
||||
nzbtomedia.logger.info("EXTRACTOR: Extraction was successful for %s to %s using password: %s" % (
|
||||
|
|
|
@ -25,6 +25,9 @@ import subprocess
|
|||
from subprocess import CalledProcessError
|
||||
import os
|
||||
|
||||
if os.name == 'nt':
|
||||
info = subprocess.STARTUPINFO()
|
||||
info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
|
||||
# Prevent spaces from messing with us!
|
||||
def _escape_param(param):
|
||||
|
@ -36,7 +39,7 @@ def _link_windows(src, dest):
|
|||
try:
|
||||
subprocess.check_output(
|
||||
'cmd /C mklink /H %s %s' % (_escape_param(dest), _escape_param(src)),
|
||||
stderr=subprocess.STDOUT)
|
||||
stderr=subprocess.STDOUT, startupinfo=info)
|
||||
except CalledProcessError as err:
|
||||
|
||||
raise IOError(err.output.decode('utf-8'))
|
||||
|
@ -50,7 +53,7 @@ def _symlink_windows(src, dest):
|
|||
try:
|
||||
subprocess.check_output(
|
||||
'cmd /C mklink %s %s' % (_escape_param(dest), _escape_param(src)),
|
||||
stderr=subprocess.STDOUT)
|
||||
stderr=subprocess.STDOUT, startupinfo=info)
|
||||
except CalledProcessError as err:
|
||||
raise IOError(err.output.decode('utf-8'))
|
||||
|
||||
|
@ -62,7 +65,7 @@ def _dirlink_windows(src, dest):
|
|||
try:
|
||||
subprocess.check_output(
|
||||
'cmd /C mklink /J %s %s' % (_escape_param(dest), _escape_param(src)),
|
||||
stderr=subprocess.STDOUT)
|
||||
stderr=subprocess.STDOUT, startupinfo=info)
|
||||
except CalledProcessError as err:
|
||||
raise IOError(err.output.decode('utf-8'))
|
||||
|
||||
|
@ -74,7 +77,7 @@ def _junctionlink_windows(src, dest):
|
|||
try:
|
||||
subprocess.check_output(
|
||||
'cmd /C mklink /D %s %s' % (_escape_param(dest), _escape_param(src)),
|
||||
stderr=subprocess.STDOUT)
|
||||
stderr=subprocess.STDOUT, startupinfo=info)
|
||||
except CalledProcessError as err:
|
||||
raise IOError(err.output.decode('utf-8'))
|
||||
|
||||
|
|
|
@ -476,7 +476,10 @@ def parse_deluge(args):
|
|||
inputName = args[2]
|
||||
inputHash = 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
|
||||
|
||||
|
||||
|
@ -734,42 +737,44 @@ def create_torrent_class(clientAgent):
|
|||
|
||||
def pause_torrent(clientAgent, inputHash, inputID, inputName):
|
||||
logger.debug("Stopping torrent %s in %s while processing" % (inputName, clientAgent))
|
||||
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID])
|
||||
|
||||
time.sleep(5)
|
||||
try:
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID])
|
||||
time.sleep(5)
|
||||
except:
|
||||
logger.warning("Failed to stop torrent %s in %s" % (inputName, clientAgent))
|
||||
|
||||
def resume_torrent(clientAgent, inputHash, inputID, inputName):
|
||||
logger.debug("Starting torrent %s in %s" % (inputName, clientAgent))
|
||||
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
||||
|
||||
time.sleep(5)
|
||||
try:
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
||||
time.sleep(5)
|
||||
except:
|
||||
logger.warning("Failed to start torrent %s in %s" % (inputName, clientAgent))
|
||||
|
||||
def remove_torrent(clientAgent, inputHash, inputID, inputName):
|
||||
if nzbtomedia.DELETE_ORIGINAL == 1 or nzbtomedia.USELINK == 'move':
|
||||
logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent))
|
||||
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
||||
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
try:
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
||||
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
||||
time.sleep(5)
|
||||
except:
|
||||
logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent))
|
||||
else:
|
||||
resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
|
||||
|
|
|
@ -215,14 +215,14 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
if nzbtomedia.VFRAMERATE and not (nzbtomedia.VFRAMERATE * 0.999 <= fr <= nzbtomedia.VFRAMERATE * 1.001):
|
||||
video_cmd.extend(['-r', str(nzbtomedia.VFRAMERATE)])
|
||||
if scale:
|
||||
w_scale = width/int(scale.split(':')[0])
|
||||
h_scale = height/int(scale.split(':')[1])
|
||||
w_scale = width/float(scale.split(':')[0])
|
||||
h_scale = height/float(scale.split(':')[1])
|
||||
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:
|
||||
video_cmd.extend(['-vf', 'scale=' + scale])
|
||||
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:
|
||||
video_cmd.extend(['-vf', 'scale=' + scale])
|
||||
if nzbtomedia.VBITRATE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue