From dc175f98183af910a97976901f22e304ef2c651e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20K=C3=A5berg?= Date: Mon, 18 Feb 2013 15:46:52 +0100 Subject: [PATCH] extentions moved to config file --- TorrentToMedia.py | 22 +++++++++++----------- autoProcessMedia.cfg.sample | 22 ++++++++++++++-------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 5a9c455a..9583d9bf 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -221,7 +221,8 @@ else: ## We will pass in %D, %N from uTorrent, or %TR_TORRENT_DIR% %TR_TORRENT_NAME% from Transmission inputDirectory = os.path.normpath(sys.argv[1]) inputName = sys.argv[2] - + Logger.debug("Received Directory: %s | Name: %s", inputDirectory, inputName) + # Sick-Beard tvCategory = config.get("SickBeard", "category") tvDestination = os.path.normpath(config.get("SickBeard", "outputDirectory")) @@ -231,17 +232,16 @@ else: # Torrent specific useLink = int(config.get("Torrent", "uselink")) extractionTool = os.path.normpath(config.get("Torrent", "extractiontool")) + compressedContainer = config.get("Torrent", "compressedExtentions") + mediaContainer = config.get("Torrent", "mediaExtentions") + metaContainer = config.get("Torrent", "metaExtentions") + + status = int(1) # we start as "failed" until we verify movie file in destination + root = int(0) + video = int(0) + video2 = int(0) inputCategory = '' # We dont have a category yet - status = 1 # we start as "failed" until we verify movie file in destination - root = 0 - video = 0 - video2 = 0 - compressedContainer = ['.zip', '.rar', '.7z', '.gz', '.bz', '.tar', '.arj'] - mediaContainer = ['.mkv', '.avi', '.divx', '.xvid', '.mov', '.wmv', '.mp4', '.mpg', '.mpeg', '.vob', '.iso'] - metaFile = ['.nfo', '.sub', '.srt', '.jpg', '.gif'] - - Logger.debug("Received Directory: %s | Name: %s", inputDirectory, inputName) inputDirectory, inputCategory, root = category_search(inputDirectory, inputCategory, root) # confirm the catgeogy by parsing directory structure. if inputCategory == movieCategory: outputDestination = os.path.normpath(os.path.join(movieDestination, inputName)) @@ -274,7 +274,7 @@ else: state = copy_link(source, target, useLink, outputDestination) if state == False: Logger.info("Failed to link file %s.", file) - elif fileExtention in metaFile: + elif fileExtention in metaContainer: source = filePath target = os.path.join(outputDestination, file) Logger.info("Found metadata file %s.", file) diff --git a/autoProcessMedia.cfg.sample b/autoProcessMedia.cfg.sample index e385f252..70b7ddb5 100644 --- a/autoProcessMedia.cfg.sample +++ b/autoProcessMedia.cfg.sample @@ -1,18 +1,23 @@ [CouchPotato] +category = movie +outputDirectory = /abs/path/to/complete/movies +apikey = +###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ###### host = localhost port = 5050 username = password = ssl = 0 web_root = -apikey = xxxxxxxx delay = 60 method = renamer delete_failed = 0 -category = movies -outputDirectory = /abs/path/to/complete/movies + [SickBeard] +category = tv +outputDirectory = /abs/path/to/complete/tv +###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ###### host=localhost port=8081 username= @@ -21,10 +26,11 @@ web_root= ssl=0 watch_dir= failed_fork=0 -category = tv -outputDirectory = /abs/path/to/complete/tv [Torrent] -uselink = 0 -extractiontool = C:\Program Files\7-Zip\7z.exe - +uselink = 1 +###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ###### +compressedExtentions = ['.zip', '.rar', '.7z', '.gz', '.bz', '.tar', '.arj'] +mediaExtentions = ['.mkv', '.avi', '.divx', '.xvid', '.mov', '.wmv', '.mp4', '.mpg', '.mpeg', '.vob', '.iso'] +metaExtentions = ['.nfo', '.sub', '.srt', '.jpg', '.gif'] +extractionTool = C:\Program Files\7-Zip\7z.exe \ No newline at end of file