[REFACTOR] init ffmpeg paths in config initialize function (#501)
* [REFACTOR] init ffmpeg paths in config initialize function * init within init
This commit is contained in:
parent
7b7a4f8ab1
commit
7d7777c119
3 changed files with 11 additions and 9 deletions
|
|
@ -127,7 +127,7 @@ def main() -> List[Tuple[Subscription, FileHandlerTransactionLog]]:
|
|||
args, extra_args = parser.parse_known_args()
|
||||
|
||||
# Load the config
|
||||
config: ConfigFile = ConfigFile.from_file_path(args.config).initialize()
|
||||
config: ConfigFile = ConfigFile.from_file_path(args.config)
|
||||
transaction_logs: List[Tuple[Subscription, FileHandlerTransactionLog]] = []
|
||||
|
||||
with working_directory_lock(config=config):
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from typing import Any
|
|||
|
||||
from ytdl_sub.config.config_validator import ConfigValidator
|
||||
from ytdl_sub.config.preset import Preset
|
||||
from ytdl_sub.utils.ffmpeg import FFMPEG
|
||||
from ytdl_sub.utils.yaml import load_yaml
|
||||
|
||||
|
||||
|
|
@ -15,7 +16,10 @@ class ConfigFile(ConfigValidator):
|
|||
for preset_name, preset_dict in self.presets.dict.items():
|
||||
Preset.preset_partial_validate(config=self, name=preset_name, value=preset_dict)
|
||||
|
||||
def initialize(self):
|
||||
# After validation, perform initialization
|
||||
self._initialize()
|
||||
|
||||
def _initialize(self):
|
||||
"""
|
||||
Configures things (umask, pgid) prior to any downloading
|
||||
|
||||
|
|
@ -26,6 +30,11 @@ class ConfigFile(ConfigValidator):
|
|||
if self.config_options.umask:
|
||||
os.umask(int(self.config_options.umask, 8))
|
||||
|
||||
FFMPEG.set_paths(
|
||||
ffmpeg_path=self.config_options.ffmpeg_path,
|
||||
ffprobe_path=self.config_options.ffprobe_path,
|
||||
)
|
||||
|
||||
return self
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ from ytdl_sub.subscriptions.base_subscription import BaseSubscription
|
|||
from ytdl_sub.subscriptions.subscription_ytdl_options import SubscriptionYTDLOptions
|
||||
from ytdl_sub.utils.datetime import to_date_range
|
||||
from ytdl_sub.utils.exceptions import ValidationException
|
||||
from ytdl_sub.utils.ffmpeg import FFMPEG
|
||||
from ytdl_sub.utils.file_handler import FileHandler
|
||||
from ytdl_sub.utils.file_handler import FileHandlerTransactionLog
|
||||
from ytdl_sub.utils.file_handler import FileMetadata
|
||||
|
|
@ -266,12 +265,6 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
|||
If true, do not download any video/audio files or move anything to the output
|
||||
directory.
|
||||
"""
|
||||
# Set ffmpeg paths
|
||||
FFMPEG.set_paths(
|
||||
ffmpeg_path=self._config_options.ffmpeg_path,
|
||||
ffprobe_path=self._config_options.ffprobe_path,
|
||||
)
|
||||
|
||||
self._enhanced_download_archive.reinitialize(dry_run=dry_run)
|
||||
plugins = self._initialize_plugins()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue