Filter info pages and search results for guests
This commit is contained in:
@@ -878,9 +878,13 @@ class DataFactory(object):
|
|||||||
|
|
||||||
ip_address = 'N/A'
|
ip_address = 'N/A'
|
||||||
|
|
||||||
|
user_cond = ''
|
||||||
|
if session.get_session_user_id():
|
||||||
|
user_cond = 'AND user_id = %s ' % session.get_session_user_id()
|
||||||
|
|
||||||
if session_key:
|
if session_key:
|
||||||
try:
|
try:
|
||||||
query = 'SELECT ip_address FROM sessions WHERE session_key = %d' % int(session_key)
|
query = 'SELECT ip_address FROM sessions WHERE session_key = %d %s' % (int(session_key), user_cond)
|
||||||
result = monitor_db.select(query)
|
result = monitor_db.select(query)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"PlexPy DataFactory :: Unable to execute database query for get_session_ip: %s." % e)
|
logger.warn(u"PlexPy DataFactory :: Unable to execute database query for get_session_ip: %s." % e)
|
||||||
|
@@ -1468,9 +1468,12 @@ class PmsConnect(object):
|
|||||||
if a.getElementsByTagName('Track'):
|
if a.getElementsByTagName('Track'):
|
||||||
result_data = a.getElementsByTagName('Track')
|
result_data = a.getElementsByTagName('Track')
|
||||||
|
|
||||||
|
section_id = helpers.get_xml_attr(a, 'librarySectionID')
|
||||||
|
|
||||||
if result_data:
|
if result_data:
|
||||||
for result in result_data:
|
for result in result_data:
|
||||||
children_output = {'rating_key': helpers.get_xml_attr(result, 'ratingKey'),
|
children_output = {'section_id': section_id,
|
||||||
|
'rating_key': helpers.get_xml_attr(result, 'ratingKey'),
|
||||||
'media_index': helpers.get_xml_attr(result, 'index'),
|
'media_index': helpers.get_xml_attr(result, 'index'),
|
||||||
'title': helpers.get_xml_attr(result, 'title'),
|
'title': helpers.get_xml_attr(result, 'title'),
|
||||||
'thumb': helpers.get_xml_attr(result, 'thumb'),
|
'thumb': helpers.get_xml_attr(result, 'thumb'),
|
||||||
@@ -1482,7 +1485,7 @@ class PmsConnect(object):
|
|||||||
output = {'children_count': helpers.get_xml_attr(xml_head[0], 'size'),
|
output = {'children_count': helpers.get_xml_attr(xml_head[0], 'size'),
|
||||||
'children_type': helpers.get_xml_attr(xml_head[0], 'viewGroup'),
|
'children_type': helpers.get_xml_attr(xml_head[0], 'viewGroup'),
|
||||||
'title': helpers.get_xml_attr(xml_head[0], 'title2'),
|
'title': helpers.get_xml_attr(xml_head[0], 'title2'),
|
||||||
'children_list': children_list
|
'children_list': session.filter_session_info(children_list, 'section_id')
|
||||||
}
|
}
|
||||||
|
|
||||||
return output
|
return output
|
||||||
@@ -1902,7 +1905,7 @@ class PmsConnect(object):
|
|||||||
search_results_count += 1
|
search_results_count += 1
|
||||||
|
|
||||||
output = {'results_count': search_results_count,
|
output = {'results_count': search_results_count,
|
||||||
'results_list': search_results_list
|
'results_list': {k: session.filter_session_info(v, 'section_id') for k, v in search_results_list.iteritems()}
|
||||||
}
|
}
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
@@ -1859,6 +1859,9 @@ class WebInterface(object):
|
|||||||
metadata['poster_url'] = poster_url
|
metadata['poster_url'] = poster_url
|
||||||
|
|
||||||
if metadata:
|
if metadata:
|
||||||
|
if metadata['section_id'] and not allow_session_library(metadata['section_id']):
|
||||||
|
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
||||||
|
|
||||||
return serve_template(templatename="info.html", data=metadata, title="Info", config=config, source=source)
|
return serve_template(templatename="info.html", data=metadata, title="Info", config=config, source=source)
|
||||||
else:
|
else:
|
||||||
return self.update_metadata(rating_key, query)
|
return self.update_metadata(rating_key, query)
|
||||||
|
Reference in New Issue
Block a user