2018-11-19 00:59:17 +11:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Used to save PKC's application state and share between modules. Be careful
|
|
|
|
if you invoke another PKC Python instance (!!) when e.g. PKC.movies is called
|
|
|
|
"""
|
|
|
|
from .account import Account
|
|
|
|
from .application import App
|
|
|
|
from .connection import Connection
|
|
|
|
from .libsync import Sync
|
|
|
|
from .playstate import PlayState
|
2021-10-31 20:44:27 +11:00
|
|
|
from .playqueues import Playqueues
|
2018-11-19 00:59:17 +11:00
|
|
|
|
|
|
|
ACCOUNT = None
|
|
|
|
APP = None
|
|
|
|
CONN = None
|
|
|
|
SYNC = None
|
|
|
|
PLAYSTATE = None
|
2021-10-31 20:44:27 +11:00
|
|
|
PLAYQUEUES = None
|
2018-11-19 00:59:17 +11:00
|
|
|
|
|
|
|
|
2018-11-26 17:19:34 +11:00
|
|
|
def init(entrypoint=False):
|
|
|
|
"""
|
|
|
|
entrypoint=True initiates only the bare minimum - for other PKC python
|
|
|
|
instances
|
|
|
|
"""
|
2021-10-31 20:44:27 +11:00
|
|
|
global ACCOUNT, APP, CONN, SYNC, PLAYSTATE, PLAYQUEUES
|
2018-11-26 17:19:34 +11:00
|
|
|
APP = App(entrypoint)
|
|
|
|
CONN = Connection(entrypoint)
|
2018-11-27 02:56:39 +11:00
|
|
|
ACCOUNT = Account(entrypoint)
|
2018-11-26 17:19:34 +11:00
|
|
|
SYNC = Sync(entrypoint)
|
|
|
|
if not entrypoint:
|
|
|
|
PLAYSTATE = PlayState()
|
2021-10-31 20:44:27 +11:00
|
|
|
PLAYQUEUES = Playqueues()
|
|
|
|
|
2020-05-07 16:37:49 +10:00
|
|
|
|
|
|
|
def reload():
|
|
|
|
"""
|
|
|
|
Reload PKC settings from xml file, e.g. on user-switch
|
|
|
|
"""
|
|
|
|
global APP, SYNC
|
|
|
|
APP.reload()
|
|
|
|
SYNC.reload()
|