2018-07-13 02:46:02 +10:00
|
|
|
#!/usr/bin/env python
|
2017-05-17 18:09:50 +10:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-07-13 02:46:02 +10:00
|
|
|
"""
|
|
|
|
THREAD SAFE
|
|
|
|
"""
|
|
|
|
from __future__ import absolute_import, division, unicode_literals
|
2018-06-22 03:24:37 +10:00
|
|
|
from threading import Lock, RLock
|
|
|
|
|
|
|
|
|
|
|
|
# LOCKS
|
|
|
|
####################
|
2018-06-22 04:43:39 +10:00
|
|
|
# Need to lock all methods and functions messing with Plex Companion subscribers
|
2018-06-22 03:24:37 +10:00
|
|
|
LOCK_SUBSCRIBER = RLock()
|
2018-06-22 04:43:39 +10:00
|
|
|
# Need to lock everything messing with Kodi/PKC playqueues
|
|
|
|
LOCK_PLAYQUEUES = RLock()
|
2018-06-22 03:24:37 +10:00
|
|
|
# Necessary to temporarily hold back librarysync/websocket listener when doing
|
|
|
|
# a full sync
|
|
|
|
LOCK_PLAYLISTS = Lock()
|
2017-05-17 18:09:50 +10:00
|
|
|
|
|
|
|
# Quit PKC
|
|
|
|
STOP_PKC = False
|
|
|
|
|
2018-11-07 22:08:35 +11:00
|
|
|
# URL of our current PMS
|
|
|
|
PMS_SERVER = None
|
2017-05-17 18:09:50 +10:00
|
|
|
# Usually triggered by another Python instance - will have to be set (by
|
|
|
|
# polling window) through e.g. librarysync thread
|
|
|
|
SUSPEND_LIBRARY_THREAD = False
|
|
|
|
# Set if user decided to cancel sync
|
|
|
|
STOP_SYNC = False
|
2018-04-18 04:18:25 +10:00
|
|
|
# Set e.g. during media playback if PKC should not do any syncs. Will NOT
|
|
|
|
# suspend synching of playstate progress
|
|
|
|
SUSPEND_SYNC = False
|
2017-08-19 23:03:19 +10:00
|
|
|
# Could we access the paths?
|
|
|
|
PATH_VERIFIED = False
|
2017-05-17 21:55:24 +10:00
|
|
|
# Set if a Plex-Kodi DB sync is being done - along with
|
|
|
|
# window('plex_dbScan') set to 'true'
|
2017-05-17 18:09:50 +10:00
|
|
|
DB_SCAN = False
|
|
|
|
# Plex Media Server Status - along with window('plex_serverStatus')
|
|
|
|
PMS_STATUS = False
|
|
|
|
# When the userclient needs to wait
|
|
|
|
SUSPEND_USER_CLIENT = False
|
|
|
|
# Plex home user? Then "False". Along with window('plex_restricteduser')
|
|
|
|
RESTRICTED_USER = False
|
2017-05-17 23:42:12 +10:00
|
|
|
# Direct Paths (True) or Addon Paths (False)? Along with
|
|
|
|
# window('useDirectPaths')
|
|
|
|
DIRECT_PATHS = False
|
2017-05-31 22:13:45 +10:00
|
|
|
# Shall we replace custom user ratings with the number of versions available?
|
|
|
|
INDICATE_MEDIA_VERSIONS = False
|
2018-08-14 03:58:09 +10:00
|
|
|
# Will sync movie trailer differently: either play trailer directly or show
|
|
|
|
# all the Plex extras for the user to choose
|
|
|
|
SHOW_EXTRAS_INSTEAD_OF_PLAYING_TRAILER = False
|
2017-08-22 02:53:38 +10:00
|
|
|
# Do we need to run a special library scan?
|
|
|
|
RUN_LIB_SCAN = None
|
2018-02-10 03:48:25 +11:00
|
|
|
# Number of items to fetch and display in widgets
|
|
|
|
FETCH_PMS_ITEM_NUMBER = None
|
2018-03-23 03:26:11 +11:00
|
|
|
# Hack to force Kodi widget for "in progress" to show up if it was empty before
|
|
|
|
FORCE_RELOAD_SKIN = True
|
2017-05-17 23:57:30 +10:00
|
|
|
|
2017-08-21 15:42:11 +10:00
|
|
|
# Stemming from the PKC settings.xml
|
|
|
|
# Shall we show Kodi dialogs when synching?
|
|
|
|
SYNC_DIALOG = True
|
2018-04-29 22:12:39 +10:00
|
|
|
# Shall Kodi show dialogs for syncing/caching images? (e.g. images left to sync)
|
|
|
|
IMAGE_SYNC_NOTIFICATIONS = True
|
2018-07-03 04:23:16 +10:00
|
|
|
# Only sync specific Plex playlists to Kodi?
|
|
|
|
SYNC_SPECIFIC_PLEX_PLAYLISTS = False
|
|
|
|
# Only sync specific Kodi playlists to Plex?
|
|
|
|
SYNC_SPECIFIC_KODI_PLAYLISTS = False
|
2017-08-22 16:16:21 +10:00
|
|
|
# Is synching of Plex music enabled?
|
2017-09-03 21:23:18 +10:00
|
|
|
ENABLE_MUSIC = True
|
2017-08-22 16:16:21 +10:00
|
|
|
# How often shall we sync?
|
|
|
|
FULL_SYNC_INTERVALL = 0
|
2018-03-10 22:58:11 +11:00
|
|
|
# Background Sync disabled?
|
|
|
|
BACKGROUND_SYNC_DISABLED = False
|
2017-08-22 16:16:21 +10:00
|
|
|
# How long shall we wait with synching a new item to make sure Plex got all
|
|
|
|
# metadata?
|
|
|
|
BACKGROUNDSYNC_SAFTYMARGIN = 0
|
|
|
|
# How many threads to download Plex metadata on sync?
|
|
|
|
SYNC_THREAD_NUMBER = 0
|
|
|
|
# What's the time offset between the PMS and Kodi?
|
|
|
|
KODI_PLEX_TIME_OFFSET = 0.0
|
2017-08-21 15:42:11 +10:00
|
|
|
|
2017-08-22 15:18:19 +10:00
|
|
|
# Path remapping mechanism (e.g. smb paths)
|
|
|
|
# Do we replace \\myserver\path to smb://myserver/path?
|
|
|
|
REPLACE_SMB_PATH = False
|
|
|
|
# Do we generally remap?
|
|
|
|
REMAP_PATH = False
|
|
|
|
# Mappings for REMAP_PATH:
|
2017-09-03 20:44:03 +10:00
|
|
|
remapSMBmovieOrg = None
|
|
|
|
remapSMBmovieNew = None
|
|
|
|
remapSMBtvOrg = None
|
|
|
|
remapSMBtvNew = None
|
|
|
|
remapSMBmusicOrg = None
|
|
|
|
remapSMBmusicNew = None
|
|
|
|
remapSMBphotoOrg = None
|
|
|
|
remapSMBphotoNew = None
|
2017-08-21 15:42:11 +10:00
|
|
|
|
2018-01-28 23:23:47 +11:00
|
|
|
# Shall we verify SSL certificates?
|
|
|
|
VERIFY_SSL_CERT = False
|
|
|
|
# Do we have an ssl certificate for PKC we need to use?
|
|
|
|
SSL_CERT_PATH = None
|
2017-05-17 18:10:14 +10:00
|
|
|
# Along with window('plex_authenticated')
|
|
|
|
AUTHENTICATED = False
|
2017-05-18 04:22:16 +10:00
|
|
|
# plex.tv username
|
2017-05-18 00:14:17 +10:00
|
|
|
PLEX_USERNAME = None
|
2017-05-18 04:22:16 +10:00
|
|
|
# Token for that user for plex.tv
|
|
|
|
PLEX_TOKEN = None
|
2018-02-15 06:38:50 +11:00
|
|
|
# Plex token for the active PMS for the active user
|
|
|
|
# (might be diffent to PLEX_TOKEN)
|
|
|
|
PMS_TOKEN = None
|
2017-05-18 04:22:16 +10:00
|
|
|
# Plex ID of that user (e.g. for plex.tv) as a STRING
|
2017-05-18 00:15:16 +10:00
|
|
|
PLEX_USER_ID = None
|
2017-05-18 04:22:16 +10:00
|
|
|
# Token passed along, e.g. if playback initiated by Plex Companion. Might be
|
|
|
|
# another user playing something! Token identifies user
|
|
|
|
PLEX_TRANSIENT_TOKEN = None
|
2017-12-08 03:25:48 +11:00
|
|
|
|
2018-01-07 01:19:12 +11:00
|
|
|
# Plex Companion Queue()
|
|
|
|
COMPANION_QUEUE = None
|
|
|
|
# Command Pipeline Queue()
|
|
|
|
COMMAND_PIPELINE_QUEUE = None
|
|
|
|
# Websocket_client queue to communicate with librarysync
|
|
|
|
WEBSOCKET_QUEUE = None
|
|
|
|
|
2018-01-22 04:31:49 +11:00
|
|
|
# Which Kodi player is/has been active? (either int 1, 2 or 3)
|
2018-05-27 19:36:54 +10:00
|
|
|
ACTIVE_PLAYERS = set()
|
2018-04-08 22:34:38 +10:00
|
|
|
# Failsafe for throwing an empty video back to Kodi's setResolvedUrl to set
|
|
|
|
# up our own playlist from the very beginning
|
2018-02-07 23:57:07 +11:00
|
|
|
PKC_CAUSED_STOP = False
|
2018-04-08 22:34:38 +10:00
|
|
|
# Flag if the 0 length PKC video has already failed so we can start resolving
|
|
|
|
# playback (set in player.py)
|
|
|
|
PKC_CAUSED_STOP_DONE = True
|
2018-01-22 04:31:49 +11:00
|
|
|
|
2017-12-11 05:01:22 +11:00
|
|
|
# Kodi player states - here, initial values are set
|
|
|
|
PLAYER_STATES = {
|
2018-02-04 02:43:39 +11:00
|
|
|
0: {},
|
2018-01-22 04:31:49 +11:00
|
|
|
1: {},
|
2018-02-04 02:43:39 +11:00
|
|
|
2: {}
|
2017-12-11 05:01:22 +11:00
|
|
|
}
|
2018-01-26 03:15:38 +11:00
|
|
|
# The LAST playstate once playback is finished
|
|
|
|
OLD_PLAYER_STATES = {
|
2018-02-04 02:43:39 +11:00
|
|
|
0: {},
|
2018-01-26 03:15:38 +11:00
|
|
|
1: {},
|
2018-02-04 02:43:39 +11:00
|
|
|
2: {}
|
2018-01-26 03:15:38 +11:00
|
|
|
}
|
2018-03-12 04:54:05 +11:00
|
|
|
# "empty" dict for the PLAYER_STATES above. Use copy.deepcopy to duplicate!
|
2018-01-22 04:31:49 +11:00
|
|
|
PLAYSTATE = {
|
|
|
|
'type': None,
|
|
|
|
'time': {
|
|
|
|
'hours': 0,
|
|
|
|
'minutes': 0,
|
|
|
|
'seconds': 0,
|
|
|
|
'milliseconds': 0},
|
|
|
|
'totaltime': {
|
|
|
|
'hours': 0,
|
|
|
|
'minutes': 0,
|
|
|
|
'seconds': 0,
|
|
|
|
'milliseconds': 0},
|
|
|
|
'speed': 0,
|
|
|
|
'shuffled': False,
|
|
|
|
'repeat': 'off',
|
|
|
|
'position': None,
|
|
|
|
'playlistid': None,
|
|
|
|
'currentvideostream': -1,
|
|
|
|
'currentaudiostream': -1,
|
|
|
|
'subtitleenabled': False,
|
|
|
|
'currentsubtitle': -1,
|
|
|
|
'file': None,
|
|
|
|
'kodi_id': None,
|
|
|
|
'kodi_type': None,
|
|
|
|
'plex_id': None,
|
|
|
|
'plex_type': None,
|
|
|
|
'container_key': None,
|
|
|
|
'volume': 100,
|
|
|
|
'muted': False,
|
|
|
|
'playmethod': None,
|
|
|
|
'playcount': None
|
|
|
|
}
|
2017-12-08 03:25:48 +11:00
|
|
|
PLAYED_INFO = {}
|
2018-01-22 21:20:37 +11:00
|
|
|
# Set by SpecialMonitor - did user choose to resume playback or start from the
|
|
|
|
# beginning?
|
|
|
|
RESUME_PLAYBACK = False
|
2018-02-03 22:45:48 +11:00
|
|
|
# Was the playback initiated by the user using the Kodi context menu?
|
|
|
|
CONTEXT_MENU_PLAY = False
|
|
|
|
# Set by context menu - shall we force-transcode the next playing item?
|
|
|
|
FORCE_TRANSCODE = False
|
2017-12-10 01:41:07 +11:00
|
|
|
|
|
|
|
# Kodi webserver details
|
|
|
|
WEBSERVER_PORT = 8080
|
|
|
|
WEBSERVER_USERNAME = 'kodi'
|
|
|
|
WEBSERVER_PASSWORD = ''
|
|
|
|
WEBSERVER_HOST = 'localhost'
|