mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-01-06 11:09:57 -08:00
aa4d98ee34
* Bump plexapi from 4.15.0 to 4.15.4 Bumps [plexapi](https://github.com/pkkid/python-plexapi) from 4.15.0 to 4.15.4. - [Release notes](https://github.com/pkkid/python-plexapi/releases) - [Commits](https://github.com/pkkid/python-plexapi/compare/4.15.0...4.15.4) --- updated-dependencies: - dependency-name: plexapi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Update plexapi==4.15.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
54 lines
2.1 KiB
Python
54 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import logging
|
|
import os
|
|
from logging.handlers import RotatingFileHandler
|
|
from platform import uname
|
|
from uuid import getnode
|
|
|
|
from plexapi.config import PlexConfig, reset_base_headers
|
|
import plexapi.const as const
|
|
from plexapi.utils import SecretsFilter
|
|
|
|
# Load User Defined Config
|
|
DEFAULT_CONFIG_PATH = os.path.expanduser('~/.config/plexapi/config.ini')
|
|
CONFIG_PATH = os.environ.get('PLEXAPI_CONFIG_PATH', DEFAULT_CONFIG_PATH)
|
|
CONFIG = PlexConfig(CONFIG_PATH)
|
|
|
|
# PlexAPI Settings
|
|
PROJECT = 'PlexAPI'
|
|
VERSION = __version__ = const.__version__
|
|
TIMEOUT = CONFIG.get('plexapi.timeout', 30, int)
|
|
X_PLEX_CONTAINER_SIZE = CONFIG.get('plexapi.container_size', 100, int)
|
|
X_PLEX_ENABLE_FAST_CONNECT = CONFIG.get('plexapi.enable_fast_connect', False, bool)
|
|
|
|
# Plex Header Configuration
|
|
X_PLEX_PROVIDES = CONFIG.get('header.provides', 'controller')
|
|
X_PLEX_PLATFORM = CONFIG.get('header.platform', uname()[0])
|
|
X_PLEX_PLATFORM_VERSION = CONFIG.get('header.platform_version', uname()[2])
|
|
X_PLEX_PRODUCT = CONFIG.get('header.product', PROJECT)
|
|
X_PLEX_VERSION = CONFIG.get('header.version', VERSION)
|
|
X_PLEX_DEVICE = CONFIG.get('header.device', X_PLEX_PLATFORM)
|
|
X_PLEX_DEVICE_NAME = CONFIG.get('header.device_name', uname()[1])
|
|
X_PLEX_IDENTIFIER = CONFIG.get('header.identifier', str(hex(getnode())))
|
|
X_PLEX_LANGUAGE = CONFIG.get('header.language', 'en')
|
|
BASE_HEADERS = reset_base_headers()
|
|
|
|
# Logging Configuration
|
|
log = logging.getLogger('plexapi')
|
|
logfile = CONFIG.get('log.path')
|
|
logformat = CONFIG.get('log.format', '%(asctime)s %(module)12s:%(lineno)-4s %(levelname)-9s %(message)s')
|
|
loglevel = CONFIG.get('log.level', 'INFO').upper()
|
|
loghandler = logging.NullHandler()
|
|
|
|
if logfile: # pragma: no cover
|
|
logbackups = CONFIG.get('log.backup_count', 3, int)
|
|
logbytes = CONFIG.get('log.rotate_bytes', 512000, int)
|
|
loghandler = RotatingFileHandler(os.path.expanduser(logfile), 'a', logbytes, logbackups)
|
|
|
|
loghandler.setFormatter(logging.Formatter(logformat))
|
|
log.addHandler(loghandler)
|
|
log.setLevel(loglevel)
|
|
logfilter = SecretsFilter()
|
|
if CONFIG.get('log.show_secrets', '').lower() != 'true':
|
|
log.addFilter(logfilter)
|