mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
Switched our config class to configObj.
nzbToMedia now fully performs manual runs for all autoProcessing scripts. autoProcessing categories are now sub-sections in the autoProcessingMedia.cfg file which allows you to have a unlimited amount of categories for your liking. nzbToMedia supports categories for all autoProcessing scripts now. Minor bug fixes and code cleanup performed during the re-code. Auto-migration code will convert old-style cfg files to new-style cfg format.
This commit is contained in:
parent
027c3e5a43
commit
b7fc74b3fd
22 changed files with 4473 additions and 572 deletions
|
@ -10,6 +10,7 @@ import logging
|
|||
import re
|
||||
import shutil
|
||||
from subprocess import Popen
|
||||
from itertools import chain
|
||||
from nzbtomedia.autoProcess.autoProcessComics import autoProcessComics
|
||||
from nzbtomedia.autoProcess.autoProcessGames import autoProcessGames
|
||||
from nzbtomedia.autoProcess.autoProcessMovie import autoProcessMovie
|
||||
|
@ -48,21 +49,9 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
|
||||
Logger.debug("MAIN: Determined Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory)
|
||||
|
||||
# init autoFork
|
||||
if inputCategory in sbCategory:
|
||||
fork, fork_params = autoFork("SickBeard")
|
||||
elif inputCategory in cpsCategory:
|
||||
fork, fork_params = autoFork("CouchPotato")
|
||||
elif inputCategory in hpCategory:
|
||||
fork, fork_params = autoFork("HeadPhones")
|
||||
elif inputCategory in gzCategory:
|
||||
fork, fork_params = autoFork("Gamez")
|
||||
elif inputCategory in mlCategory:
|
||||
fork, fork_params = autoFork("Mylar")
|
||||
else:
|
||||
fork = config.FORKS.items()[config.FORKS.keys().index(config.FORK_DEFAULT)][0]
|
||||
|
||||
if inputCategory in sbCategory:
|
||||
if inputCategory in sections["SickBeard"]:
|
||||
fork, fork_params = autoFork("SickBeard", inputCategory)
|
||||
Torrent_NoLink = int(config()["SickBeard"][inputCategory]["Torrent_NoLink"]) # 0
|
||||
if fork in config.SICKBEARD_TORRENT and Torrent_NoLink != 1:
|
||||
Logger.info("MAIN: Calling SickBeard's %s branch to post-process: %s",fork ,inputName)
|
||||
result = autoProcessTV().processEpisode(inputDirectory, inputName, 0)
|
||||
|
@ -72,7 +61,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
sys.exit()
|
||||
|
||||
outputDestination = ""
|
||||
for category in categories:
|
||||
for section, category in sections.items():
|
||||
if category == inputCategory:
|
||||
if os.path.basename(inputDirectory) == inputName and os.path.isdir(inputDirectory):
|
||||
Logger.info("MAIN: Download is a directory")
|
||||
|
@ -95,7 +84,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
outputDestination = os.path.normpath(os.path.join(outputDirectory, inputCategory, os.path.splitext(safeName(inputName))[0]))
|
||||
Logger.info("MAIN: Output directory set to: %s", outputDestination)
|
||||
|
||||
processOnly = cpsCategory + sbCategory + hpCategory + mlCategory + gzCategory
|
||||
processOnly = list(chain.from_iterable(sections.values()))
|
||||
if not "NONE" in user_script_categories: # if None, we only process the 5 listed.
|
||||
if "ALL" in user_script_categories: # All defined categories
|
||||
processOnly = categories
|
||||
|
@ -142,7 +131,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
|
||||
Logger.debug("MAIN: Scanning files in directory: %s", inputDirectory)
|
||||
|
||||
noFlatten.extend(hpCategory) # Make sure we preserve folder structure for HeadPhones.
|
||||
noFlatten.extend(config.get_categories(["HeadPhones"]).values()) # Make sure we preserve folder structure for HeadPhones.
|
||||
|
||||
outputDestinationMaster = outputDestination # Save the original, so we can change this within the loop below, and reset afterwards.
|
||||
now = datetime.datetime.now()
|
||||
|
@ -184,7 +173,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
continue # This file has not been recently moved or created, skip it
|
||||
|
||||
if fileExtension in mediaContainer: # If the file is a video file
|
||||
if is_sample(filePath, inputName, minSampleSize, SampleIDs) and not inputCategory in hpCategory: # Ignore samples
|
||||
if is_sample(filePath, inputName, minSampleSize, SampleIDs) and not inputCategory in config.get_categories(["HeadPhones"]).values(): # Ignore samples
|
||||
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
|
||||
continue
|
||||
else:
|
||||
|
@ -220,7 +209,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
except:
|
||||
Logger.exception("MAIN: Extraction failed for: %s", file)
|
||||
continue
|
||||
elif not inputCategory in cpsCategory + sbCategory: #process all for non-video categories.
|
||||
elif not inputCategory in list(chain.from_iterable(config.get_categories(['CouchPotato','SickBeard']).values())): #process all for non-video categories.
|
||||
Logger.info("MAIN: Found file %s for category %s", filePath, inputCategory)
|
||||
copy_link(filePath, targetDirectory, useLink, outputDestination)
|
||||
copy_list.append([filePath, os.path.join(outputDestination, file)])
|
||||
|
@ -234,7 +223,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
flatten(outputDestination)
|
||||
|
||||
# Now check if movie files exist in destination:
|
||||
if inputCategory in cpsCategory + sbCategory:
|
||||
if inputCategory in list(chain.from_iterable(config.get_categories(['CouchPotato','SickBeard']).values())):
|
||||
for dirpath, dirnames, filenames in os.walk(outputDestination):
|
||||
for file in filenames:
|
||||
filePath = os.path.join(dirpath, file)
|
||||
|
@ -254,12 +243,12 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
else:
|
||||
Logger.debug("MAIN: Found %s media files in output. %s were found in input", str(video2), str(video))
|
||||
|
||||
processCategories = cpsCategory + sbCategory + hpCategory + mlCategory + gzCategory
|
||||
processCategories = list(chain.from_iterable(sections.values()))
|
||||
|
||||
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)
|
||||
result = external_script(outputDestination,inputName,inputCategory)
|
||||
elif status == int(0) or (inputCategory in hpCategory + mlCategory + gzCategory): # if movies linked/extracted or for other categories.
|
||||
elif status == int(0) or (inputCategory in list(chain.from_iterable(config.get_categories(['HeadPhones','Mylar','Gamez']).values()))): # if movies linked/extracted or for other categories.
|
||||
Logger.debug("MAIN: Calling autoProcess script for successful download.")
|
||||
status = int(0) # hp, my, gz don't support failed.
|
||||
else:
|
||||
|
@ -267,20 +256,20 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
sys.exit(-1)
|
||||
|
||||
result = 0
|
||||
if inputCategory in cpsCategory:
|
||||
if inputCategory in sections['CouchPotato'].values():
|
||||
Logger.info("MAIN: Calling CouchPotatoServer to post-process: %s", inputName)
|
||||
download_id = inputHash
|
||||
result = autoProcessMovie().process(outputDestination, inputName, status, clientAgent, download_id, inputCategory)
|
||||
elif inputCategory in sbCategory:
|
||||
elif inputCategory in sections['SickBeard'].values():
|
||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||
result = autoProcessTV().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory)
|
||||
elif inputCategory in hpCategory:
|
||||
elif inputCategory in sections['HeadPhones'].values():
|
||||
Logger.info("MAIN: Calling HeadPhones to post-process: %s", inputName)
|
||||
result = autoProcessMusic().process(inputDirectory, inputName, status, clientAgent, inputCategory)
|
||||
elif inputCategory in mlCategory:
|
||||
elif inputCategory in sections['Mylar'].values():
|
||||
Logger.info("MAIN: Calling Mylar to post-process: %s", inputName)
|
||||
result = autoProcessComics().processEpisode(outputDestination, inputName, status, clientAgent, inputCategory)
|
||||
elif inputCategory in gzCategory:
|
||||
elif inputCategory in sections['Gamez'].values():
|
||||
Logger.info("MAIN: Calling Gamez to post-process: %s", inputName)
|
||||
result = autoProcessGames().process(outputDestination, inputName, status, clientAgent, inputCategory)
|
||||
|
||||
|
@ -417,58 +406,49 @@ if __name__ == "__main__":
|
|||
WakeUp()
|
||||
|
||||
# EXAMPLE VALUES:
|
||||
clientAgent = config().get("Torrent", "clientAgent") # utorrent | deluge | transmission | rtorrent | other
|
||||
useLink_in = config().get("Torrent", "useLink") # no | hard | sym
|
||||
outputDirectory = config().get("Torrent", "outputDirectory") # /abs/path/to/complete/
|
||||
categories = (config().get("Torrent", "categories")).split(',') # music,music_videos,pictures,software
|
||||
noFlatten = (config().get("Torrent", "noFlatten")).split(',')
|
||||
clientAgent = config()["Torrent"]["clientAgent"] # utorrent | deluge | transmission | rtorrent | other
|
||||
useLink_in = config()["Torrent"]["useLink"] # no | hard | sym
|
||||
outputDirectory = config()["Torrent"]["outputDirectory"] # /abs/path/to/complete/
|
||||
categories = (config()["Torrent"]["categories"]) # music,music_videos,pictures,software
|
||||
noFlatten = (config()["Torrent"]["noFlatten"])
|
||||
|
||||
uTorrentWEBui = config().get("Torrent", "uTorrentWEBui") # http://localhost:8090/gui/
|
||||
uTorrentUSR = config().get("Torrent", "uTorrentUSR") # mysecretusr
|
||||
uTorrentPWD = config().get("Torrent", "uTorrentPWD") # mysecretpwr
|
||||
uTorrentWEBui = config()["Torrent"]["uTorrentWEBui"] # http://localhost:8090/gui/
|
||||
uTorrentUSR = config()["Torrent"]["uTorrentUSR"] # mysecretusr
|
||||
uTorrentPWD = config()["Torrent"]["uTorrentPWD"] # mysecretpwr
|
||||
|
||||
TransmissionHost = config().get("Torrent", "TransmissionHost") # localhost
|
||||
TransmissionPort = config().get("Torrent", "TransmissionPort") # 8084
|
||||
TransmissionUSR = config().get("Torrent", "TransmissionUSR") # mysecretusr
|
||||
TransmissionPWD = config().get("Torrent", "TransmissionPWD") # mysecretpwr
|
||||
TransmissionHost = config()["Torrent"]["TransmissionHost"] # localhost
|
||||
TransmissionPort = config()["Torrent"]["TransmissionPort"] # 8084
|
||||
TransmissionUSR = config()["Torrent"]["TransmissionUSR"] # mysecretusr
|
||||
TransmissionPWD = config()["Torrent"]["TransmissionPWD"] # mysecretpwr
|
||||
|
||||
DelugeHost = config().get("Torrent", "DelugeHost") # localhost
|
||||
DelugePort = config().get("Torrent", "DelugePort") # 8084
|
||||
DelugeUSR = config().get("Torrent", "DelugeUSR") # mysecretusr
|
||||
DelugePWD = config().get("Torrent", "DelugePWD") # mysecretpwr
|
||||
DelugeHost = config()["Torrent"]["DelugeHost"] # localhost
|
||||
DelugePort = config()["Torrent"]["DelugePort"] # 8084
|
||||
DelugeUSR = config()["Torrent"]["DelugeUSR"] # mysecretusr
|
||||
DelugePWD = config()["Torrent"]["DelugePWD"] # mysecretpwr
|
||||
|
||||
deleteOriginal = int(config().get("Torrent", "deleteOriginal")) # 0
|
||||
forceClean = int(config().get("Torrent", "forceClean")) # 0
|
||||
deleteOriginal = int(config()["Torrent"]["deleteOriginal"]) # 0
|
||||
forceClean = int(config()["Torrent"]["forceClean"]) # 0
|
||||
|
||||
compressedContainer = (config().get("Extensions", "compressedExtensions")).split(',') # .zip,.rar,.7z
|
||||
mediaContainer = (config().get("Extensions", "mediaExtensions")).split(',') # .mkv,.avi,.divx
|
||||
metaContainer = (config().get("Extensions", "metaExtensions")).split(',') # .nfo,.sub,.srt
|
||||
minSampleSize = int(config().get("Extensions", "minSampleSize")) # 200 (in MB)
|
||||
SampleIDs = (config().get("Extensions", "SampleIDs")).split(',') # sample,-s.
|
||||
compressedContainer = (config()["Extensions"]["compressedExtensions"]) # .zip,.rar,.7z
|
||||
mediaContainer = (config()["Extensions"]["mediaExtensions"]) # .mkv,.avi,.divx
|
||||
metaContainer = (config()["Extensions"]["metaExtensions"]) # .nfo,.sub,.srt
|
||||
minSampleSize = int(config()["Extensions"]["minSampleSize"]) # 200 (in MB)
|
||||
SampleIDs = (config()["Extensions"]["SampleIDs"]) # sample,-s.
|
||||
|
||||
Torrent_NoLink = int(config().get("SickBeard", "Torrent_NoLink")) # 0
|
||||
cpsCategory = (config().get("CouchPotato", "cpsCategory")).split(',') # movie
|
||||
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') # tv
|
||||
hpCategory = (config().get("HeadPhones", "hpCategory")).split(',') # music
|
||||
mlCategory = (config().get("Mylar", "mlCategory")).split(',') # comics
|
||||
gzCategory = (config().get("Gamez", "gzCategory")).split(',') # games
|
||||
categories.extend(cpsCategory)
|
||||
categories.extend(sbCategory)
|
||||
categories.extend(hpCategory)
|
||||
categories.extend(mlCategory)
|
||||
categories.extend(gzCategory)
|
||||
sections = config.get_categories(["CouchPotato", "SickBeard", "HeadPhones", "Mylar", "Gamez"])
|
||||
categories += list(chain.from_iterable(sections.values()))
|
||||
|
||||
user_script_categories = config().get("UserScript", "user_script_categories").split(',') # NONE
|
||||
user_script_categories = config()["UserScript"]["user_script_categories"] # NONE
|
||||
if not "NONE" in user_script_categories:
|
||||
user_script_mediaExtensions = (config().get("UserScript", "user_script_mediaExtensions")).split(',')
|
||||
user_script = config().get("UserScript", "user_script_path")
|
||||
user_script_param = (config().get("UserScript", "user_script_param")).split(',')
|
||||
user_script_successCodes = (config().get("UserScript", "user_script_successCodes")).split(',')
|
||||
user_script_clean = int(config().get("UserScript", "user_script_clean"))
|
||||
user_delay = int(config().get("UserScript", "delay"))
|
||||
user_script_runOnce = int(config().get("UserScript", "user_script_runOnce"))
|
||||
user_script_mediaExtensions = (config()["UserScript"]["user_script_mediaExtensions"])
|
||||
user_script = config()["UserScript"]["user_script_path"]
|
||||
user_script_param = (config()["UserScript"]["user_script_param"])
|
||||
user_script_successCodes = (config()["UserScript"]["user_script_successCodes"])
|
||||
user_script_clean = int(config()["UserScript"]["user_script_clean"])
|
||||
user_delay = int(config()["UserScript"]["delay"])
|
||||
user_script_runOnce = int(config()["UserScript"]["user_script_runOnce"])
|
||||
|
||||
transcode = int(config().get("Transcoder", "transcode"))
|
||||
transcode = int(config()["Transcoder"]["transcode"])
|
||||
|
||||
n = 0
|
||||
for arg in sys.argv:
|
||||
|
|
|
@ -2,199 +2,174 @@
|
|||
# For more information, visit https://github.com/clinton-hall/nzbToMedia/wiki
|
||||
|
||||
[CouchPotato]
|
||||
#### autoProcessing for Movies
|
||||
#### cpsCategory - category that gets called for post-processing with CPS
|
||||
cpsCategory = movie
|
||||
apikey =
|
||||
host = localhost
|
||||
port = 5050
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
ssl = 0
|
||||
web_root =
|
||||
delay = 65
|
||||
TimePerGiB = 60
|
||||
method = renamer
|
||||
delete_failed = 0
|
||||
wait_for = 2
|
||||
#### Set to 1 if CouchPotatoServer is running on a different server to your NZB client
|
||||
remoteCPS = 0
|
||||
watch_dir =
|
||||
#### autoProcessing for Movies
|
||||
#### movie - category that gets called for post-processing with CPS
|
||||
[[movie]]
|
||||
apikey =
|
||||
host = localhost
|
||||
port = 5050
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
ssl = 0
|
||||
web_root =
|
||||
delay = 65
|
||||
TimePerGiB = 60
|
||||
method = renamer
|
||||
delete_failed = 0
|
||||
wait_for = 2
|
||||
#### Set to 1 if CouchPotatoServer is running on a different server to your NZB client
|
||||
remoteCPS = 0
|
||||
watch_dir =
|
||||
|
||||
[SickBeard]
|
||||
#### autoProcessing for TV Series
|
||||
#### sbCategory - category that gets called for post-processing with SB
|
||||
sbCategory = tv
|
||||
host = localhost
|
||||
port = 8081
|
||||
username =
|
||||
password =
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
web_root =
|
||||
ssl = 0
|
||||
delay = 0
|
||||
TimePerGiB = 60
|
||||
watch_dir =
|
||||
fork = auto
|
||||
delete_failed = 0
|
||||
nzbExtractionBy = Downloader
|
||||
Torrent_NoLink = 0
|
||||
process_method =
|
||||
#### autoProcessing for TV Series
|
||||
#### tv - category that gets called for post-processing with SB
|
||||
[[tv]]
|
||||
host = localhost
|
||||
port = 8081
|
||||
username =
|
||||
password =
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
web_root =
|
||||
ssl = 0
|
||||
delay = 0
|
||||
TimePerGiB = 60
|
||||
watch_dir =
|
||||
fork = auto
|
||||
delete_failed = 0
|
||||
nzbExtractionBy = Downloader
|
||||
Torrent_NoLink = 0
|
||||
process_method =
|
||||
|
||||
[HeadPhones]
|
||||
#### autoProcessing for Music
|
||||
#### hpCategory - category that gets called for post-processing with HP
|
||||
hpCategory = music
|
||||
apikey =
|
||||
host = localhost
|
||||
port = 8181
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
ssl = 0
|
||||
web_root =
|
||||
delay = 65
|
||||
TimePerGiB = 60
|
||||
watch_dir =
|
||||
#### autoProcessing for Music
|
||||
#### music - category that gets called for post-processing with HP
|
||||
[[music]]
|
||||
apikey =
|
||||
host = localhost
|
||||
port = 8181
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
ssl = 0
|
||||
web_root =
|
||||
delay = 65
|
||||
TimePerGiB = 60
|
||||
watch_dir =
|
||||
|
||||
[Mylar]
|
||||
#### autoProcessing for Comics
|
||||
#### mlCategory - category that gets called for post-processing with Mylar
|
||||
mlCategory = comics
|
||||
host = localhost
|
||||
port= 8090
|
||||
username=
|
||||
password=
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
web_root=
|
||||
ssl=0
|
||||
watch_dir =
|
||||
#### autoProcessing for Comics
|
||||
#### comics - category that gets called for post-processing with Mylar
|
||||
[[comics]]
|
||||
host = localhost
|
||||
port= 8090
|
||||
username=
|
||||
password=
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
web_root=
|
||||
ssl=0
|
||||
watch_dir =
|
||||
|
||||
[Gamez]
|
||||
#### autoProcessing for Games
|
||||
#### gzCategory - category that gets called for post-processing with Gamez
|
||||
gzCategory = games
|
||||
apikey =
|
||||
host = localhost
|
||||
port = 8085
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
ssl = 0
|
||||
web_root =
|
||||
watch_dir =
|
||||
#### autoProcessing for Games
|
||||
#### games - category that gets called for post-processing with Gamez
|
||||
[[games]]
|
||||
apikey =
|
||||
host = localhost
|
||||
port = 8085
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
ssl = 0
|
||||
web_root =
|
||||
watch_dir =
|
||||
|
||||
[Torrent]
|
||||
###### clientAgent - Supported clients: utorrent, transmission, deluge, rtorrent, other
|
||||
clientAgent = other
|
||||
###### useLink - Set to hard for physical links, sym for symbolic links, move to move, and no to not use links (copy)
|
||||
useLink = hard
|
||||
###### outputDirectory - Default output directory (categories will be appended as sub directory to outputDirectory)
|
||||
outputDirectory = /abs/path/to/complete/
|
||||
###### Other categories/labels defined for your downloader. Does not include CouchPotato, SickBeard, HeadPhones, Mylar categories.
|
||||
categories = music_videos,pictures,software,manual
|
||||
###### A list of categories that you don't want to be flattened (i.e preserve the directory structure when copying/linking.
|
||||
noFlatten = pictures,manual
|
||||
###### uTorrent Hardlink solution (You must edit this if your using TorrentToMedia.py with uTorrent)
|
||||
uTorrentWEBui = http://localhost:8090/gui/
|
||||
uTorrentUSR = your username
|
||||
uTorrentPWD = your password
|
||||
###### Transmission (You must edit this if your using TorrentToMedia.py with uTorrent)
|
||||
TransmissionHost = localhost
|
||||
TransmissionPort = 8084
|
||||
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)
|
||||
DelugeHost = localhost
|
||||
DelugePort = 58846
|
||||
DelugeUSR = your username
|
||||
DelugePWD = your password
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
deleteOriginal = 0
|
||||
forceClean = 0
|
||||
###### clientAgent - Supported clients: utorrent, transmission, deluge, rtorrent, other
|
||||
clientAgent = other
|
||||
###### useLink - Set to hard for physical links, sym for symbolic links, move to move, and no to not use links (copy)
|
||||
useLink = hard
|
||||
###### outputDirectory - Default output directory (categories will be appended as sub directory to outputDirectory)
|
||||
outputDirectory = /abs/path/to/complete/
|
||||
###### Other categories/labels defined for your downloader. Does not include CouchPotato, SickBeard, HeadPhones, Mylar categories.
|
||||
categories = music_videos,pictures,software,manual
|
||||
###### A list of categories that you don't want to be flattened (i.e preserve the directory structure when copying/linking.
|
||||
noFlatten = pictures,manual
|
||||
###### uTorrent Hardlink solution (You must edit this if your using TorrentToMedia.py with uTorrent)
|
||||
uTorrentWEBui = http://localhost:8090/gui/
|
||||
uTorrentUSR = your username
|
||||
uTorrentPWD = your password
|
||||
###### Transmission (You must edit this if your using TorrentToMedia.py with uTorrent)
|
||||
TransmissionHost = localhost
|
||||
TransmissionPort = 8084
|
||||
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)
|
||||
DelugeHost = localhost
|
||||
DelugePort = 58846
|
||||
DelugeUSR = your username
|
||||
DelugePWD = your password
|
||||
###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
|
||||
deleteOriginal = 0
|
||||
forceClean = 0
|
||||
|
||||
[Extensions]
|
||||
compressedExtensions = .zip,.rar,.7z,.gz,.bz,.tar,.arj,.1,.01,.001
|
||||
mediaExtensions = .mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.m4v
|
||||
metaExtensions = .nfo,.sub,.srt,.jpg,.gif
|
||||
###### minSampleSize - Minimum required size to consider a media file not a sample file (in MB, eg 200mb)
|
||||
minSampleSize = 200
|
||||
###### SampleIDs - a list of common sample identifiers. Use SizeOnly to ignore this and delete all media files less than minSampleSize
|
||||
SampleIDs = sample,-s.
|
||||
compressedExtensions = .zip,.rar,.7z,.gz,.bz,.tar,.arj,.1,.01,.001
|
||||
mediaExtensions = .mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.m4v
|
||||
metaExtensions = .nfo,.sub,.srt,.jpg,.gif
|
||||
###### minSampleSize - Minimum required size to consider a media file not a sample file (in MB, eg 200mb)
|
||||
minSampleSize = 200
|
||||
###### SampleIDs - a list of common sample identifiers. Use SizeOnly to ignore this and delete all media files less than minSampleSize
|
||||
SampleIDs = sample,-s.
|
||||
|
||||
[Transcoder]
|
||||
transcode = 0
|
||||
###### duplicate =1 will cretae a new file. =0 will replace the original
|
||||
duplicate = 1
|
||||
# Only works on Linux. Highest priority is -20, lowest priority is 19.
|
||||
niceness = 0
|
||||
ignoreExtensions = .avi,.mkv,.mp4
|
||||
outputVideoExtension = .mp4
|
||||
outputVideoCodec = libx264
|
||||
outputVideoPreset = medium
|
||||
outputVideoFramerate = 24
|
||||
outputVideoBitrate = 800k
|
||||
outputAudioCodec = libmp3lame
|
||||
outputAudioBitrate = 128k
|
||||
outputSubtitleCodec =
|
||||
# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used.
|
||||
outputFastStart = 0
|
||||
# outputQualityPercent. used as -q:a value. 0 will disable this from being used.
|
||||
outputQualityPercent = 0
|
||||
transcode = 0
|
||||
###### duplicate =1 will cretae a new file. =0 will replace the original
|
||||
duplicate = 1
|
||||
# Only works on Linux. Highest priority is -20, lowest priority is 19.
|
||||
niceness = 0
|
||||
ignoreExtensions = .avi,.mkv,.mp4
|
||||
outputVideoExtension = .mp4
|
||||
outputVideoCodec = libx264
|
||||
outputVideoPreset = medium
|
||||
outputVideoFramerate = 24
|
||||
outputVideoBitrate = 800k
|
||||
outputAudioCodec = libmp3lame
|
||||
outputAudioBitrate = 128k
|
||||
outputSubtitleCodec =
|
||||
# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used.
|
||||
outputFastStart = 0
|
||||
# outputQualityPercent. used as -q:a value. 0 will disable this from being used.
|
||||
outputQualityPercent = 0
|
||||
|
||||
[WakeOnLan]
|
||||
###### set wake = 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) the host and port specified.
|
||||
wake = 0
|
||||
host = 192.168.1.37
|
||||
port = 80
|
||||
mac = 00:01:2e:2D:64:e1
|
||||
###### set wake = 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) the host and port specified.
|
||||
wake = 0
|
||||
host = 192.168.1.37
|
||||
port = 80
|
||||
mac = 00:01:2e:2D:64:e1
|
||||
|
||||
[UserScript]
|
||||
#Use user_script for uncategorized download?
|
||||
#Set the categories to use external script, comma separated.
|
||||
#Use "UNCAT" to process non-category downloads, and "ALL" for all. Set to "NONE" to disable external script.
|
||||
user_script_categories = NONE
|
||||
#What extension do you want to process? Specify all the extension, or use "ALL" to process all files.
|
||||
user_script_mediaExtensions = .mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg
|
||||
#Specify the path of the script
|
||||
user_script_path = /media/test/script/script.sh
|
||||
#Specify the argument(s) passed to script, comma separated in order.
|
||||
#for example FP,FN,DN, TN, TL for file path (absolute file name with path), file name, absolute directory name (with path), Torrent Name, Torrent Label/Category.
|
||||
#So the result is /media/test/script/script.sh FP FN DN TN TL. Add other arguments as needed eg -f, -r
|
||||
user_script_param = FN
|
||||
#Set user_script_runOnce = 0 to run for each file, or 1 to only run once (presumably on teh entire directory).
|
||||
user_script_runOnce = 0
|
||||
#Specify the successcodes returned by the user script as a comma separated list. Linux default is 0
|
||||
user_script_successCodes = 0
|
||||
#Clean after? Note that delay function is used to prevent possible mistake :) Delay is intended as seconds
|
||||
user_script_clean = 1
|
||||
delay = 120
|
||||
#Use user_script for uncategorized download?
|
||||
#Set the categories to use external script, comma separated.
|
||||
#Use "UNCAT" to process non-category downloads, and "ALL" for all. Set to "NONE" to disable external script.
|
||||
user_script_categories = NONE
|
||||
#What extension do you want to process? Specify all the extension, or use "ALL" to process all files.
|
||||
user_script_mediaExtensions = .mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg
|
||||
#Specify the path of the script
|
||||
user_script_path = /media/test/script/script.sh
|
||||
#Specify the argument(s) passed to script, comma separated in order.
|
||||
#for example FP,FN,DN, TN, TL for file path (absolute file name with path), file name, absolute directory name (with path), Torrent Name, Torrent Label/Category.
|
||||
#So the result is /media/test/script/script.sh FP FN DN TN TL. Add other arguments as needed eg -f, -r
|
||||
user_script_param = FN
|
||||
#Set user_script_runOnce = 0 to run for each file, or 1 to only run once (presumably on teh entire directory).
|
||||
user_script_runOnce = 0
|
||||
#Specify the successcodes returned by the user script as a comma separated list. Linux default is 0
|
||||
user_script_successCodes = 0
|
||||
#Clean after? Note that delay function is used to prevent possible mistake :) Delay is intended as seconds
|
||||
user_script_clean = 1
|
||||
delay = 120
|
||||
|
||||
[ASCII]
|
||||
#Set convert =1 if you want to convert any "foreign" characters to ASCII before passing to SB/CP etc. Default is disabled (0).
|
||||
convert = 0
|
||||
#Set convert =1 if you want to convert any "foreign" characters to ASCII before passing to SB/CP etc. Default is disabled (0).
|
||||
convert = 0
|
||||
|
||||
[passwords]
|
||||
# enter the full path to a text file containing passwords to be used for extraction attempts.
|
||||
# In the passwords file, every password should be on a new line
|
||||
PassWordFile =
|
||||
|
||||
# Logging configuration
|
||||
[loggers]
|
||||
keys = root
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = NOTSET
|
||||
handlers = console
|
||||
qualname =
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stdout,)
|
||||
level = INFO
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s|%(levelname)-7.7s %(message)s
|
||||
datefmt = %H:%M:%S
|
||||
# enter the full path to a text file containing passwords to be used for extraction attempts.
|
||||
# In the passwords file, every password should be on a new line
|
||||
PassWordFile =
|
2477
lib/configobj.py
Normal file
2477
lib/configobj.py
Normal file
File diff suppressed because it is too large
Load diff
1472
lib/validate.py
Normal file
1472
lib/validate.py
Normal file
File diff suppressed because it is too large
Load diff
23
logging.cfg
Normal file
23
logging.cfg
Normal file
|
@ -0,0 +1,23 @@
|
|||
[loggers]
|
||||
keys = root
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = NOTSET
|
||||
handlers = console
|
||||
qualname =
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stdout,)
|
||||
level = INFO
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s|%(levelname)-7.7s %(message)s
|
||||
datefmt = %H:%M:%S
|
|
@ -148,8 +148,8 @@ if migratecfg().migrate():
|
|||
else:
|
||||
sys.exit(-1)
|
||||
|
||||
# couchpotato category
|
||||
cpsCategory = (config().get("CouchPotato", "cpsCategory")).split(',') # movie
|
||||
# setup sections and categories
|
||||
categories = config.get_categories(["CouchPotato"])
|
||||
|
||||
WakeUp()
|
||||
|
||||
|
@ -239,10 +239,13 @@ else:
|
|||
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
||||
Logger.info("MAIN: Running autoProcessMovie as a manual run...")
|
||||
|
||||
for dirName in get_dirnames("CouchPotato", cpsCategory[0]):
|
||||
Logger.info("MAIN: Calling CouchPotato to post-process: %s", dirName)
|
||||
result = autoProcessMovie().process(dirName, dirName, 0)
|
||||
if result != 0: break
|
||||
for section, category in categories.items():
|
||||
for dirName in get_dirnames(section, category):
|
||||
Logger.info("MAIN: Calling " + section + ":" + category + " to post-process: %s", dirName)
|
||||
results = autoProcessMovie().process(dirName, dirName, 0)
|
||||
if results != 0:
|
||||
result = 1
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessMovie script.")
|
||||
|
||||
if result == 0:
|
||||
Logger.info("MAIN: The autoProcessMovie script completed successfully.")
|
||||
|
|
|
@ -84,7 +84,7 @@ else:
|
|||
sys.exit(-1)
|
||||
|
||||
# gamez category
|
||||
gzCategory = (config().get("Gamez", "gzCategory")).split(',') # gamez
|
||||
categories = config.get_categories(['Gamez'])
|
||||
|
||||
WakeUp()
|
||||
|
||||
|
@ -162,13 +162,17 @@ elif len(sys.argv) >= config.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = autoProcessGames().process(sys.argv[1], sys.argv[3], sys.argv[7])
|
||||
else:
|
||||
result = 0
|
||||
|
||||
Logger.warn("MAIN: Invalid number of arguments received from client. Exiting")
|
||||
Logger.info("MAIN: Running autoProcessGames as a manual run...")
|
||||
|
||||
for dirName in get_dirnames("Gamez", gzCategory[0]):
|
||||
Logger.info("MAIN: Calling Gamez to post-process: %s", dirName)
|
||||
result = autoProcessGames().process(dirName, dirName, 0)
|
||||
if result != 0: break
|
||||
for section, category in categories.items():
|
||||
for dirName in get_dirnames(section, category):
|
||||
Logger.info("MAIN: Calling " + section + ":" + category + " to post-process: %s", dirName)
|
||||
results = autoProcessGames().process(dirName, dirName, 0)
|
||||
if results != 0:
|
||||
result = 1
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessGames script.")
|
||||
|
||||
if result == 0:
|
||||
Logger.info("MAIN: The autoProcessGames script completed successfully.")
|
||||
|
|
|
@ -95,8 +95,9 @@ if migratecfg().migrate():
|
|||
Logger.info("MAIN: Loading config from %s", config.CONFIG_FILE)
|
||||
else:
|
||||
sys.exit(-1)
|
||||
|
||||
# headphones category
|
||||
hpCategory = (config().get("HeadPhones", "hpCategory")).split(',') # music
|
||||
categories = config.get_categories(["HeadPhones"])
|
||||
|
||||
WakeUp()
|
||||
|
||||
|
@ -178,10 +179,13 @@ else:
|
|||
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
||||
Logger.info("MAIN: Running autoProcessMusic as a manual run...")
|
||||
|
||||
for dirName in get_dirnames("HeadPhones", hpCategory[0]):
|
||||
Logger.info("MAIN: Calling Headphones to post-process: %s", dirName)
|
||||
result = result = autoProcessMusic().process(dirName, dirName, 0)
|
||||
if result != 0: break
|
||||
for section, category in categories.items():
|
||||
for dirName in get_dirnames(section, category):
|
||||
Logger.info("MAIN: Calling " + section + ":" + category + " to post-process: %s", dirName)
|
||||
results = autoProcessMusic().process(dirName, dirName, 0)
|
||||
if results != 0:
|
||||
result = 1
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessMusic script.")
|
||||
|
||||
if result == 0:
|
||||
Logger.info("MAIN: The autoProcessMusic script completed successfully.")
|
||||
|
|
|
@ -288,7 +288,7 @@ from nzbtomedia.nzbToMediaUtil import nzbtomedia_configure_logging, WakeUp, get_
|
|||
|
||||
# post-processing
|
||||
def process(nzbDir, inputName=None, status=0, clientAgent='manual', download_id=None, inputCategory=None):
|
||||
if inputCategory in cpsCategory:
|
||||
if inputCategory in sections["CouchPotato"]:
|
||||
if isinstance(nzbDir, list):
|
||||
for dirName in nzbDir:
|
||||
Logger.info("MAIN: Calling CouchPotatoServer to post-process: %s", inputName)
|
||||
|
@ -298,7 +298,7 @@ def process(nzbDir, inputName=None, status=0, clientAgent='manual', download_id=
|
|||
else:
|
||||
Logger.info("MAIN: Calling CouchPotatoServer to post-process: %s", inputName)
|
||||
return autoProcessMovie().process(nzbDir, inputName, status, clientAgent, download_id, inputCategory)
|
||||
elif inputCategory in sbCategory:
|
||||
elif inputCategory in sections["SickBeard"]:
|
||||
if isinstance(nzbDir, list):
|
||||
for dirName in nzbDir:
|
||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||
|
@ -308,7 +308,7 @@ def process(nzbDir, inputName=None, status=0, clientAgent='manual', download_id=
|
|||
else:
|
||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||
return autoProcessTV().processEpisode(nzbDir, inputName, status, clientAgent, inputCategory)
|
||||
elif inputCategory in hpCategory:
|
||||
elif inputCategory in sections["HeadPhones"]:
|
||||
if isinstance(nzbDir, list):
|
||||
for dirName in nzbDir:
|
||||
Logger.info("MAIN: Calling Headphones to post-process: %s", dirName)
|
||||
|
@ -318,7 +318,7 @@ def process(nzbDir, inputName=None, status=0, clientAgent='manual', download_id=
|
|||
else:
|
||||
Logger.info("MAIN: Calling HeadPhones to post-process: %s", inputName)
|
||||
return autoProcessMusic().process(nzbDir, inputName, status, clientAgent, inputCategory)
|
||||
elif inputCategory in mlCategory:
|
||||
elif inputCategory in sections["Mylar"]:
|
||||
if isinstance(nzbDir, list):
|
||||
for dirName in nzbDir:
|
||||
Logger.info("MAIN: Calling Mylar to post-process: %s", dirName)
|
||||
|
@ -328,7 +328,7 @@ def process(nzbDir, inputName=None, status=0, clientAgent='manual', download_id=
|
|||
else:
|
||||
Logger.info("MAIN: Calling Mylar to post-process: %s", inputName)
|
||||
return autoProcessComics().processEpisode(nzbDir, inputName, status, clientAgent, inputCategory)
|
||||
elif inputCategory in gzCategory:
|
||||
elif inputCategory in sections["Gamez"]:
|
||||
if isinstance(nzbDir, list):
|
||||
for dirName in nzbDir:
|
||||
Logger.info("MAIN: Calling Gamez to post-process: %s", dirName)
|
||||
|
@ -361,12 +361,8 @@ else:
|
|||
print("Unable to find " + config.CONFIG_FILE + " or " + config.SAMPLE_CONFIG_FILE)
|
||||
sys.exit(-1)
|
||||
|
||||
# setup categories
|
||||
cpsCategory = (config().get("CouchPotato", "cpsCategory")).split(',') or []
|
||||
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') or []
|
||||
hpCategory = (config().get("HeadPhones", "hpCategory")).split(',') or []
|
||||
mlCategory = (config().get("Mylar", "mlCategory")).split(',') or []
|
||||
gzCategory = (config().get("Gamez", "gzCategory")).split(',') or []
|
||||
# setup sections and categories
|
||||
sections = config.get_categories(["CouchPotato","SickBeard","HeadPhones","Mylar","Gamez"])
|
||||
|
||||
WakeUp()
|
||||
|
||||
|
@ -453,31 +449,16 @@ elif len(sys.argv) >= config.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = process(sys.argv[1], inputName=sys.argv[2], status=sys.argv[7], inputCategory=sys.argv[5], clientAgent = "sabnzbd", download_id='')
|
||||
if result != 0:Logger.info("MAIN: A problem was reported in the autoProcess* script.")
|
||||
else:
|
||||
# only CPS and SB supports this manual run for now.
|
||||
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
||||
|
||||
Logger.info("MAIN: Running autoProcessMovie as a manual run...")
|
||||
if process(get_dirnames("CouchPotato", cpsCategory[0]), inputName=get_dirnames("CouchPotato", cpsCategory[0]), status=0, inputCategory=cpsCategory[0], clientAgent = "manual", download_id='') != 0:
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessMovie script.")
|
||||
|
||||
Logger.info("MAIN: Running autoProcessTV as a manual run...")
|
||||
if process(get_dirnames("SickBeard", sbCategory[0]), inputName=get_dirnames("SickBeard", sbCategory[0]), status=0, clientAgent = "manual", inputCategory=sbCategory[0]) != 0:
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessTV script.")
|
||||
|
||||
Logger.info("MAIN: Running autoProcessMusic as a manual run...")
|
||||
if process(get_dirnames("HeadPhones", hpCategory[0]), inputName=get_dirnames("HeadPhones", hpCategory[0]), status=0, clientAgent = "manual", inputCategory=hpCategory[0]) != 0:
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessMusic script.")
|
||||
|
||||
Logger.info("MAIN: Running autoProcessComics as a manual run...")
|
||||
if process(get_dirnames("Mylar", mlCategory[0]), inputName=get_dirnames("Mylar", mlCategory[0]), status=0,clientAgent="manual", inputCategory=mlCategory[0]) != 0:
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessComics script.")
|
||||
|
||||
Logger.info("MAIN: Running autoProcessGames as a manual run...")
|
||||
if process(get_dirnames("Gamez", gzCategory[0]), inputName=get_dirnames("Gamez", gzCategory[0]), status=0,clientAgent="manual", inputCategory=gzCategory[0]) != 0:
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessGames script.")
|
||||
|
||||
result = 0
|
||||
|
||||
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
||||
for section, categories in sections.items():
|
||||
for category in categories:
|
||||
dirnames = get_dirnames(section, category)
|
||||
Logger.info("MAIN: Running " + section + ":" + category + " as a manual run...")
|
||||
if process(dirnames, inputName=dirnames, status=0, inputCategory=category, clientAgent = "manual") != 0:
|
||||
Logger.info("MAIN: A problem was reported when trying to manually run " + section + ":" + category + ".")
|
||||
|
||||
if result == 0:
|
||||
Logger.info("MAIN: The nzbToMedia script completed successfully.")
|
||||
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
||||
|
|
|
@ -89,7 +89,7 @@ else:
|
|||
sys.exit(-1)
|
||||
|
||||
# mylar category
|
||||
mlCategory = (config().get("Mylar", "mlCategory")).split(',') # tv
|
||||
categories = config.get_categories(["Mylar"])
|
||||
|
||||
WakeUp()
|
||||
|
||||
|
@ -171,10 +171,13 @@ else:
|
|||
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
||||
Logger.info("MAIN: Running autoProcessComics as a manual run...")
|
||||
|
||||
for dirName in get_dirnames("Mylar", mlCategory[0]):
|
||||
Logger.info("MAIN: Calling Mylar to post-process: %s", dirName)
|
||||
result = autoProcessComics().processEpisode(dirName, dirName, 0)
|
||||
if result != 0: break
|
||||
for section, category in categories.items():
|
||||
for dirName in get_dirnames(section, category):
|
||||
Logger.info("MAIN: Calling " + section + ":" + category + " to post-process: %s", dirName)
|
||||
results = autoProcessComics().processEpisode(dirName, dirName, 0)
|
||||
if results != 0:
|
||||
result = 1
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessComics script.")
|
||||
|
||||
if result == 0:
|
||||
Logger.info("MAIN: The autoProcessComics script completed successfully.")
|
||||
|
|
|
@ -151,7 +151,7 @@ else:
|
|||
sys.exit(-1)
|
||||
|
||||
# sickbeard category
|
||||
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') # tv
|
||||
categories = config.get_categories(["SickBeard"])
|
||||
|
||||
WakeUp()
|
||||
|
||||
|
@ -231,15 +231,18 @@ elif len(sys.argv) >= config.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
clientAgent = "sabnzbd"
|
||||
result = autoProcessTV().processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
||||
else:
|
||||
result = 0
|
||||
|
||||
Logger.debug("MAIN: Invalid number of arguments received from client.")
|
||||
Logger.info("MAIN: Running autoProcessTV as a manual run...")
|
||||
|
||||
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') # tv
|
||||
for section, category in categories.items():
|
||||
for dirName in get_dirnames(section, category):
|
||||
Logger.info("MAIN: Calling " + section + ":" + category + " to post-process: %s", dirName)
|
||||
results = autoProcessTV().processEpisode(dirName, dirName, 0)
|
||||
if results != 0:
|
||||
result = 1
|
||||
for dirName in get_dirnames("SickBeard", sbCategory[0]):
|
||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", dirName)
|
||||
result = autoProcessTV().processEpisode(dirName, dirName, 0)
|
||||
if result != 0: break
|
||||
Logger.info("MAIN: A problem was reported in the autoProcessTV script.")
|
||||
|
||||
if result == 0:
|
||||
Logger.info("MAIN: The autoProcessTV script completed successfully.")
|
||||
|
|
|
@ -36,22 +36,22 @@ class Transcoder:
|
|||
Logger.error("You need an autoProcessMedia.cfg file - did you rename and edit the .sample?")
|
||||
return 1 # failure
|
||||
|
||||
mediaContainer = (config().get("Extensions", "mediaExtensions")).split(',')
|
||||
duplicate = int(config().get("Transcoder", "duplicate"))
|
||||
ignoreExtensions = (config().get("Transcoder", "ignoreExtensions")).split(',')
|
||||
outputVideoExtension = config().get("Transcoder", "outputVideoExtension").strip()
|
||||
outputVideoCodec = config().get("Transcoder", "outputVideoCodec").strip()
|
||||
outputVideoPreset = config().get("Transcoder", "outputVideoPreset").strip()
|
||||
outputVideoFramerate = config().get("Transcoder", "outputVideoFramerate").strip()
|
||||
outputVideoBitrate = config().get("Transcoder", "outputVideoBitrate").strip()
|
||||
outputAudioCodec = config().get("Transcoder", "outputAudioCodec").strip()
|
||||
outputAudioBitrate = config().get("Transcoder", "outputAudioBitrate").strip()
|
||||
outputSubtitleCodec = config().get("Transcoder", "outputSubtitleCodec").strip()
|
||||
outputFastStart = int(config().get("Transcoder", "outputFastStart"))
|
||||
outputQualityPercent = int(config().get("Transcoder", "outputQualityPercent"))
|
||||
mediaContainer = (config()["Transcoder"]["duplicate"])
|
||||
duplicate = int(config()["Transcoder"]["duplicate"])
|
||||
ignoreExtensions = (config()["Transcoder"]["ignoreExtensions"])
|
||||
outputVideoExtension = config()["Transcoder"]["outputVideoExtension"].strip()
|
||||
outputVideoCodec = config()["Transcoder"]["outputVideoCodec"].strip()
|
||||
outputVideoPreset = config()["Transcoder"]["outputVideoPreset"].strip()
|
||||
outputVideoFramerate = config()["Transcoder"]["outputVideoFramerate"].strip()
|
||||
outputVideoBitrate = config()["Transcoder"]["outputVideoBitrate"].strip()
|
||||
outputAudioCodec = config()["Transcoder"]["outputAudioCodec"].strip()
|
||||
outputAudioBitrate = config()["Transcoder"]["outputAudioBitrate"].strip()
|
||||
outputSubtitleCodec = config()["Transcoder"]["outputSubtitleCodec"].strip()
|
||||
outputFastStart = int(config()["Transcoder"]["outputFastStart"])
|
||||
outputQualityPercent = int(config()["Transcoder"]["outputQualityPercent"])
|
||||
|
||||
niceness = None
|
||||
if useNiceness:niceness = int(config().get("Transcoder", "niceness"))
|
||||
if useNiceness:niceness = int(config()["Transcoder"]["niceness"])
|
||||
|
||||
map(lambda ext: ext.strip(), mediaContainer)
|
||||
map(lambda ext: ext.strip(), ignoreExtensions)
|
||||
|
|
|
@ -19,25 +19,23 @@ class autoProcessComics:
|
|||
Logger.info("Loading config from %s", config.CONFIG_FILE)
|
||||
|
||||
section = "Mylar"
|
||||
if inputCategory != None and config().has_section(inputCategory):
|
||||
section = inputCategory
|
||||
host = config().get(section, "host")
|
||||
port = config().get(section, "port")
|
||||
username = config().get(section, "username")
|
||||
password = config().get(section, "password")
|
||||
host = config()[section][inputCategory]["host"]
|
||||
port = config()[section][inputCategory]["port"]
|
||||
username = config()[section][inputCategory]["username"]
|
||||
password = config()[section][inputCategory]["password"]
|
||||
try:
|
||||
ssl = int(config().get(section, "ssl"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
ssl = int(config()[section][inputCategory]["ssl"])
|
||||
except:
|
||||
ssl = 0
|
||||
|
||||
try:
|
||||
web_root = config().get(section, "web_root")
|
||||
except config.NoOptionError:
|
||||
web_root = config()[section][inputCategory]["web_root"]
|
||||
except:
|
||||
web_root = ""
|
||||
|
||||
try:
|
||||
watch_dir = config().get(section, "watch_dir")
|
||||
except config.NoOptionError:
|
||||
watch_dir = config()[section][inputCategory]["watch_dir"]
|
||||
except:
|
||||
watch_dir = ""
|
||||
params = {}
|
||||
|
||||
|
|
|
@ -20,21 +20,18 @@ class autoProcessGames:
|
|||
status = int(status)
|
||||
|
||||
section = "Gamez"
|
||||
if inputCategory != None and config().has_section(inputCategory):
|
||||
section = inputCategory
|
||||
|
||||
host = config().get(section, "host")
|
||||
port = config().get(section, "port")
|
||||
apikey = config().get(section, "apikey")
|
||||
host = config()[section][inputCategory]["host"]
|
||||
port = config()[section][inputCategory]["port"]
|
||||
apikey = config()[section][inputCategory]["apikey"]
|
||||
|
||||
try:
|
||||
ssl = int(config().get(section, "ssl"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
ssl = int(config()[section][inputCategory]["ssl"])
|
||||
except:
|
||||
ssl = 0
|
||||
|
||||
try:
|
||||
web_root = config().get(section, "web_root")
|
||||
except config.NoOptionError:
|
||||
web_root = config()[section][inputCategory]["web_root"]
|
||||
except:
|
||||
web_root = ""
|
||||
|
||||
if ssl:
|
||||
|
|
|
@ -173,35 +173,32 @@ class autoProcessMovie:
|
|||
status = int(status)
|
||||
|
||||
section = "CouchPotato"
|
||||
if inputCategory != None and config().has_section(inputCategory):
|
||||
section = inputCategory
|
||||
|
||||
host = config().get(section, "host")
|
||||
port = config().get(section, "port")
|
||||
apikey = config().get(section, "apikey")
|
||||
delay = float(config().get(section, "delay"))
|
||||
method = config().get(section, "method")
|
||||
delete_failed = int(config().get(section, "delete_failed"))
|
||||
wait_for = int(config().get(section, "wait_for"))
|
||||
host = config()[section][inputCategory]["host"]
|
||||
port = config()[section][inputCategory]["port"]
|
||||
apikey = config()[section][inputCategory]["apikey"]
|
||||
delay = float(config()[section][inputCategory]["delay"])
|
||||
method = config()[section][inputCategory]["method"]
|
||||
delete_failed = int(config()[section][inputCategory]["delete_failed"])
|
||||
wait_for = int(config()[section][inputCategory]["wait_for"])
|
||||
try:
|
||||
TimePerGiB = int(config().get(section, "TimePerGiB"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
TimePerGiB = int(config()[section][inputCategory]["TimePerGiB"])
|
||||
except:
|
||||
TimePerGiB = 60 # note, if using Network to transfer on 100Mbit LAN, expect ~ 600 MB/minute.
|
||||
try:
|
||||
ssl = int(config().get(section, "ssl"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
ssl = int(config()[section][inputCategory]["ssl"])
|
||||
except:
|
||||
ssl = 0
|
||||
try:
|
||||
web_root = config().get(section, "web_root")
|
||||
except config.NoOptionError:
|
||||
web_root = config()[section][inputCategory]["web_root"]
|
||||
except:
|
||||
web_root = ""
|
||||
try:
|
||||
transcode = int(config().get("Transcoder", "transcode"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
transcode = int(config()["Transcoder"]["transcode"])
|
||||
except:
|
||||
transcode = 0
|
||||
try:
|
||||
remoteCPS = int(config().get(section, "remoteCPS"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
remoteCPS = int(config()[section][inputCategory]["remoteCPS"])
|
||||
except:
|
||||
remoteCPS = 0
|
||||
|
||||
nzbName = str(nzbName) # make sure it is a string
|
||||
|
|
|
@ -21,25 +21,22 @@ class autoProcessMusic:
|
|||
status = int(status)
|
||||
|
||||
section = "HeadPhones"
|
||||
if inputCategory != None and config().has_section(inputCategory):
|
||||
section = inputCategory
|
||||
|
||||
host = config().get(section, "host")
|
||||
port = config().get(section, "port")
|
||||
apikey = config().get(section, "apikey")
|
||||
delay = float(config().get(section, "delay"))
|
||||
host = config()[section][inputCategory]["host"]
|
||||
port = config()[section][inputCategory]["port"]
|
||||
apikey = config()[section][inputCategory]["apikey"]
|
||||
delay = float(config()[section][inputCategory]["delay"])
|
||||
|
||||
try:
|
||||
ssl = int(config().get(section, "ssl"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
ssl = int(config()[section][inputCategory]["ssl"])
|
||||
except:
|
||||
ssl = 0
|
||||
try:
|
||||
web_root = config().get(section, "web_root")
|
||||
except config.NoOptionError:
|
||||
web_root = config()[section][inputCategory]["web_root"]
|
||||
except:
|
||||
web_root = ""
|
||||
try:
|
||||
TimePerGiB = int(config().get(section, "TimePerGiB"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
TimePerGiB = int(config()[section][inputCategory]["TimePerGiB"])
|
||||
except:
|
||||
TimePerGiB = 60 # note, if using Network to transfer on 100Mbit LAN, expect ~ 600 MB/minute.
|
||||
if ssl:
|
||||
protocol = "https://"
|
||||
|
|
|
@ -26,62 +26,59 @@ class autoProcessTV:
|
|||
status = int(failed)
|
||||
|
||||
section = "SickBeard"
|
||||
if inputCategory != None and config().has_section(inputCategory):
|
||||
section = inputCategory
|
||||
|
||||
host = config().get(section, "host")
|
||||
port = config().get(section, "port")
|
||||
username = config().get(section, "username")
|
||||
password = config().get(section, "password")
|
||||
host = config()[section][inputCategory]["host"]
|
||||
port = config()[section][inputCategory]["port"]
|
||||
username = config()[section][inputCategory]["username"]
|
||||
password = config()[section][inputCategory]["password"]
|
||||
|
||||
try:
|
||||
ssl = int(config().get(section, "ssl"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
ssl = int(config()[section][inputCategory]["ssl"])
|
||||
except:
|
||||
ssl = 0
|
||||
try:
|
||||
web_root = config().get(section, "web_root")
|
||||
except config.NoOptionError:
|
||||
web_root = config()[section][inputCategory]["web_root"]
|
||||
except:
|
||||
web_root = ""
|
||||
try:
|
||||
watch_dir = config().get(section, "watch_dir")
|
||||
except config.NoOptionError:
|
||||
watch_dir = config()[section][inputCategory]["watch_dir"]
|
||||
except:
|
||||
watch_dir = ""
|
||||
try:
|
||||
transcode = int(config().get("Transcoder", "transcode"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
transcode = int(config()["Transcoder"]["transcode"])
|
||||
except:
|
||||
transcode = 0
|
||||
try:
|
||||
delete_failed = int(config().get(section, "delete_failed"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
delete_failed = int(config()[section][inputCategory]["delete_failed"])
|
||||
except:
|
||||
delete_failed = 0
|
||||
try:
|
||||
delay = float(config().get(section, "delay"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
delay = float(config()[section][inputCategory]["delay"])
|
||||
except:
|
||||
delay = 0
|
||||
try:
|
||||
TimePerGiB = int(config().get(section, "TimePerGiB"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
TimePerGiB = int(config()[section][inputCategory]["TimePerGiB"])
|
||||
except:
|
||||
TimePerGiB = 60 # note, if using Network to transfer on 100Mbit LAN, expect ~ 600 MB/minute.
|
||||
try:
|
||||
SampleIDs = (config().get("Extensions", "SampleIDs")).split(',')
|
||||
except (config.NoOptionError, ValueError):
|
||||
SampleIDs = (config()["Extensions"]["SampleIDs"])
|
||||
except:
|
||||
SampleIDs = ['sample','-s.']
|
||||
try:
|
||||
nzbExtractionBy = config().get(section, "nzbExtractionBy")
|
||||
except (config.NoOptionError, ValueError):
|
||||
nzbExtractionBy = config()[section][inputCategory]["nzbExtractionBy"]
|
||||
except:
|
||||
nzbExtractionBy = "Downloader"
|
||||
try:
|
||||
process_method = config().get(section, "process_method")
|
||||
except config.NoOptionError:
|
||||
process_method = config()[section][inputCategory]["process_method"]
|
||||
except:
|
||||
process_method = None
|
||||
try:
|
||||
Torrent_NoLink = int(config().get(section, "Torrent_NoLink"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
Torrent_NoLink = int(config()[section][inputCategory]["Torrent_NoLink"])
|
||||
except:
|
||||
Torrent_NoLink = 0
|
||||
|
||||
|
||||
mediaContainer = (config().get("Extensions", "mediaExtensions")).split(',')
|
||||
minSampleSize = int(config().get("Extensions", "minSampleSize"))
|
||||
mediaContainer = (config()["Extensions"]["mediaExtensions"])
|
||||
minSampleSize = int(config()["Extensions"]["minSampleSize"])
|
||||
|
||||
if not os.path.isdir(dirName) and os.path.isfile(dirName): # If the input directory is a file, assume single file download and split dir/name.
|
||||
dirName = os.path.split(os.path.normpath(dirName))[0]
|
||||
|
@ -94,7 +91,7 @@ class autoProcessTV:
|
|||
dirName = SpecificPath
|
||||
|
||||
# auto-detect fork type
|
||||
fork, params = autoFork(section)
|
||||
fork, params = autoFork(section, inputCategory)
|
||||
|
||||
if fork not in config.SICKBEARD_TORRENT or (clientAgent in ['nzbget','sabnzbd'] and nzbExtractionBy != "Destination"):
|
||||
if nzbName:
|
||||
|
@ -141,7 +138,7 @@ class autoProcessTV:
|
|||
params[param] = dirName
|
||||
|
||||
if param == "process_method":
|
||||
if fork in SICKBEARD_TORRENT and Torrent_NoLink == 1 and not clientAgent in ['nzbget','sabnzbd']: #use default SickBeard settings here.
|
||||
if fork in config.SICKBEARD_TORRENT and Torrent_NoLink == 1 and not clientAgent in ['nzbget','sabnzbd']: #use default SickBeard settings here.
|
||||
del params[param]
|
||||
if process_method:
|
||||
params[param] = process_method
|
||||
|
|
|
@ -113,7 +113,7 @@ def extract(filePath, outputDestination):
|
|||
|
||||
Logger.info("MAIN: Loading config from %s", config.CONFIG_FILE)
|
||||
|
||||
passwordsfile = config().get("passwords", "PassWordFile")
|
||||
passwordsfile = config()["passwords"]["PassWordFile"]
|
||||
if passwordsfile != "" and os.path.isfile(os.path.normpath(passwordsfile)):
|
||||
passwords = [line.strip() for line in open(os.path.normpath(passwordsfile))]
|
||||
else:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import os
|
||||
import shutil
|
||||
from nzbtomedia.nzbToMediaConfig import config
|
||||
from itertools import chain
|
||||
|
||||
class migratecfg:
|
||||
def migrate(self):
|
||||
categories = []
|
||||
categories = {}
|
||||
confignew = None
|
||||
configold = None
|
||||
|
||||
|
@ -26,63 +27,75 @@ class migratecfg:
|
|||
if not config() and not config(config.SAMPLE_CONFIG_FILE) or not confignew or not configold:
|
||||
return False
|
||||
|
||||
section = "CouchPotato"
|
||||
for option, value in configold.items(section) or config(config.MOVIE_CONFIG_FILE).items(section):
|
||||
for section in configold.sections:
|
||||
for option, value in configold[section].items():
|
||||
if section == "CouchPotato":
|
||||
if option == "category": # change this old format
|
||||
option = "cpsCategory"
|
||||
if option == "outputDirectory": # move this to new location format
|
||||
value = os.path.split(os.path.normpath(value))[0]
|
||||
confignew.set("Torrent", option, value)
|
||||
continue
|
||||
if option in ["username", "password" ]: # these are no-longer needed.
|
||||
continue
|
||||
if option == "cpsCategory":
|
||||
categories.extend(value.split(','))
|
||||
confignew.set(section, option, value)
|
||||
|
||||
section = "SickBeard"
|
||||
for option, value in configold.items(section) or config(config.TV_CONFIG_FILE).items(section):
|
||||
if section == "SickBeard":
|
||||
if option == "category": # change this old format
|
||||
option = "sbCategory"
|
||||
if option in ["cpsCategory","sbCategory","hpCategory","mlCategory","gzCategory"]:
|
||||
if not isinstance(value, list):
|
||||
value = [value]
|
||||
|
||||
categories.update({section: value})
|
||||
continue
|
||||
|
||||
try:
|
||||
for section in configold.sections:
|
||||
subsection = None
|
||||
if section in list(chain.from_iterable(categories.values())):
|
||||
subsection = section
|
||||
section = ''.join([k for k, v in categories.iteritems() if subsection in v])
|
||||
elif section in categories.keys():
|
||||
subsection = categories[section][0]
|
||||
|
||||
# create subsection if it does not exist
|
||||
if subsection and subsection not in confignew[section].sections:
|
||||
confignew[section][subsection] = {}
|
||||
|
||||
for option, value in configold[section].items():
|
||||
if section == "CouchPotato":
|
||||
if option == "outputDirectory": # move this to new location format
|
||||
value = os.path.split(os.path.normpath(value))[0]
|
||||
confignew['Torrent'][option] = value
|
||||
continue
|
||||
if option in ["username", "password"]: # these are no-longer needed.
|
||||
continue
|
||||
if option in ["category","cpsCategory"]:
|
||||
continue
|
||||
|
||||
if section == "SickBeard":
|
||||
if option == "wait_for": # remove old format
|
||||
continue
|
||||
if option == "failed_fork": # change this old format
|
||||
option = "fork"
|
||||
if value not in ["default", "failed", "failed-torrent", "auto"]:
|
||||
value = "auto"
|
||||
if option == "fork" and value not in ["default", "failed", "failed-torrent", "auto"]:
|
||||
value = "auto"
|
||||
if option == "Torrent_ForceLink":
|
||||
continue
|
||||
if option == "outputDirectory": # move this to new location format
|
||||
value = os.path.split(os.path.normpath(value))[0]
|
||||
confignew.set("Torrent", option, value)
|
||||
confignew['Torrent'][option] = value
|
||||
continue
|
||||
if option in ["category", "sbCategory"]:
|
||||
continue
|
||||
if option == "sbCategory":
|
||||
categories.extend(value.split(','))
|
||||
confignew.set(section, option, value)
|
||||
|
||||
for section in configold.sections():
|
||||
try:
|
||||
for option, value in configold.items(section):
|
||||
if section == "HeadPhones":
|
||||
if option in ["username", "password" ]:
|
||||
continue
|
||||
if option == "hpCategory":
|
||||
categories.extend(value.split(','))
|
||||
confignew.set(section, option, value)
|
||||
continue
|
||||
|
||||
if section == "Mylar":
|
||||
if option in "mlCategory":
|
||||
categories.extend(value.split(','))
|
||||
confignew.set(section, option, value)
|
||||
continue
|
||||
|
||||
if section == "Gamez":
|
||||
if option in ["username", "password" ]: # these are no-longer needed.
|
||||
if option in ["username", "password"]: # these are no-longer needed.
|
||||
continue
|
||||
if option == "gzCategory":
|
||||
categories.extend(value.split(','))
|
||||
confignew.set(section, option, value)
|
||||
continue
|
||||
|
||||
if section == "Torrent":
|
||||
if option in ["compressedExtensions", "mediaExtensions", "metaExtensions", "minSampleSize"]:
|
||||
|
@ -94,55 +107,13 @@ class migratecfg:
|
|||
value = "hard"
|
||||
else:
|
||||
value = "no"
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "Extensions":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "Transcoder":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "WakeOnLan":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "UserScript":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "ASCII":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "passwords":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "loggers":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "handlers":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "formatters":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "logger_root":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "handler_console":
|
||||
confignew.set(section, option, value)
|
||||
|
||||
if section == "formatter_generic":
|
||||
confignew.set(section, option, value)
|
||||
except config.InterpolationMissingOptionError:
|
||||
pass
|
||||
|
||||
for section in categories:
|
||||
try:
|
||||
if configold.items(section):
|
||||
confignew.add_section(section)
|
||||
|
||||
for option, value in configold.items(section):
|
||||
confignew.set(section, option, value)
|
||||
except config.NoSectionError:
|
||||
continue
|
||||
if subsection:
|
||||
confignew[section][subsection][option] = value
|
||||
else:
|
||||
confignew[section][option] = value
|
||||
except:
|
||||
return False
|
||||
|
||||
# create a backup of our old config
|
||||
if os.path.isfile(config.CONFIG_FILE):
|
||||
|
@ -160,55 +131,65 @@ class migratecfg:
|
|||
def addnzbget(self):
|
||||
confignew = config()
|
||||
section = "CouchPotato"
|
||||
envKeys = ['CATEGORY', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'METHOD', 'DELETE_FAILED', 'REMOTECPS', 'WAIT_FOR', 'TIMEPERGIB']
|
||||
cfgKeys = ['cpsCategory', 'apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'method', 'delete_failed', 'remoteCPS', 'wait_for', 'TimePerGiB']
|
||||
envCatKey = 'NZBPO_CPSCATEGORY'
|
||||
envKeys = ['APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'METHOD', 'DELETE_FAILED', 'REMOTECPS', 'WAIT_FOR', 'TIMEPERGIB']
|
||||
cfgKeys = ['apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'method', 'delete_failed', 'remoteCPS', 'wait_for', 'TimePerGiB']
|
||||
for index in range(len(envKeys)):
|
||||
key = 'NZBPO_CPS' + envKeys[index]
|
||||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
if confignew[section].has_key(os.environ[envCatKey]) and option not in confignew[section].sections:
|
||||
confignew[section][envCatKey][option] = value
|
||||
|
||||
|
||||
section = "SickBeard"
|
||||
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'TIMEPERGIB', 'PROCESS_METHOD']
|
||||
cfgKeys = ['sbCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'TimePerGiB', 'process_method']
|
||||
envCatKey = 'NZBPO_SBCATEGORY'
|
||||
envKeys = ['HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'TIMEPERGIB', 'PROCESS_METHOD']
|
||||
cfgKeys = ['host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'TimePerGiB', 'process_method']
|
||||
for index in range(len(envKeys)):
|
||||
key = 'NZBPO_SB' + envKeys[index]
|
||||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
if confignew[section].has_key(os.environ[envCatKey]) and option not in confignew[section].sections:
|
||||
confignew[section][envCatKey][option] = value
|
||||
|
||||
section = "HeadPhones"
|
||||
envKeys = ['CATEGORY', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'TIMEPERGIB']
|
||||
cfgKeys = ['hpCategory', 'apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'TimePerGiB']
|
||||
envCatKey = 'NZBPO_HPCATEGORY'
|
||||
envKeys = ['APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'DELAY', 'TIMEPERGIB']
|
||||
cfgKeys = ['apikey', 'host', 'port', 'ssl', 'web_root', 'delay', 'TimePerGiB']
|
||||
for index in range(len(envKeys)):
|
||||
key = 'NZBPO_HP' + envKeys[index]
|
||||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
if confignew[section].has_key(os.environ[envCatKey]) and option not in confignew[section].sections:
|
||||
confignew[section][envCatKey][option] = value
|
||||
|
||||
section = "Mylar"
|
||||
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT']
|
||||
cfgKeys = ['mlCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root']
|
||||
envCatKey = 'NZBPO_MYCATEGORY'
|
||||
envKeys = ['HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT']
|
||||
cfgKeys = ['host', 'port', 'username', 'password', 'ssl', 'web_root']
|
||||
for index in range(len(envKeys)):
|
||||
key = 'NZBPO_MY' + envKeys[index]
|
||||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
if confignew[section].has_key(os.environ[envCatKey]) and option not in confignew[section].sections:
|
||||
confignew[section][envCatKey][option] = value
|
||||
|
||||
section = "Gamez"
|
||||
envKeys = ['CATEGORY', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT']
|
||||
cfgKeys = ['gzCategory', 'apikey', 'host', 'port', 'ssl', 'web_root']
|
||||
envCatKey = 'NZBPO_GZCATEGORY'
|
||||
envKeys = ['APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT']
|
||||
cfgKeys = ['apikey', 'host', 'port', 'ssl', 'web_root']
|
||||
for index in range(len(envKeys)):
|
||||
key = 'NZBPO_GZ' + envKeys[index]
|
||||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
if confignew[section].has_key(os.environ[envCatKey]) and option not in confignew[section].sections:
|
||||
confignew[section][envCatKey][option] = value
|
||||
|
||||
section = "Extensions"
|
||||
envKeys = ['COMPRESSEDEXTENSIONS', 'MEDIAEXTENSIONS', 'METAEXTENSIONS']
|
||||
|
@ -218,7 +199,7 @@ class migratecfg:
|
|||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
confignew[section][option] = value
|
||||
|
||||
section = "Transcoder"
|
||||
envKeys = ['TRANSCODE', 'DUPLICATE', 'IGNOREEXTENSIONS', 'OUTPUTVIDEOEXTENSION', 'OUTPUTVIDEOCODEC', 'OUTPUTVIDEOPRESET', 'OUTPUTVIDEOFRAMERATE', 'OUTPUTVIDEOBITRATE', 'OUTPUTAUDIOCODEC', 'OUTPUTAUDIOBITRATE', 'OUTPUTSUBTITLECODEC']
|
||||
|
@ -228,7 +209,7 @@ class migratecfg:
|
|||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
confignew[section][option] = value
|
||||
|
||||
section = "WakeOnLan"
|
||||
envKeys = ['WAKE', 'HOST', 'PORT', 'MAC']
|
||||
|
@ -238,7 +219,7 @@ class migratecfg:
|
|||
if os.environ.has_key(key):
|
||||
option = cfgKeys[index]
|
||||
value = os.environ[key]
|
||||
confignew.set(section, option, value)
|
||||
confignew[section][option] = value
|
||||
|
||||
# create a backup of our old config
|
||||
if os.path.isfile(config.CONFIG_FILE):
|
||||
|
|
|
@ -5,33 +5,37 @@ from lib import requests
|
|||
|
||||
from nzbToMediaConfig import config
|
||||
|
||||
def autoFork(section):
|
||||
def autoFork(section, category):
|
||||
|
||||
Logger = logging.getLogger()
|
||||
|
||||
# config settings
|
||||
host = config().get(section, "host")
|
||||
port = config().get(section, "port")
|
||||
try:
|
||||
host = config()[section][category]["host"]
|
||||
port = config()[section][category]["port"]
|
||||
except:
|
||||
host = None
|
||||
port = None
|
||||
|
||||
try:
|
||||
username = config().get(section, "username")
|
||||
password = config().get(section, "password")
|
||||
username = config()[section][category]["username"]
|
||||
password = config()[section][category]["password"]
|
||||
except:
|
||||
username = None
|
||||
password = None
|
||||
|
||||
try:
|
||||
ssl = int(config().get(section, "ssl"))
|
||||
except (config.NoOptionError, ValueError):
|
||||
ssl = int(config()[section][category]["ssl"])
|
||||
except (config, ValueError):
|
||||
ssl = 0
|
||||
|
||||
try:
|
||||
web_root = config().get(section, "web_root")
|
||||
except config.NoOptionError:
|
||||
web_root = config()[section][category]["web_root"]
|
||||
except config:
|
||||
web_root = ""
|
||||
|
||||
try:
|
||||
fork = config.FORKS.items()[config.FORKS.keys().index(config().get(section, "fork"))]
|
||||
fork = config.FORKS.items()[config.FORKS.keys().index(config()[section][category]["fork"])]
|
||||
except:
|
||||
fork = "auto"
|
||||
|
||||
|
@ -53,7 +57,7 @@ def autoFork(section):
|
|||
else:
|
||||
r = requests.get(url)
|
||||
except requests.ConnectionError:
|
||||
Logger.info("Could not connect to " + section + " to perform auto-fork detection!")
|
||||
Logger.info("Could not connect to " + section + ":" + category + " to perform auto-fork detection!")
|
||||
break
|
||||
|
||||
if r.ok:
|
||||
|
@ -61,10 +65,10 @@ def autoFork(section):
|
|||
break
|
||||
|
||||
if detected:
|
||||
Logger.info("" + section + " fork auto-detection successful ...")
|
||||
Logger.info("" + section + ":" + category + " fork auto-detection successful ...")
|
||||
else:
|
||||
Logger.info("" + section + " fork auto-detection failed")
|
||||
Logger.info("" + section + ":" + category + " fork auto-detection failed")
|
||||
fork = config.FORKS.items()[config.FORKS.keys().index(config.FORK_DEFAULT)]
|
||||
|
||||
Logger.info("" + section + " fork set to %s", fork[0])
|
||||
Logger.info("" + section + ":" + category + " fork set to %s", fork[0])
|
||||
return fork[0], fork[1]
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
import ConfigParser
|
||||
from lib import configobj
|
||||
|
||||
class config(object):
|
||||
# constants for nzbtomedia
|
||||
|
@ -34,28 +34,32 @@ class config(object):
|
|||
MOVIE_CONFIG_FILE = os.path.join(PROGRAM_DIR, "autoProcessMovie.cfg")
|
||||
TV_CONFIG_FILE = os.path.join(PROGRAM_DIR, "autoProcessTv.cfg")
|
||||
LOG_FILE = os.path.join(PROGRAM_DIR, "postprocess.log")
|
||||
LOG_CONFIG = os.path.join(PROGRAM_DIR, "logging.cfg")
|
||||
|
||||
# config error handling classes
|
||||
Error = ConfigParser.Error
|
||||
NoSectionError = ConfigParser.NoSectionError
|
||||
NoOptionError = ConfigParser.NoOptionError
|
||||
DuplicateSectionError = ConfigParser.DuplicateSectionError
|
||||
InterpolationError = ConfigParser.InterpolationError
|
||||
InterpolationMissingOptionError = ConfigParser.InterpolationMissingOptionError
|
||||
InterpolationSyntaxError = ConfigParser.InterpolationSyntaxError
|
||||
InterpolationDepthError = ConfigParser.InterpolationDepthError
|
||||
ParsingError = ConfigParser.ParsingError
|
||||
MissingSectionHeaderError = ConfigParser.MissingSectionHeaderError
|
||||
|
||||
def __new__(cls, *file):
|
||||
if not file:
|
||||
file = cls.CONFIG_FILE
|
||||
return cls.loadConfig(file)
|
||||
def __new__(cls, *config_file):
|
||||
try:
|
||||
# load config
|
||||
if not config_file:
|
||||
return configobj.ConfigObj(cls.CONFIG_FILE)
|
||||
else:
|
||||
return configobj.ConfigObj(*config_file)
|
||||
except Exception, e:
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def loadConfig(file):
|
||||
# load config
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.optionxform = str
|
||||
if config.read(file):
|
||||
return config
|
||||
def get_categories(section):
|
||||
sections = {}
|
||||
|
||||
# check and return categories if section does exist
|
||||
if not isinstance(section, list):
|
||||
section = [section]
|
||||
|
||||
for x in section:
|
||||
if config().has_key(x):
|
||||
sections.update({x: config()[x].sections})
|
||||
return sections
|
||||
|
||||
@staticmethod
|
||||
def gather_subsection(section, key):
|
||||
if section.depth > 1:
|
||||
return section.name
|
|
@ -32,7 +32,8 @@ def safeName(name):
|
|||
def nzbtomedia_configure_logging(logfile=None):
|
||||
if not logfile:
|
||||
logfile = config.LOG_FILE
|
||||
logging.config.fileConfig(config.CONFIG_FILE)
|
||||
|
||||
logging.config.fileConfig(config.LOG_CONFIG)
|
||||
fileHandler = logging.handlers.RotatingFileHandler(logfile, mode='a', maxBytes=1048576, backupCount=1, encoding='utf-8', delay=True)
|
||||
fileHandler.formatter = logging.Formatter('%(asctime)s|%(levelname)-7.7s %(message)s', '%H:%M:%S')
|
||||
fileHandler.level = logging.DEBUG
|
||||
|
@ -329,14 +330,14 @@ def WakeUp():
|
|||
Logger.error("You need an autoProcessMedia.config() file - did you rename and edit the .sample?")
|
||||
return
|
||||
|
||||
wake = int(config().get("WakeOnLan", "wake"))
|
||||
wake = int(config()["WakeOnLan"]["wake"])
|
||||
if wake == 0: # just return if we don't need to wake anything.
|
||||
return
|
||||
Logger.info("Loading WakeOnLan config from %s", config.CONFIG_FILE)
|
||||
config().get("WakeOnLan", "host")
|
||||
host = config().get("WakeOnLan", "host")
|
||||
port = int(config().get("WakeOnLan", "port"))
|
||||
mac = config().get("WakeOnLan", "mac")
|
||||
config()["WakeOnLan"]["host"]
|
||||
host = config()["WakeOnLan"]["host"]
|
||||
port = int(config()["WakeOnLan"]["port"])
|
||||
mac = config()["WakeOnLan"]["mac"]
|
||||
|
||||
i=1
|
||||
while TestCon(host, port) == "Down" and i < 4:
|
||||
|
@ -355,7 +356,7 @@ def convert_to_ascii(nzbName, dirName):
|
|||
Logger.error("You need an autoProcessMedia.cfg file - did you rename and edit the .sample?")
|
||||
return nzbName, dirName
|
||||
|
||||
ascii_convert = int(config().get("ASCII", "convert"))
|
||||
ascii_convert = int(config()["ASCII"]["convert"])
|
||||
if ascii_convert == 0 or os.name == 'nt': # just return if we don't want to convert or on windows os and "\" is replaced!.
|
||||
return nzbName, dirName
|
||||
|
||||
|
@ -452,12 +453,12 @@ def parse_args(clientAgent):
|
|||
|
||||
def get_dirnames(section, category):
|
||||
try:
|
||||
watch_dir = config().get(section, "watch_dir")
|
||||
except config.NoOptionError:
|
||||
watch_dir = config()[section][inputCategory]["watch_dir"]
|
||||
except:
|
||||
watch_dir = ""
|
||||
try:
|
||||
outputDirectory = os.path.join(config().get("Torrent", "outputDirectory"), category)
|
||||
except config.NoOptionError:
|
||||
outputDirectory = os.path.join(config()["Torrent"]["outputDirectory"], category)
|
||||
except:
|
||||
outputDirectory = ""
|
||||
|
||||
# set dirName
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue