This tool allows syncing data from a Quest device running QuestDrive to a local directory.
The primary use for this is moving recorded videos from a Quest - as it has limited space - to an external device for storage.
name.mp4
Tech used: Python, Poetry, pre-commit, httpx, mypy, ruff
Empowered by the QuestDrive application, this Python script interacts with the QuestDrive web interface to obtain information about the Quest, available videos, and how to download/delete them.
Developed with Test-Driven Development - via pytest
- with consistency & safety brought by mypy
, typeguard
, ruff
, and various other pre-commits
hooks - for a total of 60 hooks!
Other notable usages include the built-in argparse
for CLI parsing, httpx
for HTTP requests, and rich
for both the pretty progress bars & CLI interface.
The most valuable pytest
plugins used are pytest-cov
for coverage, pytest-mock
for reasonable mocking, and pytest-network
to ensure all network requests are mocked.
To perform all checks manually, one can run the following:
poetry run pre-commit run --all-files
A Quest device running QuestDrive, and a computer with Python 3.9+ and enough space to store the synced data.
poetry run python questdrive_syncer --questdrive-url=URL_OF_QUESTDRIVE_INSTANCE
You can additionally use the --help
flag to see all available options.
Process-locking has been implemented, so you can run this script on a schedule without worrying about it overlapping executions.
To do so with cron
for example, you can use the following:
0 * * * * ABSOLUTE_PATH_TO_POETRY run python ABSOLUTE_PATH_TO_THIS_REPO --simple-output
To add instant logging for example, you can use the following:
0 * * * * ABSOLUTE_PATH_TO_POETRY run python ABSOLUTE_PATH_TO_THIS_REPO --simple-output >> ABSOLUTE_PATH_TO_LOGFILE 2>&1
There are various options to customize the circumstances under which the script will run, so be sure to check out the help output.
Only two features were never implemented:
- The ability to resume interrupted downloads
- Impossible to do in a performant manner as QuestDrive does not support range requests
- Live updates on consumed/free space both locally and on the Quest
- Given the time & effort to implement and - lack of - demand for this feature, it was not implemented