Skip to main content

A simple CLI utility to backup and restore game saves

Project description

Save Scummer

Build PyPI PyPI - Python Versions

Save-Scummer is a simple CLI utility to backup and restore game saves. This is intended for rogue-lite games like Rogue Legacy, FTL and Don't Starve, but it could also be applied to other games or non-game applications.

I made this because I enjoy roguelike/rogue-lite games, but when one starts to get too difficult, I may resort to save-scumming as an option to make the game a bit easier. When doing that manually, I find myself wasting precious seconds of time copying files back and forth, so naturally I decided to waste hours making it (semi-)automated instead.

A full backup utility (like Duplicati) or sync utility (like rsync) will obviously have many more features, but for the basic case of handling game saves, I wanted something simpler with concise command line usage.

Features

  • Just provide a save directory (or glob pattern) to configure a new game
  • Easily make backups, and restore them by most recent (default), time expressions (to indicate how far back in time you want to go), or choose from a list
  • Tab autocompletion

Installation

Install with pipx (recommended):

pipx install save-scummer

Or with pip:

pip install save-scummer

Autocompletion (optional)

Tab autocompletion is available for most common shells: bash, fish, zsh and Windows PowerShell. To install, run:

ssc --install [shell name]

Usage

Save-scummer provides the command save-scummer (also aliased as ssc) with the following subcommands:

sh: ssc COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  add      Add a game and its save directory
  backup   Create a backup of one, multiple, or all games
  ls       List all currently configured games
  restore  Restore a backup of the specified game

Add

Use ssc add to add (or update) a game and its save directory.

Relative paths, user paths, and glob patterns are supported:

ssc add game1 ~/Games/game1           # Add a dir (including any subdirs)
ssc add game1 '~/Games/game1/**'      # Equivalent glob pattern (quotes required)
ssc add game2 'C:\Games\game2\*.sav'  # Add files ending in .sav

Backup

Use ssc backup to create a new backup. Just specify the game title, and an optional description:

ssc backup game1 -d 'level 10 with full health'

Or just backup everything:

ssc backup --all

List

Use ssc ls to show a summary of all configured games:

╒════════╤═════════════════╤═════════════════════════════════╕
│ Title   Total backups    Last saved                      │
╞════════╪═════════════════╪═════════════════════════════════╡
│ game1   0                never                           │
├────────┼─────────────────┼─────────────────────────────────┤
│ game2   7 (94.96 KB)     2021-01-19 15:20 (23 hours ago) │
╘════════╧═════════════════╧═════════════════════════════════╛

Or use ssc ls [game title] to show more details on a specific game and its backups:

Game:               game2
Total backups:      7 (94.96 KB)
Last saved:         2021-01-19 15:20 (23 hours ago)
Last backed up:     2021-01-19 16:24 (22 hours ago)
Source directory:   /home/user/game2/saves
Backup directory:   /home/user/.local/share/save-scummer/backups/game2
Backup files:
0:  game2-2021-01-26T19:23:26.zip
1:  game2-2021-01-20T16:33:42-pre-restore.zip
2:  game2-2021-01-19T19:26:10.zip
3:  game2-2021-01-19T18:31:58.zip
4:  game2-2021-01-18T12:17:52.zip
5:  game2-2021-01-17T16:18:09.zip
6:  game2-2021-01-17T15:01:58.zip

Note that "Last saved" is the time that the source files were created/modified.

Restore

Use ssc restore to restore a backup. A specific backup can be indicated by backup index, age, date/time, or filename. Otherwise, the most recent backup is restored.

Usage: ssc restore [OPTIONS] [TITLE]

Options:
  -i, --index INTEGER  Backup number (starting at 0, from newest to oldest)
  -a, --age TEXT       Minimum age (relative to current time)
  -d, --date TEXT      Maximum date/time (absolute)
  -f TEXT              Backup filename; either absolute or relative to backup dir

Backup specifiers

Index: The backup index, sorted from newest to oldest, e.g. "Restore the save from x backups ago." 0 is the latest backup, 1 is the backup made before that, etc. Negative values can also be given; -1 would give you the oldest backup. See ls command for full list of available backups.

Age: Minimum age of the save to restore, e.g "I want to go back in time by 1 hour." Amounts of time can be specified in 'HH:MM' format, or with a number followed by a unit. Examples:

  • '1:30' (an hour and a half ago)
  • '30m' (or '30 minutes')
  • '6h' (or '6 hours')
  • '9 hours, 15 minutes' (or '9:15')
  • '2d' (or '2 days')
  • See pytimeparse for more formats

Date/Time: Maximum date/time of the save to restore, e.g., "I want to go back in time to 1:30 yesterday." Most date/time formats are supported. Examples:

  • '16:30' or '4:30 PM' (today)
  • '2021-01-20'
  • 'August 3 2020'
  • Most date/time formats are supported; see dateutil for more examples.

Filename: Either a full path or just the filename (relative to the backup dir)

Restore Examples

# Just restore the most recent backup
ssc restore game1

# Restore the backup made 2 backups ago (aka the 3rd most recent)
ssc restore game1 -i 2

# Restore a backup from (at least) an hour and a half ago
ssc restore game1 -a '1:30'

# Restore a backup from (at least) 2 days ago
ssc restore game1 -a 2d

# Restore a backup from 4:00 PM today or earlier
ssc restore game1 -d '4:00 PM'

# Restore a backup from March 22 or earlier
ssc restore game1 -d 'Mar 22 2021'

# Restore a backup by filename
ssc restore game1 -f game1-2021-01-20T00:09:10.zip

Development setup

To set up for local development:

git clone https://github.com/JWCook/save-scummer && cd save-scummer
pip install -Ue '.[dev]'

To run linting, formatting, etc.:

pre-commit run -a

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

save_scummer-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

save_scummer-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file save_scummer-0.1.0.tar.gz.

File metadata

  • Download URL: save_scummer-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for save_scummer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1023617e6beb97f875770610501215fcd4bf31f026e7c9d97a9800633bb8c9b7
MD5 49e766a0e50bd55cdd86583e69dd2051
BLAKE2b-256 44448309867188ad837cf58df296c370e9be007380be2fe0e79f391fb192fb01

See more details on using hashes here.

File details

Details for the file save_scummer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: save_scummer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for save_scummer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b87dced3acfcb49e942b6a68af5d331f8a09b9f5fcbe7c169325a231e1401beb
MD5 99cbca9f9f2038d08b27cfc821eda0f1
BLAKE2b-256 1b5933d529a63ae8034938aca2389b309f4cb9ba1172eb13736f370416c1d850

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page