mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 18:47:09 -07:00
Refactor section configuration
This commit is contained in:
parent
4f828e0a77
commit
0a58b6b6a0
1 changed files with 14 additions and 6 deletions
|
@ -921,6 +921,19 @@ def configure_torrent_class():
|
|||
TORRENT_CLASS = create_torrent_class(TORRENT_CLIENT_AGENT)
|
||||
|
||||
|
||||
def configure_sections(section):
|
||||
global SECTIONS
|
||||
global CATEGORIES
|
||||
# check for script-defied section and if None set to allow sections
|
||||
SECTIONS = CFG[
|
||||
tuple(x for x in CFG if CFG[x].sections and CFG[x].isenabled())
|
||||
if not section else (section,)
|
||||
]
|
||||
for section, subsections in SECTIONS.items():
|
||||
CATEGORIES.extend([subsection for subsection in subsections if CFG[section][subsection].isenabled()])
|
||||
CATEGORIES = list(set(CATEGORIES))
|
||||
|
||||
|
||||
def initialize(section=None):
|
||||
global SHOWEXTRACT
|
||||
global CATEGORIES
|
||||
|
@ -1051,12 +1064,7 @@ def initialize(section=None):
|
|||
logger.warning('Failed to locate ffprobe. Video corruption detection disabled!')
|
||||
logger.warning('Install ffmpeg with x264 support to enable this feature ...')
|
||||
|
||||
# check for script-defied section and if None set to allow sections
|
||||
SECTIONS = CFG[tuple(x for x in CFG if CFG[x].sections and CFG[x].isenabled()) if not section else (section,)]
|
||||
for section, subsections in SECTIONS.items():
|
||||
CATEGORIES.extend([subsection for subsection in subsections if CFG[section][subsection].isenabled()])
|
||||
CATEGORIES = list(set(CATEGORIES))
|
||||
|
||||
configure_sections(section)
|
||||
configure_torrent_class()
|
||||
|
||||
# finished initalizing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue