Mercurial > codedump
view rename.py @ 132:71df0cf3aa05 default tip
add create.py
this is a script to render out video files from entire albums,
singles, or EPs. eventually it can be edited to be more robust
(such as automatically finding discogs/musicbrainz links) but
I think it's pretty damn good for now.
It's basically just an ffmpeg frontend with a few hardcoded options
that are suitable for this kind of thing.
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 02 Jan 2026 10:35:03 -0500 |
| parents | 2aa9614cb39a |
| children |
line wrap: on
line source
import os import sys # valid filename: "[title] - [episode number].mkv" for file in os.listdir("./"): if file.endswith(".mkv"): name = file[:-9] try: throwaway = open(f"{name} - 01.mkv", 'rb') except OSError: print(f'Could not open "{name} - 01.mkv". Are you sure the file exists?') sys.exit() throwaway.close() titles = open('list.txt', 'r', encoding='utf-8') titlelist = titles.readlines() titles.close() count = 1 for line in titlelist: line = line.rstrip("\n") if int(count) <= 9: os.rename(f'{name} - 0{count}.mkv', f'{name} - 0{count} [{line}].mkv') else: os.rename(f'{name} - {count}.mkv', f'{name} - {count} [{line}].mkv') count += 1
