added cross plattform ffmpeg, and an option to set ffmpeg bin

This commit is contained in:
Hellow2
2023-06-21 11:53:59 +02:00
parent 1d64aab778
commit cd61fe4c1d
5 changed files with 17 additions and 5 deletions

View File

@@ -38,12 +38,19 @@ class PathsSection(Section):
r'^\.' # is hidden/starts with a "."
]
)
self.FFMPEG_BINARY = PathAttribute(
name="ffmpeg_binary",
description="Set the path to the ffmpeg binary.",
value=str(LOCATIONS.FFMPEG_BIN)
)
self.attribute_list = [
self.MUSIC_DIRECTORY,
self.TEMP_DIRECTORY,
self.LOG_PATH,
self.NOT_A_GENRE_REGEX
self.NOT_A_GENRE_REGEX,
self.FFMPEG_BINARY
]
super().__init__()

View File

@@ -2,6 +2,7 @@ from pathlib import Path
import os
import tempfile
from pyffmpeg import FFmpeg
from .music_directory import get_music_directory
from .config_directory import get_config_directory
@@ -19,6 +20,8 @@ class Locations:
self.CONFIG_DIRECTORY = get_config_directory(str(application_name))
self.CONFIG_DIRECTORY.mkdir(exist_ok=True, parents=True)
self.CONFIG_FILE = Path(self.CONFIG_DIRECTORY, f"{application_name}.conf")
self.FFMPEG_BIN = Path(FFmpeg(enable_log=False).get_ffmpeg_bin())
def get_log_file(self, file_name: os.PathLike) -> Path:
return Path(self.TEMP_DIRECTORY, file_name)

View File

@@ -120,3 +120,5 @@ to download:
have fun :3
""".strip()
FFMPEG_BINARY: Path = PATHS_SECTION.FFMPEG_BINARY.object_from_value