mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-29 21:31:23 +00:00
Bugfix: -o m4a would fail [Fixes #720]
In FFmpeg, a given encoding may not always point to the same format string.
This commit is contained in:
@@ -21,6 +21,13 @@ from spotdl.encode.exceptions import EncoderNotFoundError
|
||||
|
||||
"""
|
||||
|
||||
_TARGET_FORMATS_FROM_ENCODING = {
|
||||
"m4a": "mp4",
|
||||
"mp3": "mp3",
|
||||
"opus": "opus",
|
||||
"flac": "flac"
|
||||
}
|
||||
|
||||
|
||||
class EncoderBase(ABC):
|
||||
"""
|
||||
@@ -44,6 +51,7 @@ class EncoderBase(ABC):
|
||||
self.encoder_path = encoder_path
|
||||
self._loglevel = loglevel
|
||||
self._additional_arguments = additional_arguments
|
||||
self._target_formats_from_encoding = _TARGET_FORMATS_FROM_ENCODING
|
||||
|
||||
def set_argument(self, argument):
|
||||
"""
|
||||
@@ -94,6 +102,14 @@ class EncoderBase(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
def target_format_from_encoding(self, encoding):
|
||||
"""
|
||||
This method generates the target stream format from given
|
||||
input encoding.
|
||||
"""
|
||||
target_format = self._target_formats_from_encoding[encoding]
|
||||
return target_format
|
||||
|
||||
def re_encode_from_stdin(self, input_encoding, target_path):
|
||||
"""
|
||||
This method must invoke the encoder to encode stdin to a
|
||||
|
||||
Reference in New Issue
Block a user