Removing old code, updating readme

This commit is contained in:
Dan 2026-01-16 10:19:57 +00:00
parent 6f332d46aa
commit e4aff104b2
2 changed files with 28 additions and 29 deletions

View file

@ -56,21 +56,6 @@ try:
except ImportError:
webvtt = None
try:
import pgsrip
except ImportError:
pgsrip = None
try:
import pytesseract
except ImportError:
pytesseract = None
try:
from PIL import Image
except ImportError:
Image = None
class SubtitleError(Exception):
"""Base exception for subtitle-related errors"""
@ -114,14 +99,14 @@ def parse_arguments() -> argparse.Namespace:
parser.add_argument(
"--context-before",
type=float,
default=0.5,
help="Extra seconds before subtitle (default: 0.5, can be negative to trim)"
default=0,
help="Extra seconds before subtitle (default: 0, can be negative to trim)"
)
parser.add_argument(
"--context-after",
type=float,
default=0.5,
help="Extra seconds after subtitle (default: 0.5, can be negative to trim)"
default=0,
help="Extra seconds after subtitle (default: 0, can be negative to trim)"
)
parser.add_argument(
"--include-surrounding-subtitles",
@ -323,13 +308,8 @@ def extract_embedded_subtitles(video_path: str, output_dir: str, base_name: str)
# Keep original extension for ASS/VTT
output_path = temp_output
else:
# Image-based subtitle format detected
print(f"{Fore.YELLOW} ⚠️ Detected image-based subtitle format: {selected_codec}{Style.RESET_ALL}")
return None
else:
# Check if the codec is image-based
if selected_codec in ['hdmv_pgs_subtitle', 'dvd_subtitle', 'dvdsub', 'pgssub']:
print(f"{Fore.YELLOW} ⚠️ Found image-based subtitles ({selected_codec}){Style.RESET_ALL}")
# Unsupported subtitle format detected
print(f"{Fore.YELLOW} ⚠️ Detected unsupported subtitle format: {selected_codec}{Style.RESET_ALL}")
return None
print(f"{Fore.GREEN}✅ Extracted embedded subtitles to: {output_path}{Style.RESET_ALL}")