mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -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)
|
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):
|
def initialize(section=None):
|
||||||
global SHOWEXTRACT
|
global SHOWEXTRACT
|
||||||
global CATEGORIES
|
global CATEGORIES
|
||||||
|
@ -1051,12 +1064,7 @@ def initialize(section=None):
|
||||||
logger.warning('Failed to locate ffprobe. Video corruption detection disabled!')
|
logger.warning('Failed to locate ffprobe. Video corruption detection disabled!')
|
||||||
logger.warning('Install ffmpeg with x264 support to enable this feature ...')
|
logger.warning('Install ffmpeg with x264 support to enable this feature ...')
|
||||||
|
|
||||||
# check for script-defied section and if None set to allow sections
|
configure_sections(section)
|
||||||
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_torrent_class()
|
configure_torrent_class()
|
||||||
|
|
||||||
# finished initalizing
|
# finished initalizing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue