mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Good day plex!
This commit is contained in:
parent
f7bc208fd1
commit
37df262b24
5 changed files with 578 additions and 53 deletions
|
@ -1,4 +1,7 @@
|
|||
# This file is part of PlexPy.
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This file is part of PlexPy.
|
||||
#
|
||||
# PlexPy is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -97,8 +100,7 @@ class WebInterface(object):
|
|||
}
|
||||
|
||||
# The setup wizard just refreshes the page on submit so we must redirect to home if config set.
|
||||
# Also redirecting to home if a PMS token already exists - will remove this in future.
|
||||
if plexpy.CONFIG.FIRST_RUN_COMPLETE or plexpy.CONFIG.PMS_TOKEN:
|
||||
if plexpy.CONFIG.FIRST_RUN_COMPLETE:
|
||||
plexpy.initialize_scheduler()
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
else:
|
||||
|
@ -566,7 +568,7 @@ class WebInterface(object):
|
|||
|
||||
watched_percent = plexpy.CONFIG.NOTIFY_WATCHED_PERCENT
|
||||
|
||||
custom_where=[]
|
||||
custom_where = []
|
||||
if user_id:
|
||||
custom_where = [['session_history.user_id', user_id]]
|
||||
elif user:
|
||||
|
@ -887,7 +889,7 @@ class WebInterface(object):
|
|||
@cherrypy.expose
|
||||
def get_user_ips(self, user_id=None, user=None, **kwargs):
|
||||
|
||||
custom_where=[]
|
||||
custom_where = []
|
||||
if user_id:
|
||||
custom_where = [['user_id', user_id]]
|
||||
elif user:
|
||||
|
@ -1121,7 +1123,7 @@ class WebInterface(object):
|
|||
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_server_children()
|
||||
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
return json.dumps(result)
|
||||
|
@ -1386,8 +1388,8 @@ class WebInterface(object):
|
|||
new_key_list = pms_connect.get_rating_keys_list(rating_key=new_rating_key, media_type=media_type)
|
||||
|
||||
update_db = data_factory.update_rating_key(old_key_list=old_key_list,
|
||||
new_key_list=new_key_list,
|
||||
media_type=media_type)
|
||||
new_key_list=new_key_list,
|
||||
media_type=media_type)
|
||||
|
||||
if update_db:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
|
@ -1396,7 +1398,6 @@ class WebInterface(object):
|
|||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
return json.dumps({'message': 'no data received'})
|
||||
|
||||
|
||||
# test code
|
||||
@cherrypy.expose
|
||||
def get_new_rating_keys(self, rating_key='', media_type='', **kwargs):
|
||||
|
@ -1433,11 +1434,27 @@ class WebInterface(object):
|
|||
new_key_list = pms_connect.get_rating_keys_list(rating_key=new_rating_key, media_type=media_type)
|
||||
|
||||
result = data_factory.update_rating_key(old_key_list=old_key_list,
|
||||
new_key_list=new_key_list,
|
||||
media_type=media_type)
|
||||
new_key_list=new_key_list,
|
||||
media_type=media_type)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
return json.dumps(result)
|
||||
else:
|
||||
logger.warn('Unable to retrieve data.')
|
||||
|
||||
@cherrypy.expose
|
||||
def discover(self, token=''):
|
||||
"""
|
||||
Returns the servers that you own as a
|
||||
list of dicts (formatted for selectize)
|
||||
"""
|
||||
# Need to set token so result dont return http 401
|
||||
plexpy.CONFIG.__setattr__('PMS_TOKEN', token)
|
||||
plexpy.CONFIG.write()
|
||||
|
||||
result = plextv.PlexTV()
|
||||
servers = result.discover()
|
||||
if servers:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
return servers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue