From 1a96e190e5ab76c36b678a14cd0ef4212603a482 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 11 Apr 2014 11:57:13 +0930 Subject: [PATCH 1/3] add git version printing where available. --- nzbtomedia/nzbToMediaConfig.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nzbtomedia/nzbToMediaConfig.py b/nzbtomedia/nzbToMediaConfig.py index 70270646..e090fe4f 100644 --- a/nzbtomedia/nzbToMediaConfig.py +++ b/nzbtomedia/nzbToMediaConfig.py @@ -1,6 +1,7 @@ import os import shutil import lib.configobj +from subprocess import check_output, CalledProcessError from lib.configobj import ConfigObj from itertools import chain @@ -41,6 +42,14 @@ class config(original_ConfigObj): LOG_CONFIG = os.path.join(PROGRAM_DIR, "logging.cfg") SAMPLE_LOG_CONFIG = os.path.join(PROGRAM_DIR, "logging.cfg.sample") + try: + repo = check_output(["git", "config", "--get", "remote.origin.url"]).splitlines()[0] + branch = check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).splitlines()[0] + hash = check_output(["git", "rev-parse", "--short", "HEAD"]).splitlines()[0] + NZBTOMEDIA_VERSION = 'repo:' + repo + ' branch:' + branch + ' hash: ' + hash + except CalledProcessError: + pass + def __init__(self, *args, **kw): if len(args) == 0: args = (self.CONFIG_FILE,) From 8e754aa3343501c9d3053fca4edf6d5ecfea6a93 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 11 Apr 2014 12:09:58 +0930 Subject: [PATCH 2/3] logging error. fixes #314 --- TorrentToMedia.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index f9c32cea..4a820c3a 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -170,7 +170,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): Logger.debug("MAIN: Found %s media files", str(video)) status = int(0) else: - Logger.warning("MAIN: Found no media files in output.", str(video)) + Logger.warning("MAIN: Found no media files in output.") if (inputCategory in user_script_categories and not "NONE" in user_script_categories) or ("ALL" in user_script_categories and not inputCategory in processCategories): Logger.info("MAIN: Processing user script %s.", user_script) From c431e0e3da1b31482fa075527793c9dc1250695a Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 11 Apr 2014 15:14:48 +0930 Subject: [PATCH 3/3] count archive files for failed-torrent branch. fixes #314 --- TorrentToMedia.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 4a820c3a..be254d21 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -30,6 +30,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): status = int(1) # 1 = failed | 0 = success root = int(0) video = int(0) + archive = int(0) foundFile = int(0) extracted_folder = [] extractionSuccess = False @@ -166,9 +167,14 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): if fileExtension in mediaContainer: # If the file is a video file Logger.debug("MAIN: Found media file: %s", filePath) video += 1 + if fileExtension in compressedContainer: # If the file is an archive file + archive += 1 if video > int(0): # Check that media files exist Logger.debug("MAIN: Found %s media files", str(video)) status = int(0) + elif not (config().issubsection(inputCategory,["SickBeard"]) and config()["SickBeard"][inputCategory]["nzbExtractionBy"] == "Destination") and archive > int(0): + Logger.debug("MAIN: Found %s archive files to be extracted by SickBeard", str(archive)) + status = int(0) else: Logger.warning("MAIN: Found no media files in output.")