From 5da3edcd89a59aa6926e2054ef77edb8a1eb0aaa Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Thu, 26 Mar 2026 17:59:25 -0300 Subject: [PATCH] Add KeyEmu support to SpotifyBaseInterface --- votify/interface/base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/votify/interface/base.py b/votify/interface/base.py index 737e961..eaafb0b 100644 --- a/votify/interface/base.py +++ b/votify/interface/base.py @@ -9,6 +9,7 @@ from .constants import URL_INFO_RE from .enums import CoverSize, MediaRating from .exceptions import VotifyNoCdmException, VotifyUrlParseException from .types import DecryptionKey, PlaylistTags, SpotifyUrlInfo +from unplayplay.key_emu import KeyEmu logger = logging.getLogger(__name__) @@ -20,15 +21,18 @@ class SpotifyBaseInterface: cover_size: CoverSize = CoverSize.EXTRA_LARGE, skip_stream_info: bool = False, wvd_path: str | None = None, + spotify_dll_path: str | None = None, disallowed_media_types: list[str] | None = None, ) -> None: self.api = api self.cover_size = cover_size self.skip_stream_info = skip_stream_info self.wvd_path = wvd_path + self.spotify_dll_path = spotify_dll_path self.disallowed_media_types = disallowed_media_types or [] self._initialize_cdm() + self._initialize_key_emu() @alru_cache() async def get_album_data_cached(self, album_id: str) -> tuple[dict, list[dict]]: @@ -67,6 +71,12 @@ class SpotifyBaseInterface: else: self.cdm = None + def _initialize_key_emu(self) -> None: + if self.spotify_dll_path: + self.key_emu = KeyEmu(self.spotify_dll_path) + else: + self.key_emu = None + def parse_url_info(self, url: str) -> SpotifyUrlInfo: match = URL_INFO_RE.match(url) if not match: