Browse Source

End plugins before shutdown

pull/66/head
Ruud 14 years ago
parent
commit
044a23764d
  1. 6
      CouchPotato.py
  2. 5
      couchpotato/core/_base/_core/main.py

6
CouchPotato.py

@ -6,6 +6,7 @@ from os.path import dirname
import os
import sys
import subprocess
import time
# Root path
@ -34,6 +35,8 @@ def start():
subprocess.call(args, env = new_environ)
return os.path.isfile(os.path.join(base_path, 'restart'))
except KeyboardInterrupt, e:
pass
except Exception, e:
log.critical(e)
return 0
@ -52,4 +55,7 @@ if __name__ == '__main__':
if not restart:
break
from couchpotato.core.event import fireEvent
fireEvent('app.crappy_shutdown', single = True)
time.sleep(1)
sys.exit()

5
couchpotato/core/_base/_core/main.py

@ -17,13 +17,14 @@ log = CPLog(__name__)
class Core(Plugin):
ignore_restart = ['Core.crappyRestart']
ignore_restart = ['Core.crappyRestart', 'Core.shutdown']
def __init__(self):
addApiView('app.shutdown', self.shutdown)
addApiView('app.restart', self.restart)
addApiView('app.available', self.available)
addEvent('app.crappy_shutdown', self.shutdown)
addEvent('app.crappy_restart', self.crappyRestart)
addEvent('app.load', self.launchBrowser, priority = 100)
addEvent('app.base_url', self.createBaseUrl)
@ -70,7 +71,7 @@ class Core(Plugin):
if brk: break
time.sleep(300)
time.sleep(1)
if restart:
self.createFile(self.restartFilePath(), 'This is the most suckiest way to register if CP is restarted. Ever...')

Loading…
Cancel
Save