File: android-deltas-sync/config_phone.py
"""
=======================================================================
PHONE setup code => EDIT ME ON YOUR PHONE.
Change the assigned values following "# SETTINGS" below. The
settings you make here are shared by initial copies and syncs.
They're also used by verifies and exports, with reversed roles.
See _README.html for license, attribution, version, and docs.
-----------------------------------------------------------------------
How to edit settings:
You need to edit this file on the phone copy of this package only.
This is Python code: spaces work around '=', quote all strings with
either ' or ", and use r'...', '..\\..', or '../..' for Windows-path
backslashes. In all paths, home-folder (~) and environment-variable
($var) syntax is automatically expanded on all platforms.
For LOGS, give the path to any folder on your phone for logfile saves.
In Termux, logs may be monitored with 'tail -f LOGS/logfilename'.
For MALL, give the path to the folder where you've unzipped the
Mergeall source-code package on your phone. Any folder will do,
but /sdcard/Download/Mergeall-source is normal on most Androids.
For FROM, give the path in which zips are copied on your phone.
For TO, give the path to the content folder on your phone.
For STUFF, give the name of your content's top-level folder.
Content folder ($ means value of):
- $TO/$STUFF is your content copy's folder on your phone
Zipfiles:
- $FROM/$STUFF.zip is the PC-content zip used for initial copies
- $FROM/DELTAS.zip is the PC-changes zip used for content syncs
- $FROM/PHONE.zip is the $TO/$STUFF zip made for verify/export
Temp folder:
- $FROM/DELTAS is the temp folder where syncs unzip deltas
The temp folder and zipfiles in $FROM are automatically removed.
For FROM and TO, use any mix of:
- Shared storage: /sdcard (or /storage/emulated/0)
- App-specific storage: /sdcard/Android/data/com.termux
- App-private storage: /data/data/com.termux
See this package's _README.html for more on Android storage.
In short, app storages have limited access and are removed on
owning-app uninstall, and shared storage is longer-lived but
slower. This generally makes app storages better for temporary
zips, and shared better for content, though use cases may vary.
If you run this system's scripts in Pydroid 3 instead of Termux,
app-specific storage is /sdcard/Android/data/ru.iiec.pydroid3
(create as needed). Termux's shell support is more functional.
-----------------------------------------------------------------------
Subtleties:
- Zips (FROM) and content (TO) need not both use the _same_
storage types. In practice, you might use app-private
or app-specific for zips to optimize sync speed, and shared
for content to boost its accessibility and longevity.
All ops will run quicker if FROM is app-specific/private,
but more apps will be able to use content if TO is shared,
and shared (only) is not auto-removed on app uninstall.
- You can use Termux app-private storage for FROM, TO, or both,
if you also use a file explorer that can access Termux's home
folder via its Storage-Access-Framework interface. 4 of 11
explorers tested support both this interface and USB drives,
which qualifies app-private for TO (content) and FROM (zipfile
copies). For more, see _README.html#termux-app-private-SAF.
- Android 13 _may_ make it harder to use app-specific storage in
Android file explorers; see _README.html#android13-app-specific.
- Initial copies and syncs transfer content to the TO destination;
verify and export scripts zip up TO as the content source.
- It's okay for FROM to be the _same_ as TO (e.g., both set to the
root of shared or app-specific storage). If so, initial copies
unzip $STUFF.zip to a folder named $STUFF, in the same location;
syncs unzip DELTAS.zip to, and apply changes from, a folder named
DELTAS alongside $STUFF; and verifies and exports make PHONE.zip.
- It's not okay for FROM to be a folder _nested_ in TO, or
vice-versa; make sure these paths are the same or disjoint.
- In this system, "PC" means a Windows, macOS, or Linux device,
but "phone" can be anything: though designed to sync changes
to Android 11 and later, these scripts can also sync to both
earlier Androids and PCs. For the latter, use PC paths here.
-----------------------------------------------------------------------
Changes:
[1.2] Added CheckFilenames here, to control on-phone runs of the
nonportable-filenames fixer in the new export scripts' part 1.
This flag was formerly used only for on-PC init/sync runs, but
names may also be created in Android app-private storage which
will not work on Windows and some drives. Set this flag to
False here to skip the fixer step in exports (e.g., if using
shared storage). This setting here is used only on phones; its
version in the PC config file is used only on PCs and may vary.
=======================================================================
"""
# SETTINGS
# Folders: quoted paths
LOGS = '/sdcard/Download/deltas-logs' # logfiles folder (tail -f to watch)
MALL = '/sdcard/Download/Mergeall-source' # Mergeall source-code folder
FROM = '/sdcard/Android/data/com.termux' # path to copied zips: $STUFF, DELTAS, PHONE
TO = '/sdcard' # path to $STUFF content root on phone
STUFF = 'MY-STUFF' # name of content's root folder on phone
# Options: True or False
PauseSteps = True # stop for enter or ctrl-c between steps?
ShowRuntimes = True # display each step's runtime in the console?
UnixPermissions = False # copy Unix permissions to phone app storage (see readme)?
ForceKeyToClose = False # require enter/return to close script (Termux:Widget)?
BackupChanges = False # save phone items changed so sync can be rolled back?
CheckFilenames = True # ask to run nonportable-filenames fixer on exports? [1.2]