예제 #1
0
def daemon_mode(config_path):
    try:
        twit = Daemon(config_path, log=False)
        twit.spawn_watchers()
        twit.spawn_tweet_thread()
        twit.spawn_retweet_thread()
        interface = CursesInterface(twit)
        interface.run()
        while active_count() > 0:
            try:
                sleep(1)
            except Exception as e:
                twit.log_handler.emit(e, rec_type='error')
                sleep(1)
    except KeyboardInterrupt:
        exit()
예제 #2
0
 def __init__(self):
     super(DaemonMonitor, self).__init__()
     self._lock = threading.Lock()
     self._daemon = Daemon(
         "torrest", os.path.join(kodi.ADDON_PATH, "resources", "bin", get_platform_arch()),
         android_extra_dirs=(xbmc.translatePath("special://xbmcbin"),),
         dest_dir=os.path.join(kodi.ADDON_DATA, "bin"),
         pid_file=os.path.join(kodi.ADDON_DATA, ".pid"),
         root=run_as_root())
     self._daemon.ensure_exec_permissions()
     self._daemon.kill_leftover_process()
     self._port = self._enabled = None
     self._settings_path = os.path.join(kodi.ADDON_DATA, self.settings_name)
     self._log_path = os.path.join(kodi.ADDON_DATA, self.log_name)
     self._settings_spec = [s for s in kodi.get_all_settings_spec() if s["id"].startswith(
         self._settings_prefix + self._settings_separator)]
     self.onSettingsChanged()
예제 #3
0
 def __init__(self):
     super(DaemonMonitor, self).__init__()
     self._lock = threading.Lock()
     self._daemon = Daemon(
         "torrest",
         os.path.join(kodi.ADDON_PATH, "resources", "bin",
                      get_platform_arch()),
         extra_dirs=(xbmc.translatePath("special://xbmcbin"), ))
     self._daemon.ensure_exec_permissions()
     self._port = self._enabled = None
     self._settings_path = os.path.join(kodi.ADDON_DATA, "settings.json")
     self._log_path = os.path.join(kodi.ADDON_DATA, "torrest.log")
     self._settings_spec = [
         s for s in kodi.get_all_settings_spec()
         if s["id"].startswith(self._settings_prefix +
                               self._settings_separator)
     ]
     self.onSettingsChanged()