Skip to content

Commit e8b28a3

Browse files
authored
Add function to find Rigaya encoder binaries (#707)
1 parent f451d21 commit e8b28a3

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

fastflix/models/config.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,30 @@ def where(filename: str, portable_mode=False) -> Path | None:
9898
return location
9999
return None
100100

101+
def find_rigaya_encoder(base_name: str) -> Path | None:
102+
"""Find Rigaya encoder binaries with case-insensitive search."""
103+
# Try common binary names in order of preference
104+
candidates = [
105+
f"{base_name}64", # Windows 64-bit
106+
f"{base_name}", # Windows/Linux
107+
f"{base_name.lower()}", # Linux lowercase
108+
]
109+
110+
for candidate in candidates:
111+
if location := where(candidate):
112+
return location
113+
return None
114+
101115

102116
class Config(BaseModel):
103117
version: str = __version__
104118
config_path: Path = Field(default_factory=get_config)
105119
ffmpeg: Path = Field(default_factory=lambda: find_ffmpeg_file("ffmpeg"))
106120
ffprobe: Path = Field(default_factory=lambda: find_ffmpeg_file("ffprobe"))
107121
hdr10plus_parser: Path | None = Field(default_factory=find_hdr10plus_tool)
108-
nvencc: Path | None = Field(default_factory=lambda: where("NVEncC64") or where("NVEncC"))
109-
vceencc: Path | None = Field(default_factory=lambda: where("VCEEncC64") or where("VCEEncC"))
110-
qsvencc: Path | None = Field(default_factory=lambda: where("QSVEncC64") or where("QSVEncC"))
122+
nvencc: Path | None = Field(default_factory=lambda: find_rigaya_encoder("NVEncC"))
123+
vceencc: Path | None = Field(default_factory=lambda: find_rigaya_encoder("VCEEncC"))
124+
qsvencc: Path | None = Field(default_factory=lambda: find_rigaya_encoder("QSVEncC"))
111125
output_directory: Path | None = None
112126
source_directory: Path | None = None
113127
output_name_format: str = "{source}-fastflix-{rand_4}"

0 commit comments

Comments
 (0)