mirror of
https://github.com/hrfee/jellyfin-accounts.git
synced 2026-07-26 12:01:42 +00:00
Self-restarting for config changes
When changing settings that need restart, the option is now available to
do it automatically. Functions on linux at least, might need testing on
windows.
This commit is contained in:
@@ -44,7 +44,7 @@ class Jellyfin:
|
||||
|
||||
pass
|
||||
|
||||
def __init__(self, server, client, version, device, deviceId):
|
||||
def __init__(self, server, client, version, device, deviceId, cacheMinutes=30):
|
||||
"""
|
||||
Initializes the Jellyfin object. All parameters except server
|
||||
have no effect on the client's capability.
|
||||
@@ -61,7 +61,7 @@ class Jellyfin:
|
||||
self.version = version
|
||||
self.device = device
|
||||
self.deviceId = deviceId
|
||||
self.timeout = 30 * 60
|
||||
self.timeout = cacheMinutes * 60
|
||||
self.userCacheAge = time.time() - self.timeout - 1
|
||||
self.userCachePublicAge = self.userCacheAge
|
||||
self.useragent = f"{self.client}/{self.version}"
|
||||
@@ -83,6 +83,16 @@ class Jellyfin:
|
||||
self.info = requests.get(self.server + "/System/Info/Public").json()
|
||||
except:
|
||||
pass
|
||||
|
||||
def reloadCache(self):
|
||||
""" Forces a reload of the user caches """
|
||||
self.userCachePublicAge = time.time() - self.timeout - 1
|
||||
self.getUsers()
|
||||
try:
|
||||
self.userCacheAge = self.userCachePublicAge
|
||||
self.getUsers(public=False)
|
||||
except self.AuthenticationRequiredError:
|
||||
pass
|
||||
|
||||
def getUsers(self, username: str = "all", userId: str = "all", public: bool = True):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user