Access to the PicoChess games without email

75 views
Skip to first unread message

Dirk

unread,
May 20, 2024, 10:08:09 AMMay 20
to PicoChess
Hello,

I must admit I have never used or tested the email pgn function of PicoChess. I still wonder who really wants his played games sent to him via email in these days ;-)

I was looking for a solution for that and found one I now use and I thought I could share it with you...

The idea is to sync just the games folder to all my other devices (eg. my main mac, iPhone, iPad and to my Chestnut Evo where I use often use the ChessIs app for analyzing etc.


sftp:::pi@192.168.178.86 - FileZilla 2024-05-20 12-12-57.jpg

In this folder all the games are stored in file games.pgn and the last game is always stored in the file last_game.pgn.

sftp:pi@192.168.178.86 - FileZilla 2024-05-20 12-12-34.jpg



Main requirement is that you have a dropbox account!

Unfortunately there is no app for Raspian so we have to use a 3rd party script which I found on Github which does this for us:

"Drupebox" ;-)

https://github.com/duncanhawthorne/drupebox


I could easily execute all steps and install the repository, allow permissions and finally execute the sync script:


pi@picochessweb:~ $ sudo apt install git python3-configobj python3-send2trash python3-dropbox

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

git is already the newest version (1:2.39.2-1.1).

python3-send2trash is already the newest version (1.8.1~b0-2).

python3-send2trash set to manually installed.

Suggested packages:

  python-configobj-doc python-ply-doc

The following NEW packages will be installed:

  python3-configobj python3-dropbox python3-ply python3-stone

0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.

Need to get 636 kB of archives.

After this operation, 6,924 kB of additional disk space will be used.

...

pi@picochessweb:~ $ git clone https://github.com/duncanhawthorne/drupebox.git

Cloning into 'drupebox'...

...

pi@picochessweb:~ $ python3 drupebox/drupebox.py

1. Go to: https://www.dropbox.com/oauth2/authorize?response_type=code&client_id=1skff241na3x0at&token_access_type=offline&code_challenge=exxxxx

2. Click "Allow" (you might have to log in first)

3. Copy the authorization code.

Enter the authorization code here: xxxxxxxxxxx

Enter dropbox local path (or press enter for /home/pi/Dropbox/) /opt/picochess/games

Drupebox sync started at Mon, 20 May 2024 10:04:51 +0000 UTC

    Scanning for any remotely deleted files since last Drupebox run

    Syncing any locally deleted files since last Drupebox run

>>> Changed list of excluded folder paths, skipping check

    Syncing all other local and remote files changes

    

>>> Found local file that isn't on remote Dropbox, so upload

uuu /last_game.pgn

>>> Fix local time for file

>>> Found local file that isn't on remote Dropbox, so upload

uuu /games.pgn

>>> Fix local time for file

Drupebox sync complete at Mon, 20 May 2024 10:04:55 +0000 UTC


After this I could access the game files on my mac:


Dropbox 2024-05-20 12-13-30.jpg


In order to sync we just have to execute the python script in /home/pi/drupebox/drupbox.py (assuming you also have inhaled the repo in your home directory).


I added the following code to my picochess code (in utilities.py) for shutdown/reboot and exit routines:


try:

        subprocess.run(['python3', '/home/pi/drupebox/drupebox.py'])

except FileNotFoundError:

        pass

time.sleep(10)  # give some time to send out or sync the pgn file or talk event



By this the game files are synced each time we leave PicoChess automatically,


Dirk



RandyR

unread,
May 20, 2024, 11:38:11 AMMay 20
to PicoChess
Hi Dirk,

Thanks for sharing. Seems like a nice option for anyone using Dropbox.

Randy

Peter Eggen

unread,
May 23, 2024, 4:55:59 AMMay 23
to PicoChess
Hi,
probably you know this already, but the easiest way to access and copy the games.pgn of the Pi is just by using scp command from the computer you want to have the file been exported to. I use this i.e. when returning from offline scenarios with no network connection available. 
"scp username@host:/opt/picochess/games/games.pgn ." will copy the games.pgn file to your local directory of your machine in use, provided it could reach the pi via network.
Regards Peter

Reply all
Reply to author
Forward
0 new messages