mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-30 19:40:03 -07:00
Refactor plex configuration to plugins.plex
This commit is contained in:
parent
1d75439441
commit
e12f2724e6
2 changed files with 22 additions and 24 deletions
|
@ -11,9 +11,9 @@ import subprocess
|
|||
import sys
|
||||
import time
|
||||
|
||||
import eol
|
||||
import libs.autoload
|
||||
import libs.util
|
||||
import eol
|
||||
|
||||
if not libs.autoload.completed:
|
||||
sys.exit('Could not load vendored libraries.')
|
||||
|
@ -56,6 +56,7 @@ from core.plugins.downloaders.utils import (
|
|||
remove_torrent,
|
||||
resume_torrent,
|
||||
)
|
||||
from core.plugins.plex import configure_plex
|
||||
from core.utils import (
|
||||
RunningProcess,
|
||||
category_search,
|
||||
|
@ -443,28 +444,6 @@ def configure_remote_paths():
|
|||
]
|
||||
|
||||
|
||||
def configure_plex():
|
||||
global PLEX_SSL
|
||||
global PLEX_HOST
|
||||
global PLEX_PORT
|
||||
global PLEX_TOKEN
|
||||
global PLEX_SECTION
|
||||
|
||||
PLEX_SSL = int(CFG['Plex']['plex_ssl'])
|
||||
PLEX_HOST = CFG['Plex']['plex_host']
|
||||
PLEX_PORT = CFG['Plex']['plex_port']
|
||||
PLEX_TOKEN = CFG['Plex']['plex_token']
|
||||
PLEX_SECTION = CFG['Plex']['plex_sections'] or []
|
||||
|
||||
if PLEX_SECTION:
|
||||
if isinstance(PLEX_SECTION, list):
|
||||
PLEX_SECTION = ','.join(PLEX_SECTION) # fix in case this imported as list.
|
||||
PLEX_SECTION = [
|
||||
tuple(item.split(','))
|
||||
for item in PLEX_SECTION.split('|')
|
||||
]
|
||||
|
||||
|
||||
def configure_niceness():
|
||||
global NICENESS
|
||||
|
||||
|
@ -1012,7 +991,7 @@ def initialize(section=None):
|
|||
configure_nzbs(CFG)
|
||||
configure_torrents(CFG)
|
||||
configure_remote_paths()
|
||||
configure_plex()
|
||||
configure_plex(CFG)
|
||||
configure_niceness()
|
||||
configure_containers()
|
||||
configure_transcoder()
|
||||
|
|
19
core/plugins/plex.py
Normal file
19
core/plugins/plex.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
import core
|
||||
|
||||
|
||||
def configure_plex(config):
|
||||
core.PLEX_SSL = int(config['Plex']['plex_ssl'])
|
||||
core.PLEX_HOST = config['Plex']['plex_host']
|
||||
core.PLEX_PORT = config['Plex']['plex_port']
|
||||
core.PLEX_TOKEN = config['Plex']['plex_token']
|
||||
plex_section = config['Plex']['plex_sections'] or []
|
||||
|
||||
if plex_section:
|
||||
if isinstance(plex_section, list):
|
||||
plex_section = ','.join(plex_section) # fix in case this imported as list.
|
||||
plex_section = [
|
||||
tuple(item.split(','))
|
||||
for item in plex_section.split('|')
|
||||
]
|
||||
|
||||
core.PLEX_SECTION = plex_section
|
Loading…
Add table
Add a link
Reference in a new issue