mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Proxy PMS downloads json through server
This commit is contained in:
parent
d943877e76
commit
b7937b8740
4 changed files with 27 additions and 23 deletions
|
@ -261,7 +261,7 @@ def check_server_updates():
|
|||
logger.info("Tautulli Monitor :: Checking for PMS updates...")
|
||||
|
||||
plex_tv = plextv.PlexTV()
|
||||
download_info = plex_tv.get_plex_downloads()
|
||||
download_info = plex_tv.get_plex_update()
|
||||
|
||||
if download_info:
|
||||
logger.info("Tautulli Monitor :: Current PMS version: %s", plexpy.CONFIG.PMS_VERSION)
|
||||
|
|
|
@ -754,7 +754,16 @@ class PlexTV(object):
|
|||
|
||||
return clean_servers
|
||||
|
||||
def get_plex_downloads(self):
|
||||
def get_plex_downloads(self, update_channel):
|
||||
plex_downloads = self.get_plextv_downloads(plexpass=(update_channel == 'beta'))
|
||||
|
||||
try:
|
||||
return json.loads(plex_downloads)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli PlexTV :: Unable to load JSON for get_plex_updates: %s", e)
|
||||
return {}
|
||||
|
||||
def get_plex_update(self):
|
||||
logger.debug("Tautulli PlexTV :: Retrieving current server version.")
|
||||
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
|
@ -763,12 +772,9 @@ class PlexTV(object):
|
|||
update_channel = pms_connect.get_server_update_channel()
|
||||
|
||||
logger.debug("Tautulli PlexTV :: Plex update channel is %s." % update_channel)
|
||||
plex_downloads = self.get_plextv_downloads(plexpass=(update_channel == 'beta'))
|
||||
available_downloads = self.get_plex_downloads(update_channel=update_channel)
|
||||
|
||||
try:
|
||||
available_downloads = json.loads(plex_downloads)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli PlexTV :: Unable to load JSON for get_plex_updates.")
|
||||
if not available_downloads:
|
||||
return {}
|
||||
|
||||
# Get the updates for the platform
|
||||
|
|
|
@ -3423,6 +3423,14 @@ class WebInterface(object):
|
|||
if not response.ok:
|
||||
cherrypy.response.status = 401
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
def get_pms_downloads(self, update_channel, **kwargs):
|
||||
plex_tv = plextv.PlexTV()
|
||||
downloads = plex_tv.get_plex_downloads(update_channel=update_channel)
|
||||
return downloads
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
|
@ -3471,8 +3479,7 @@ class WebInterface(object):
|
|||
plexpy.CONFIG.PMS_PLATFORM, plexpy.CONFIG.PMS_PLATFORM),
|
||||
'pms_update_channel': plexpy.CONFIG.PMS_UPDATE_CHANNEL,
|
||||
'pms_update_distro': plexpy.CONFIG.PMS_UPDATE_DISTRO,
|
||||
'pms_update_distro_build': plexpy.CONFIG.PMS_UPDATE_DISTRO_BUILD,
|
||||
'plex_update_channel': 'plexpass' if update_channel == 'beta' else 'public'}
|
||||
'pms_update_distro_build': plexpy.CONFIG.PMS_UPDATE_DISTRO_BUILD}
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
|
@ -6423,7 +6430,7 @@ class WebInterface(object):
|
|||
```
|
||||
"""
|
||||
plex_tv = plextv.PlexTV()
|
||||
result = plex_tv.get_plex_downloads()
|
||||
result = plex_tv.get_plex_update()
|
||||
return result
|
||||
|
||||
@cherrypy.expose
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue