mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -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':
|
if sectionName == 'CouchPotato':
|
||||||
result = nzbtomedia.autoProcessMovie().process(sectionName,outputDestination, inputName, status, clientAgent, inputHash,
|
result = nzbtomedia.autoProcessMovie().process(sectionName,outputDestination, inputName, status, clientAgent, inputHash,
|
||||||
inputCategory)
|
inputCategory)
|
||||||
elif sectionName == 'SickBeard':
|
elif sectionName in ['SickBeard','NzbDrone']:
|
||||||
result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent,
|
|
||||||
inputCategory)
|
|
||||||
elif sectionName == 'NzbDrone':
|
|
||||||
result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent,
|
result = nzbtomedia.autoProcessTV().processEpisode(sectionName,outputDestination, inputName, status, clientAgent,
|
||||||
inputCategory)
|
inputCategory)
|
||||||
elif sectionName == 'HeadPhones':
|
elif sectionName == 'HeadPhones':
|
||||||
|
|
|
@ -153,4 +153,5 @@ class autoProcessTV:
|
||||||
if status != 0 and delete_failed and not os.path.dirname(dirName) == dirName:
|
if status != 0 and delete_failed and not os.path.dirname(dirName) == dirName:
|
||||||
logger.postprocess("Deleting failed files and folder %s" % (dirName),section)
|
logger.postprocess("Deleting failed files and folder %s" % (dirName),section)
|
||||||
rmDir(dirName)
|
rmDir(dirName)
|
||||||
|
|
||||||
return 0 # Success
|
return 0 # Success
|
||||||
|
|
|
@ -23,8 +23,10 @@ class Section(configobj.Section):
|
||||||
if not int(subsections['enabled']) == 1:
|
if not int(subsections['enabled']) == 1:
|
||||||
del to_return[section_name]
|
del to_return[section_name]
|
||||||
|
|
||||||
if len(to_return[section_name]) == 0:
|
# cleanout empty sections and subsections
|
||||||
del to_return[section_name]
|
for key in [k for (k, v) in to_return.items() if not v]:
|
||||||
|
del to_return[key]
|
||||||
|
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
def findsection(section, key):
|
def findsection(section, key):
|
||||||
|
@ -32,6 +34,11 @@ class Section(configobj.Section):
|
||||||
for subsection in to_return:
|
for subsection in to_return:
|
||||||
if key not in to_return[subsection]:
|
if key not in to_return[subsection]:
|
||||||
del 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
|
return to_return
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
|
@ -54,8 +61,9 @@ class Section(configobj.Section):
|
||||||
if section not in key:
|
if section not in key:
|
||||||
del to_return[section]
|
del to_return[section]
|
||||||
|
|
||||||
if len(subsections) == 0:
|
# cleanout empty sections and subsections
|
||||||
del to_return[section]
|
for key in [k for (k, v) in to_return.items() if not v]:
|
||||||
|
del to_return[key]
|
||||||
|
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,6 @@ from nzbtomedia.nzbToMediaUtil import get_downloadInfo
|
||||||
# Initialize the config
|
# Initialize the config
|
||||||
nzbtomedia.initialize()
|
nzbtomedia.initialize()
|
||||||
|
|
||||||
test = nzbtomedia.CFG['HeadPhones']['music']
|
test = nzbtomedia.CFG['SickBeard','NzbDrone']['tv']
|
||||||
section = nzbtomedia.CFG.findsection('tv').isenabled()
|
section = nzbtomedia.CFG.findsection('tv').isenabled()
|
||||||
print section
|
print section
|
Loading…
Add table
Add a link
Reference in a new issue