subtitles almost ready
This commit is contained in:
parent
3b3c23963e
commit
baae5ff72d
6 changed files with 17 additions and 3 deletions
|
|
@ -56,6 +56,7 @@ class Downloader(DownloadArchiver, Generic[DownloaderOptionsT, DownloaderEntryT]
|
||||||
downloader_entry_type: Type[Entry] = Entry
|
downloader_entry_type: Type[Entry] = Entry
|
||||||
|
|
||||||
supports_download_archive: bool = True
|
supports_download_archive: bool = True
|
||||||
|
supports_subtitles: bool = True
|
||||||
|
|
||||||
_extract_entry_num_retries: int = 5
|
_extract_entry_num_retries: int = 5
|
||||||
_extract_entry_retry_wait_sec: int = 3
|
_extract_entry_retry_wait_sec: int = 3
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ class SoundcloudAlbumsAndSinglesDownloader(
|
||||||
SoundcloudDownloader[SoundcloudAlbumsAndSinglesDownloadOptions]
|
SoundcloudDownloader[SoundcloudAlbumsAndSinglesDownloadOptions]
|
||||||
):
|
):
|
||||||
downloader_options_type = SoundcloudAlbumsAndSinglesDownloadOptions
|
downloader_options_type = SoundcloudAlbumsAndSinglesDownloadOptions
|
||||||
|
supports_subtitles = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ytdl_option_defaults(cls) -> Dict:
|
def ytdl_option_defaults(cls) -> Dict:
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class YoutubeMergePlaylistDownloader(
|
||||||
downloader_options_type = YoutubeMergePlaylistDownloaderOptions
|
downloader_options_type = YoutubeMergePlaylistDownloaderOptions
|
||||||
downloader_entry_type = YoutubeVideo
|
downloader_entry_type = YoutubeVideo
|
||||||
supports_download_archive = False
|
supports_download_archive = False
|
||||||
|
supports_subtitles = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ytdl_option_defaults(cls) -> Dict:
|
def ytdl_option_defaults(cls) -> Dict:
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,9 @@ class YoutubeSplitVideoDownloader(
|
||||||
downloader_options_type = YoutubeSplitVideoDownloaderOptions
|
downloader_options_type = YoutubeSplitVideoDownloaderOptions
|
||||||
downloader_entry_type = YoutubePlaylistVideo
|
downloader_entry_type = YoutubePlaylistVideo
|
||||||
|
|
||||||
|
supports_download_archive = False
|
||||||
|
supports_subtitles = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ytdl_option_defaults(cls) -> Dict:
|
def ytdl_option_defaults(cls) -> Dict:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -204,8 +204,7 @@ class Subscription:
|
||||||
entry=entry,
|
entry=entry,
|
||||||
)
|
)
|
||||||
|
|
||||||
# # TODO: see if entry even has subtitles
|
# if self.downloader_class.supports_subtitles and self.subtitle_options.subtitles_name and (
|
||||||
# if self.output_options.subtitles_name and (
|
|
||||||
# entry.kwargs_contains("subtitles") or entry.kwargs_contains("automatic_captions")
|
# entry.kwargs_contains("subtitles") or entry.kwargs_contains("automatic_captions")
|
||||||
# ):
|
# ):
|
||||||
# output_subtitles_name = self.overrides.apply_formatter(
|
# output_subtitles_name = self.overrides.apply_formatter(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
from typing import Type
|
||||||
|
|
||||||
from ytdl_sub.config.preset import Preset
|
from ytdl_sub.config.preset import Preset
|
||||||
|
from ytdl_sub.downloaders.downloader import Downloader
|
||||||
from ytdl_sub.downloaders.ytdl_options_builder import YTDLOptionsBuilder
|
from ytdl_sub.downloaders.ytdl_options_builder import YTDLOptionsBuilder
|
||||||
from ytdl_sub.ytdl_additions.enhanced_download_archive import EnhancedDownloadArchive
|
from ytdl_sub.ytdl_additions.enhanced_download_archive import EnhancedDownloadArchive
|
||||||
|
|
||||||
|
|
@ -19,6 +21,10 @@ class SubscriptionYTDLOptions:
|
||||||
self._working_directory = working_directory
|
self._working_directory = working_directory
|
||||||
self._dry_run = dry_run
|
self._dry_run = dry_run
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _downloader(self) -> Type[Downloader]:
|
||||||
|
return self._preset.downloader
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _global_options(self) -> Dict:
|
def _global_options(self) -> Dict:
|
||||||
"""
|
"""
|
||||||
|
|
@ -32,7 +38,7 @@ class SubscriptionYTDLOptions:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self._preset.downloader.supports_download_archive
|
self._downloader.supports_download_archive
|
||||||
and self._preset.output_options.maintain_download_archive
|
and self._preset.output_options.maintain_download_archive
|
||||||
):
|
):
|
||||||
ytdl_options["download_archive"] = str(
|
ytdl_options["download_archive"] = str(
|
||||||
|
|
@ -61,6 +67,9 @@ class SubscriptionYTDLOptions:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _subtitle_options(self) -> Dict:
|
def _subtitle_options(self) -> Dict:
|
||||||
|
if not self._downloader.supports_subtitles:
|
||||||
|
return {}
|
||||||
|
|
||||||
ytdl_options: Dict = {}
|
ytdl_options: Dict = {}
|
||||||
subtitle_options = self._preset.subtitle_options
|
subtitle_options = self._preset.subtitle_options
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue