Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa41dc3f35 |
No files matched your search
@@ -70,7 +70,7 @@ def Start():
|
|||||||
ValidatePrefs()
|
ValidatePrefs()
|
||||||
Log.Debug(config.full_version)
|
Log.Debug(config.full_version)
|
||||||
|
|
||||||
if not config.permissions_ok:
|
if config.initialized and not config.permissions_ok:
|
||||||
Log.Error("Insufficient permissions on library folders:")
|
Log.Error("Insufficient permissions on library folders:")
|
||||||
for title, path in config.missing_permissions:
|
for title, path in config.missing_permissions:
|
||||||
Log.Error("Insufficient permissions on library %s, folder: %s" % (title, path))
|
Log.Error("Insufficient permissions on library %s, folder: %s" % (title, path))
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
from subzero.constants import PREFIX, TITLE, ART
|
import time
|
||||||
|
|
||||||
|
from subzero.constants import PREFIX, TITLE, ART, START_DELAY
|
||||||
from support.config import config
|
from support.config import config
|
||||||
from support.helpers import pad_title, timestamp, df, display_language
|
from support.helpers import pad_title, timestamp, df, display_language
|
||||||
from support.scheduler import scheduler
|
from support.scheduler import scheduler
|
||||||
@@ -27,45 +29,56 @@ def fatality(randomize=None, force_title=None, header=None, message=None, only_r
|
|||||||
no_history=no_history,
|
no_history=no_history,
|
||||||
replace_parent=replace_parent, no_cache=True)
|
replace_parent=replace_parent, no_cache=True)
|
||||||
|
|
||||||
# always re-check permissions
|
if config.initialized:
|
||||||
config.refresh_permissions_status()
|
# always re-check permissions
|
||||||
|
config.refresh_permissions_status()
|
||||||
|
|
||||||
# always re-check enabled sections
|
# always re-check enabled sections
|
||||||
config.refresh_enabled_sections()
|
config.refresh_enabled_sections()
|
||||||
|
|
||||||
if config.lock_menu and not config.pin_correct:
|
if config.lock_menu and not config.pin_correct:
|
||||||
oc.add(DirectoryObject(
|
|
||||||
key=Callback(PinMenu, randomize=timestamp()),
|
|
||||||
title=pad_title(_("Enter PIN")),
|
|
||||||
summary=_("The owner has restricted the access to this menu. Please enter the correct pin"),
|
|
||||||
))
|
|
||||||
return oc
|
|
||||||
|
|
||||||
if not config.permissions_ok and config.missing_permissions:
|
|
||||||
if not isinstance(config.missing_permissions, list):
|
|
||||||
oc.add(DirectoryObject(
|
oc.add(DirectoryObject(
|
||||||
key=Callback(fatality, randomize=timestamp()),
|
key=Callback(PinMenu, randomize=timestamp()),
|
||||||
title=pad_title(_("Insufficient permissions")),
|
title=pad_title(_("Enter PIN")),
|
||||||
summary=config.missing_permissions,
|
summary=_("The owner has restricted the access to this menu. Please enter the correct pin"),
|
||||||
))
|
))
|
||||||
else:
|
return oc
|
||||||
for title, path in config.missing_permissions:
|
|
||||||
|
if not config.permissions_ok and config.missing_permissions:
|
||||||
|
if not isinstance(config.missing_permissions, list):
|
||||||
oc.add(DirectoryObject(
|
oc.add(DirectoryObject(
|
||||||
key=Callback(fatality, randomize=timestamp()),
|
key=Callback(fatality, randomize=timestamp()),
|
||||||
title=pad_title(_("Insufficient permissions")),
|
title=pad_title(_("Insufficient permissions")),
|
||||||
summary=_("Insufficient permissions on library %(title)s, folder: %(path)s",
|
summary=config.missing_permissions,
|
||||||
title=title,
|
|
||||||
path=path),
|
|
||||||
))
|
))
|
||||||
return oc
|
else:
|
||||||
|
for title, path in config.missing_permissions:
|
||||||
|
oc.add(DirectoryObject(
|
||||||
|
key=Callback(fatality, randomize=timestamp()),
|
||||||
|
title=pad_title(_("Insufficient permissions")),
|
||||||
|
summary=_("Insufficient permissions on library %(title)s, folder: %(path)s",
|
||||||
|
title=title,
|
||||||
|
path=path),
|
||||||
|
))
|
||||||
|
return oc
|
||||||
|
|
||||||
if not config.enabled_sections:
|
if not config.enabled_sections:
|
||||||
oc.add(DirectoryObject(
|
oc.add(DirectoryObject(
|
||||||
key=Callback(fatality, randomize=timestamp()),
|
key=Callback(fatality, randomize=timestamp()),
|
||||||
title=pad_title(_("I'm not enabled!")),
|
title=pad_title(_("I'm not enabled!")),
|
||||||
summary=_("Please enable me for some of your libraries in your server settings; currently I do nothing"),
|
summary=_("Please enable me for some of your libraries in your server settings; currently I do nothing"),
|
||||||
))
|
))
|
||||||
return oc
|
return oc
|
||||||
|
else:
|
||||||
|
if config.delay_system_queries:
|
||||||
|
elapsed = int(START_DELAY - (time.time() - config.start_delay_elapsed))
|
||||||
|
oc.add(DirectoryObject(
|
||||||
|
key=Callback(fatality, randomize=timestamp()),
|
||||||
|
title=pad_title(_("Finalizing ..."
|
||||||
|
if elapsed <= 0 else "Initializing, please wait %s seconds ..." % elapsed)),
|
||||||
|
summary=_("Start is delayed by %s seconds to cope with a slow PMS" % int(START_DELAY)),
|
||||||
|
))
|
||||||
|
return oc
|
||||||
|
|
||||||
if not only_refresh:
|
if not only_refresh:
|
||||||
if Dict["current_refresh_state"]:
|
if Dict["current_refresh_state"]:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import sys
|
|||||||
import rarfile
|
import rarfile
|
||||||
import jstyleson
|
import jstyleson
|
||||||
import datetime
|
import datetime
|
||||||
|
import time
|
||||||
|
|
||||||
import subliminal
|
import subliminal
|
||||||
import subliminal_patch
|
import subliminal_patch
|
||||||
@@ -22,7 +23,7 @@ from subliminal.cli import MutexLock
|
|||||||
from subzero.lib.io import FileIO, get_viable_encoding
|
from subzero.lib.io import FileIO, get_viable_encoding
|
||||||
from subzero.lib.dict import Dicked
|
from subzero.lib.dict import Dicked
|
||||||
from subzero.util import get_root_path
|
from subzero.util import get_root_path
|
||||||
from subzero.constants import PLUGIN_NAME, PLUGIN_IDENTIFIER, MOVIE, SHOW, MEDIA_TYPE_TO_STRING
|
from subzero.constants import PLUGIN_NAME, PLUGIN_IDENTIFIER, MOVIE, SHOW, MEDIA_TYPE_TO_STRING, START_DELAY
|
||||||
from subzero.prefs import get_user_prefs, update_user_prefs
|
from subzero.prefs import get_user_prefs, update_user_prefs
|
||||||
from dogpile.cache.region import register_backend as register_cache_backend
|
from dogpile.cache.region import register_backend as register_cache_backend
|
||||||
from lib import Plex
|
from lib import Plex
|
||||||
@@ -148,10 +149,15 @@ class Config(object):
|
|||||||
unrar = None
|
unrar = None
|
||||||
adv_cfg_path = None
|
adv_cfg_path = None
|
||||||
use_custom_dns = False
|
use_custom_dns = False
|
||||||
|
delay_system_queries = False
|
||||||
|
|
||||||
store_recently_played_amount = 40
|
store_recently_played_amount = 40
|
||||||
|
|
||||||
initialized = False
|
initialized = False
|
||||||
|
system_queries_done = False
|
||||||
|
base_init_done = False
|
||||||
|
system_queries_timer = None
|
||||||
|
start_delay_elapsed = None
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.libraries_root = os.path.abspath(os.path.join(get_root_path(), ".."))
|
self.libraries_root = os.path.abspath(os.path.join(get_root_path(), ".."))
|
||||||
@@ -169,6 +175,7 @@ class Config(object):
|
|||||||
self.set_log_paths()
|
self.set_log_paths()
|
||||||
self.app_support_path = Core.app_support_path
|
self.app_support_path = Core.app_support_path
|
||||||
self.data_path = getattr(Data, "_core").storage.data_path
|
self.data_path = getattr(Data, "_core").storage.data_path
|
||||||
|
self.delay_system_queries = os.path.isfile(os.path.join(self.data_path, "delayed_start"))
|
||||||
self.data_items_path = os.path.join(self.data_path, "DataItems")
|
self.data_items_path = os.path.join(self.data_path, "DataItems")
|
||||||
self.universal_plex_token = self.get_universal_plex_token()
|
self.universal_plex_token = self.get_universal_plex_token()
|
||||||
self.plex_token = os.environ.get("PLEXTOKEN", self.universal_plex_token)
|
self.plex_token = os.environ.get("PLEXTOKEN", self.universal_plex_token)
|
||||||
@@ -205,8 +212,25 @@ class Config(object):
|
|||||||
self.missing_permissions = []
|
self.missing_permissions = []
|
||||||
self.include_exclude_sz_files = cast_bool(Prefs["subtitles.include_exclude_fs"])
|
self.include_exclude_sz_files = cast_bool(Prefs["subtitles.include_exclude_fs"])
|
||||||
self.include_exclude_paths = self.parse_include_exclude_paths()
|
self.include_exclude_paths = self.parse_include_exclude_paths()
|
||||||
self.enabled_sections = self.check_enabled_sections()
|
|
||||||
self.permissions_ok = self.check_permissions()
|
self.system_queries_done = False
|
||||||
|
|
||||||
|
def system_queries():
|
||||||
|
self.enabled_sections = self.check_enabled_sections()
|
||||||
|
self.permissions_ok = self.check_permissions()
|
||||||
|
self.system_queries_done = True
|
||||||
|
self.system_queries_timer = None
|
||||||
|
if self.base_init_done:
|
||||||
|
self.initialized = True
|
||||||
|
|
||||||
|
if self.delay_system_queries:
|
||||||
|
if not self.system_queries_timer or not self.system_queries_timer.is_alive():
|
||||||
|
Log.Info("Waiting %s seconds until querying the system endpoints of your PMS" % START_DELAY)
|
||||||
|
Thread.CreateTimer(START_DELAY, system_queries)
|
||||||
|
self.start_delay_elapsed = time.time()
|
||||||
|
else:
|
||||||
|
system_queries()
|
||||||
|
|
||||||
self.notify_executable = self.check_notify_executable()
|
self.notify_executable = self.check_notify_executable()
|
||||||
self.remove_hi = cast_bool(Prefs['subtitles.remove_hi'])
|
self.remove_hi = cast_bool(Prefs['subtitles.remove_hi'])
|
||||||
self.remove_tags = cast_bool(Prefs['subtitles.remove_tags'])
|
self.remove_tags = cast_bool(Prefs['subtitles.remove_tags'])
|
||||||
@@ -228,7 +252,11 @@ class Config(object):
|
|||||||
self.embedded_auto_extract = cast_bool(Prefs["subtitles.embedded.autoextract"])
|
self.embedded_auto_extract = cast_bool(Prefs["subtitles.embedded.autoextract"])
|
||||||
self.ietf_as_alpha3 = cast_bool(Prefs["subtitles.language.ietf_normalize"])
|
self.ietf_as_alpha3 = cast_bool(Prefs["subtitles.language.ietf_normalize"])
|
||||||
self.use_custom_dns = cast_bool(Prefs['use_custom_dns'])
|
self.use_custom_dns = cast_bool(Prefs['use_custom_dns'])
|
||||||
self.initialized = True
|
|
||||||
|
self.base_init_done = True
|
||||||
|
|
||||||
|
if self.system_queries_done:
|
||||||
|
self.initialized = True
|
||||||
|
|
||||||
def migrate_prefs(self):
|
def migrate_prefs(self):
|
||||||
config_version = 0 if "config_version" not in Dict else Dict["config_version"]
|
config_version = 0 if "config_version" not in Dict else Dict["config_version"]
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ ICON = 'icon-default.jpg'
|
|||||||
ICON_SUB = 'icon-sub.jpg'
|
ICON_SUB = 'icon-sub.jpg'
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 15
|
DEFAULT_TIMEOUT = 15
|
||||||
|
START_DELAY = 30.0
|
||||||
|
|
||||||
|
|
||||||
# media types as on https://github.com/Arcanemagus/plex-api/wiki/MediaTypes
|
# media types as on https://github.com/Arcanemagus/plex-api/wiki/MediaTypes
|
||||||
|
|||||||
Reference in new issue
Block a user