mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 10:36:52 -07:00
Fixes issue with KeyErrors recently being returned
This commit is contained in:
parent
eec6ed3b11
commit
a81464502e
4 changed files with 15 additions and 9 deletions
|
@ -174,10 +174,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
|||
if sectionName == 'CouchPotato':
|
||||
result = nzbtomedia.autoProcessMovie().process(sectionName,outputDestination, inputName, status, clientAgent, inputHash,
|
||||
inputCategory)
|
||||
elif sectionName == 'SickBeard':
|
||||
result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent,
|
||||
inputCategory)
|
||||
elif sectionName == 'NzbDrone':
|
||||
elif sectionName in ['SickBeard','NzbDrone']:
|
||||
result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent,
|
||||
inputCategory)
|
||||
elif sectionName == 'HeadPhones':
|
||||
|
|
|
@ -153,4 +153,5 @@ class autoProcessTV:
|
|||
if status != 0 and delete_failed and not os.path.dirname(dirName) == dirName:
|
||||
logger.postprocess("Deleting failed files and folder %s" % (dirName),section)
|
||||
rmDir(dirName)
|
||||
|
||||
return 0 # Success
|
||||
|
|
|
@ -23,8 +23,10 @@ class Section(configobj.Section):
|
|||
if not int(subsections['enabled']) == 1:
|
||||
del to_return[section_name]
|
||||
|
||||
if len(to_return[section_name]) == 0:
|
||||
del to_return[section_name]
|
||||
# cleanout empty sections and subsections
|
||||
for key in [k for (k, v) in to_return.items() if not v]:
|
||||
del to_return[key]
|
||||
|
||||
return to_return
|
||||
|
||||
def findsection(section, key):
|
||||
|
@ -32,6 +34,11 @@ class Section(configobj.Section):
|
|||
for subsection in to_return:
|
||||
if key not in to_return[subsection]:
|
||||
del to_return[subsection]
|
||||
|
||||
# cleanout empty sections and subsections
|
||||
for key in [k for (k, v) in to_return.items() if not v]:
|
||||
del to_return[key]
|
||||
|
||||
return to_return
|
||||
|
||||
def __getitem__(self, key):
|
||||
|
@ -54,8 +61,9 @@ class Section(configobj.Section):
|
|||
if section not in key:
|
||||
del to_return[section]
|
||||
|
||||
if len(subsections) == 0:
|
||||
del to_return[section]
|
||||
# cleanout empty sections and subsections
|
||||
for key in [k for (k, v) in to_return.items() if not v]:
|
||||
del to_return[key]
|
||||
|
||||
return to_return
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@ from nzbtomedia.nzbToMediaUtil import get_downloadInfo
|
|||
# Initialize the config
|
||||
nzbtomedia.initialize()
|
||||
|
||||
test = nzbtomedia.CFG['HeadPhones']['music']
|
||||
test = nzbtomedia.CFG['SickBeard','NzbDrone']['tv']
|
||||
section = nzbtomedia.CFG.findsection('tv').isenabled()
|
||||
print section
|
Loading…
Add table
Add a link
Reference in a new issue