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.
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
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:
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