Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit f3af167

Browse files
committed
use memory cache on windows for now; add config debug logging
1 parent c984c98 commit f3af167

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

Contents/Code/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from interface.menu import *
3030
from support.plex_media import media_to_videos, get_media_item_ids, scan_videos
3131
from support.subtitlehelpers import get_subtitles_from_metadata
32-
from support.storage import whack_missing_parts, save_subtitles, get_subtitle_storage
32+
from support.storage import whack_missing_parts, save_subtitles
3333
from support.items import is_ignored
3434
from support.config import config
3535
from support.lib import get_intent
@@ -43,13 +43,7 @@ def Start():
4343
HTTP.CacheTime = 0
4444
HTTP.Headers['User-agent'] = OS_PLEX_USERAGENT
4545

46-
try:
47-
subliminal.region.configure('dogpile.cache.dbm', expiration_time=datetime.timedelta(days=30),
48-
arguments={'filename': os.path.join(config.data_items_path, 'subzero.dbm'),
49-
'lock_factory': MutexLock})
50-
except:
51-
Log.Warn("Not using file based cache!")
52-
subliminal.region.configure('dogpile.cache.memory')
46+
config.init_cache()
5347

5448
# clear expired intents
5549
intent = get_intent()

Contents/Code/interface/menu.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from subzero.constants import ART, PREFIX, DEPENDENCY_MODULE_NAMES
1212
from support.scheduler import scheduler
1313
from support.config import config
14-
from support.helpers import timestamp, df
14+
from support.helpers import timestamp, df
1515
from support.ignore import ignore_list
1616
from support.items import get_all_items, get_items_info, \
1717
get_item_kind_from_rating_key
@@ -149,6 +149,15 @@ def ValidatePrefs():
149149
Core.log.setLevel(logging.DEBUG)
150150
Log.Debug("Validate Prefs called.")
151151

152+
# SZ config debug
153+
Log.Debug("--- SZ Config-Debug ---")
154+
for attr in [
155+
"app_support_path", "data_path", "data_items_path", "plugin_log_path", "server_log_path", "enable_agent",
156+
"enable_channel", "permissions_ok", "missing_permissions", "fs_encoding"]:
157+
Log.Debug("config.%s: %s", attr, getattr(config, attr))
158+
159+
Log.Debug("-----------------------")
160+
152161
# cache the channel state
153162
update_dict = False
154163
restart = False
@@ -187,4 +196,3 @@ def ValidatePrefs():
187196
Core.log.setLevel(logging.getLevelName(Prefs["log_level"]))
188197

189198
return
190-

Contents/Code/support/config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,21 @@ def initialize(self):
118118
self.default_mods = self.get_default_mods()
119119
self.initialized = True
120120

121+
def init_cache(self):
122+
use_fallback_cache = True
123+
if Core.runtime.os != "Windows":
124+
try:
125+
subliminal.region.configure('dogpile.cache.dbm', expiration_time=datetime.timedelta(days=30),
126+
arguments={'filename': os.path.join(config.data_items_path, 'subzero.dbm'),
127+
'lock_factory': MutexLock})
128+
use_fallback_cache = False
129+
except:
130+
pass
131+
132+
if use_fallback_cache:
133+
Log.Warn("Not using file based cache!")
134+
subliminal.region.configure('dogpile.cache.memory')
135+
121136
def set_log_paths(self):
122137
# find log handler
123138
for handler in Core.log.handlers:

Contents/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>CFBundleSignature</key>
1414
<string>????</string>
1515
<key>CFBundleVersion</key>
16-
<string>2.0.0.10</string>
16+
<string>2.0.0.11</string>
1717
<key>PlexFrameworkVersion</key>
1818
<string>2</string>
1919
<key>PlexPluginClass</key>
@@ -32,7 +32,7 @@
3232
3333
&lt;h1&gt;Sub-Zero for Plex&lt;/h1&gt;&lt;i&gt;Subtitles done right&lt;/i&gt;
3434
35-
Version 2.0.0.10 DEV
35+
Version 2.0.0.11 DEV
3636
3737
Originally based on @bramwalet's awesome &lt;a href=&quot;https://github.com/bramwalet/Subliminal.bundle&quot;&gt;Subliminal.bundle&lt;/a&gt;
3838

0 commit comments

Comments
 (0)