Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions fastflix/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,30 @@ def where(filename: str, portable_mode=False) -> Path | None:
return location
return None

def find_rigaya_encoder(base_name: str) -> Path | None:
"""Find Rigaya encoder binaries with case-insensitive search."""
# Try common binary names in order of preference
candidates = [
f"{base_name}64", # Windows 64-bit
f"{base_name}", # Windows/Linux
f"{base_name.lower()}", # Linux lowercase
]

for candidate in candidates:
if location := where(candidate):
return location
return None


class Config(BaseModel):
version: str = __version__
config_path: Path = Field(default_factory=get_config)
ffmpeg: Path = Field(default_factory=lambda: find_ffmpeg_file("ffmpeg"))
ffprobe: Path = Field(default_factory=lambda: find_ffmpeg_file("ffprobe"))
hdr10plus_parser: Path | None = Field(default_factory=find_hdr10plus_tool)
nvencc: Path | None = Field(default_factory=lambda: where("NVEncC64") or where("NVEncC"))
vceencc: Path | None = Field(default_factory=lambda: where("VCEEncC64") or where("VCEEncC"))
qsvencc: Path | None = Field(default_factory=lambda: where("QSVEncC64") or where("QSVEncC"))
nvencc: Path | None = Field(default_factory=lambda: find_rigaya_encoder("NVEncC"))
vceencc: Path | None = Field(default_factory=lambda: find_rigaya_encoder("VCEEncC"))
qsvencc: Path | None = Field(default_factory=lambda: find_rigaya_encoder("QSVEncC"))
output_directory: Path | None = None
source_directory: Path | None = None
output_name_format: str = "{source}-fastflix-{rand_4}"
Expand Down
Loading