fixed the _pb2 suffix error and import errors
This commit is contained in:
@@ -3,10 +3,10 @@ from __future__ import annotations
|
||||
import typing
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from librespot.proto import Metadata
|
||||
from librespot.proto import Metadata_pb2
|
||||
|
||||
|
||||
class AudioQualityPicker:
|
||||
def get_file(self,
|
||||
files: typing.List[Metadata.AudioFile]) -> Metadata.AudioFile:
|
||||
files: typing.List[Metadata_pb2.AudioFile]) -> Metadata_pb2.AudioFile:
|
||||
pass
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from librespot.proto import Metadata
|
||||
from librespot.proto import Metadata_pb2
|
||||
import enum
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@ class SuperAudioFormat(enum.Enum):
|
||||
AAC = 0x02
|
||||
|
||||
@staticmethod
|
||||
def get(audio_format: Metadata.AudioFile.Format):
|
||||
if audio_format == Metadata.AudioFile.Format.OGG_VORBIS_96 or \
|
||||
audio_format == Metadata.AudioFile.Format.OGG_VORBIS_160 or \
|
||||
audio_format == Metadata.AudioFile.Format.OGG_VORBIS_320:
|
||||
def get(audio_format: Metadata_pb2.AudioFile.Format):
|
||||
if audio_format == Metadata_pb2.AudioFile.Format.OGG_VORBIS_96 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.OGG_VORBIS_160 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.OGG_VORBIS_320:
|
||||
return SuperAudioFormat.VORBIS
|
||||
if audio_format == Metadata.AudioFile.Format.MP3_256 or \
|
||||
audio_format == Metadata.AudioFile.Format.MP3_320 or \
|
||||
audio_format == Metadata.AudioFile.Format.MP3_160 or \
|
||||
audio_format == Metadata.AudioFile.Format.MP3_96 or \
|
||||
audio_format == Metadata.AudioFile.Format.MP3_160_ENC:
|
||||
if audio_format == Metadata_pb2.AudioFile.Format.MP3_256 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.MP3_320 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.MP3_160 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.MP3_96 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.MP3_160_ENC:
|
||||
return SuperAudioFormat.MP3
|
||||
if audio_format == Metadata.AudioFile.Format.AAC_24 or \
|
||||
audio_format == Metadata.AudioFile.Format.AAC_48 or \
|
||||
audio_format == Metadata.AudioFile.Format.AAC_24_NORM:
|
||||
if audio_format == Metadata_pb2.AudioFile.Format.AAC_24 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.AAC_48 or \
|
||||
audio_format == Metadata_pb2.AudioFile.Format.AAC_24_NORM:
|
||||
return SuperAudioFormat.AAC
|
||||
raise RuntimeError("Unknown audio format: {}".format(audio_format))
|
||||
|
||||
Reference in New Issue
Block a user