+11
-3
@@ -1,4 +1,5 @@
|
|||||||
import os.path
|
import os.path
|
||||||
|
import shutil
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from enum import Enum, StrEnum
|
from enum import Enum, StrEnum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -182,10 +183,15 @@ class DialogPreferences(QtWidgets.QDialog):
|
|||||||
self,
|
self,
|
||||||
obj_line_edit: QtWidgets.QLineEdit,
|
obj_line_edit: QtWidgets.QLineEdit,
|
||||||
file_mode: QtWidgets.QFileDialog | QtWidgets.QFileDialog.FileMode = QtWidgets.QFileDialog.Directory,
|
file_mode: QtWidgets.QFileDialog | QtWidgets.QFileDialog.FileMode = QtWidgets.QFileDialog.Directory,
|
||||||
|
path_default: str = None,
|
||||||
):
|
):
|
||||||
# If a path is set, use it otherwise the users home directory.
|
# If a path is set, use it otherwise the users home directory.
|
||||||
settings_path: str = os.path.expanduser(obj_line_edit.text()) if obj_line_edit.text() else ""
|
path_settings: str = os.path.expanduser(obj_line_edit.text()) if obj_line_edit.text() else ""
|
||||||
dir_current: str = settings_path if settings_path and os.path.exists(settings_path) else str(Path.home())
|
# Check if obj_line_edit is empty but path_default can be usd instead
|
||||||
|
path_settings = (
|
||||||
|
path_settings if path_settings else os.path.expanduser(path_default) if path_default else path_settings
|
||||||
|
)
|
||||||
|
dir_current: str = path_settings if path_settings and os.path.exists(path_settings) else str(Path.home())
|
||||||
dialog: QtWidgets.QFileDialog = QtWidgets.QFileDialog()
|
dialog: QtWidgets.QFileDialog = QtWidgets.QFileDialog()
|
||||||
|
|
||||||
# Set to directory mode only but show files.
|
# Set to directory mode only but show files.
|
||||||
@@ -222,7 +228,9 @@ class DialogPreferences(QtWidgets.QDialog):
|
|||||||
self.ui.pb_download_base_path.clicked.connect(lambda x: self.dialog_chose_file(self.ui.le_download_base_path))
|
self.ui.pb_download_base_path.clicked.connect(lambda x: self.dialog_chose_file(self.ui.le_download_base_path))
|
||||||
self.ui.pb_path_binary_ffmpeg.clicked.connect(
|
self.ui.pb_path_binary_ffmpeg.clicked.connect(
|
||||||
lambda x: self.dialog_chose_file(
|
lambda x: self.dialog_chose_file(
|
||||||
self.ui.le_path_binary_ffmpeg, file_mode=QtWidgets.QFileDialog.FileMode.ExistingFiles
|
self.ui.le_path_binary_ffmpeg,
|
||||||
|
file_mode=QtWidgets.QFileDialog.FileMode.ExistingFiles,
|
||||||
|
path_default=shutil.which("ffmpeg"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -75,14 +75,13 @@ class Download:
|
|||||||
if not self.settings.data.path_binary_ffmpeg and (
|
if not self.settings.data.path_binary_ffmpeg and (
|
||||||
self.settings.data.video_convert_mp4 or self.settings.data.extract_flac
|
self.settings.data.video_convert_mp4 or self.settings.data.extract_flac
|
||||||
):
|
):
|
||||||
self.settings.data.path_binary_ffmpeg = shutil.which("ffmpeg")
|
|
||||||
if not self.settings.data.path_binary_ffmpeg:
|
|
||||||
self.settings.data.video_convert_mp4 = False
|
self.settings.data.video_convert_mp4 = False
|
||||||
self.settings.data.extract_flac = False
|
self.settings.data.extract_flac = False
|
||||||
|
|
||||||
self.fn_logger.error(
|
self.fn_logger.error(
|
||||||
"FFmpeg is not set. Videos can be downloaded but will not be processed. FLAC cannot be extracted from MP4 containers. "
|
"FFmpeg path is not set. Videos can be downloaded but will not be processed. FLAC cannot be "
|
||||||
"Make sure FFmpeg is installed. The path to the binary can be specified (`path_binary_ffmpeg`)."
|
"extracted from MP4 containers. Make sure FFmpeg is installed. The path to the FFmpeg binary must "
|
||||||
|
"be set in (`path_binary_ffmpeg`)."
|
||||||
)
|
)
|
||||||
|
|
||||||
def _download(
|
def _download(
|
||||||
|
|||||||
@@ -72,7 +72,10 @@ class HelpSettings:
|
|||||||
"Videos are downloaded as MPEG Transport Stream (TS) files. With this option each video "
|
"Videos are downloaded as MPEG Transport Stream (TS) files. With this option each video "
|
||||||
"will be converted to MP4. FFmpeg must be installed."
|
"will be converted to MP4. FFmpeg must be installed."
|
||||||
)
|
)
|
||||||
path_binary_ffmpeg: str = "Path to FFmpeg binary. Only necesarry if FFmpeg not present in path."
|
path_binary_ffmpeg: str = (
|
||||||
|
"Path to FFmpeg binary file (executable). Only necessary if FFmpeg not set in $PATH. Mandatory for Windows: "
|
||||||
|
"The directory of `ffmpeg.exe`must be set in %PATH%."
|
||||||
|
)
|
||||||
metadata_cover_dimension: str = (
|
metadata_cover_dimension: str = (
|
||||||
"The dimensions of the cover image embedded into the track. Possible values: 320x320, 640x640x 1280x1280."
|
"The dimensions of the cover image embedded into the track. Possible values: 320x320, 640x640x 1280x1280."
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user