Skip to content

Commit

Permalink
Dropbox pgn game sync after every end of game event
Browse files Browse the repository at this point in the history
  • Loading branch information
tosca07 authored Jun 6, 2024
1 parent c4a2c7c commit b26e339
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pgn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import requests
import chess # type: ignore
import chess.pgn # type: ignore
import subprocess

from email import encoders
from email.mime.multipart import MIMEMultipart
Expand Down Expand Up @@ -487,6 +488,11 @@ def _save_and_email_pgn(self, message):
pgn_game.accept(exporter)

self.emailer.send("Game PGN", str(pgn_game), self.file_name)

try:
subprocess.run(['python3', '/home/pi/drupebox/drupebox.py'])
except FileNotFoundError:
pass

def _save_pgn(self, message):
l_file_name = "games" + os.sep + message.pgn_filename
Expand All @@ -497,7 +503,12 @@ def _save_pgn(self, message):
with open(l_file_name, "w") as file:
exporter = chess.pgn.FileExporter(file)
pgn_game.accept(exporter)


try:
subprocess.run(['python3', '/home/pi/drupebox/drupebox.py'])
except FileNotFoundError:
pass

logger.debug("molli: save pgn finished")

def _process_message(self, message):
Expand Down

0 comments on commit b26e339

Please sign in to comment.