def MainMenu(): DATABASE.ensure_keys() archives.init_rar(Prefs['unrar']) archives.init_sz(Prefs['seven_zip']) user = DATABASE.get_user(Request.Headers.get('X-Plex-Token', 'default')) Log.Info('USER: {}'.format(user)) oc = ObjectContainer(title2=unicode(user), no_cache=True) if bool(Prefs['update']): Updater(PREFIX + '/updater', oc) for x in BrowseDir(Prefs['cb_path'], page_size=int(Prefs['page_size']), user=user).objects: oc.add(x) return oc
def MainMenu(): DATABASE.ensure_keys() Log.Debug('test_token: {}'.format(test_token(Request.Headers.get('X-Plex-Token')))) archives.init_rar(Prefs['unrar']) archives.init_sz(Prefs['seven_zip']) user = DATABASE.get_user(Request.Headers.get('X-Plex-Token', 'default')) Log.Info('USER: {}'.format(user)) oc = ObjectContainer(title2=unicode(user), no_cache=True) if bool(Prefs['update']): Updater(PREFIX + '/updater', oc) oc.add(DirectoryObject(key=Callback(Users), title='Hello {}. Switch User?'.format(user), thumb=R('icon-default.png'))) browse_dir = BrowseDir(Prefs['cb_path'], page_size=int(Prefs['page_size']), user=user) if not hasattr(browse_dir, 'objects'): return browse_dir for x in browse_dir.objects: oc.add(x) return oc
def RefreshUser(): DATABASE.get_user(Request.Headers.get('X-Plex-Token', 'default'), force=True) return error_message('refreshed user', 'refreshed user')