From ab24081e30171539d0b65283b62d87d0d6294a12 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Tue, 23 Dec 2014 09:38:29 +1030 Subject: [PATCH 01/13] change default Transmission port. Fixes #645 --- autoProcessMedia.cfg.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoProcessMedia.cfg.spec b/autoProcessMedia.cfg.spec index 550a4366..f6459900 100644 --- a/autoProcessMedia.cfg.spec +++ b/autoProcessMedia.cfg.spec @@ -229,7 +229,7 @@ uTorrentPWD = your password ###### Transmission (You must edit this if your using TorrentToMedia.py with uTorrent) TransmissionHost = localhost - TransmissionPort = 8084 + TransmissionPort = 9091 TransmissionUSR = your username TransmissionPWD = your password #### Deluge (You must edit this if your using TorrentToMedia.py with deluge. Note that the host/port is for the deluge daemon, not the webui) From 7f980a496426788cdf9858765a61df662867d8c2 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 2 Jan 2015 07:07:08 +1030 Subject: [PATCH 02/13] only use Upper if hash exists. Fixes #651 --- TorrentToMedia.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 65a14d99..a3ba48ca 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -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': From 632810b1e118dc71359e031c950087151b25b9ab Mon Sep 17 00:00:00 2001 From: WithoutCord Date: Fri, 2 Jan 2015 03:18:12 +0100 Subject: [PATCH 03/13] fix for not picking up next highest ranked release --- nzbtomedia/autoProcess/autoProcessMovie.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nzbtomedia/autoProcess/autoProcessMovie.py b/nzbtomedia/autoProcess/autoProcessMovie.py index 0bd59092..64669022 100644 --- a/nzbtomedia/autoProcess/autoProcessMovie.py +++ b/nzbtomedia/autoProcess/autoProcessMovie.py @@ -292,7 +292,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) ] From 90734d3fab19256b46b0b73eee5a348feb89d3f6 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sat, 3 Jan 2015 15:28:18 +1030 Subject: [PATCH 04/13] don't check status for manage.scan. Fixes #653 --- nzbtomedia/autoProcess/autoProcessMovie.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nzbtomedia/autoProcess/autoProcessMovie.py b/nzbtomedia/autoProcess/autoProcessMovie.py index 64669022..cf036598 100644 --- a/nzbtomedia/autoProcess/autoProcessMovie.py +++ b/nzbtomedia/autoProcess/autoProcessMovie.py @@ -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) From e581ca25e02443782c728c9396a109c8fc6689d2 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Mon, 12 Jan 2015 09:01:35 +1030 Subject: [PATCH 05/13] add tooltip for host. Fixes #663 --- nzbToCouchPotato.py | 2 ++ nzbToGamez.py | 2 ++ nzbToHeadPhones.py | 2 ++ nzbToMedia.py | 12 ++++++++++++ nzbToMylar.py | 2 ++ nzbToNzbDrone.py | 2 ++ nzbToSickBeard.py | 2 ++ 7 files changed, 24 insertions(+) diff --git a/nzbToCouchPotato.py b/nzbToCouchPotato.py index 980dfc17..f75342b1 100755 --- a/nzbToCouchPotato.py +++ b/nzbToCouchPotato.py @@ -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. diff --git a/nzbToGamez.py b/nzbToGamez.py index a48f7a3d..d85c2961 100755 --- a/nzbToGamez.py +++ b/nzbToGamez.py @@ -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. diff --git a/nzbToHeadPhones.py b/nzbToHeadPhones.py index 4d5f0097..9f24faf4 100755 --- a/nzbToHeadPhones.py +++ b/nzbToHeadPhones.py @@ -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. diff --git a/nzbToMedia.py b/nzbToMedia.py index 89df7ea9..2f5cd382 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -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. diff --git a/nzbToMylar.py b/nzbToMylar.py index fbc8b618..21d7e183 100755 --- a/nzbToMylar.py +++ b/nzbToMylar.py @@ -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. diff --git a/nzbToNzbDrone.py b/nzbToNzbDrone.py index 47f0dcae..caa2703d 100755 --- a/nzbToNzbDrone.py +++ b/nzbToNzbDrone.py @@ -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. diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index cfd77002..d97a29ea 100755 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -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. From 12ac0ef70183b5ec9fd40f979d3b1ba44e30c99c Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 16 Jan 2015 16:58:39 +1030 Subject: [PATCH 06/13] dont' fail if can't connect to deluge. Test category from directory. --- nzbtomedia/nzbToMediaUtil.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nzbtomedia/nzbToMediaUtil.py b/nzbtomedia/nzbToMediaUtil.py index 26b0a8fd..ab7f1ae6 100644 --- a/nzbtomedia/nzbToMediaUtil.py +++ b/nzbtomedia/nzbToMediaUtil.py @@ -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 From d5cdf2ad6971bba307434c519a618dfb2563dedc Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sat, 17 Jan 2015 12:12:26 +1030 Subject: [PATCH 07/13] continue if failed to connect to torrent client. --- TorrentToMedia.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index a3ba48ca..2621c4f9 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -95,7 +95,10 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, uniquePath = 1 if clientAgent != 'manual': - nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) + try: + nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) + except: + logger.warning("Failed to pause torrent %s in %s" % (inputName, clientAgent)) if uniquePath: outputDestination = os.path.normpath( @@ -221,14 +224,20 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, if clientAgent != 'manual': 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) + try: + nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName) + except: + logger.warning("Failed to resume torrent %s in %s" % (inputName, clientAgent)) else: if clientAgent != 'manual': # update download status in our DB nzbtomedia.update_downloadInfoStatus(inputName, 1) # remove torrent - nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName) + try: + nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName) + except: + logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent)) if not sectionName == 'UserScript': # for user script, we assume this is cleaned by the script or option USER_SCRIPT_CLEAN # cleanup our processing folders of any misc unwanted files and empty directories From 9f99d1be3853befac1d35d902e29ed3e281c017e Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sun, 18 Jan 2015 07:30:03 +1030 Subject: [PATCH 08/13] better warning logging for torrent actions. --- TorrentToMedia.py | 16 +++------- nzbtomedia/nzbToMediaUtil.py | 60 +++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 2621c4f9..ff7cf106 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -95,10 +95,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, uniquePath = 1 if clientAgent != 'manual': - try: - nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) - except: - logger.warning("Failed to pause torrent %s in %s" % (inputName, clientAgent)) + nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) if uniquePath: outputDestination = os.path.normpath( @@ -224,20 +221,15 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, if clientAgent != 'manual': logger.error( "A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding") - try: - nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName) - except: - logger.warning("Failed to resume torrent %s in %s" % (inputName, clientAgent)) + nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName) + else: if clientAgent != 'manual': # update download status in our DB nzbtomedia.update_downloadInfoStatus(inputName, 1) # remove torrent - try: - nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName) - except: - logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent)) + nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName) if not sectionName == 'UserScript': # for user script, we assume this is cleaned by the script or option USER_SCRIPT_CLEAN # cleanup our processing folders of any misc unwanted files and empty directories diff --git a/nzbtomedia/nzbToMediaUtil.py b/nzbtomedia/nzbToMediaUtil.py index ab7f1ae6..16f8e5c9 100644 --- a/nzbtomedia/nzbToMediaUtil.py +++ b/nzbtomedia/nzbToMediaUtil.py @@ -737,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) From f97087e4927e73acdc5b628a76bcc1fca9dc5750 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sun, 18 Jan 2015 07:39:01 +1030 Subject: [PATCH 09/13] use float for resolution scaling. Fixes #672 --- nzbtomedia/transcoder/transcoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nzbtomedia/transcoder/transcoder.py b/nzbtomedia/transcoder/transcoder.py index 7005b226..f1afa407 100644 --- a/nzbtomedia/transcoder/transcoder.py +++ b/nzbtomedia/transcoder/transcoder.py @@ -215,8 +215,8 @@ 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" if w_scale != 1: From 2864b730ca3a1fa8a0f324ac3b47e2fa916ee371 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sun, 18 Jan 2015 08:12:21 +1030 Subject: [PATCH 10/13] fix scaling issues. Fixes #672 --- nzbtomedia/transcoder/transcoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nzbtomedia/transcoder/transcoder.py b/nzbtomedia/transcoder/transcoder.py index f1afa407..a9206b23 100644 --- a/nzbtomedia/transcoder/transcoder.py +++ b/nzbtomedia/transcoder/transcoder.py @@ -218,11 +218,11 @@ def buildCommands(file, newDir, movieName, bitbucket): 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: From dd902e1fc775a0171c91efedd83f7a8d2102cd8f Mon Sep 17 00:00:00 2001 From: Jaerin Date: Sat, 17 Jan 2015 16:46:18 -0500 Subject: [PATCH 11/13] Add flags to make windows linking and extraction invisible --- nzbtomedia/extractor/bin/invisible.cmd | 2 +- nzbtomedia/extractor/extractor.py | 8 ++++++-- nzbtomedia/linktastic/linktastic.py | 10 ++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/nzbtomedia/extractor/bin/invisible.cmd b/nzbtomedia/extractor/bin/invisible.cmd index 09d46c6f..ef1e54ae 100755 --- a/nzbtomedia/extractor/bin/invisible.cmd +++ b/nzbtomedia/extractor/bin/invisible.cmd @@ -1 +1 @@ -start /wait wscript "%~dp0\invisible.vbs" %* \ No newline at end of file +start /B /wait wscript "%~dp0\invisible.vbs" %* \ No newline at end of file diff --git a/nzbtomedia/extractor/extractor.py b/nzbtomedia/extractor/extractor.py index 4f2a7f3b..9163eca0 100644 --- a/nzbtomedia/extractor/extractor.py +++ b/nzbtomedia/extractor/extractor.py @@ -97,13 +97,17 @@ 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') + + info = subprocess.STARTUPINFO() + info.dwFlags |= subprocess.STARTF_USESHOWWINDOW + try: # now works same for nt and *nix cmd.append(filePath) # add filePath to final cmd arg. if platform.system() != 'Windows': 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 +121,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" % ( diff --git a/nzbtomedia/linktastic/linktastic.py b/nzbtomedia/linktastic/linktastic.py index 9e5e96ed..6696e4a3 100644 --- a/nzbtomedia/linktastic/linktastic.py +++ b/nzbtomedia/linktastic/linktastic.py @@ -25,6 +25,8 @@ import subprocess from subprocess import CalledProcessError import os +info = subprocess.STARTUPINFO() +info.dwFlags |= subprocess.STARTF_USESHOWWINDOW # Prevent spaces from messing with us! def _escape_param(param): @@ -36,7 +38,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 +52,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 +64,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 +76,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')) From 9a715773befe312bc0db5022afeb1b6f19ecdfd2 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Mon, 19 Jan 2015 09:34:30 +1030 Subject: [PATCH 12/13] edit PR #679 to only change Windows. Fixes #676 --- nzbtomedia/extractor/extractor.py | 9 +++++---- nzbtomedia/linktastic/linktastic.py | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nzbtomedia/extractor/extractor.py b/nzbtomedia/extractor/extractor.py index 9163eca0..344903ec 100644 --- a/nzbtomedia/extractor/extractor.py +++ b/nzbtomedia/extractor/extractor.py @@ -98,12 +98,13 @@ def extract(filePath, outputDestination): os.chdir(outputDestination) # Not all unpack commands accept full paths, so just extract into this directory devnull = open(os.devnull, 'w') - info = subprocess.STARTUPINFO() - info.dwFlags |= subprocess.STARTF_USESHOWWINDOW - 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. diff --git a/nzbtomedia/linktastic/linktastic.py b/nzbtomedia/linktastic/linktastic.py index 6696e4a3..408bbc2e 100644 --- a/nzbtomedia/linktastic/linktastic.py +++ b/nzbtomedia/linktastic/linktastic.py @@ -25,8 +25,9 @@ import subprocess from subprocess import CalledProcessError import os -info = subprocess.STARTUPINFO() -info.dwFlags |= subprocess.STARTF_USESHOWWINDOW +if os.name == 'nt': + info = subprocess.STARTUPINFO() + info.dwFlags |= subprocess.STARTF_USESHOWWINDOW # Prevent spaces from messing with us! def _escape_param(param): From cac3d80c859f1559cea4030b7b56ac3ae6091d8f Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Mon, 19 Jan 2015 09:41:30 +1030 Subject: [PATCH 13/13] V10.9 --- changelog.txt | 10 ++++++++++ nzbtomedia/__init__.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 0887c8ea..8b49ff25 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/nzbtomedia/__init__.py b/nzbtomedia/__init__.py index a103b4ee..f680e100 100644 --- a/nzbtomedia/__init__.py +++ b/nzbtomedia/__init__.py @@ -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'