[102] allow pmm to set db cache size

pull/1574/head
meisnate12 1 year ago
parent 5d57039856
commit 673d057ac8

@ -1 +1 @@
1.19.0-develop101 1.19.0-develop102

@ -80,6 +80,7 @@ plex: # Can be individually specified per library as
url: http://192.168.1.12:32400 url: http://192.168.1.12:32400
token: #################### token: ####################
timeout: 60 timeout: 60
db_cache:
clean_bundles: false clean_bundles: false
empty_trash: false empty_trash: false
optimize: false optimize: false

@ -10,19 +10,21 @@ plex:
url: http://192.168.1.12:32400 url: http://192.168.1.12:32400
token: #################### token: ####################
timeout: 60 timeout: 60
db_cache: 4096
clean_bundles: true clean_bundles: true
empty_trash: true empty_trash: true
optimize: false optimize: false
``` ```
| Attribute | Allowed Values | Default | Required | | Attribute | Allowed Values | Default | Required |
|:----------------|:-------------------------------------------------------------------------------------------------------------------------------|:--------|:--------:| |:----------------|:-----------------------------------------------------------------------|:--------|:--------:|
| `url` | Plex Server URL<br><strong>Example:</strong> http://192.168.1.12:32400 | N/A | &#9989; | | `url` | Plex Server URL<br><strong>Example:</strong> http://192.168.1.12:32400 | N/A | &#9989; |
| `token` | Plex Server Authentication Token | N/A | &#9989; | | `token` | Plex Server Authentication Token | N/A | &#9989; |
| `timeout` | Plex Server Timeout | 60 | &#10060; | | `timeout` | Plex Server Timeout | 60 | &#10060; |
| `clean_bundles` | Runs Clean Bundles on the Server after all Metadata Files are run | false | &#10060; | | `db_cache` | Plex Server Database Cache Size | None | &#10060; |
| `empty_trash` | Runs Empty Trash on the Server after all Metadata Files are run | false | &#10060; | | `clean_bundles` | Runs Clean Bundles on the Server after all Metadata Files are run | false | &#10060; |
| `optimize` | Runs Optimize on the Server after all Metadata Files are run | false | &#10060; | | `empty_trash` | Runs Empty Trash on the Server after all Metadata Files are run | false | &#10060; |
| `optimize` | Runs Optimize on the Server after all Metadata Files are run | false | &#10060; |
* **Do Not Use the Plex Token found in Plex's Preferences.xml file** * **Do Not Use the Plex Token found in Plex's Preferences.xml file**
@ -47,11 +49,13 @@ libraries:
url: http://plex.boing.bong url: http://plex.boing.bong
token: SOME_TOKEN token: SOME_TOKEN
timeout: 360 timeout: 360
db_cache: 8192
... ...
plex: plex:
url: http://plex.bing.bang url: http://plex.bing.bang
token: SOME_TOKEN token: SOME_TOKEN
timeout: 60 timeout: 60
db_cache: 4096
clean_bundles: false clean_bundles: false
empty_trash: false empty_trash: false
optimize: false optimize: false

@ -159,6 +159,7 @@ data:
url: http://PLEX_IP_HERE:32400 url: http://PLEX_IP_HERE:32400
token: YOUR_TOKEN_HERE token: YOUR_TOKEN_HERE
timeout: 60 timeout: 60
db_cache:
clean_bundles: false clean_bundles: false
empty_trash: false empty_trash: false
optimize: false optimize: false

@ -8,6 +8,7 @@ plex: # Can be individually specified
url: http://bing.bang.boing <<< ENTER YOUR PLEX URL HERE url: http://bing.bang.boing <<< ENTER YOUR PLEX URL HERE
token: XXXXXXXXXXXXXXXXXXXX <<< ENTER YOUR PLEX TOKEN HERE token: XXXXXXXXXXXXXXXXXXXX <<< ENTER YOUR PLEX TOKEN HERE
timeout: 60 timeout: 60
db_cache:
clean_bundles: false clean_bundles: false
empty_trash: false empty_trash: false
optimize: false optimize: false

@ -662,6 +662,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),
"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),
"optimize": check_for_attribute(self.data, "optimize", parent="plex", var_type="bool", default=False) "optimize": check_for_attribute(self.data, "optimize", parent="plex", var_type="bool", default=False)
@ -944,6 +945,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),
"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),
"optimize": check_for_attribute(lib, "optimize", parent="plex", var_type="bool", default=self.general["plex"]["optimize"], save=False) "optimize": check_for_attribute(lib, "optimize", parent="plex", var_type="bool", default=self.general["plex"]["optimize"], save=False)

@ -1,5 +1,4 @@
import os, plexapi, re, requests import os, plexapi, re, requests
import distutils.version
from datetime import datetime, timedelta from datetime import datetime, timedelta
from modules import builder, util from modules import builder, util
from modules.library import Library from modules.library import Library
@ -433,9 +432,9 @@ class Plex(Library):
def __init__(self, config, params): def __init__(self, config, params):
super().__init__(config, params) super().__init__(config, params)
self.plex = params["plex"] self.plex = params["plex"]
self.url = params["plex"]["url"] self.url = self.plex["url"]
self.token = params["plex"]["token"] self.token = self.plex["token"]
self.timeout = params["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:
@ -446,12 +445,15 @@ class Plex(Library):
logger.info(f"Running on {self.PlexServer.platform} version {self.PlexServer.platformVersion}") logger.info(f"Running on {self.PlexServer.platform} version {self.PlexServer.platformVersion}")
pp_str = f"PlexPass: {self.PlexServer.myPlexSubscription}" pp_str = f"PlexPass: {self.PlexServer.myPlexSubscription}"
srv_settings = self.PlexServer.settings srv_settings = self.PlexServer.settings
plex_version = self.PlexServer.version try:
parsed_version = distutils.version.LooseVersion(plex_version) db_cache = srv_settings.get("DatabaseCacheSize")
min_version = distutils.version.LooseVersion("1.29") logger.info(f"Plex DB cache setting: {db_cache.value} MB")
if parsed_version > min_version: if self.plex["db_cache"] and self.plex["db_cache"] != db_cache.value:
db_cache = srv_settings.get("DatabaseCacheSize").value db_cache.set(self.plex["db_cache"])
logger.info(f"Plex DB cache setting: {db_cache} kilobytes") self.PlexServer.settings.save()
logger.info(f"Plex DB Cache updated to {self.plex['db_cache']} MB")
except NotFound:
logger.info(f"Plex DB cache setting: Unknown")
uc_str = f"Unknown update channel." uc_str = f"Unknown update channel."
if srv_settings.get("butlerUpdateChannel").value == '16': if srv_settings.get("butlerUpdateChannel").value == '16':
uc_str = f"Public update channel." uc_str = f"Public update channel."

Loading…
Cancel
Save