Skip to main content

A small CLI tool to shift season and episode numbers of TV episode files based on configurable offsets.

Project description

Seasonal Shift

PyPI version

A small CLI tool to shift season and episode numbers of TV episode files based on configurable offsets.

This is useful when episodes are downloaded with incorrect season numbering and need to be renamed and moved to the correct season folders.

The tool:

  • Renames episode files
  • Moves them to the correct season directory
  • Shows a preview before applying changes
  • Detects rename collisions
  • Supports undoing the latest change
  • Cleans up empty folders

Features

  • Configurable season and episode offsets
  • Preview changes before applying
  • Collision detection
  • Duplicate destination detection
  • Undo support
  • Automatic cleanup of empty season folders
  • Uses XDG directories for config and state
  • Written with Typer, Rich, and Pydantic

Installation

Install with pip:

pip install seasonal-shift

Configuration

By default the tool reads the config from:

~/.config/seasonal-shift/config.yaml

(or $XDG_CONFIG_HOME/seasonal-shift/config.yaml)

Example configuration:

shows:
  - name: Breaking Bad
    path: /media/shows/Breaking Bad
    seasons:
      1:
        season_offset: 2
        episode_offset: 0
      2:
        season_offset: 2
        episode_offset: 0

Meaning:

Season 1 → Season 3
Season 2 → Season 4

Episode numbering can also be shifted.


Directory Structure

Expected show layout:

Show Name/
  Season 1/
    Show Name - S01E01 - Episode Title.mkv
  Season 2/
    Show Name - S02E01 - Episode Title.mkv

Files must already follow a SxxExx naming pattern.


Usage

Preview and apply changes

seasonal-shift run

The tool will:

  1. Show a preview of planned renames
  2. Ask for confirmation
  3. Rename and move files
  4. Save an undo file

Use a custom config

seasonal-shift run --config my-config.yaml

Undo the latest change

seasonal-shift undo

Undo files are stored in:

~/.local/state/seasonal-shift/

You can also undo a specific operation:

seasonal-shift undo undo-20260310-032201.json

Run diagnostics

seasonal-shift doctor

This checks:

  • Config validity
  • Show paths
  • Episode detection
  • Potential rename collisions

No changes are made.


Example Preview

Breaking Bad
------------

Season 1 → 3
  Breaking Bad - S01E01 - Pilot.mkv
    → Breaking Bad - S03E01 - Pilot.mkv
  Breaking Bad - S01E02 - Cat's in the Bag.mkv
    → Breaking Bad - S03E02 - Cat's in the Bag.mkv

Undo System

Every run creates an undo file:

~/.local/state/seasonal-shift/undo-YYYYMMDD-HHMMSS.json

This allows reverting renames even after files are moved.


Requirements

  • Python 3.11+
  • typer
  • rich
  • pydantic
  • pyyaml

License

MIT License.

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

seasonal_shift-1.2.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seasonal_shift-1.2.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file seasonal_shift-1.2.0.tar.gz.

File metadata

  • Download URL: seasonal_shift-1.2.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.2 Linux/6.18.6-arch1-1

File hashes

Hashes for seasonal_shift-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e9b8bf2c67a84b5366ffc37efd9c73afd23fdfd38ec24a6cc5b81622c8e52063
MD5 0e4d254378845269e0c8300a77af0e15
BLAKE2b-256 4486645cad0ab99852a0a3b09f76e07fd3e26d1dc12cf13b178f34f6c7096828

See more details on using hashes here.

File details

Details for the file seasonal_shift-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: seasonal_shift-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.2 Linux/6.18.6-arch1-1

File hashes

Hashes for seasonal_shift-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3d31ab1d5b6b0272be99cbd83e6ef873a00b91e0fad75aa5f7c7fe291e285ed
MD5 2871e0f8b73616477cab8a49fc1a7cc3
BLAKE2b-256 1a4f283fc3944c0bc9a801a45805710b939bcc1790a54fc9d37346eac0acfea5

See more details on using hashes here.

Supported by

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