Here’s a pesky little script I’ve written that helps naming files when ripping personal DVD collection.

Prerequisites

To use it, you need uv.

Prepping the data

Let’s say you have a DVD box of Keeping Up Appearances. You go to it’s IMDB’s episode list page.

Screenshot from IMDB episode list for Keeping up appearances' season 1.

You then copy everything in the episode list at the bottom, starting from S1.E1 onwards and store it in a file episodes:

S1.E1 ∙ Daddy's Accident
Mon, Oct 29, 1990
Hyacinth Bucket (pronounced Bouquet), an overbearing hostess, is stunned when her less-than-well-off sisters Daisy and Rose inform her that their father has been taken to the hospital. Hyacinth is even more stunned however when she finds out why he was taken there.
7.6/10 (497)
Jeremy Gittins and Patricia Routledge in Keeping Up Appearances (1990)
S1.E2 ∙ The New Vicar
Mon, Nov 5, 1990
As Hyacinth prepares to have the new vicar over for tea, Rose threatens to commit suicide and their father runs off with a gypsy woman.
7.8/10 (426)
Patricia Routledge in Keeping Up Appearances (1990)
S1.E3 ∙ Stately Home
Mon, Nov 12, 1990
After an eventful visits at Daddy's, Hyacinth and Richard visit a stately home where they wait to catch a glimpse of the residing family. But Hyacinth's attempts to attract her ladyships eye are stifled when Daisy, Onslow and Rose turn up.
7.8/10 (400)
Patricia Routledge in Keeping Up Appearances (1990)
S1.E4 ∙ The Charity Shop
Mon, Nov 19, 1990
Hyacinth is distracted from her community service at the charity shop when Daisy informs her that there is a strange woman in Daddy's bedroom claiming to be his fiancée.
8.0/10 (411)
Jonny Lee Miller, Judy Cornwell, Geoffrey Hughes, and Shirley Stelfox in Keeping Up Appearances (1990)
S1.E5 ∙ Daisy's Toyboy
Mon, Nov 26, 1990
Attempting to get Onslow's attention, Daisy picks up a toyboy who--with any luck--will make him jealous; meanwhile, Hyacinth forces Elizabeth and Richard to help her organize the setup of a function at the church hall.
7.6/10 (392)
Patricia Routledge, Gerald Sim, and Shirley Stelfox in Keeping Up Appearances (1990)
S1.E6 ∙ The Christening
Mon, Dec 3, 1990
Daisy and Onslow's daughter Stephanie is having her baby christened. When her car breaks down, Hyacinth and Richard volunteer to go pick her up and bring her to the church, but they are unprepared for what awaits them.
7.8/10 (381)

The script

I have this script saved as ,parse_episode_names (for why it’s named like that, see Pesky little scripts):

#!/usr/bin/env -S uv run --quiet --script
 
"""Python script to capture episode numbers and names from copy-paste from IMDB.
 
Usage:
 
1. Go to IMDB episode listing (for example: https://www.imdb.com/title/tt0407362/episodes/?season=4)
2. Copy-paste everything from first episode to the last into a file (episodes.txt)
3. Run `,parse_episode_names episodes.txt [Series Name]`
"""
 
import re
import sys
 
from collections import namedtuple
 
Episode = namedtuple("Episode", ["season", "number", "name"])
 
EPISODE_PATTERN = r"S(\d+)\.E(\d+)(.*)"
 
 
def parse_episodes(filename: str) -> list[Episode]:
    episodes = []
    with open(filename, "r") as f:
        lines = f.readlines()
 
        for line in lines:
            if m := re.match(EPISODE_PATTERN, line):
                season, number, name = m.groups()
                number = int(number)
                season = int(season)
                name = name.replace(":", "")
 
                episodes.append(Episode(season, number, name))
    return episodes
 
 
def print_episodes(episodes: list[Episode], series: str) -> None:
    for season, number, name in episodes:
        print(f"S{season:02d}E{number:02d} - {series} - {name}")
 
 
def print_help():
    print(
        """Python script to capture episode numbers and names from copy-paste from IMDB.
 
Usage:
 
1. Go to IMDB episode listing (for example: https://www.imdb.com/title/tt0407362/episodes/?season=4)
2. Copy-paste everything from first episode to the last into a file (episodes.txt)
3. Run `,parse_episode_names episodes.txt [Series Name]`"""
    )
 
 
if __name__ == "__main__":
    try:
        filename = sys.argv[1]
        series = sys.argv[2]
    except IndexError:
        print_help()
        sys.exit(2)
 
    episodes = parse_episodes(filename)
    print_episodes(episodes, series)

and you run it as

,parse_episode_names episodes "Keeping up appearances"

and it will print out

S01E01 - Keeping up appearances - Daddy's Accident
S01E02 - Keeping up appearances - The New Vicar
S01E03 - Keeping up appearances - Stately Home
S01E04 - Keeping up appearances - The Charity Shop
S01E05 - Keeping up appearances - Daisy's Toyboy
S01E06 - Keeping up appearances - The Christening

which you can use to rename the files as they are being created.