mirror of
https://github.com/glomatico/votify.git
synced 2026-09-29 20:42:32 +02:00
Unify decryption key type to DecryptionKey
This commit is contained in:
@@ -3,7 +3,7 @@ import logging
|
||||
from .base import SpotifyBaseInterface
|
||||
from .enums import AudioQuality
|
||||
from .exceptions import VotifyMediaAudioQualityNotAvailableException
|
||||
from .types import DecryptionKeyAv, StreamInfo, StreamInfoAv
|
||||
from .types import DecryptionKey, StreamInfo, StreamInfoAv
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -59,7 +59,7 @@ class SpotifyAudioInterface(SpotifyBaseInterface):
|
||||
|
||||
return stream_info
|
||||
|
||||
async def get_widevine_decryption_key(self, pssh: str) -> DecryptionKeyAv:
|
||||
async def get_widevine_decryption_key(self, pssh: str) -> DecryptionKey:
|
||||
return await self._get_widevine_decryption_key(pssh, "audio")
|
||||
|
||||
def _parse_file_id(
|
||||
|
||||
@@ -8,7 +8,7 @@ from ..api import SpotifyApi
|
||||
from .constants import URL_INFO_RE
|
||||
from .enums import CoverSize, MediaRating
|
||||
from .exceptions import VotifyUrlParseException
|
||||
from .types import DecryptionKey, DecryptionKeyAv, PlaylistTags, SpotifyUrlInfo
|
||||
from .types import DecryptionKey, PlaylistTags, SpotifyUrlInfo
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -82,7 +82,7 @@ class SpotifyBaseInterface:
|
||||
self,
|
||||
pssh: str,
|
||||
media_type: str,
|
||||
) -> DecryptionKeyAv:
|
||||
) -> DecryptionKey:
|
||||
try:
|
||||
cdm_session = self.cdm.open()
|
||||
pssh = PSSH(pssh)
|
||||
@@ -99,9 +99,7 @@ class SpotifyBaseInterface:
|
||||
|
||||
logger.debug(f"Received decryption key: {key_id}:{decryption_key}")
|
||||
|
||||
return DecryptionKeyAv(
|
||||
DecryptionKey(key_id=key_id, decryption_key=decryption_key)
|
||||
)
|
||||
return DecryptionKey(key_id=key_id, decryption_key=decryption_key)
|
||||
|
||||
def is_video(self, playback_info: dict) -> bool:
|
||||
return bool(playback_info["manifest"].get("manifest_ids_video"))
|
||||
|
||||
@@ -54,10 +54,8 @@ class SpotifyEpisodeInterface(SpotifyAudioInterface):
|
||||
e.media_metadata = episode_data
|
||||
raise
|
||||
|
||||
media.decryption_key = DecryptionKeyAv(
|
||||
DecryptionKey(
|
||||
decryption_key=DEFAULT_EPISODE_DECRYPTION_KEY,
|
||||
)
|
||||
media.decryption_key = DecryptionKey(
|
||||
decryption_key=DEFAULT_EPISODE_DECRYPTION_KEY,
|
||||
)
|
||||
|
||||
logger.debug(f"Parsed episode media: {media}")
|
||||
|
||||
@@ -20,12 +20,6 @@ class DecryptionKey:
|
||||
key_id: str = "0" * 32
|
||||
|
||||
|
||||
@dataclass
|
||||
class DecryptionKeyAv:
|
||||
audio: DecryptionKey
|
||||
video: DecryptionKey | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class StreamInfo:
|
||||
stream_url: str | list[str]
|
||||
@@ -192,5 +186,5 @@ class SpotifyMedia:
|
||||
cover_url: str | None = None
|
||||
lyrics: MediaLyrics | None = None
|
||||
stream_info: StreamInfoAv | None = None
|
||||
decryption_key: DecryptionKeyAv | None = None
|
||||
decryption_key: DecryptionKey | None = None
|
||||
flat_filter_result: Any = None
|
||||
|
||||
@@ -6,7 +6,7 @@ from InquirerPy.base.control import Choice
|
||||
from .base import SpotifyBaseInterface
|
||||
from .constants import COVER_SIZE_ID_MAP_VIDEO
|
||||
from .enums import VideoFormat, VideoResolution
|
||||
from .types import StreamInfo, StreamInfoAv
|
||||
from .types import DecryptionKey, StreamInfo, StreamInfoAv
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -270,5 +270,5 @@ class SpotifyVideoInterface(SpotifyBaseInterface):
|
||||
|
||||
return cover_url
|
||||
|
||||
async def get_widevine_decryption_key(self, pssh: str):
|
||||
async def get_widevine_decryption_key(self, pssh: str) -> DecryptionKey:
|
||||
return await self._get_widevine_decryption_key(pssh, "video")
|
||||
|
||||
Reference in New Issue
Block a user