More template filters for Libraries, Users, and Sync

This commit is contained in:
JonnyWong16 2016-04-24 00:59:01 -07:00
parent 4f8a5211f8
commit 89694b5069
13 changed files with 74 additions and 43 deletions

View file

@ -562,4 +562,18 @@ def uploadToImgur(imgPath, imgTitle=''):
except (urllib2.HTTPError, urllib2.URLError) as e:
logger.warn(u"PlexPy Helpers :: Unable to upload image to Imgur: %s" % e)
return img_url
return img_url
def filter_datatable_session(list_of_dicts):
import cherrypy
from plexpy.webauth import SESSION_KEY
_cp_session = cherrypy.session.get(SESSION_KEY)
_session = {}
_session['username'], _session['user_id'], _session['user_group'], _session['expiry'] = \
_cp_session if _cp_session else (None, None, None, None)
if _session['user_id']:
return [d for d in list_of_dicts if str(d.get('user_id')) == str(_session['user_id'])]
else:
return list_of_dicts