Browse Source

Use general shutdown_program function everywhere

tags/2.3.3RC1
Safihre 7 years ago
parent
commit
8a676aeab4
  1. 8
      SABnzbd.py
  2. 2
      sabnzbd/__init__.py
  3. 5
      sabnzbd/api.py
  4. 15
      sabnzbd/interface.py
  5. 5
      sabnzbd/osxmenu.py
  6. 5
      sabnzbd/sabtray.py
  7. 4
      sabnzbd/sabtraylinux.py

8
SABnzbd.py

@ -1516,9 +1516,7 @@ def main():
# Or special restart cases like Mac and WindowsService
if sabnzbd.TRIGGER_RESTART:
# Shutdown
cherrypy.engine.exit()
sabnzbd.halt()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
if sabnzbd.downloader.Downloader.do.paused:
sabnzbd.RESTART_ARGS.append('-p')
@ -1725,9 +1723,7 @@ if __name__ == '__main__':
def stop(self):
logging.info('[osx] sabApp Quit - stopping main thread ')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
logging.info('[osx] sabApp Quit - main thread stopped')
sabApp = startApp()

2
sabnzbd/__init__.py

@ -769,7 +769,7 @@ def system_standby():
def shutdown_program():
""" Stop program after halting and saving """
logging.info("Performing sabnzbd shutdown")
logging.info("[%s] Performing SABnzbd shutdown", misc.caller_name())
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True

5
sabnzbd/api.py

@ -589,10 +589,7 @@ def _api_resume(name, output, kwargs):
def _api_shutdown(name, output, kwargs):
""" API: accepts output """
logging.info('Shutdown requested by API')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
return report(output)

15
sabnzbd/interface.py

@ -463,10 +463,7 @@ class MainPage(object):
if pid_in and int(pid_in) != os.getpid():
return "Incorrect PID for this instance, remove PID from URL to initiate shutdown."
logging.info('Shutdown requested by interface')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
return T('SABnzbd shutdown finished')
@secured_expose(check_session_key=True)
@ -636,10 +633,7 @@ class Wizard(object):
@secured_expose
def exit(self, **kwargs):
""" Stop SABnzbd """
logging.info('Shutdown requested by wizard')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
return T('SABnzbd shutdown finished')
def get_access_info():
@ -1030,10 +1024,7 @@ class QueuePage(object):
@secured_expose(check_session_key=True)
def shutdown(self, **kwargs):
logging.info('Shutdown requested by interface')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
return T('SABnzbd shutdown finished')
@secured_expose(check_session_key=True)

5
sabnzbd/osxmenu.py

@ -764,10 +764,7 @@ class SABnzbdDelegate(NSObject):
self.setMenuTitle_("\n\n%s\n" % (T('Stopping...')))
self.status_item.setHighlightMode_(NO)
self.osx_icon = False
logging.info('[osx] application stopping daemon')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
try:
notifier.send_notification('SABnzbd', T('SABnzbd shutdown finished'), notifier.NOTIFICATION['other'])
except AttributeError:

5
sabnzbd/sabtray.py

@ -166,10 +166,7 @@ class SABTrayThread(SysTrayIconThread):
# menu handler - adapted from interface.py
def shutdown(self, icon):
self.hover_text = self.txt_shutdown
logging.info('Shutdown requested by tray')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
# adapted from interface.py
def pause(self):

4
sabnzbd/sabtraylinux.py

@ -169,9 +169,7 @@ class StatusIcon(Thread):
def shutdown(self, icon):
self.hover_text = T('Shutdown')
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
sabnzbd.shutdown_program()
def pause(self):
scheduler.plan_resume(0)

Loading…
Cancel
Save