Fixed a bunch of issues that where present in TorrentToMedia and our config class including the migration code.

Added in manual run for TorrentToMedia.

All autoProcessing scripts now auto-detect the correct section based on sub-section.

NzbDrone support is 90% done but is not functional ... YET!

Lots more I'm sure but I wanted this released for those that where having issues.
This commit is contained in:
echel0n 2014-04-07 01:42:55 -07:00
commit 7d4ccf53cc
17 changed files with 715 additions and 305 deletions

View file

@ -14,18 +14,34 @@ from nzbtomedia.nzbToMediaUtil import convert_to_ascii, is_sample, flatten, getD
Logger = logging.getLogger()
class autoProcessTV:
def processEpisode(self, dirName, nzbName=None, failed=False, clientAgent = "manual", inputCategory=None):
def processEpisode(self, dirName, nzbName=None, failed=False, clientAgent = "manual", section=None, inputCategory=None):
if dirName is None:
Logger.error("No directory was given!")
return 1 # failure
# auto-detect correct section
section = [x for x in config.issubsection(inputCategory) if config()[x][inputCategory]['enabled'] == 1]
if len(section) > 1:
Logger.error(
"MAIN: You can't have multiple sub-sections with the same name enabled, fix your autoProcessMedia.cfg file.")
return 1
elif len(section) == 0:
Logger.error(
"MAIN: We were unable to find a processor for category %s that was enabled, please check your autoProcessMedia.cfg file.", inputCategory)
return 1
fork, fork_params = autoFork(section, inputCategory)
Torrent_NoLink = int(config()[section][inputCategory]["Torrent_NoLink"]) # 0
if not fork in config.SICKBEARD_TORRENT and not Torrent_NoLink == 1:
if clientAgent in ['utorrent', 'transmission', 'deluge']:
return 1
socket.setdefaulttimeout(int(config.NZBTOMEDIA_TIMEOUT)) #initialize socket timeout.
Logger.info("Loading config from %s", config.CONFIG_FILE)
status = int(failed)
section = "SickBeard"
host = config()[section][inputCategory]["host"]
port = config()[section][inputCategory]["port"]
username = config()[section][inputCategory]["username"]
@ -90,9 +106,6 @@ class autoProcessTV:
if os.path.isdir(SpecificPath):
dirName = SpecificPath
# auto-detect fork type
fork, params = autoFork(section, inputCategory)
if fork not in config.SICKBEARD_TORRENT or (clientAgent in ['nzbget','sabnzbd'] and nzbExtractionBy != "Destination"):
if nzbName:
process_all_exceptions(nzbName.lower(), dirName)