Hope this fixes the crappy merge...
Conflicts: couchpotato/core/_base/_core/main.py couchpotato/core/_base/desktop/main.py
This commit is contained in:
1 parent
9e06a6f075
commit
33602f227d
8 files changed
+83
-33
No files matched your search
@@ -2,24 +2,34 @@ from couchpotato.core.event import fireEvent, addEvent
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
from couchpotato.environment import Env
|
||||
from urllib import quote
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
if Env.get('desktop'):
|
||||
|
||||
class Desktop(Plugin):
|
||||
class Desktop(Plugin):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self):
|
||||
|
||||
if not Env.get('binary_port'):
|
||||
return
|
||||
desktop = Env.get('desktop')
|
||||
desktop.setSettings({
|
||||
'base_url': fireEvent('app.base_url', single = True),
|
||||
'api_url': fireEvent('app.api_url', single = True),
|
||||
'api': Env.setting('api'),
|
||||
})
|
||||
|
||||
addEvent('app.load', self.settingsToDesktop, priority = 2)
|
||||
# Events from desktop
|
||||
desktop.addEvents({
|
||||
'onClose': self.onClose,
|
||||
})
|
||||
|
||||
def settingsToDesktop(self):
|
||||
# Events to desktop
|
||||
addEvent('app.after_shutdown', desktop.afterShutdown)
|
||||
|
||||
base_url = fireEvent('app.base_url', single = True)
|
||||
base_url_api = '%s/%s' % (base_url, Env.setting('api_key'))
|
||||
def onClose(self, event):
|
||||
return fireEvent('app.crappy_shutdown', single = True)
|
||||
|
||||
url_data = '{"host": "%s", "api": "%s"}' % (base_url, base_url_api)
|
||||
self.urlopen('http://localhost:%s/%s' % (Env.get('binary_port'), quote(url_data)))
|
||||
else:
|
||||
|
||||
class Desktop(Plugin):
|
||||
pass
|
||||
Reference in new issue
Block a user