mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
Allow for only turning off ssl verification for plex
This commit is contained in:
parent
56961ccca1
commit
3e463cd048
4 changed files with 14 additions and 1 deletions
|
@ -89,6 +89,7 @@ plex: # Can be individually specified per library as
|
||||||
clean_bundles: false
|
clean_bundles: false
|
||||||
empty_trash: false
|
empty_trash: false
|
||||||
optimize: false
|
optimize: false
|
||||||
|
verify_ssl: true
|
||||||
tmdb: # REQUIRED for the script to run
|
tmdb: # REQUIRED for the script to run
|
||||||
apikey: ################################
|
apikey: ################################
|
||||||
language: en
|
language: en
|
||||||
|
|
|
@ -86,6 +86,9 @@
|
||||||
"optimize": {
|
"optimize": {
|
||||||
"description": "true/false - If 'true', optimizes database on this Plex server",
|
"description": "true/false - If 'true', optimizes database on this Plex server",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"verify_ssl": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|
|
@ -719,6 +719,7 @@ class ConfigFile:
|
||||||
"url": check_for_attribute(self.data, "url", parent="plex", var_type="url", default_is_none=True),
|
"url": check_for_attribute(self.data, "url", parent="plex", var_type="url", default_is_none=True),
|
||||||
"token": check_for_attribute(self.data, "token", parent="plex", default_is_none=True),
|
"token": check_for_attribute(self.data, "token", parent="plex", default_is_none=True),
|
||||||
"timeout": check_for_attribute(self.data, "timeout", parent="plex", var_type="int", default=60),
|
"timeout": check_for_attribute(self.data, "timeout", parent="plex", var_type="int", default=60),
|
||||||
|
"verify_ssl": check_for_attribute(self.data, "verify_ssl", parent="plex", var_type="bool", default=True),
|
||||||
"db_cache": check_for_attribute(self.data, "db_cache", parent="plex", var_type="int", default_is_none=True),
|
"db_cache": check_for_attribute(self.data, "db_cache", parent="plex", var_type="int", default_is_none=True),
|
||||||
"clean_bundles": check_for_attribute(self.data, "clean_bundles", parent="plex", var_type="bool", default=False),
|
"clean_bundles": check_for_attribute(self.data, "clean_bundles", parent="plex", var_type="bool", default=False),
|
||||||
"empty_trash": check_for_attribute(self.data, "empty_trash", parent="plex", var_type="bool", default=False),
|
"empty_trash": check_for_attribute(self.data, "empty_trash", parent="plex", var_type="bool", default=False),
|
||||||
|
@ -1071,6 +1072,7 @@ class ConfigFile:
|
||||||
"url": check_for_attribute(lib, "url", parent="plex", var_type="url", default=self.general["plex"]["url"], req_default=True, save=False),
|
"url": check_for_attribute(lib, "url", parent="plex", var_type="url", default=self.general["plex"]["url"], req_default=True, save=False),
|
||||||
"token": check_for_attribute(lib, "token", parent="plex", default=self.general["plex"]["token"], req_default=True, save=False),
|
"token": check_for_attribute(lib, "token", parent="plex", default=self.general["plex"]["token"], req_default=True, save=False),
|
||||||
"timeout": check_for_attribute(lib, "timeout", parent="plex", var_type="int", default=self.general["plex"]["timeout"], save=False),
|
"timeout": check_for_attribute(lib, "timeout", parent="plex", var_type="int", default=self.general["plex"]["timeout"], save=False),
|
||||||
|
"verify_ssl": check_for_attribute(lib, "verify_ssl", parent="plex", var_type="bool", default=self.general["plex"]["verify_ssl"], save=False),
|
||||||
"db_cache": check_for_attribute(lib, "db_cache", parent="plex", var_type="int", default=self.general["plex"]["db_cache"], default_is_none=True, save=False),
|
"db_cache": check_for_attribute(lib, "db_cache", parent="plex", var_type="int", default=self.general["plex"]["db_cache"], default_is_none=True, save=False),
|
||||||
"clean_bundles": check_for_attribute(lib, "clean_bundles", parent="plex", var_type="bool", default=self.general["plex"]["clean_bundles"], save=False),
|
"clean_bundles": check_for_attribute(lib, "clean_bundles", parent="plex", var_type="bool", default=self.general["plex"]["clean_bundles"], save=False),
|
||||||
"empty_trash": check_for_attribute(lib, "empty_trash", parent="plex", var_type="bool", default=self.general["plex"]["empty_trash"], save=False),
|
"empty_trash": check_for_attribute(lib, "empty_trash", parent="plex", var_type="bool", default=self.general["plex"]["empty_trash"], save=False),
|
||||||
|
|
|
@ -435,12 +435,19 @@ class Plex(Library):
|
||||||
super().__init__(config, params)
|
super().__init__(config, params)
|
||||||
self.plex = params["plex"]
|
self.plex = params["plex"]
|
||||||
self.url = self.plex["url"]
|
self.url = self.plex["url"]
|
||||||
|
self.plex["session"] = self.config.session
|
||||||
|
if self.plex.get("verify_ssl") is False and self.config.general["verify_ssl"] is True:
|
||||||
|
logger.debug("Overriding verify_ssl to False for Plex connection")
|
||||||
|
self.plex["session"] = requests.Session()
|
||||||
|
self.plex["session"].verify = False
|
||||||
|
import urllib3
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
self.token = self.plex["token"]
|
self.token = self.plex["token"]
|
||||||
self.timeout = self.plex["timeout"]
|
self.timeout = self.plex["timeout"]
|
||||||
logger.secret(self.url)
|
logger.secret(self.url)
|
||||||
logger.secret(self.token)
|
logger.secret(self.token)
|
||||||
try:
|
try:
|
||||||
self.PlexServer = PlexServer(baseurl=self.url, token=self.token, session=self.config.session, timeout=self.timeout)
|
self.PlexServer = PlexServer(baseurl=self.url, token=self.token, session=self.plex["session"], timeout=self.timeout)
|
||||||
plexapi.server.TIMEOUT = self.timeout
|
plexapi.server.TIMEOUT = self.timeout
|
||||||
os.environ["PLEXAPI_PLEXAPI_TIMEOUT"] = str(self.timeout)
|
os.environ["PLEXAPI_PLEXAPI_TIMEOUT"] = str(self.timeout)
|
||||||
logger.info(f"Connected to server {self.PlexServer.friendlyName} version {self.PlexServer.version}")
|
logger.info(f"Connected to server {self.PlexServer.friendlyName} version {self.PlexServer.version}")
|
||||||
|
|
Loading…
Reference in a new issue