Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart enabled launcher instead of default xochitl #56

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions remy/remarkable/filesource.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,26 @@ def cleanup(self):
if not self.persist_cache:
log.debug("Clearing cache")
shutil.rmtree(self.cache_dir, ignore_errors=True)
self.refreshXochitl()
self.refreshLauncher()

def refreshXochitl(self, force=False):
if self._dirty or force:
try:
_,out,_ = self.ssh.exec_command("/bin/systemctl restart xochitl")
def refreshLauncher(self, force=False):
if not self._dirty and not force:
return
try:
for launcher in ['xochitl','tarnish','remux','draft']:
_,out,_ = self.ssh.exec_command("/bin/systemctl is-enabled " + launcher)
if out.channel.recv_exit_status() == 0:
self._dirty = False
except paramiko.SSHException as e:
log.warning("Could not restart xochitl."
"This is most probably due to the tablet going to sleep."
"A manual reboot of the tablet is recommended.")
log.debug("SSH Error: %s", e)
_,out_,_ = self.ssh.exec_command("/bin/systemctl restart " + launcher)
if out_.channel.recv_exit_status() == 0:
self._dirty = False
# No need to check for more than one launcher
return

except paramiko.SSHException as e:
log.warning("Could not restart launcher."
"This is most probably due to the tablet going to sleep."
"A manual reboot of the tablet is recommended.")
log.debug("SSH Error: %s", e)

def listItems(self):
with self._lock:
Expand Down Expand Up @@ -553,6 +560,6 @@ def prefetchDocument(self, uid, progress=None, force=False):

def cleanup(self):
log.debug("CLEANUP: %s", self._dirty)
self.refreshXochitl()
self.refreshLauncher()