Skip to content
kevinriderPublic

Latest commit

 

History

43 Commits

Folders and files

Repository files navigation

DNFileVault Sync Utility (dnfvsync)

Latest Version Unit tests GitHub issues License

dnfvsync is a command-line utility written in Python for downloading and syncing your DNFileVault purchases and groups to a local folder. It is designed to be run periodically on a server to keep a local archive up to date but can also be used for single-account sync runs.

Features

  • Downloads purchases and groups to a local archive
  • Optional group filtering and sync window (DNFV_DAYS)
  • Resume support for partial downloads via HTTP Range when available
  • Progress bars and configurable logging
  • Retries with backoff

Installation

  1. Install Python 3.10+: Make sure Python 3.10 or newer is installed.

  2. Clone the repository:

    git clone https://github.com/kevinrider/dnfvsync.git
    cd dnfvsync

    (If you prefer SSH, use git clone git@github.com:kevinrider/dnfvsync.git.)

  3. Install dependencies:

    python3 -m venv .venv && . .venv/bin/activate && python3 -m pip install -e .

    (On some Linux distros you may need python3-venv installed for the venv step.)

    (Use pip install . if you do not need editable mode.)

Configuration

Configuration can be loaded from a config file and/or environment variables. CLI arguments override config and environment variables; environment variables take precedence over the config file.

Config File

dnfvsync will read the config file path from --config if provided, otherwise it will read the first config file it finds in this order:

  1. ~/.config/dnfvsync/config.ini
  2. ~/.dnfvsync.ini

Example config file:

[dnfvsync]
email = you@example.com
password = your-password
out_dir = /data/dnfilevault-downloads
groups = eodLevel2,eodLevel3
days = 7
log_level = INFO
log_file = /var/log/dnfvsync.log
max_retries = 5
backoff_seconds = 1.0

Environment Variables

Required Environment Variables

Variable Description Example
DNFV_EMAIL DNFileVault account email. you@example.com
DNFV_PASSWORD DNFileVault account password. your-password

Optional Environment Variables

Variable Description Default
DNFV_BASE_URL API base URL. https://api.dnfilevault.com
DNFV_OUT_DIR Output directory for downloads. ~/dnfilevault-downloads
DNFV_GROUPS Comma-separated group names to include. (all groups)
DNFV_DAYS Sync window in days. 7
DNFV_LOG_LEVEL Log level. INFO
DNFV_MAX_RETRIES Retry attempts for retryable HTTP errors. 5
DNFV_BACKOFF_SECONDS Base backoff seconds (exponential with jitter). 1.0

Bash env setup example

Copy the following into .bashrc, updating as needed for your specific config:

export DNFV_EMAIL='you@example.com'
export DNFV_PASSWORD='your-password'
export DNFV_OUT_DIR="$HOME/dnfilevault-downloads"
export DNFV_GROUPS="eodLevel2,eodLevel3"
export DNFV_DAYS="7"

Apply changes:

source ~/.bashrc

Usage

Run from the command line:

dnfvsync

Disable progress bars:

dnfvsync --no-progress

Logging options:

dnfvsync --log-level DEBUG --log-file dnfvsync.log

Module entry point:

python3 -m dnfvsync

Scheduling with Cron

For automatic, periodic sync, schedule the script to run using cron. A reasonable cadence is once per day.

Example Cron Job:

  1. Open your crontab for editing:

    crontab -e
  2. Add the following line, replacing /path/to/dnfvsync and the Python path as needed (runs daily at 6:00 PM):

    0 18 * * * cd /path/to/dnfvsync && /path/to/python -m dnfvsync >> /your/log/dir/dnfvsync.log 2>&1
  3. An alternative is to check at regular intervals (every 12 hours in this example):

    0 */12 * * * cd /path/to/dnfvsync && /path/to/python -m dnfvsync >> /your/log/dir/dnfvsync.log 2>&1

Tests

Install dev dependencies and run pytest:

python3 -m pip install -e ".[dev]"
python3 -m pytest

References

Releases

Packages

Contributors

Languages