def append(q): collection().append(q) plex.user_dict().Save()
def remove(q): collection().remove(q) plex.user_dict().Save()
def initialize_dict(key, default = None): if not key in plex.user_dict(): plex.user_dict()[key] = default return plex.user_dict()[key]
import plex import user def clear(): user.attempt_clear('searches') def includes(q): return q in collection() def collection(): return user.initialize_dict('searches', []) def toggle(q): try: if includes(q): remove(q) response = 'removed' else: append(q) response = 'added' except Exception, e: return 'error' plex.user_dict().Save() return response def append(q): collection().append(q) plex.user_dict().Save() def remove(q): collection().remove(q) plex.user_dict().Save()
def set_current(download): plex.user_dict()['download_current'] = download plex.user_dict().Save()
def attempt_clear(key): if key in plex.user_dict(): del plex.user_dict()[key] plex.user_dict().Save()
def append(**kwargs): queue().append(kwargs) plex.user_dict().Save()
def remove(download): queue().remove(download) plex.user_dict().Save()
def assumed_running(): return 'download_current' in plex.user_dict() def curl_running(): return pid_running(current_pid())
def current(): return plex.user_dict()['download_current'] def current_pid(): return current().get('pid')
def store_curl_pid(dl): current()['title'] = dl.file_name() current()['pid'] = dl.pid plex.user_dict().Save()
def remove(endpoint): del collection()[endpoint] plex.user_dict().Save()
def append(**k): endpoint = k["endpoint"] del k["endpoint"] collection()[endpoint] = k plex.user_dict().Save()