Restyled by yapf

This commit is contained in:
Restyled.io 2021-05-22 01:27:30 +00:00
parent 9c47be20a5
commit 0fbe39722b
48 changed files with 1213 additions and 1198 deletions

View File

@ -33,18 +33,15 @@ def client():
return
if (args[0] == "p" or args[0] == "play") and len(args) == 2:
track_uri_search = re.search(
r"^spotify:track:(?P<TrackID>[0-9a-zA-Z]{22})$", args[1]
)
r"^spotify:track:(?P<TrackID>[0-9a-zA-Z]{22})$", args[1])
track_url_search = re.search(
r"^(https?://)?open.spotify.com/track/(?P<TrackID>[0-9a-zA-Z]{22})(\?si=.+?)?$",
args[1],
)
if track_uri_search is not None or track_url_search is not None:
track_id_str = (
track_uri_search
if track_uri_search is not None
else track_url_search
).group("TrackID")
track_id_str = (track_uri_search
if track_uri_search is not None else
track_url_search).group("TrackID")
play(track_id_str)
wait()
if args[0] == "q" or args[0] == "quality":
@ -64,20 +61,22 @@ def client():
token = session.tokens().get("user-read-email")
resp = requests.get(
"https://api.spotify.com/v1/search",
{"limit": "5", "offset": "0", "q": cmd[2:], "type": "track"},
{
"limit": "5",
"offset": "0",
"q": cmd[2:],
"type": "track"
},
headers={"Authorization": "Bearer %s" % token},
)
i = 1
tracks = resp.json()["tracks"]["items"]
for track in tracks:
print(
"%d, %s | %s"
% (
i,
track["name"],
",".join([artist["name"] for artist in track["artists"]]),
)
)
print("%d, %s | %s" % (
i,
track["name"],
",".join([artist["name"] for artist in track["artists"]]),
))
i += 1
position = -1
while True:
@ -115,8 +114,7 @@ def login():
def play(track_id_str: str):
track_id = TrackId.from_base62(track_id_str)
stream = session.content_feeder().load(
track_id, VorbisOnlyAudioQuality(AudioQuality.VERY_HIGH), False, None
)
track_id, VorbisOnlyAudioQuality(AudioQuality.VERY_HIGH), False, None)
ffplay = subprocess.Popen(
["ffplay", "-"],
stdin=subprocess.PIPE,
@ -131,13 +129,11 @@ def play(track_id_str: str):
def splash():
print(
"=================================\n"
"| Librespot-Python Player |\n"
"| |\n"
"| by kokarare1212 |\n"
"=================================\n\n\n"
)
print("=================================\n"
"| Librespot-Python Player |\n"
"| |\n"
"| by kokarare1212 |\n"
"=================================\n\n\n")
def main():

View File

@ -24,7 +24,8 @@ class ZeroconfServer(Closeable):
__keys: DiffieHellman
__inner: ZeroconfServer.Inner
def __init__(self, inner: ZeroconfServer.Inner, listen_port: int, listen_all: bool):
def __init__(self, inner: ZeroconfServer.Inner, listen_port: int,
listen_all: bool):
self.__inner = inner
self.__keys = DiffieHellman()
@ -78,15 +79,13 @@ class ZeroconfServer(Closeable):
self.conf = conf
self.device_type = device_type
self.device_name = device_name
self.device_id = (
device_id if device_id is not None else Utils.random_hex_string(40)
)
self.device_id = (device_id if device_id is not None else
Utils.random_hex_string(40))
class HttpRunner(Runnable, Closeable):
__sock: socket
__executorService: concurrent.futures.ThreadPoolExecutor = (
concurrent.futures.ThreadPoolExecutor()
)
concurrent.futures.ThreadPoolExecutor())
__shouldStop: bool = False
def __init__(self, port: int):

View File

@ -22,7 +22,9 @@ class AbsChunkedInputStream(InputStream, HaltListener):
_decoded_length: int = 0
def __init__(self, retry_on_chunk_error: bool):
self.retries: typing.Final[typing.List[int]] = [0 for _ in range(self.chunks())]
self.retries: typing.Final[typing.List[int]] = [
0 for _ in range(self.chunks())
]
self.retry_on_chunk_error = retry_on_chunk_error
def is_closed(self) -> bool:
@ -107,13 +109,10 @@ class AbsChunkedInputStream(InputStream, HaltListener):
self.request_chunk_from_stream(chunk)
self.requested_chunks()[chunk] = True
for i in range(
chunk + 1, min(self.chunks() - 1, chunk + self.preload_ahead) + 1
):
if (
self.requested_chunks()[i]
and self.retries[i] < self.preload_chunk_retries
):
for i in range(chunk + 1,
min(self.chunks() - 1, chunk + self.preload_ahead) + 1):
if (self.requested_chunks()[i]
and self.retries[i] < self.preload_chunk_retries):
self.request_chunk_from_stream(i)
self.requested_chunks()[chunk] = True
@ -147,7 +146,10 @@ class AbsChunkedInputStream(InputStream, HaltListener):
self.check_availability(chunk, True, True)
def read(self, b: bytearray = None, offset: int = None, length: int = None) -> int:
def read(self,
b: bytearray = None,
offset: int = None,
length: int = None) -> int:
if b is None and offset is None and length is None:
return self.internal_read()
if not (b is not None and offset is not None and length is not None):
@ -157,9 +159,8 @@ class AbsChunkedInputStream(InputStream, HaltListener):
raise IOError("Stream is closed!")
if offset < 0 or length < 0 or length > len(b) - offset:
raise IndexError(
"offset: {}, length: {}, buffer: {}".format(offset, length, len(b))
)
raise IndexError("offset: {}, length: {}, buffer: {}".format(
offset, length, len(b)))
elif length == 0:
return 0
@ -174,7 +175,8 @@ class AbsChunkedInputStream(InputStream, HaltListener):
self.check_availability(chunk, True, False)
copy = min(len(self.buffer()[chunk]) - chunk_off, length - i)
b[offset + 0 : copy] = self.buffer()[chunk][chunk_off : chunk_off + copy]
b[offset + 0:copy] = self.buffer()[chunk][chunk_off:chunk_off +
copy]
i += copy
self._pos += copy
@ -222,5 +224,4 @@ class AbsChunkedInputStream(InputStream, HaltListener):
@staticmethod
def from_stream_error(stream_error: int):
return AbsChunkedInputStream.ChunkException(
"Failed due to stream error, code: {}".format(stream_error)
)
"Failed due to stream error, code: {}".format(stream_error))

View File

@ -26,7 +26,10 @@ class AudioKeyManager(PacketsReceiver):
def __init__(self, session: Session):
self._session = session
def get_audio_key(self, gid: bytes, file_id: bytes, retry: bool = True) -> bytes:
def get_audio_key(self,
gid: bytes,
file_id: bytes,
retry: bool = True) -> bytes:
seq: int
with self._seqHolderLock:
seq = self._seqHolder
@ -49,9 +52,8 @@ class AudioKeyManager(PacketsReceiver):
return self.get_audio_key(gid, file_id, False)
raise RuntimeError(
"Failed fetching audio key! gid: {}, fileId: {}".format(
Utils.Utils.bytes_to_hex(gid), Utils.Utils.bytes_to_hex(file_id)
)
)
Utils.Utils.bytes_to_hex(gid),
Utils.Utils.bytes_to_hex(file_id)))
return key
@ -61,7 +63,8 @@ class AudioKeyManager(PacketsReceiver):
callback = self._callbacks.get(seq)
if callback is None:
self._LOGGER.warning("Couldn't find callback for seq: {}".format(seq))
self._LOGGER.warning(
"Couldn't find callback for seq: {}".format(seq))
return
if packet.is_cmd(Packet.Type.aes_key):
@ -73,9 +76,7 @@ class AudioKeyManager(PacketsReceiver):
else:
self._LOGGER.warning(
"Couldn't handle packet, cmd: {}, length: {}".format(
packet.cmd, len(packet.payload)
)
)
packet.cmd, len(packet.payload)))
class Callback:
def key(self, key: bytes) -> None:
@ -99,15 +100,15 @@ class AudioKeyManager(PacketsReceiver):
def error(self, code: int) -> None:
self._audioKeyManager._LOGGER.fatal(
"Audio key error, code: {}".format(code)
)
"Audio key error, code: {}".format(code))
with self.reference_lock:
self.reference.put(None)
self.reference_lock.notify_all()
def wait_response(self) -> bytes:
with self.reference_lock:
self.reference_lock.wait(AudioKeyManager._AUDIO_KEY_REQUEST_TIMEOUT)
self.reference_lock.wait(
AudioKeyManager._AUDIO_KEY_REQUEST_TIMEOUT)
return self.reference.get(block=False)
class AesKeyException(IOError):

View File

@ -20,8 +20,7 @@ class PlayableContentFeeder:
_LOGGER: logging = logging.getLogger(__name__)
STORAGE_RESOLVE_INTERACTIVE: str = "/storage-resolve/files/audio/interactive/{}"
STORAGE_RESOLVE_INTERACTIVE_PREFETCH: str = (
"/storage-resolve/files/audio/interactive_prefetch/{}"
)
"/storage-resolve/files/audio/interactive_prefetch/{}")
session: Session
def __init__(self, session: Session):
@ -45,20 +44,17 @@ class PlayableContentFeeder:
halt_listener: HaltListener,
):
if type(playable_id) is TrackId:
return self.load_track(
playable_id, audio_quality_picker, preload, halt_listener
)
return self.load_track(playable_id, audio_quality_picker, preload,
halt_listener)
def resolve_storage_interactive(
self, file_id: bytes, preload: bool
) -> StorageResolve.StorageResolveResponse:
self, file_id: bytes,
preload: bool) -> StorageResolve.StorageResolveResponse:
resp = self.session.api().send(
"GET",
(
self.STORAGE_RESOLVE_INTERACTIVE_PREFETCH
if preload
else self.STORAGE_RESOLVE_INTERACTIVE
).format(Utils.bytes_to_hex(file_id)),
(self.STORAGE_RESOLVE_INTERACTIVE_PREFETCH
if preload else self.STORAGE_RESOLVE_INTERACTIVE).format(
Utils.bytes_to_hex(file_id)),
None,
None,
)
@ -81,7 +77,8 @@ class PlayableContentFeeder:
halt_listener: HaltListener,
):
if type(track_id_or_track) is TrackId:
original = self.session.api().get_metadata_4_track(track_id_or_track)
original = self.session.api().get_metadata_4_track(
track_id_or_track)
track = self.pick_alternative_if_necessary(original)
if track is None:
raise
@ -89,7 +86,8 @@ class PlayableContentFeeder:
track = track_id_or_track
file = audio_quality_picker.get_file(track.file)
if file is None:
self._LOGGER.fatal("Couldn't find any suitable audio file, available")
self._LOGGER.fatal(
"Couldn't find any suitable audio file, available")
raise
return self.load_stream(file, track, None, preload, halt_listener)
@ -108,12 +106,10 @@ class PlayableContentFeeder:
resp = self.resolve_storage_interactive(file.file_id, preload)
if resp.result == StorageResolve.StorageResolveResponse.Result.CDN:
if track is not None:
return CdnFeedHelper.load_track(
self.session, track, file, resp, preload, halt_lister
)
return CdnFeedHelper.load_episode(
self.session, episode, file, resp, preload, halt_lister
)
return CdnFeedHelper.load_track(self.session, track, file,
resp, preload, halt_lister)
return CdnFeedHelper.load_episode(self.session, episode, file,
resp, preload, halt_lister)
elif resp.result == StorageResolve.StorageResolveResponse.Result.STORAGE:
if track is None:
# return StorageFeedHelper
@ -156,10 +152,10 @@ class PlayableContentFeeder:
preloaded_audio_key: bool
audio_key_time: int
def __init__(
self, file_id: bytes, preloaded_audio_key: bool, audio_key_time: int
):
self.file_id = None if file_id is None else Utils.bytes_to_hex(file_id)
def __init__(self, file_id: bytes, preloaded_audio_key: bool,
audio_key_time: int):
self.file_id = None if file_id is None else Utils.bytes_to_hex(
file_id)
self.preloaded_audio_key = preloaded_audio_key
self.audio_key_time = audio_key_time

View File

@ -40,7 +40,8 @@ class CdnFeedHelper:
streamer = session.cdn().stream_file(file, key, url, halt_listener)
input_stream = streamer.stream()
normalization_data = NormalizationData.NormalizationData.read(input_stream)
normalization_data = NormalizationData.NormalizationData.read(
input_stream)
if input_stream.skip(0xA7) != 0xA7:
raise IOError("Couldn't skip 0xa7 bytes!")
return PlayableContentFeeder.PlayableContentFeeder.LoadedStream(
@ -48,13 +49,13 @@ class CdnFeedHelper:
streamer,
normalization_data,
PlayableContentFeeder.PlayableContentFeeder.Metrics(
file.file_id, preload, -1 if preload else audio_key_time
),
file.file_id, preload, -1 if preload else audio_key_time),
)
@staticmethod
def load_episode_external(
session: Session, episode: Metadata.Episode, halt_listener: HaltListener
session: Session, episode: Metadata.Episode,
halt_listener: HaltListener
) -> PlayableContentFeeder.PlayableContentFeeder.LoadedStream:
resp = session.client().head(episode.external_url)
@ -62,18 +63,17 @@ class CdnFeedHelper:
CdnFeedHelper._LOGGER.warning("Couldn't resolve redirect!")
url = resp.url
CdnFeedHelper._LOGGER.debug(
"Fetched external url for {}: {}".format(
Utils.Utils.bytes_to_hex(episode.gid), url
)
)
CdnFeedHelper._LOGGER.debug("Fetched external url for {}: {}".format(
Utils.Utils.bytes_to_hex(episode.gid), url))
streamer = session.cdn().stream_external_episode(episode, url, halt_listener)
streamer = session.cdn().stream_external_episode(
episode, url, halt_listener)
return PlayableContentFeeder.PlayableContentFeeder.LoadedStream(
episode,
streamer,
None,
PlayableContentFeeder.PlayableContentFeeder.Metrics(None, False, -1),
PlayableContentFeeder.PlayableContentFeeder.Metrics(
None, False, -1),
)
@staticmethod
@ -102,6 +102,5 @@ class CdnFeedHelper:
streamer,
normalization_data,
PlayableContentFeeder.PlayableContentFeeder.Metrics(
file.file_id, False, audio_key_time
),
file.file_id, False, audio_key_time),
)

View File

@ -37,9 +37,9 @@ class CdnManager:
def get_head(self, file_id: bytes):
resp = self._session.client().get(
self._session.get_user_attribute(
"head-files-url", "https://heads-fa.spotify.com/head/{file_id}"
).replace("{file_id}", Utils.bytes_to_hex(file_id))
)
"head-files-url",
"https://heads-fa.spotify.com/head/{file_id}").replace(
"{file_id}", Utils.bytes_to_hex(file_id)))
if resp.status_code != 200:
raise IOError("{}".format(resp.status_code))
@ -50,9 +50,9 @@ class CdnManager:
return body
def stream_external_episode(
self, episode: Metadata.Episode, external_url: str, halt_listener: HaltListener
):
def stream_external_episode(self, episode: Metadata.Episode,
external_url: str,
halt_listener: HaltListener):
return CdnManager.Streamer(
self._session,
StreamId(episode),
@ -84,8 +84,7 @@ class CdnManager:
resp = self._session.api().send(
"GET",
"/storage-resolve/files/audio/interactive/{}".format(
Utils.bytes_to_hex(file_id)
),
Utils.bytes_to_hex(file_id)),
None,
None,
)
@ -101,13 +100,11 @@ class CdnManager:
proto.ParseFromString(body)
if proto.result == StorageResolve.StorageResolveResponse.Result.CDN:
url = random.choice(proto.cdnurl)
self._LOGGER.debug(
"Fetched CDN url for {}: {}".format(Utils.bytes_to_hex(file_id), url)
)
self._LOGGER.debug("Fetched CDN url for {}: {}".format(
Utils.bytes_to_hex(file_id), url))
return url
raise CdnManager.CdnException(
"Could not retrieve CDN url! result: {}".format(proto.result)
)
"Could not retrieve CDN url! result: {}".format(proto.result))
class CdnException(Exception):
pass
@ -161,14 +158,13 @@ class CdnManager:
continue
if s[0][:i] == "exp":
expire_at = int(s[0][i + 1 :])
expire_at = int(s[0][i + 1:])
break
if expire_at is None:
self._expiration = -1
self._cdnManager._LOGGER.warning(
"Invalid __token__ in CDN url: {}".format(url)
)
"Invalid __token__ in CDN url: {}".format(url))
return
self._expiration = expire_at * 1000
@ -178,10 +174,8 @@ class CdnManager:
except ValueError:
self._expiration = -1
self._cdnManager._LOGGER.warning(
"Couldn't extract expiration, invalid parameter in CDN url: ".format(
url
)
)
"Couldn't extract expiration, invalid parameter in CDN url: "
.format(url))
return
self._expiration = int(token_url.query[:i]) * 1000
@ -190,8 +184,8 @@ class CdnManager:
self._expiration = -1
class Streamer(
GeneralAudioStream.GeneralAudioStream,
GeneralWritableStream.GeneralWritableStream,
GeneralAudioStream.GeneralAudioStream,
GeneralWritableStream.GeneralWritableStream,
):
_session: Session = None
_streamId: StreamId = None
@ -224,38 +218,39 @@ class CdnManager:
self._cdnUrl = cdn_url
self._haltListener = halt_listener
resp = self.request(range_start=0, range_end=ChannelManager.CHUNK_SIZE - 1)
resp = self.request(range_start=0,
range_end=ChannelManager.CHUNK_SIZE - 1)
content_range = resp._headers.get("Content-Range")
if content_range is None:
raise IOError("Missing Content-Range header!")
split = Utils.split(content_range, "/")
self._size = int(split[1])
self._chunks = int(math.ceil(self._size / ChannelManager.CHUNK_SIZE))
self._chunks = int(
math.ceil(self._size / ChannelManager.CHUNK_SIZE))
first_chunk = resp._buffer
self._available = [False for _ in range(self._chunks)]
self._requested = [False for _ in range(self._chunks)]
self._buffer = [bytearray() for _ in range(self._chunks)]
self._internalStream = CdnManager.Streamer.InternalStream(self, False)
self._internalStream = CdnManager.Streamer.InternalStream(
self, False)
self._requested[0] = True
self.write_chunk(first_chunk, 0, False)
def write_chunk(self, chunk: bytes, chunk_index: int, cached: bool) -> None:
def write_chunk(self, chunk: bytes, chunk_index: int,
cached: bool) -> None:
if self._internalStream.is_closed():
return
self._session._LOGGER.debug(
"Chunk {}/{} completed, cached: {}, stream: {}".format(
chunk_index + 1, self._chunks, cached, self.describe()
)
)
chunk_index + 1, self._chunks, cached, self.describe()))
self._buffer[chunk_index] = self._audioDecrypt.decrypt_chunk(
chunk_index, chunk
)
chunk_index, chunk)
self._internalStream.notify_chunk_available(chunk_index)
def stream(self) -> AbsChunkedInputStream:
@ -266,7 +261,8 @@ class CdnManager:
def describe(self) -> str:
if self._streamId.is_episode():
return "episode_gid: {}".format(self._streamId.get_episode_gid())
return "episode_gid: {}".format(
self._streamId.get_episode_gid())
return "file_id: {}".format(self._streamId.get_file_id())
def decrypt_time_ms(self) -> int:
@ -276,9 +272,10 @@ class CdnManager:
resp = self.request(index)
self.write_chunk(resp._buffer, index, False)
def request(
self, chunk: int = None, range_start: int = None, range_end: int = None
) -> CdnManager.InternalResponse:
def request(self,
chunk: int = None,
range_start: int = None,
range_end: int = None) -> CdnManager.InternalResponse:
if chunk is None and range_start is None and range_end is None:
raise TypeError()
@ -288,7 +285,9 @@ class CdnManager:
resp = self._session.client().get(
self._cdnUrl._url,
headers={"Range": "bytes={}-{}".format(range_start, range_end)},
headers={
"Range": "bytes={}-{}".format(range_start, range_end)
},
)
if resp.status_code != 206:
@ -324,21 +323,16 @@ class CdnManager:
def request_chunk_from_stream(self, index: int) -> None:
self.streamer._executorService.submit(
lambda: self.streamer.request_chunk(index)
)
lambda: self.streamer.request_chunk(index))
def stream_read_halted(self, chunk: int, _time: int) -> None:
if self.streamer._haltListener is not None:
self.streamer._executorService.submit(
lambda: self.streamer._haltListener.stream_read_halted(
chunk, _time
)
)
chunk, _time))
def stream_read_resumed(self, chunk: int, _time: int) -> None:
if self.streamer._haltListener is not None:
self.streamer._executorService.submit(
lambda: self.streamer._haltListener.stream_read_resumed(
chunk, _time
)
)
lambda: self.streamer._haltListener.
stream_read_resumed(chunk, _time))

View File

@ -13,35 +13,28 @@ class AudioQuality(enum.Enum):
@staticmethod
def get_quality(audio_format: AudioFile.Format) -> AudioQuality:
if (
audio_format == AudioFile.MP3_96
or audio_format == AudioFile.OGG_VORBIS_96
or audio_format == AudioFile.AAC_24_NORM
):
if (audio_format == AudioFile.MP3_96
or audio_format == AudioFile.OGG_VORBIS_96
or audio_format == AudioFile.AAC_24_NORM):
return AudioQuality.NORMAL
if (
audio_format == AudioFile.MP3_160
or audio_format == AudioFile.MP3_160_ENC
or audio_format == AudioFile.OGG_VORBIS_160
or audio_format == AudioFile.AAC_24
):
if (audio_format == AudioFile.MP3_160
or audio_format == AudioFile.MP3_160_ENC
or audio_format == AudioFile.OGG_VORBIS_160
or audio_format == AudioFile.AAC_24):
return AudioQuality.HIGH
if (
audio_format == AudioFile.MP3_320
or audio_format == AudioFile.MP3_256
or audio_format == AudioFile.OGG_VORBIS_320
or audio_format == AudioFile.AAC_48
):
if (audio_format == AudioFile.MP3_320
or audio_format == AudioFile.MP3_256
or audio_format == AudioFile.OGG_VORBIS_320
or audio_format == AudioFile.AAC_48):
return AudioQuality.VERY_HIGH
raise RuntimeError("Unknown format: {}".format(format))
def get_matches(self, files: typing.List[AudioFile]) -> typing.List[AudioFile]:
def get_matches(self,
files: typing.List[AudioFile]) -> typing.List[AudioFile]:
file_list = []
for file in files:
if (
hasattr(file, "format")
and AudioQuality.get_quality(file.format) == self
):
if (hasattr(file, "format")
and AudioQuality.get_quality(file.format) == self):
file_list.append(file)
return file_list

View File

@ -8,26 +8,24 @@ from librespot.audio.storage import ChannelManager
class AesAudioDecrypt(AudioDecrypt):
audio_aes_iv = bytes(
[
0x72,
0xE0,
0x67,
0xFB,
0xDD,
0xCB,
0xCF,
0x77,
0xEB,
0xE8,
0xBC,
0x64,
0x3F,
0x63,
0x0D,
0x93,
]
)
audio_aes_iv = bytes([
0x72,
0xE0,
0x67,
0xFB,
0xDD,
0xCB,
0xCF,
0x77,
0xEB,
0xE8,
0xBC,
0x64,
0x3F,
0x63,
0x0D,
0x93,
])
iv_int = int.from_bytes(audio_aes_iv, "big")
iv_diff = 0x100
cipher = None
@ -50,14 +48,12 @@ class AesAudioDecrypt(AudioDecrypt):
)
count = min(4096, len(buffer) - i)
decrypted_buffer = cipher.decrypt(buffer[i : i + count])
decrypted_buffer = cipher.decrypt(buffer[i:i + count])
new_buffer += decrypted_buffer
if count != len(decrypted_buffer):
raise RuntimeError(
"Couldn't process all data, actual: {}, expected: {}".format(
len(decrypted_buffer), count
)
)
"Couldn't process all data, actual: {}, expected: {}".
format(len(decrypted_buffer), count))
iv += self.iv_diff
@ -67,8 +63,5 @@ class AesAudioDecrypt(AudioDecrypt):
return new_buffer
def decrypt_time_ms(self):
return (
0
if self.decrypt_count == 0
else int((self.decrypt_total_time / self.decrypt_count) / 1000000)
)
return (0 if self.decrypt_count == 0 else int(
(self.decrypt_total_time / self.decrypt_count) / 1000000))

View File

@ -7,5 +7,6 @@ if typing.TYPE_CHECKING:
class AudioQualityPicker:
def get_file(self, files: typing.List[Metadata.AudioFile]) -> Metadata.AudioFile:
def get_file(self,
files: typing.List[Metadata.AudioFile]) -> Metadata.AudioFile:
pass

View File

@ -24,8 +24,7 @@ class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
_seqHolder: int = 0
_seqHolderLock: threading.Condition = threading.Condition()
_executorService: concurrent.futures.ThreadPoolExecutor = (
concurrent.futures.ThreadPoolExecutor()
)
concurrent.futures.ThreadPoolExecutor())
_session: Session = None
def __init__(self, session: Session):
@ -58,9 +57,7 @@ class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
if channel is None:
self._LOGGER.warning(
"Couldn't find channel, id: {}, received: {}".format(
chunk_id, len(packet.payload)
)
)
chunk_id, len(packet.payload)))
return
channel._add_to_queue(payload)
@ -70,18 +67,14 @@ class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
if channel is None:
self._LOGGER.warning(
"Dropping channel error, id: {}, code: {}".format(
chunk_id, payload.read_short()
)
)
chunk_id, payload.read_short()))
return
channel.stream_error(payload.read_short())
else:
self._LOGGER.warning(
"Couldn't handle packet, cmd: {}, payload: {}".format(
packet.cmd, Utils.Utils.bytes_to_hex(packet.payload)
)
)
packet.cmd, Utils.Utils.bytes_to_hex(packet.payload)))
def close(self) -> None:
self._executorService.shutdown()
@ -95,9 +88,8 @@ class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
_buffer: BytesOutputStream = BytesOutputStream()
_header: bool = True
def __init__(
self, channel_manager: ChannelManager, file: AudioFile, chunk_index: int
):
def __init__(self, channel_manager: ChannelManager, file: AudioFile,
chunk_index: int):
self._channelManager = channel_manager
self._file = file
self._chunkIndex = chunk_index
@ -106,18 +98,17 @@ class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
self._channelManager._seqHolder += 1
self._channelManager._executorService.submit(
lambda: ChannelManager.Channel.Handler(self)
)
lambda: ChannelManager.Channel.Handler(self))
def _handle(self, payload: BytesInputStream) -> bool:
if len(payload.buffer) == 0:
if not self._header:
self._file.write_chunk(
bytearray(payload.buffer), self._chunkIndex, False
)
self._file.write_chunk(bytearray(payload.buffer),
self._chunkIndex, False)
return True
self._channelManager._LOGGER.debug("Received empty chunk, skipping.")
self._channelManager._LOGGER.debug(
"Received empty chunk, skipping.")
return False
if self._header:
@ -128,9 +119,8 @@ class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
break
header_id = payload.read_byte()
header_data = payload.read(length - 1)
self._file.write_header(
int.from_bytes(header_id, "big"), bytearray(header_data), False
)
self._file.write_header(int.from_bytes(header_id, "big"),
bytearray(header_data), False)
self._header = False
else:
self._buffer.write(payload.read(len(payload.buffer)))
@ -151,12 +141,11 @@ class ChannelManager(Closeable, PacketsReceiver.PacketsReceiver):
def run(self) -> None:
self._channel._channelManager._LOGGER.debug(
"ChannelManager.Handler is starting"
)
"ChannelManager.Handler is starting")
with self._channel._q.all_tasks_done:
self._channel._channelManager._channels.pop(self._channel.chunkId)
self._channel._channelManager._channels.pop(
self._channel.chunkId)
self._channel._channelManager._LOGGER.debug(
"ChannelManager.Handler is shutting down"
)
"ChannelManager.Handler is shutting down")

View File

@ -8,7 +8,8 @@ class ApResolver:
@staticmethod
def request(service_type: str):
response = requests.get("{}?type={}".format(ApResolver.base_url, service_type))
response = requests.get("{}?type={}".format(ApResolver.base_url,
service_type))
return response.json()
@staticmethod

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,7 @@ class TokenProvider:
self._session = session
def find_token_with_all_scopes(
self, scopes: typing.List[str]
) -> TokenProvider.StoredToken:
self, scopes: typing.List[str]) -> TokenProvider.StoredToken:
for token in self._tokens:
if token.has_scopes(scopes):
return token
@ -40,20 +39,16 @@ class TokenProvider:
return token
self._LOGGER.debug(
"Token expired or not suitable, requesting again. scopes: {}, old_token: {}".format(
scopes, token
)
)
"Token expired or not suitable, requesting again. scopes: {}, old_token: {}"
.format(scopes, token))
resp = self._session.mercury().send_sync_json(
MercuryRequests.request_token(self._session.device_id(), ",".join(scopes))
)
MercuryRequests.request_token(self._session.device_id(),
",".join(scopes)))
token = TokenProvider.StoredToken(resp)
self._LOGGER.debug(
"Updated token successfully! scopes: {}, new_token: {}".format(
scopes, token
)
)
scopes, token))
self._tokens.append(token)
return token
@ -74,11 +69,9 @@ class TokenProvider:
self.scopes = obj["scope"]
def expired(self) -> bool:
return (
self.timestamp
+ (self.expires_in - TokenProvider._TOKEN_EXPIRE_THRESHOLD) * 1000
< TimeProvider.TimeProvider().current_time_millis()
)
return (self.timestamp +
(self.expires_in - TokenProvider._TOKEN_EXPIRE_THRESHOLD) *
1000 < TimeProvider.TimeProvider().current_time_millis())
def has_scope(self, scope: str) -> bool:
for s in self.scopes:

View File

@ -4,106 +4,104 @@ from librespot.common.Utils import Utils
class DiffieHellman:
prime_bytes: bytearray = bytes(
[
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xC9,
0x0F,
0xDA,
0xA2,
0x21,
0x68,
0xC2,
0x34,
0xC4,
0xC6,
0x62,
0x8B,
0x80,
0xDC,
0x1C,
0xD1,
0x29,
0x02,
0x4E,
0x08,
0x8A,
0x67,
0xCC,
0x74,
0x02,
0x0B,
0xBE,
0xA6,
0x3B,
0x13,
0x9B,
0x22,
0x51,
0x4A,
0x08,
0x79,
0x8E,
0x34,
0x04,
0xDD,
0xEF,
0x95,
0x19,
0xB3,
0xCD,
0x3A,
0x43,
0x1B,
0x30,
0x2B,
0x0A,
0x6D,
0xF2,
0x5F,
0x14,
0x37,
0x4F,
0xE1,
0x35,
0x6D,
0x6D,
0x51,
0xC2,
0x45,
0xE4,
0x85,
0xB5,
0x76,
0x62,
0x5E,
0x7E,
0xC6,
0xF4,
0x4C,
0x42,
0xE9,
0xA6,
0x3A,
0x36,
0x20,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
]
)
prime_bytes: bytearray = bytes([
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xC9,
0x0F,
0xDA,
0xA2,
0x21,
0x68,
0xC2,
0x34,
0xC4,
0xC6,
0x62,
0x8B,
0x80,
0xDC,
0x1C,
0xD1,
0x29,
0x02,
0x4E,
0x08,
0x8A,
0x67,
0xCC,
0x74,
0x02,
0x0B,
0xBE,
0xA6,
0x3B,
0x13,
0x9B,
0x22,
0x51,
0x4A,
0x08,
0x79,
0x8E,
0x34,
0x04,
0xDD,
0xEF,
0x95,
0x19,
0xB3,
0xCD,
0x3A,
0x43,
0x1B,
0x30,
0x2B,
0x0A,
0x6D,
0xF2,
0x5F,
0x14,
0x37,
0x4F,
0xE1,
0x35,
0x6D,
0x6D,
0x51,
0xC2,
0x45,
0xE4,
0x85,
0xB5,
0x76,
0x62,
0x5E,
0x7E,
0xC6,
0xF4,
0x4C,
0x42,
0xE9,
0xA6,
0x3A,
0x36,
0x20,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
])
prime: int = int.from_bytes(prime_bytes, "big")
private_key: int
public_key: int

View File

@ -37,8 +37,7 @@ class ApiClient(Closeable):
if headers is not None:
request.headers = headers
request.headers["Authorization"] = "Bearer {}".format(
self._session.tokens().get("playlist-read")
)
self._session.tokens().get("playlist-read"))
request.url = self._baseUrl + suffix
return request
@ -50,13 +49,11 @@ class ApiClient(Closeable):
body: typing.Union[None, bytes],
) -> requests.Response:
resp = self._session.client().send(
self.build_request(method, suffix, headers, body)
)
self.build_request(method, suffix, headers, body))
return resp
def put_connect_state(
self, connection_id: str, proto: Connect.PutStateRequest
) -> None:
def put_connect_state(self, connection_id: str,
proto: Connect.PutStateRequest) -> None:
resp = self.send(
"PUT",
"/connect-state/v1/devices/{}".format(self._session.device_id()),
@ -69,21 +66,15 @@ class ApiClient(Closeable):
if resp.status_code == 413:
self._LOGGER.warning(
"PUT state payload is too large: {} bytes uncompressed.".format(
len(proto.SerializeToString())
)
)
"PUT state payload is too large: {} bytes uncompressed.".
format(len(proto.SerializeToString())))
elif resp.status_code != 200:
self._LOGGER.warning(
"PUT state returned {}. headers: {}".format(
resp.status_code, resp.headers
)
)
self._LOGGER.warning("PUT state returned {}. headers: {}".format(
resp.status_code, resp.headers))
def get_metadata_4_track(self, track: TrackId) -> Metadata.Track:
resp = self.send(
"GET", "/metadata/4/track/{}".format(track.hex_id()), None, None
)
resp = self.send("GET", "/metadata/4/track/{}".format(track.hex_id()),
None, None)
ApiClient.StatusCodeException.check_status(resp)
body = resp.content
@ -94,9 +85,9 @@ class ApiClient(Closeable):
return proto
def get_metadata_4_episode(self, episode: EpisodeId) -> Metadata.Episode:
resp = self.send(
"GET", "/metadata/4/episode/{}".format(episode.hex_id()), None, None
)
resp = self.send("GET",
"/metadata/4/episode/{}".format(episode.hex_id()),
None, None)
ApiClient.StatusCodeException.check_status(resp)
body = resp.content
@ -107,9 +98,8 @@ class ApiClient(Closeable):
return proto
def get_metadata_4_album(self, album: AlbumId) -> Metadata.Album:
resp = self.send(
"GET", "/metadata/4/album/{}".format(album.hex_id()), None, None
)
resp = self.send("GET", "/metadata/4/album/{}".format(album.hex_id()),
None, None)
ApiClient.StatusCodeException.check_status(resp)
body = resp.content
@ -120,9 +110,9 @@ class ApiClient(Closeable):
return proto
def get_metadata_4_artist(self, artist: ArtistId) -> Metadata.Artist:
resp = self.send(
"GET", "/metadata/4/artist/{}".format(artist.hex_id()), None, None
)
resp = self.send("GET",
"/metadata/4/artist/{}".format(artist.hex_id()), None,
None)
ApiClient.StatusCodeException.check_status(resp)
body = resp.content
@ -133,7 +123,8 @@ class ApiClient(Closeable):
return proto
def get_metadata_4_show(self, show: ShowId) -> Metadata.Show:
resp = self.send("GET", "/metadata/4/show/{}".format(show.hex_id()), None, None)
resp = self.send("GET", "/metadata/4/show/{}".format(show.hex_id()),
None, None)
ApiClient.StatusCodeException.check_status(resp)
body = resp.content

View File

@ -12,9 +12,11 @@ class DealerClient(Closeable):
def connect(self):
pass
def add_message_listener(self, listener: DealerClient.MessageListener, *uris: str):
def add_message_listener(self, listener: DealerClient.MessageListener,
*uris: str):
pass
class MessageListener:
def on_message(self, uri: str, headers: typing.Dict[str, str], payload: bytes):
def on_message(self, uri: str, headers: typing.Dict[str, str],
payload: bytes):
pass

View File

@ -45,12 +45,10 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
sub = Pubsub.Subscription()
sub.ParseFromString(payload)
self._subscriptions.append(
MercuryClient.InternalSubListener(sub.uri, listener, True)
)
MercuryClient.InternalSubListener(sub.uri, listener, True))
else:
self._subscriptions.append(
MercuryClient.InternalSubListener(uri, listener, True)
)
MercuryClient.InternalSubListener(uri, listener, True))
self._LOGGER.debug("Subscribed successfully to {}!".format(uri))
@ -73,10 +71,8 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
resp = callback.wait_response()
if resp is None:
raise IOError(
"Request timeout out, {} passed, yet no response. seq: {}".format(
self._MERCURY_REQUEST_TIMEOUT, seq
)
)
"Request timeout out, {} passed, yet no response. seq: {}".
format(self._MERCURY_REQUEST_TIMEOUT, seq))
return resp
except queue.Empty as e:
raise IOError(e)
@ -97,9 +93,7 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
self._LOGGER.debug(
"Send Mercury request, seq: {}, uri: {}, method: {}".format(
seq, request.header.uri, request.header.method
)
)
seq, request.header.uri, request.header.method))
buffer.write_short(4)
buffer.write_int(seq)
@ -143,9 +137,7 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
self._LOGGER.debug(
"Handling packet, cmd: 0x{}, seq: {}, flags: {}, parts: {}".format(
Utils.bytes_to_hex(packet.cmd), seq, flags, parts
)
)
Utils.bytes_to_hex(packet.cmd), seq, flags, parts))
for i in range(parts):
size = payload.read_short()
@ -173,39 +165,30 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
if not dispatched:
self._LOGGER.debug(
"Couldn't dispatch Mercury event seq: {}, uri: {}, code: {}, payload: {}".format(
seq, header.uri, header.status_code, resp.payload
)
)
elif (
packet.is_cmd(Packet.Type.mercury_req)
or packet.is_cmd(Packet.Type.mercury_sub)
or packet.is_cmd(Packet.Type.mercury_sub)
):
"Couldn't dispatch Mercury event seq: {}, uri: {}, code: {}, payload: {}"
.format(seq, header.uri, header.status_code, resp.payload))
elif (packet.is_cmd(Packet.Type.mercury_req)
or packet.is_cmd(Packet.Type.mercury_sub)
or packet.is_cmd(Packet.Type.mercury_sub)):
callback = self._callbacks.get(seq)
self._callbacks.pop(seq)
if callback is not None:
callback.response(resp)
else:
self._LOGGER.warning(
"Skipped Mercury response, seq: {}, uri: {}, code: {}".format(
seq, resp.uri, resp.status_code
)
)
"Skipped Mercury response, seq: {}, uri: {}, code: {}".
format(seq, resp.uri, resp.status_code))
with self._removeCallbackLock:
self._removeCallbackLock.notify_all()
else:
self._LOGGER.warning(
"Couldn't handle packet, seq: {}, uri: {}, code: {}".format(
seq, header.uri, header.status_code
)
)
seq, header.uri, header.status_code))
def interested_in(self, uri: str, listener: SubListener) -> None:
self._subscriptions.append(
MercuryClient.InternalSubListener(uri, listener, False)
)
MercuryClient.InternalSubListener(uri, listener, False))
def not_interested_in(self, listener: SubListener) -> None:
try:
@ -240,7 +223,8 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
self._reference.task_done()
def wait_response(self) -> typing.Any:
return self._reference.get(timeout=MercuryClient._MERCURY_REQUEST_TIMEOUT)
return self._reference.get(
timeout=MercuryClient._MERCURY_REQUEST_TIMEOUT)
# class PubSubException(MercuryClient.MercuryException):
# pass
@ -273,7 +257,8 @@ class MercuryClient(PacketsReceiver.PacketsReceiver, Closeable):
payload: typing.List[bytes]
status_code: int
def __init__(self, header: Mercury.Header, payload: typing.List[bytes]):
def __init__(self, header: Mercury.Header,
payload: typing.List[bytes]):
self.uri = header.uri
self.status_code = header.status_code
self.payload = payload[1:]

View File

@ -13,35 +13,28 @@ class RawMercuryRequest:
@staticmethod
def sub(uri: str):
return RawMercuryRequest.new_builder().set_uri(uri).set_method("SUB").build()
return RawMercuryRequest.new_builder().set_uri(uri).set_method(
"SUB").build()
@staticmethod
def unsub(uri: str):
return RawMercuryRequest.new_builder().set_uri(uri).set_method("UNSUB").build()
return RawMercuryRequest.new_builder().set_uri(uri).set_method(
"UNSUB").build()
@staticmethod
def get(uri: str):
return RawMercuryRequest.new_builder().set_uri(uri).set_method("GET").build()
return RawMercuryRequest.new_builder().set_uri(uri).set_method(
"GET").build()
@staticmethod
def send(uri: str, part: bytes):
return (
RawMercuryRequest.new_builder()
.set_uri(uri)
.add_payload_part(part)
.set_method("SEND")
.build()
)
return (RawMercuryRequest.new_builder().set_uri(uri).add_payload_part(
part).set_method("SEND").build())
@staticmethod
def post(uri: str, part: bytes):
return (
RawMercuryRequest.new_builder()
.set_uri(uri)
.set_method("POST")
.add_payload_part(part)
.build()
)
return (RawMercuryRequest.new_builder().set_uri(uri).set_method(
"POST").add_payload_part(part).build())
@staticmethod
def new_builder():
@ -67,9 +60,10 @@ class RawMercuryRequest:
self.header_dict["method"] = method
return self
def add_user_field(
self, field: Mercury.UserField = None, key: str = None, value: str = None
):
def add_user_field(self,
field: Mercury.UserField = None,
key: str = None,
value: str = None):
if field is None and (key is None or value is None):
return self
try:
@ -80,8 +74,7 @@ class RawMercuryRequest:
self.header_dict["user_fields"].append(field)
if key is not None and value is not None:
self.header_dict["user_fields"].append(
Mercury.UserField(key=key, value=value.encode())
)
Mercury.UserField(key=key, value=value.encode()))
return self
def add_payload_part(self, part: bytes):
@ -92,4 +85,5 @@ class RawMercuryRequest:
return self.add_payload_part(msg)
def build(self):
return RawMercuryRequest(Mercury.Header(**self.header_dict), self.payload)
return RawMercuryRequest(Mercury.Header(**self.header_dict),
self.payload)

View File

@ -49,11 +49,9 @@ class PlayableId:
@staticmethod
def is_supported(uri: str):
return (
not uri.startswith("spotify:local:")
and not uri == "spotify:delimiter"
and not uri == "spotify:meta:delimiter"
)
return (not uri.startswith("spotify:local:")
and not uri == "spotify:delimiter"
and not uri == "spotify:meta:delimiter")
@staticmethod
def should_play(track: ContextTrack):
@ -98,7 +96,8 @@ class AlbumId(SpotifyId):
matcher = AlbumId._PATTERN.search(uri)
if matcher is not None:
album_id = matcher.group(1)
return AlbumId(Utils.bytes_to_hex(AlbumId._BASE62.decode(album_id, 16)))
return AlbumId(
Utils.bytes_to_hex(AlbumId._BASE62.decode(album_id, 16)))
raise TypeError("Not a Spotify album ID: {}.f".format(uri))
@staticmethod
@ -111,8 +110,7 @@ class AlbumId(SpotifyId):
def to_mercury_uri(self) -> str:
return "spotify:album:{}".format(
AlbumId._BASE62.encode(Utils.hex_to_bytes(self._hexId))
)
AlbumId._BASE62.encode(Utils.hex_to_bytes(self._hexId)))
def hex_id(self) -> str:
return self._hexId
@ -131,12 +129,14 @@ class ArtistId(SpotifyId):
matcher = ArtistId._PATTERN.search(uri)
if matcher is not None:
artist_id = matcher.group(1)
return ArtistId(Utils.bytes_to_hex(ArtistId._BASE62.decode(artist_id, 16)))
return ArtistId(
Utils.bytes_to_hex(ArtistId._BASE62.decode(artist_id, 16)))
raise TypeError("Not a Spotify artist ID: {}".format(uri))
@staticmethod
def from_base62(base62: str) -> ArtistId:
return ArtistId(Utils.bytes_to_hex(ArtistId._BASE62.decode(base62, 16)))
return ArtistId(Utils.bytes_to_hex(ArtistId._BASE62.decode(base62,
16)))
@staticmethod
def from_hex(hex_str: str) -> ArtistId:
@ -147,8 +147,7 @@ class ArtistId(SpotifyId):
def to_spotify_uri(self) -> str:
return "spotify:artist:{}".format(
ArtistId._BASE62.encode(Utils.hex_to_bytes(self._hexId))
)
ArtistId._BASE62.encode(Utils.hex_to_bytes(self._hexId)))
def hex_id(self) -> str:
return self._hexId
@ -167,13 +166,14 @@ class EpisodeId(SpotifyId, PlayableId):
if matcher is not None:
episode_id = matcher.group(1)
return EpisodeId(
Utils.Utils.bytes_to_hex(PlayableId.BASE62.decode(episode_id, 16))
)
Utils.Utils.bytes_to_hex(
PlayableId.BASE62.decode(episode_id, 16)))
TypeError("Not a Spotify episode ID: {}".format(uri))
@staticmethod
def from_base62(base62: str) -> EpisodeId:
return EpisodeId(Utils.Utils.bytes_to_hex(PlayableId.BASE62.decode(base62, 16)))
return EpisodeId(
Utils.Utils.bytes_to_hex(PlayableId.BASE62.decode(base62, 16)))
@staticmethod
def from_hex(hex_str: str) -> EpisodeId:
@ -184,8 +184,7 @@ class EpisodeId(SpotifyId, PlayableId):
def to_spotify_uri(self) -> str:
return "Spotify:episode:{}".format(
PlayableId.BASE62.encode(Utils.Utils.hex_to_bytes(self._hexId))
)
PlayableId.BASE62.encode(Utils.Utils.hex_to_bytes(self._hexId)))
def hex_id(self) -> str:
return self._hexId
@ -207,7 +206,8 @@ class ShowId(SpotifyId):
matcher = ShowId._PATTERN.search(uri)
if matcher is not None:
show_id = matcher.group(1)
return ShowId(Utils.bytes_to_hex(ShowId._BASE62.decode(show_id, 16)))
return ShowId(
Utils.bytes_to_hex(ShowId._BASE62.decode(show_id, 16)))
raise TypeError("Not a Spotify show ID: {}".format(uri))
@staticmethod
@ -223,8 +223,7 @@ class ShowId(SpotifyId):
def to_spotify_uri(self) -> str:
return "spotify:show:{}".format(
ShowId._BASE62.encode(Utils.hex_to_bytes(self._hexId))
)
ShowId._BASE62.encode(Utils.hex_to_bytes(self._hexId)))
def hex_id(self) -> str:
return self._hexId
@ -242,12 +241,14 @@ class TrackId(PlayableId, SpotifyId):
search = TrackId.PATTERN.search(uri)
if search is not None:
track_id = search.group(1)
return TrackId(Utils.bytes_to_hex(PlayableId.BASE62.decode(track_id, 16)))
return TrackId(
Utils.bytes_to_hex(PlayableId.BASE62.decode(track_id, 16)))
raise RuntimeError("Not a Spotify track ID: {}".format(uri))
@staticmethod
def from_base62(base62: str) -> TrackId:
return TrackId(Utils.bytes_to_hex(PlayableId.BASE62.decode(base62, 16)))
return TrackId(Utils.bytes_to_hex(PlayableId.BASE62.decode(base62,
16)))
@staticmethod
def from_hex(hex_str: str) -> TrackId:

View File

@ -38,7 +38,8 @@ class Player(Closeable, PlayerSession.Listener, AudioSink.Listener):
self.__init_state()
def __init_state(self):
self._state = StateWrapper.StateWrapper(self._session, self, self._conf)
self._state = StateWrapper.StateWrapper(self._session, self,
self._conf)
class Anonymous(DeviceStateHandler.Listener):
_player: Player = None
@ -54,7 +55,8 @@ class Player(Closeable, PlayerSession.Listener, AudioSink.Listener):
endpoint: DeviceStateHandler.Endpoint,
data: DeviceStateHandler.CommandBody,
) -> None:
self._player._LOGGER.debug("Received command: {}".format(endpoint))
self._player._LOGGER.debug(
"Received command: {}".format(endpoint))
self._deviceStateListener = Anonymous(self)
self._state.add_listener(self._deviceStateListener)

View File

@ -51,15 +51,18 @@ class PlayerConfiguration:
def __init__(self):
pass
def set_preferred_quality(self, preferred_quality: AudioQuality) -> __class__:
def set_preferred_quality(
self, preferred_quality: AudioQuality) -> __class__:
self.preferred_quality = preferred_quality
return self
def set_enable_normalisation(self, enable_normalisation: bool) -> __class__:
def set_enable_normalisation(self,
enable_normalisation: bool) -> __class__:
self.enable_normalisation = enable_normalisation
return self
def set_normalisation_pregain(self, normalisation_pregain: float) -> __class__:
def set_normalisation_pregain(
self, normalisation_pregain: float) -> __class__:
self.normalisation_pregain = normalisation_pregain
return self

View File

@ -20,7 +20,8 @@ class StateWrapper(DeviceStateHandler.Listener, DealerClient.MessageListener):
_player: Player = None
_device: DeviceStateHandler = None
def __init__(self, session: Session, player: Player, conf: PlayerConfiguration):
def __init__(self, session: Session, player: Player,
conf: PlayerConfiguration):
self._session = session
self._player = player
self._device = DeviceStateHandler(session, self, conf)
@ -39,9 +40,9 @@ class StateWrapper(DeviceStateHandler.Listener, DealerClient.MessageListener):
playback_speed=1.0,
suppressions=Suppressions(),
context_restrictions=Restrictions(),
options=ContextPlayerOptions(
repeating_context=False, shuffling_context=False, repeating_track=False
),
options=ContextPlayerOptions(repeating_context=False,
shuffling_context=False,
repeating_track=False),
position_as_of_timestamp=0,
position=0,
is_playing=False,
@ -51,7 +52,9 @@ class StateWrapper(DeviceStateHandler.Listener, DealerClient.MessageListener):
self._device.add_listener(listener)
def ready(self) -> None:
self._device.update_state(Connect.PutStateReason.NEW_DEVICE, 0, self._state)
self._device.update_state(Connect.PutStateReason.NEW_DEVICE, 0,
self._state)
def on_message(self, uri: str, headers: typing.Dict[str, str], payload: bytes):
def on_message(self, uri: str, headers: typing.Dict[str, str],
payload: bytes):
pass

View File

@ -19,26 +19,26 @@ class VorbisOnlyAudioQuality(AudioQualityPicker):
@staticmethod
def get_vorbis_file(files: typing.List[Metadata.AudioFile]):
for file in files:
if (
hasattr(file, "format")
and SuperAudioFormat.get(file.format) == SuperAudioFormat.VORBIS
):
if (hasattr(file, "format") and SuperAudioFormat.get(file.format)
== SuperAudioFormat.VORBIS):
return file
return None
def get_file(self, files: typing.List[Metadata.AudioFile]):
matches: typing.List[Metadata.AudioFile] = self.preferred.get_matches(files)
vorbis: Metadata.AudioFile = VorbisOnlyAudioQuality.get_vorbis_file(matches)
matches: typing.List[Metadata.AudioFile] = self.preferred.get_matches(
files)
vorbis: Metadata.AudioFile = VorbisOnlyAudioQuality.get_vorbis_file(
matches)
if vorbis is None:
vorbis: Metadata.AudioFile = VorbisOnlyAudioQuality.get_vorbis_file(files)
vorbis: Metadata.AudioFile = VorbisOnlyAudioQuality.get_vorbis_file(
files)
if vorbis is not None:
self._LOGGER.warning(
"Using {} because preferred {} couldn't be found.".format(
vorbis.format, self.preferred
)
)
vorbis.format, self.preferred))
else:
self._LOGGER.fatal("Couldn't find any Vorbis file, available: {}")
self._LOGGER.fatal(
"Couldn't find any Vorbis file, available: {}")
return vorbis

View File

@ -22,8 +22,7 @@ class DeviceStateHandler:
_listeners: typing.List[DeviceStateHandler.Listener] = []
_putState: Connect.PutStateRequest = None
_putStateWorker: concurrent.futures.ThreadPoolExecutor = (
concurrent.futures.ThreadPoolExecutor()
)
concurrent.futures.ThreadPoolExecutor())
_connectionId: str = None
def __init__(self, session: Session, player, conf: PlayerConfiguration):
@ -36,9 +35,8 @@ class DeviceStateHandler:
if self._connectionId is None or self._connectionId != newer:
self._connectionId = newer
self._LOGGER.debug(
"Updated Spotify-Connection-Id: {}".format(self._connectionId)
)
self._LOGGER.debug("Updated Spotify-Connection-Id: {}".format(
self._connectionId))
self._notify_ready()
def add_listener(self, listener: DeviceStateHandler.Listener):
@ -71,13 +69,11 @@ class DeviceStateHandler:
def _put_connect_state(self, req: Connect.PutStateRequest):
self._session.api().put_connect_state(self._connectionId, req)
self._LOGGER.info(
"Put state. ts: {}, connId: {}, reason: {}".format(
req.client_side_timestamp,
Utils.truncate_middle(self._connectionId, 10),
req.put_state_reason,
)
)
self._LOGGER.info("Put state. ts: {}, connId: {}, reason: {}".format(
req.client_side_timestamp,
Utils.truncate_middle(self._connectionId, 10),
req.put_state_reason,
))
class Endpoint(enum.Enum):
Play: str = "play"

View File

@ -12,14 +12,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="canvaz.proto",
package="com.spotify.canvazcache",
syntax="proto3",
serialized_options=b"\n\022com.spotify.canvazH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0c\x63\x61nvaz.proto\x12\x17\x63om.spotify.canvazcache\x1a\x11\x63\x61nvaz-meta.proto"3\n\x06\x41rtist\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06\x61vatar\x18\x03 \x01(\t"\xe1\x02\n\x14\x45ntityCanvazResponse\x12\x46\n\x08\x63\x61nvases\x18\x01 \x03(\x0b\x32\x34.com.spotify.canvazcache.EntityCanvazResponse.Canvaz\x12\x16\n\x0ettl_in_seconds\x18\x02 \x01(\x03\x1a\xe8\x01\n\x06\x43\x61nvaz\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12\x0f\n\x07\x66ile_id\x18\x03 \x01(\t\x12&\n\x04type\x18\x04 \x01(\x0e\x32\x18.com.spotify.canvaz.Type\x12\x12\n\nentity_uri\x18\x05 \x01(\t\x12/\n\x06\x61rtist\x18\x06 \x01(\x0b\x32\x1f.com.spotify.canvazcache.Artist\x12\x10\n\x08\x65xplicit\x18\x07 \x01(\x08\x12\x13\n\x0buploaded_by\x18\x08 \x01(\t\x12\x0c\n\x04\x65tag\x18\t \x01(\t\x12\x12\n\ncanvas_uri\x18\x0b \x01(\t"\x88\x01\n\x13\x45ntityCanvazRequest\x12\x45\n\x08\x65ntities\x18\x01 \x03(\x0b\x32\x33.com.spotify.canvazcache.EntityCanvazRequest.Entity\x1a*\n\x06\x45ntity\x12\x12\n\nentity_uri\x18\x01 \x01(\t\x12\x0c\n\x04\x65tag\x18\x02 \x01(\tB\x16\n\x12\x63om.spotify.canvazH\x02\x62\x06proto3',
serialized_pb=
b'\n\x0c\x63\x61nvaz.proto\x12\x17\x63om.spotify.canvazcache\x1a\x11\x63\x61nvaz-meta.proto"3\n\x06\x41rtist\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06\x61vatar\x18\x03 \x01(\t"\xe1\x02\n\x14\x45ntityCanvazResponse\x12\x46\n\x08\x63\x61nvases\x18\x01 \x03(\x0b\x32\x34.com.spotify.canvazcache.EntityCanvazResponse.Canvaz\x12\x16\n\x0ettl_in_seconds\x18\x02 \x01(\x03\x1a\xe8\x01\n\x06\x43\x61nvaz\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12\x0f\n\x07\x66ile_id\x18\x03 \x01(\t\x12&\n\x04type\x18\x04 \x01(\x0e\x32\x18.com.spotify.canvaz.Type\x12\x12\n\nentity_uri\x18\x05 \x01(\t\x12/\n\x06\x61rtist\x18\x06 \x01(\x0b\x32\x1f.com.spotify.canvazcache.Artist\x12\x10\n\x08\x65xplicit\x18\x07 \x01(\x08\x12\x13\n\x0buploaded_by\x18\x08 \x01(\t\x12\x0c\n\x04\x65tag\x18\t \x01(\t\x12\x12\n\ncanvas_uri\x18\x0b \x01(\t"\x88\x01\n\x13\x45ntityCanvazRequest\x12\x45\n\x08\x65ntities\x18\x01 \x03(\x0b\x32\x33.com.spotify.canvazcache.EntityCanvazRequest.Entity\x1a*\n\x06\x45ntity\x12\x12\n\nentity_uri\x18\x01 \x01(\t\x12\x0c\n\x04\x65tag\x18\x02 \x01(\tB\x16\n\x12\x63om.spotify.canvazH\x02\x62\x06proto3',
dependencies=[
canvaz__meta__pb2.DESCRIPTOR,
],
@ -151,7 +151,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="file_id",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.file_id",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.file_id",
index=2,
number=3,
type=9,
@ -170,7 +171,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="type",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.type",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.type",
index=3,
number=4,
type=14,
@ -189,7 +191,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="entity_uri",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.entity_uri",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.entity_uri",
index=4,
number=5,
type=9,
@ -208,7 +211,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="artist",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.artist",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.artist",
index=5,
number=6,
type=11,
@ -227,7 +231,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="explicit",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.explicit",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.explicit",
index=6,
number=7,
type=8,
@ -246,7 +251,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="uploaded_by",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.uploaded_by",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.uploaded_by",
index=7,
number=8,
type=9,
@ -265,7 +271,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="etag",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.etag",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.etag",
index=8,
number=9,
type=9,
@ -284,7 +291,8 @@ _ENTITYCANVAZRESPONSE_CANVAZ = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="canvas_uri",
full_name="com.spotify.canvazcache.EntityCanvazResponse.Canvaz.canvas_uri",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.Canvaz.canvas_uri",
index=9,
number=11,
type=9,
@ -343,7 +351,8 @@ _ENTITYCANVAZRESPONSE = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="ttl_in_seconds",
full_name="com.spotify.canvazcache.EntityCanvazResponse.ttl_in_seconds",
full_name=
"com.spotify.canvazcache.EntityCanvazResponse.ttl_in_seconds",
index=1,
number=2,
type=3,
@ -385,7 +394,8 @@ _ENTITYCANVAZREQUEST_ENTITY = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="entity_uri",
full_name="com.spotify.canvazcache.EntityCanvazRequest.Entity.entity_uri",
full_name=
"com.spotify.canvazcache.EntityCanvazRequest.Entity.entity_uri",
index=0,
number=1,
type=9,
@ -476,24 +486,24 @@ _ENTITYCANVAZREQUEST = _descriptor.Descriptor(
serialized_end=606,
)
_ENTITYCANVAZRESPONSE_CANVAZ.fields_by_name["type"].enum_type = canvaz__meta__pb2._TYPE
_ENTITYCANVAZRESPONSE_CANVAZ.fields_by_name[
"type"].enum_type = canvaz__meta__pb2._TYPE
_ENTITYCANVAZRESPONSE_CANVAZ.fields_by_name["artist"].message_type = _ARTIST
_ENTITYCANVAZRESPONSE_CANVAZ.containing_type = _ENTITYCANVAZRESPONSE
_ENTITYCANVAZRESPONSE.fields_by_name[
"canvases"
].message_type = _ENTITYCANVAZRESPONSE_CANVAZ
"canvases"].message_type = _ENTITYCANVAZRESPONSE_CANVAZ
_ENTITYCANVAZREQUEST_ENTITY.containing_type = _ENTITYCANVAZREQUEST
_ENTITYCANVAZREQUEST.fields_by_name[
"entities"
].message_type = _ENTITYCANVAZREQUEST_ENTITY
"entities"].message_type = _ENTITYCANVAZREQUEST_ENTITY
DESCRIPTOR.message_types_by_name["Artist"] = _ARTIST
DESCRIPTOR.message_types_by_name["EntityCanvazResponse"] = _ENTITYCANVAZRESPONSE
DESCRIPTOR.message_types_by_name[
"EntityCanvazResponse"] = _ENTITYCANVAZRESPONSE
DESCRIPTOR.message_types_by_name["EntityCanvazRequest"] = _ENTITYCANVAZREQUEST
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Artist = _reflection.GeneratedProtocolMessageType(
"Artist",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _ARTIST,
"__module__": "canvaz_pb2"
@ -504,19 +514,22 @@ _sym_db.RegisterMessage(Artist)
EntityCanvazResponse = _reflection.GeneratedProtocolMessageType(
"EntityCanvazResponse",
(_message.Message,),
(_message.Message, ),
{
"Canvaz": _reflection.GeneratedProtocolMessageType(
"Canvaz":
_reflection.GeneratedProtocolMessageType(
"Canvaz",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _ENTITYCANVAZRESPONSE_CANVAZ,
"__module__": "canvaz_pb2"
# @@protoc_insertion_point(class_scope:com.spotify.canvazcache.EntityCanvazResponse.Canvaz)
},
),
"DESCRIPTOR": _ENTITYCANVAZRESPONSE,
"__module__": "canvaz_pb2"
"DESCRIPTOR":
_ENTITYCANVAZRESPONSE,
"__module__":
"canvaz_pb2"
# @@protoc_insertion_point(class_scope:com.spotify.canvazcache.EntityCanvazResponse)
},
)
@ -525,19 +538,22 @@ _sym_db.RegisterMessage(EntityCanvazResponse.Canvaz)
EntityCanvazRequest = _reflection.GeneratedProtocolMessageType(
"EntityCanvazRequest",
(_message.Message,),
(_message.Message, ),
{
"Entity": _reflection.GeneratedProtocolMessageType(
"Entity":
_reflection.GeneratedProtocolMessageType(
"Entity",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _ENTITYCANVAZREQUEST_ENTITY,
"__module__": "canvaz_pb2"
# @@protoc_insertion_point(class_scope:com.spotify.canvazcache.EntityCanvazRequest.Entity)
},
),
"DESCRIPTOR": _ENTITYCANVAZREQUEST,
"__module__": "canvaz_pb2"
"DESCRIPTOR":
_ENTITYCANVAZREQUEST,
"__module__":
"canvaz_pb2"
# @@protoc_insertion_point(class_scope:com.spotify.canvazcache.EntityCanvazRequest)
},
)

View File

@ -18,7 +18,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto3",
serialized_options=b"\n\022com.spotify.canvazH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b"\n\x11\x63\x61nvaz-meta.proto\x12\x12\x63om.spotify.canvaz*R\n\x04Type\x12\t\n\x05IMAGE\x10\x00\x12\t\n\x05VIDEO\x10\x01\x12\x11\n\rVIDEO_LOOPING\x10\x02\x12\x18\n\x14VIDEO_LOOPING_RANDOM\x10\x03\x12\x07\n\x03GIF\x10\x04\x42\x16\n\x12\x63om.spotify.canvazH\x02\x62\x06proto3",
serialized_pb=
b"\n\x11\x63\x61nvaz-meta.proto\x12\x12\x63om.spotify.canvaz*R\n\x04Type\x12\t\n\x05IMAGE\x10\x00\x12\t\n\x05VIDEO\x10\x01\x12\x11\n\rVIDEO_LOOPING\x10\x02\x12\x18\n\x14VIDEO_LOOPING_RANDOM\x10\x03\x12\x07\n\x03GIF\x10\x04\x42\x16\n\x12\x63om.spotify.canvazH\x02\x62\x06proto3",
)
_TYPE = _descriptor.EnumDescriptor(

View File

@ -13,14 +13,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="context.proto",
package="spotify.player.proto",
syntax="proto2",
serialized_options=b"\n\023com.spotify.contextH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\rcontext.proto\x12\x14spotify.player.proto\x1a\x12\x63ontext_page.proto\x1a\x12restrictions.proto"\x90\x02\n\x07\x43ontext\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12=\n\x08metadata\x18\x03 \x03(\x0b\x32+.spotify.player.proto.Context.MetadataEntry\x12\x38\n\x0crestrictions\x18\x04 \x01(\x0b\x32".spotify.player.proto.Restrictions\x12\x30\n\x05pages\x18\x05 \x03(\x0b\x32!.spotify.player.proto.ContextPage\x12\x0f\n\x07loading\x18\x06 \x01(\x08\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x13\x63om.spotify.contextH\x02',
serialized_pb=
b'\n\rcontext.proto\x12\x14spotify.player.proto\x1a\x12\x63ontext_page.proto\x1a\x12restrictions.proto"\x90\x02\n\x07\x43ontext\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12=\n\x08metadata\x18\x03 \x03(\x0b\x32+.spotify.player.proto.Context.MetadataEntry\x12\x38\n\x0crestrictions\x18\x04 \x01(\x0b\x32".spotify.player.proto.Restrictions\x12\x30\n\x05pages\x18\x05 \x03(\x0b\x32!.spotify.player.proto.ContextPage\x12\x0f\n\x07loading\x18\x06 \x01(\x08\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x13\x63om.spotify.contextH\x02',
dependencies=[
context__page__pb2.DESCRIPTOR,
restrictions__pb2.DESCRIPTOR,
@ -225,26 +225,30 @@ _CONTEXT = _descriptor.Descriptor(
_CONTEXT_METADATAENTRY.containing_type = _CONTEXT
_CONTEXT.fields_by_name["metadata"].message_type = _CONTEXT_METADATAENTRY
_CONTEXT.fields_by_name["restrictions"].message_type = restrictions__pb2._RESTRICTIONS
_CONTEXT.fields_by_name[
"restrictions"].message_type = restrictions__pb2._RESTRICTIONS
_CONTEXT.fields_by_name["pages"].message_type = context__page__pb2._CONTEXTPAGE
DESCRIPTOR.message_types_by_name["Context"] = _CONTEXT
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Context = _reflection.GeneratedProtocolMessageType(
"Context",
(_message.Message,),
(_message.Message, ),
{
"MetadataEntry": _reflection.GeneratedProtocolMessageType(
"MetadataEntry":
_reflection.GeneratedProtocolMessageType(
"MetadataEntry",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CONTEXT_METADATAENTRY,
"__module__": "context_pb2"
# @@protoc_insertion_point(class_scope:spotify.player.proto.Context.MetadataEntry)
},
),
"DESCRIPTOR": _CONTEXT,
"__module__": "context_pb2"
"DESCRIPTOR":
_CONTEXT,
"__module__":
"context_pb2"
# @@protoc_insertion_point(class_scope:spotify.player.proto.Context)
},
)

View File

@ -12,14 +12,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="context_page.proto",
package="spotify.player.proto",
syntax="proto2",
serialized_options=b"\n\023com.spotify.contextH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x12\x63ontext_page.proto\x12\x14spotify.player.proto\x1a\x13\x63ontext_track.proto"\xef\x01\n\x0b\x43ontextPage\x12\x10\n\x08page_url\x18\x01 \x01(\t\x12\x15\n\rnext_page_url\x18\x02 \x01(\t\x12\x41\n\x08metadata\x18\x03 \x03(\x0b\x32/.spotify.player.proto.ContextPage.MetadataEntry\x12\x32\n\x06tracks\x18\x04 \x03(\x0b\x32".spotify.player.proto.ContextTrack\x12\x0f\n\x07loading\x18\x05 \x01(\x08\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x13\x63om.spotify.contextH\x02',
serialized_pb=
b'\n\x12\x63ontext_page.proto\x12\x14spotify.player.proto\x1a\x13\x63ontext_track.proto"\xef\x01\n\x0b\x43ontextPage\x12\x10\n\x08page_url\x18\x01 \x01(\t\x12\x15\n\rnext_page_url\x18\x02 \x01(\t\x12\x41\n\x08metadata\x18\x03 \x03(\x0b\x32/.spotify.player.proto.ContextPage.MetadataEntry\x12\x32\n\x06tracks\x18\x04 \x03(\x0b\x32".spotify.player.proto.ContextTrack\x12\x0f\n\x07loading\x18\x05 \x01(\x08\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x13\x63om.spotify.contextH\x02',
dependencies=[
context__track__pb2.DESCRIPTOR,
],
@ -203,26 +203,31 @@ _CONTEXTPAGE = _descriptor.Descriptor(
)
_CONTEXTPAGE_METADATAENTRY.containing_type = _CONTEXTPAGE
_CONTEXTPAGE.fields_by_name["metadata"].message_type = _CONTEXTPAGE_METADATAENTRY
_CONTEXTPAGE.fields_by_name["tracks"].message_type = context__track__pb2._CONTEXTTRACK
_CONTEXTPAGE.fields_by_name[
"metadata"].message_type = _CONTEXTPAGE_METADATAENTRY
_CONTEXTPAGE.fields_by_name[
"tracks"].message_type = context__track__pb2._CONTEXTTRACK
DESCRIPTOR.message_types_by_name["ContextPage"] = _CONTEXTPAGE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
ContextPage = _reflection.GeneratedProtocolMessageType(
"ContextPage",
(_message.Message,),
(_message.Message, ),
{
"MetadataEntry": _reflection.GeneratedProtocolMessageType(
"MetadataEntry":
_reflection.GeneratedProtocolMessageType(
"MetadataEntry",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CONTEXTPAGE_METADATAENTRY,
"__module__": "context_page_pb2"
# @@protoc_insertion_point(class_scope:spotify.player.proto.ContextPage.MetadataEntry)
},
),
"DESCRIPTOR": _CONTEXTPAGE,
"__module__": "context_page_pb2"
"DESCRIPTOR":
_CONTEXTPAGE,
"__module__":
"context_page_pb2"
# @@protoc_insertion_point(class_scope:spotify.player.proto.ContextPage)
},
)

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto2",
serialized_options=b"\n\023com.spotify.contextH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x1c\x63ontext_player_options.proto\x12\x14spotify.player.proto"e\n\x14\x43ontextPlayerOptions\x12\x19\n\x11shuffling_context\x18\x01 \x01(\x08\x12\x19\n\x11repeating_context\x18\x02 \x01(\x08\x12\x17\n\x0frepeating_track\x18\x03 \x01(\x08"m\n\x1c\x43ontextPlayerOptionOverrides\x12\x19\n\x11shuffling_context\x18\x01 \x01(\x08\x12\x19\n\x11repeating_context\x18\x02 \x01(\x08\x12\x17\n\x0frepeating_track\x18\x03 \x01(\x08\x42\x17\n\x13\x63om.spotify.contextH\x02',
serialized_pb=
b'\n\x1c\x63ontext_player_options.proto\x12\x14spotify.player.proto"e\n\x14\x43ontextPlayerOptions\x12\x19\n\x11shuffling_context\x18\x01 \x01(\x08\x12\x19\n\x11repeating_context\x18\x02 \x01(\x08\x12\x17\n\x0frepeating_track\x18\x03 \x01(\x08"m\n\x1c\x43ontextPlayerOptionOverrides\x12\x19\n\x11shuffling_context\x18\x01 \x01(\x08\x12\x19\n\x11repeating_context\x18\x02 \x01(\x08\x12\x17\n\x0frepeating_track\x18\x03 \x01(\x08\x42\x17\n\x13\x63om.spotify.contextH\x02',
)
_CONTEXTPLAYEROPTIONS = _descriptor.Descriptor(
@ -30,7 +31,8 @@ _CONTEXTPLAYEROPTIONS = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="shuffling_context",
full_name="spotify.player.proto.ContextPlayerOptions.shuffling_context",
full_name=
"spotify.player.proto.ContextPlayerOptions.shuffling_context",
index=0,
number=1,
type=8,
@ -49,7 +51,8 @@ _CONTEXTPLAYEROPTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="repeating_context",
full_name="spotify.player.proto.ContextPlayerOptions.repeating_context",
full_name=
"spotify.player.proto.ContextPlayerOptions.repeating_context",
index=1,
number=2,
type=8,
@ -68,7 +71,8 @@ _CONTEXTPLAYEROPTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="repeating_track",
full_name="spotify.player.proto.ContextPlayerOptions.repeating_track",
full_name=
"spotify.player.proto.ContextPlayerOptions.repeating_track",
index=2,
number=3,
type=8,
@ -108,7 +112,8 @@ _CONTEXTPLAYEROPTIONOVERRIDES = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="shuffling_context",
full_name="spotify.player.proto.ContextPlayerOptionOverrides.shuffling_context",
full_name=
"spotify.player.proto.ContextPlayerOptionOverrides.shuffling_context",
index=0,
number=1,
type=8,
@ -127,7 +132,8 @@ _CONTEXTPLAYEROPTIONOVERRIDES = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="repeating_context",
full_name="spotify.player.proto.ContextPlayerOptionOverrides.repeating_context",
full_name=
"spotify.player.proto.ContextPlayerOptionOverrides.repeating_context",
index=1,
number=2,
type=8,
@ -146,7 +152,8 @@ _CONTEXTPLAYEROPTIONOVERRIDES = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="repeating_track",
full_name="spotify.player.proto.ContextPlayerOptionOverrides.repeating_track",
full_name=
"spotify.player.proto.ContextPlayerOptionOverrides.repeating_track",
index=2,
number=3,
type=8,
@ -176,15 +183,15 @@ _CONTEXTPLAYEROPTIONOVERRIDES = _descriptor.Descriptor(
serialized_end=266,
)
DESCRIPTOR.message_types_by_name["ContextPlayerOptions"] = _CONTEXTPLAYEROPTIONS
DESCRIPTOR.message_types_by_name[
"ContextPlayerOptionOverrides"
] = _CONTEXTPLAYEROPTIONOVERRIDES
"ContextPlayerOptions"] = _CONTEXTPLAYEROPTIONS
DESCRIPTOR.message_types_by_name[
"ContextPlayerOptionOverrides"] = _CONTEXTPLAYEROPTIONOVERRIDES
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
ContextPlayerOptions = _reflection.GeneratedProtocolMessageType(
"ContextPlayerOptions",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CONTEXTPLAYEROPTIONS,
"__module__": "context_player_options_pb2"
@ -195,7 +202,7 @@ _sym_db.RegisterMessage(ContextPlayerOptions)
ContextPlayerOptionOverrides = _reflection.GeneratedProtocolMessageType(
"ContextPlayerOptionOverrides",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CONTEXTPLAYEROPTIONOVERRIDES,
"__module__": "context_player_options_pb2"

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto2",
serialized_options=b"\n\023com.spotify.contextH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x13\x63ontext_track.proto\x12\x14spotify.player.proto"\xaa\x01\n\x0c\x43ontextTrack\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x0b\n\x03uid\x18\x02 \x01(\t\x12\x0b\n\x03gid\x18\x03 \x01(\x0c\x12\x42\n\x08metadata\x18\x04 \x03(\x0b\x32\x30.spotify.player.proto.ContextTrack.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x13\x63om.spotify.contextH\x02',
serialized_pb=
b'\n\x13\x63ontext_track.proto\x12\x14spotify.player.proto"\xaa\x01\n\x0c\x43ontextTrack\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x0b\n\x03uid\x18\x02 \x01(\t\x12\x0b\n\x03gid\x18\x03 \x01(\x0c\x12\x42\n\x08metadata\x18\x04 \x03(\x0b\x32\x30.spotify.player.proto.ContextTrack.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x13\x63om.spotify.contextH\x02',
)
_CONTEXTTRACK_METADATAENTRY = _descriptor.Descriptor(
@ -179,25 +180,29 @@ _CONTEXTTRACK = _descriptor.Descriptor(
)
_CONTEXTTRACK_METADATAENTRY.containing_type = _CONTEXTTRACK
_CONTEXTTRACK.fields_by_name["metadata"].message_type = _CONTEXTTRACK_METADATAENTRY
_CONTEXTTRACK.fields_by_name[
"metadata"].message_type = _CONTEXTTRACK_METADATAENTRY
DESCRIPTOR.message_types_by_name["ContextTrack"] = _CONTEXTTRACK
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
ContextTrack = _reflection.GeneratedProtocolMessageType(
"ContextTrack",
(_message.Message,),
(_message.Message, ),
{
"MetadataEntry": _reflection.GeneratedProtocolMessageType(
"MetadataEntry":
_reflection.GeneratedProtocolMessageType(
"MetadataEntry",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CONTEXTTRACK_METADATAENTRY,
"__module__": "context_track_pb2"
# @@protoc_insertion_point(class_scope:spotify.player.proto.ContextTrack.MetadataEntry)
},
),
"DESCRIPTOR": _CONTEXTTRACK,
"__module__": "context_track_pb2"
"DESCRIPTOR":
_CONTEXTTRACK,
"__module__":
"context_track_pb2"
# @@protoc_insertion_point(class_scope:spotify.player.proto.ContextTrack)
},
)

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto2",
serialized_options=b"\n\023com.spotify.contextH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x11play_origin.proto\x12\x14spotify.player.proto"\xbf\x01\n\nPlayOrigin\x12\x1a\n\x12\x66\x65\x61ture_identifier\x18\x01 \x01(\t\x12\x17\n\x0f\x66\x65\x61ture_version\x18\x02 \x01(\t\x12\x10\n\x08view_uri\x18\x03 \x01(\t\x12\x19\n\x11\x65xternal_referrer\x18\x04 \x01(\t\x12\x1b\n\x13referrer_identifier\x18\x05 \x01(\t\x12\x19\n\x11\x64\x65vice_identifier\x18\x06 \x01(\t\x12\x17\n\x0f\x66\x65\x61ture_classes\x18\x07 \x03(\tB\x17\n\x13\x63om.spotify.contextH\x02',
serialized_pb=
b'\n\x11play_origin.proto\x12\x14spotify.player.proto"\xbf\x01\n\nPlayOrigin\x12\x1a\n\x12\x66\x65\x61ture_identifier\x18\x01 \x01(\t\x12\x17\n\x0f\x66\x65\x61ture_version\x18\x02 \x01(\t\x12\x10\n\x08view_uri\x18\x03 \x01(\t\x12\x19\n\x11\x65xternal_referrer\x18\x04 \x01(\t\x12\x1b\n\x13referrer_identifier\x18\x05 \x01(\t\x12\x19\n\x11\x64\x65vice_identifier\x18\x06 \x01(\t\x12\x17\n\x0f\x66\x65\x61ture_classes\x18\x07 \x03(\tB\x17\n\x13\x63om.spotify.contextH\x02',
)
_PLAYORIGIN = _descriptor.Descriptor(
@ -179,7 +180,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
PlayOrigin = _reflection.GeneratedProtocolMessageType(
"PlayOrigin",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _PLAYORIGIN,
"__module__": "play_origin_pb2"

View File

@ -12,14 +12,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="playback.proto",
package="spotify.player.proto.transfer",
syntax="proto2",
serialized_options=b"\n\024com.spotify.transferH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0eplayback.proto\x12\x1dspotify.player.proto.transfer\x1a\x13\x63ontext_track.proto"\xa5\x01\n\x08Playback\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12 \n\x18position_as_of_timestamp\x18\x02 \x01(\x05\x12\x16\n\x0eplayback_speed\x18\x03 \x01(\x01\x12\x11\n\tis_paused\x18\x04 \x01(\x08\x12\x39\n\rcurrent_track\x18\x05 \x01(\x0b\x32".spotify.player.proto.ContextTrackB\x18\n\x14\x63om.spotify.transferH\x02',
serialized_pb=
b'\n\x0eplayback.proto\x12\x1dspotify.player.proto.transfer\x1a\x13\x63ontext_track.proto"\xa5\x01\n\x08Playback\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12 \n\x18position_as_of_timestamp\x18\x02 \x01(\x05\x12\x16\n\x0eplayback_speed\x18\x03 \x01(\x01\x12\x11\n\tis_paused\x18\x04 \x01(\x08\x12\x39\n\rcurrent_track\x18\x05 \x01(\x0b\x32".spotify.player.proto.ContextTrackB\x18\n\x14\x63om.spotify.transferH\x02',
dependencies=[
context__track__pb2.DESCRIPTOR,
],
@ -54,7 +54,8 @@ _PLAYBACK = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="position_as_of_timestamp",
full_name="spotify.player.proto.transfer.Playback.position_as_of_timestamp",
full_name=
"spotify.player.proto.transfer.Playback.position_as_of_timestamp",
index=1,
number=2,
type=5,
@ -142,14 +143,13 @@ _PLAYBACK = _descriptor.Descriptor(
)
_PLAYBACK.fields_by_name[
"current_track"
].message_type = context__track__pb2._CONTEXTTRACK
"current_track"].message_type = context__track__pb2._CONTEXTTRACK
DESCRIPTOR.message_types_by_name["Playback"] = _PLAYBACK
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Playback = _reflection.GeneratedProtocolMessageType(
"Playback",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _PLAYBACK,
"__module__": "playback_pb2"

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto2",
serialized_options=b"\n\036com.spotify.playlist_annotate3H\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x18playlist_annotate3.proto\x12 spotify_playlist_annotate3.proto"a\n\x0fTakedownRequest\x12N\n\x12\x61\x62use_report_state\x18\x01 \x01(\x0e\x32\x32.spotify_playlist_annotate3.proto.AbuseReportState"9\n\x0f\x41nnotateRequest\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x11\n\timage_uri\x18\x02 \x01(\t"5\n\x11TranscodedPicture\x12\x13\n\x0btarget_name\x18\x01 \x01(\t\x12\x0b\n\x03uri\x18\x02 \x01(\t"\xf4\x02\n\x12PlaylistAnnotation\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x0f\n\x07picture\x18\x02 \x01(\t\x12i\n\x1a\x64\x65precated_render_features\x18\x03 \x01(\x0e\x32\x30.spotify_playlist_annotate3.proto.RenderFeatures:\x0fNORMAL_FEATURESB\x02\x18\x01\x12O\n\x12transcoded_picture\x18\x04 \x03(\x0b\x32\x33.spotify_playlist_annotate3.proto.TranscodedPicture\x12(\n\x1ais_abuse_reporting_enabled\x18\x06 \x01(\x08:\x04true\x12R\n\x12\x61\x62use_report_state\x18\x07 \x01(\x0e\x32\x32.spotify_playlist_annotate3.proto.AbuseReportState:\x02OK*<\n\x0eRenderFeatures\x12\x13\n\x0fNORMAL_FEATURES\x10\x01\x12\x15\n\x11\x45XTENDED_FEATURES\x10\x02**\n\x10\x41\x62useReportState\x12\x06\n\x02OK\x10\x00\x12\x0e\n\nTAKEN_DOWN\x10\x01\x42"\n\x1e\x63om.spotify.playlist_annotate3H\x02',
serialized_pb=
b'\n\x18playlist_annotate3.proto\x12 spotify_playlist_annotate3.proto"a\n\x0fTakedownRequest\x12N\n\x12\x61\x62use_report_state\x18\x01 \x01(\x0e\x32\x32.spotify_playlist_annotate3.proto.AbuseReportState"9\n\x0f\x41nnotateRequest\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x11\n\timage_uri\x18\x02 \x01(\t"5\n\x11TranscodedPicture\x12\x13\n\x0btarget_name\x18\x01 \x01(\t\x12\x0b\n\x03uri\x18\x02 \x01(\t"\xf4\x02\n\x12PlaylistAnnotation\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x0f\n\x07picture\x18\x02 \x01(\t\x12i\n\x1a\x64\x65precated_render_features\x18\x03 \x01(\x0e\x32\x30.spotify_playlist_annotate3.proto.RenderFeatures:\x0fNORMAL_FEATURESB\x02\x18\x01\x12O\n\x12transcoded_picture\x18\x04 \x03(\x0b\x32\x33.spotify_playlist_annotate3.proto.TranscodedPicture\x12(\n\x1ais_abuse_reporting_enabled\x18\x06 \x01(\x08:\x04true\x12R\n\x12\x61\x62use_report_state\x18\x07 \x01(\x0e\x32\x32.spotify_playlist_annotate3.proto.AbuseReportState:\x02OK*<\n\x0eRenderFeatures\x12\x13\n\x0fNORMAL_FEATURES\x10\x01\x12\x15\n\x11\x45XTENDED_FEATURES\x10\x02**\n\x10\x41\x62useReportState\x12\x06\n\x02OK\x10\x00\x12\x0e\n\nTAKEN_DOWN\x10\x01\x42"\n\x1e\x63om.spotify.playlist_annotate3H\x02',
)
_RENDERFEATURES = _descriptor.EnumDescriptor(
@ -100,7 +101,8 @@ _TAKEDOWNREQUEST = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="abuse_report_state",
full_name="spotify_playlist_annotate3.proto.TakedownRequest.abuse_report_state",
full_name=
"spotify_playlist_annotate3.proto.TakedownRequest.abuse_report_state",
index=0,
number=1,
type=14,
@ -140,7 +142,8 @@ _ANNOTATEREQUEST = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="description",
full_name="spotify_playlist_annotate3.proto.AnnotateRequest.description",
full_name=
"spotify_playlist_annotate3.proto.AnnotateRequest.description",
index=0,
number=1,
type=9,
@ -159,7 +162,8 @@ _ANNOTATEREQUEST = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="image_uri",
full_name="spotify_playlist_annotate3.proto.AnnotateRequest.image_uri",
full_name=
"spotify_playlist_annotate3.proto.AnnotateRequest.image_uri",
index=1,
number=2,
type=9,
@ -199,7 +203,8 @@ _TRANSCODEDPICTURE = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="target_name",
full_name="spotify_playlist_annotate3.proto.TranscodedPicture.target_name",
full_name=
"spotify_playlist_annotate3.proto.TranscodedPicture.target_name",
index=0,
number=1,
type=9,
@ -258,7 +263,8 @@ _PLAYLISTANNOTATION = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="description",
full_name="spotify_playlist_annotate3.proto.PlaylistAnnotation.description",
full_name=
"spotify_playlist_annotate3.proto.PlaylistAnnotation.description",
index=0,
number=1,
type=9,
@ -277,7 +283,8 @@ _PLAYLISTANNOTATION = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="picture",
full_name="spotify_playlist_annotate3.proto.PlaylistAnnotation.picture",
full_name=
"spotify_playlist_annotate3.proto.PlaylistAnnotation.picture",
index=1,
number=2,
type=9,
@ -296,7 +303,8 @@ _PLAYLISTANNOTATION = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="deprecated_render_features",
full_name="spotify_playlist_annotate3.proto.PlaylistAnnotation.deprecated_render_features",
full_name=
"spotify_playlist_annotate3.proto.PlaylistAnnotation.deprecated_render_features",
index=2,
number=3,
type=14,
@ -315,7 +323,8 @@ _PLAYLISTANNOTATION = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="transcoded_picture",
full_name="spotify_playlist_annotate3.proto.PlaylistAnnotation.transcoded_picture",
full_name=
"spotify_playlist_annotate3.proto.PlaylistAnnotation.transcoded_picture",
index=3,
number=4,
type=11,
@ -334,7 +343,8 @@ _PLAYLISTANNOTATION = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="is_abuse_reporting_enabled",
full_name="spotify_playlist_annotate3.proto.PlaylistAnnotation.is_abuse_reporting_enabled",
full_name=
"spotify_playlist_annotate3.proto.PlaylistAnnotation.is_abuse_reporting_enabled",
index=4,
number=6,
type=8,
@ -353,7 +363,8 @@ _PLAYLISTANNOTATION = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="abuse_report_state",
full_name="spotify_playlist_annotate3.proto.PlaylistAnnotation.abuse_report_state",
full_name=
"spotify_playlist_annotate3.proto.PlaylistAnnotation.abuse_report_state",
index=5,
number=7,
type=14,
@ -383,14 +394,14 @@ _PLAYLISTANNOTATION = _descriptor.Descriptor(
serialized_end=648,
)
_TAKEDOWNREQUEST.fields_by_name["abuse_report_state"].enum_type = _ABUSEREPORTSTATE
_TAKEDOWNREQUEST.fields_by_name[
"abuse_report_state"].enum_type = _ABUSEREPORTSTATE
_PLAYLISTANNOTATION.fields_by_name[
"deprecated_render_features"
].enum_type = _RENDERFEATURES
"deprecated_render_features"].enum_type = _RENDERFEATURES
_PLAYLISTANNOTATION.fields_by_name[
"transcoded_picture"
].message_type = _TRANSCODEDPICTURE
_PLAYLISTANNOTATION.fields_by_name["abuse_report_state"].enum_type = _ABUSEREPORTSTATE
"transcoded_picture"].message_type = _TRANSCODEDPICTURE
_PLAYLISTANNOTATION.fields_by_name[
"abuse_report_state"].enum_type = _ABUSEREPORTSTATE
DESCRIPTOR.message_types_by_name["TakedownRequest"] = _TAKEDOWNREQUEST
DESCRIPTOR.message_types_by_name["AnnotateRequest"] = _ANNOTATEREQUEST
DESCRIPTOR.message_types_by_name["TranscodedPicture"] = _TRANSCODEDPICTURE
@ -401,7 +412,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
TakedownRequest = _reflection.GeneratedProtocolMessageType(
"TakedownRequest",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _TAKEDOWNREQUEST,
"__module__": "playlist_annotate3_pb2"
@ -412,7 +423,7 @@ _sym_db.RegisterMessage(TakedownRequest)
AnnotateRequest = _reflection.GeneratedProtocolMessageType(
"AnnotateRequest",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _ANNOTATEREQUEST,
"__module__": "playlist_annotate3_pb2"
@ -423,7 +434,7 @@ _sym_db.RegisterMessage(AnnotateRequest)
TranscodedPicture = _reflection.GeneratedProtocolMessageType(
"TranscodedPicture",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _TRANSCODEDPICTURE,
"__module__": "playlist_annotate3_pb2"
@ -434,7 +445,7 @@ _sym_db.RegisterMessage(TranscodedPicture)
PlaylistAnnotation = _reflection.GeneratedProtocolMessageType(
"PlaylistAnnotation",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _PLAYLISTANNOTATION,
"__module__": "playlist_annotate3_pb2"
@ -444,5 +455,6 @@ PlaylistAnnotation = _reflection.GeneratedProtocolMessageType(
_sym_db.RegisterMessage(PlaylistAnnotation)
DESCRIPTOR._options = None
_PLAYLISTANNOTATION.fields_by_name["deprecated_render_features"]._options = None
_PLAYLISTANNOTATION.fields_by_name[
"deprecated_render_features"]._options = None
# @@protoc_insertion_point(module_scope)

View File

@ -12,14 +12,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="queue.proto",
package="spotify.player.proto.transfer",
syntax="proto2",
serialized_options=b"\n\024com.spotify.transferH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0bqueue.proto\x12\x1dspotify.player.proto.transfer\x1a\x13\x63ontext_track.proto"U\n\x05Queue\x12\x32\n\x06tracks\x18\x01 \x03(\x0b\x32".spotify.player.proto.ContextTrack\x12\x18\n\x10is_playing_queue\x18\x02 \x01(\x08\x42\x18\n\x14\x63om.spotify.transferH\x02',
serialized_pb=
b'\n\x0bqueue.proto\x12\x1dspotify.player.proto.transfer\x1a\x13\x63ontext_track.proto"U\n\x05Queue\x12\x32\n\x06tracks\x18\x01 \x03(\x0b\x32".spotify.player.proto.ContextTrack\x12\x18\n\x10is_playing_queue\x18\x02 \x01(\x08\x42\x18\n\x14\x63om.spotify.transferH\x02',
dependencies=[
context__track__pb2.DESCRIPTOR,
],
@ -84,13 +84,14 @@ _QUEUE = _descriptor.Descriptor(
serialized_end=152,
)
_QUEUE.fields_by_name["tracks"].message_type = context__track__pb2._CONTEXTTRACK
_QUEUE.fields_by_name[
"tracks"].message_type = context__track__pb2._CONTEXTTRACK
DESCRIPTOR.message_types_by_name["Queue"] = _QUEUE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Queue = _reflection.GeneratedProtocolMessageType(
"Queue",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _QUEUE,
"__module__": "queue_pb2"

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto2",
serialized_options=b"\n\023com.spotify.contextH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x12restrictions.proto\x12\x14spotify.player.proto"\xbb\x07\n\x0cRestrictions\x12 \n\x18\x64isallow_pausing_reasons\x18\x01 \x03(\t\x12!\n\x19\x64isallow_resuming_reasons\x18\x02 \x03(\t\x12 \n\x18\x64isallow_seeking_reasons\x18\x03 \x03(\t\x12%\n\x1d\x64isallow_peeking_prev_reasons\x18\x04 \x03(\t\x12%\n\x1d\x64isallow_peeking_next_reasons\x18\x05 \x03(\t\x12&\n\x1e\x64isallow_skipping_prev_reasons\x18\x06 \x03(\t\x12&\n\x1e\x64isallow_skipping_next_reasons\x18\x07 \x03(\t\x12\x30\n(disallow_toggling_repeat_context_reasons\x18\x08 \x03(\t\x12.\n&disallow_toggling_repeat_track_reasons\x18\t \x03(\t\x12)\n!disallow_toggling_shuffle_reasons\x18\n \x03(\t\x12"\n\x1a\x64isallow_set_queue_reasons\x18\x0b \x03(\t\x12.\n&disallow_interrupting_playback_reasons\x18\x0c \x03(\t\x12.\n&disallow_transferring_playback_reasons\x18\r \x03(\t\x12\'\n\x1f\x64isallow_remote_control_reasons\x18\x0e \x03(\t\x12\x33\n+disallow_inserting_into_next_tracks_reasons\x18\x0f \x03(\t\x12\x36\n.disallow_inserting_into_context_tracks_reasons\x18\x10 \x03(\t\x12\x32\n*disallow_reordering_in_next_tracks_reasons\x18\x11 \x03(\t\x12\x35\n-disallow_reordering_in_context_tracks_reasons\x18\x12 \x03(\t\x12\x32\n*disallow_removing_from_next_tracks_reasons\x18\x13 \x03(\t\x12\x35\n-disallow_removing_from_context_tracks_reasons\x18\x14 \x03(\t\x12)\n!disallow_updating_context_reasons\x18\x15 \x03(\tB\x17\n\x13\x63om.spotify.contextH\x02',
serialized_pb=
b'\n\x12restrictions.proto\x12\x14spotify.player.proto"\xbb\x07\n\x0cRestrictions\x12 \n\x18\x64isallow_pausing_reasons\x18\x01 \x03(\t\x12!\n\x19\x64isallow_resuming_reasons\x18\x02 \x03(\t\x12 \n\x18\x64isallow_seeking_reasons\x18\x03 \x03(\t\x12%\n\x1d\x64isallow_peeking_prev_reasons\x18\x04 \x03(\t\x12%\n\x1d\x64isallow_peeking_next_reasons\x18\x05 \x03(\t\x12&\n\x1e\x64isallow_skipping_prev_reasons\x18\x06 \x03(\t\x12&\n\x1e\x64isallow_skipping_next_reasons\x18\x07 \x03(\t\x12\x30\n(disallow_toggling_repeat_context_reasons\x18\x08 \x03(\t\x12.\n&disallow_toggling_repeat_track_reasons\x18\t \x03(\t\x12)\n!disallow_toggling_shuffle_reasons\x18\n \x03(\t\x12"\n\x1a\x64isallow_set_queue_reasons\x18\x0b \x03(\t\x12.\n&disallow_interrupting_playback_reasons\x18\x0c \x03(\t\x12.\n&disallow_transferring_playback_reasons\x18\r \x03(\t\x12\'\n\x1f\x64isallow_remote_control_reasons\x18\x0e \x03(\t\x12\x33\n+disallow_inserting_into_next_tracks_reasons\x18\x0f \x03(\t\x12\x36\n.disallow_inserting_into_context_tracks_reasons\x18\x10 \x03(\t\x12\x32\n*disallow_reordering_in_next_tracks_reasons\x18\x11 \x03(\t\x12\x35\n-disallow_reordering_in_context_tracks_reasons\x18\x12 \x03(\t\x12\x32\n*disallow_removing_from_next_tracks_reasons\x18\x13 \x03(\t\x12\x35\n-disallow_removing_from_context_tracks_reasons\x18\x14 \x03(\t\x12)\n!disallow_updating_context_reasons\x18\x15 \x03(\tB\x17\n\x13\x63om.spotify.contextH\x02',
)
_RESTRICTIONS = _descriptor.Descriptor(
@ -30,7 +31,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="disallow_pausing_reasons",
full_name="spotify.player.proto.Restrictions.disallow_pausing_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_pausing_reasons",
index=0,
number=1,
type=9,
@ -49,7 +51,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_resuming_reasons",
full_name="spotify.player.proto.Restrictions.disallow_resuming_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_resuming_reasons",
index=1,
number=2,
type=9,
@ -68,7 +71,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_seeking_reasons",
full_name="spotify.player.proto.Restrictions.disallow_seeking_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_seeking_reasons",
index=2,
number=3,
type=9,
@ -87,7 +91,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_peeking_prev_reasons",
full_name="spotify.player.proto.Restrictions.disallow_peeking_prev_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_peeking_prev_reasons",
index=3,
number=4,
type=9,
@ -106,7 +111,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_peeking_next_reasons",
full_name="spotify.player.proto.Restrictions.disallow_peeking_next_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_peeking_next_reasons",
index=4,
number=5,
type=9,
@ -125,7 +131,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_skipping_prev_reasons",
full_name="spotify.player.proto.Restrictions.disallow_skipping_prev_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_skipping_prev_reasons",
index=5,
number=6,
type=9,
@ -144,7 +151,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_skipping_next_reasons",
full_name="spotify.player.proto.Restrictions.disallow_skipping_next_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_skipping_next_reasons",
index=6,
number=7,
type=9,
@ -163,7 +171,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_toggling_repeat_context_reasons",
full_name="spotify.player.proto.Restrictions.disallow_toggling_repeat_context_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_toggling_repeat_context_reasons",
index=7,
number=8,
type=9,
@ -182,7 +191,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_toggling_repeat_track_reasons",
full_name="spotify.player.proto.Restrictions.disallow_toggling_repeat_track_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_toggling_repeat_track_reasons",
index=8,
number=9,
type=9,
@ -201,7 +211,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_toggling_shuffle_reasons",
full_name="spotify.player.proto.Restrictions.disallow_toggling_shuffle_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_toggling_shuffle_reasons",
index=9,
number=10,
type=9,
@ -220,7 +231,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_set_queue_reasons",
full_name="spotify.player.proto.Restrictions.disallow_set_queue_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_set_queue_reasons",
index=10,
number=11,
type=9,
@ -239,7 +251,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_interrupting_playback_reasons",
full_name="spotify.player.proto.Restrictions.disallow_interrupting_playback_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_interrupting_playback_reasons",
index=11,
number=12,
type=9,
@ -258,7 +271,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_transferring_playback_reasons",
full_name="spotify.player.proto.Restrictions.disallow_transferring_playback_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_transferring_playback_reasons",
index=12,
number=13,
type=9,
@ -277,7 +291,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_remote_control_reasons",
full_name="spotify.player.proto.Restrictions.disallow_remote_control_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_remote_control_reasons",
index=13,
number=14,
type=9,
@ -296,7 +311,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_inserting_into_next_tracks_reasons",
full_name="spotify.player.proto.Restrictions.disallow_inserting_into_next_tracks_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_inserting_into_next_tracks_reasons",
index=14,
number=15,
type=9,
@ -315,7 +331,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_inserting_into_context_tracks_reasons",
full_name="spotify.player.proto.Restrictions.disallow_inserting_into_context_tracks_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_inserting_into_context_tracks_reasons",
index=15,
number=16,
type=9,
@ -334,7 +351,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_reordering_in_next_tracks_reasons",
full_name="spotify.player.proto.Restrictions.disallow_reordering_in_next_tracks_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_reordering_in_next_tracks_reasons",
index=16,
number=17,
type=9,
@ -353,7 +371,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_reordering_in_context_tracks_reasons",
full_name="spotify.player.proto.Restrictions.disallow_reordering_in_context_tracks_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_reordering_in_context_tracks_reasons",
index=17,
number=18,
type=9,
@ -372,7 +391,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_removing_from_next_tracks_reasons",
full_name="spotify.player.proto.Restrictions.disallow_removing_from_next_tracks_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_removing_from_next_tracks_reasons",
index=18,
number=19,
type=9,
@ -391,7 +411,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_removing_from_context_tracks_reasons",
full_name="spotify.player.proto.Restrictions.disallow_removing_from_context_tracks_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_removing_from_context_tracks_reasons",
index=19,
number=20,
type=9,
@ -410,7 +431,8 @@ _RESTRICTIONS = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="disallow_updating_context_reasons",
full_name="spotify.player.proto.Restrictions.disallow_updating_context_reasons",
full_name=
"spotify.player.proto.Restrictions.disallow_updating_context_reasons",
index=20,
number=21,
type=9,
@ -445,7 +467,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Restrictions = _reflection.GeneratedProtocolMessageType(
"Restrictions",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _RESTRICTIONS,
"__module__": "restrictions_pb2"

View File

@ -14,14 +14,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="session.proto",
package="spotify.player.proto.transfer",
syntax="proto2",
serialized_options=b"\n\024com.spotify.transferH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\rsession.proto\x12\x1dspotify.player.proto.transfer\x1a\rcontext.proto\x1a\x1c\x63ontext_player_options.proto\x1a\x11play_origin.proto"\xd3\x01\n\x07Session\x12\x35\n\x0bplay_origin\x18\x01 \x01(\x0b\x32 .spotify.player.proto.PlayOrigin\x12.\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x1d.spotify.player.proto.Context\x12\x13\n\x0b\x63urrent_uid\x18\x03 \x01(\t\x12L\n\x10option_overrides\x18\x04 \x01(\x0b\x32\x32.spotify.player.proto.ContextPlayerOptionOverridesB\x18\n\x14\x63om.spotify.transferH\x02',
serialized_pb=
b'\n\rsession.proto\x12\x1dspotify.player.proto.transfer\x1a\rcontext.proto\x1a\x1c\x63ontext_player_options.proto\x1a\x11play_origin.proto"\xd3\x01\n\x07Session\x12\x35\n\x0bplay_origin\x18\x01 \x01(\x0b\x32 .spotify.player.proto.PlayOrigin\x12.\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x1d.spotify.player.proto.Context\x12\x13\n\x0b\x63urrent_uid\x18\x03 \x01(\t\x12L\n\x10option_overrides\x18\x04 \x01(\x0b\x32\x32.spotify.player.proto.ContextPlayerOptionOverridesB\x18\n\x14\x63om.spotify.transferH\x02',
dependencies=[
context__pb2.DESCRIPTOR,
context__player__options__pb2.DESCRIPTOR,
@ -126,17 +126,17 @@ _SESSION = _descriptor.Descriptor(
serialized_end=324,
)
_SESSION.fields_by_name["play_origin"].message_type = play__origin__pb2._PLAYORIGIN
_SESSION.fields_by_name[
"play_origin"].message_type = play__origin__pb2._PLAYORIGIN
_SESSION.fields_by_name["context"].message_type = context__pb2._CONTEXT
_SESSION.fields_by_name[
"option_overrides"
].message_type = context__player__options__pb2._CONTEXTPLAYEROPTIONOVERRIDES
"option_overrides"].message_type = context__player__options__pb2._CONTEXTPLAYEROPTIONOVERRIDES
DESCRIPTOR.message_types_by_name["Session"] = _SESSION
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Session = _reflection.GeneratedProtocolMessageType(
"Session",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _SESSION,
"__module__": "session_pb2"

View File

@ -15,14 +15,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="transfer_state.proto",
package="spotify.player.proto.transfer",
syntax="proto2",
serialized_options=b"\n\024com.spotify.transferH\002",
create_key=_descriptor._internal_create_key,
serialized_pb=b"\n\x14transfer_state.proto\x12\x1dspotify.player.proto.transfer\x1a\x1c\x63ontext_player_options.proto\x1a\x0eplayback.proto\x1a\rsession.proto\x1a\x0bqueue.proto\"\x99\x02\n\rTransferState\x12;\n\x07options\x18\x01 \x01(\x0b\x32*.spotify.player.proto.ContextPlayerOptions\x12\x39\n\x08playback\x18\x02 \x01(\x0b\x32'.spotify.player.proto.transfer.Playback\x12?\n\x0f\x63urrent_session\x18\x03 \x01(\x0b\x32&.spotify.player.proto.transfer.Session\x12\x33\n\x05queue\x18\x04 \x01(\x0b\x32$.spotify.player.proto.transfer.Queue\x12\x1a\n\x12\x63reation_timestamp\x18\x05 \x01(\x03\x42\x18\n\x14\x63om.spotify.transferH\x02",
serialized_pb=
b"\n\x14transfer_state.proto\x12\x1dspotify.player.proto.transfer\x1a\x1c\x63ontext_player_options.proto\x1a\x0eplayback.proto\x1a\rsession.proto\x1a\x0bqueue.proto\"\x99\x02\n\rTransferState\x12;\n\x07options\x18\x01 \x01(\x0b\x32*.spotify.player.proto.ContextPlayerOptions\x12\x39\n\x08playback\x18\x02 \x01(\x0b\x32'.spotify.player.proto.transfer.Playback\x12?\n\x0f\x63urrent_session\x18\x03 \x01(\x0b\x32&.spotify.player.proto.transfer.Session\x12\x33\n\x05queue\x18\x04 \x01(\x0b\x32$.spotify.player.proto.transfer.Queue\x12\x1a\n\x12\x63reation_timestamp\x18\x05 \x01(\x03\x42\x18\n\x14\x63om.spotify.transferH\x02",
dependencies=[
context__player__options__pb2.DESCRIPTOR,
playback__pb2.DESCRIPTOR,
@ -79,7 +79,8 @@ _TRANSFERSTATE = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="current_session",
full_name="spotify.player.proto.transfer.TransferState.current_session",
full_name=
"spotify.player.proto.transfer.TransferState.current_session",
index=2,
number=3,
type=11,
@ -117,7 +118,8 @@ _TRANSFERSTATE = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="creation_timestamp",
full_name="spotify.player.proto.transfer.TransferState.creation_timestamp",
full_name=
"spotify.player.proto.transfer.TransferState.creation_timestamp",
index=4,
number=5,
type=3,
@ -148,17 +150,18 @@ _TRANSFERSTATE = _descriptor.Descriptor(
)
_TRANSFERSTATE.fields_by_name[
"options"
].message_type = context__player__options__pb2._CONTEXTPLAYEROPTIONS
_TRANSFERSTATE.fields_by_name["playback"].message_type = playback__pb2._PLAYBACK
_TRANSFERSTATE.fields_by_name["current_session"].message_type = session__pb2._SESSION
"options"].message_type = context__player__options__pb2._CONTEXTPLAYEROPTIONS
_TRANSFERSTATE.fields_by_name[
"playback"].message_type = playback__pb2._PLAYBACK
_TRANSFERSTATE.fields_by_name[
"current_session"].message_type = session__pb2._SESSION
_TRANSFERSTATE.fields_by_name["queue"].message_type = queue__pb2._QUEUE
DESCRIPTOR.message_types_by_name["TransferState"] = _TRANSFERSTATE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
TransferState = _reflection.GeneratedProtocolMessageType(
"TransferState",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _TRANSFERSTATE,
"__module__": "transfer_state_pb2"

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto3",
serialized_options=b"\n\024com.spotify.login5v3",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n#spotify/login5/v3/client_info.proto\x12\x11spotify.login5.v3"2\n\nClientInfo\x12\x11\n\tclient_id\x18\x01 \x01(\t\x12\x11\n\tdevice_id\x18\x02 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
serialized_pb=
b'\n#spotify/login5/v3/client_info.proto\x12\x11spotify.login5.v3"2\n\nClientInfo\x12\x11\n\tclient_id\x18\x01 \x01(\t\x12\x11\n\tdevice_id\x18\x02 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
)
_CLIENTINFO = _descriptor.Descriptor(
@ -84,7 +85,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
ClientInfo = _reflection.GeneratedProtocolMessageType(
"ClientInfo",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CLIENTINFO,
"__module__": "spotify.login5.v3.client_info_pb2"

View File

@ -26,21 +26,23 @@ from spotify.login5.v3.identifiers import \
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="spotify/login5/v3/login5.proto",
package="spotify.login5.v3",
syntax="proto3",
serialized_options=b"\n\024com.spotify.login5v3",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x1espotify/login5/v3/login5.proto\x12\x11spotify.login5.v3\x1a#spotify/login5/v3/client_info.proto\x1a!spotify/login5/v3/user_info.proto\x1a\'spotify/login5/v3/challenges/code.proto\x1a+spotify/login5/v3/challenges/hashcash.proto\x1a/spotify/login5/v3/credentials/credentials.proto\x1a/spotify/login5/v3/identifiers/identifiers.proto">\n\nChallenges\x12\x30\n\nchallenges\x18\x01 \x03(\x0b\x32\x1c.spotify.login5.v3.Challenge"\x89\x01\n\tChallenge\x12\x41\n\x08hashcash\x18\x01 \x01(\x0b\x32/.spotify.login5.v3.challenges.HashcashChallenge\x12\x39\n\x04\x63ode\x18\x02 \x01(\x0b\x32+.spotify.login5.v3.challenges.CodeChallenge"M\n\x12\x43hallengeSolutions\x12\x37\n\tsolutions\x18\x01 \x03(\x0b\x32$.spotify.login5.v3.ChallengeSolution"\x8f\x01\n\x11\x43hallengeSolution\x12@\n\x08hashcash\x18\x01 \x01(\x0b\x32..spotify.login5.v3.challenges.HashcashSolution\x12\x38\n\x04\x63ode\x18\x02 \x01(\x0b\x32*.spotify.login5.v3.challenges.CodeSolution"\xad\x05\n\x0cLoginRequest\x12\x32\n\x0b\x63lient_info\x18\x01 \x01(\x0b\x32\x1d.spotify.login5.v3.ClientInfo\x12\x15\n\rlogin_context\x18\x02 \x01(\x0c\x12\x42\n\x13\x63hallenge_solutions\x18\x03 \x01(\x0b\x32%.spotify.login5.v3.ChallengeSolutions\x12J\n\x11stored_credential\x18\x64 \x01(\x0b\x32/.spotify.login5.v3.credentials.StoredCredential\x12\x39\n\x08password\x18\x65 \x01(\x0b\x32\'.spotify.login5.v3.credentials.Password\x12Q\n\x15\x66\x61\x63\x65\x62ook_access_token\x18\x66 \x01(\x0b\x32\x32.spotify.login5.v3.credentials.FacebookAccessToken\x12@\n\x0cphone_number\x18g \x01(\x0b\x32*.spotify.login5.v3.identifiers.PhoneNumber\x12\x43\n\x0eone_time_token\x18h \x01(\x0b\x32+.spotify.login5.v3.credentials.OneTimeToken\x12U\n\x17parent_child_credential\x18i \x01(\x0b\x32\x34.spotify.login5.v3.credentials.ParentChildCredential\x12V\n\x18\x61pple_sign_in_credential\x18j \x01(\x0b\x32\x34.spotify.login5.v3.credentials.AppleSignInCredential"m\n\x07LoginOk\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x14\n\x0c\x61\x63\x63\x65ss_token\x18\x02 \x01(\t\x12\x19\n\x11stored_credential\x18\x03 \x01(\x0c\x12\x1f\n\x17\x61\x63\x63\x65ss_token_expires_in\x18\x04 \x01(\x05"\xf8\x02\n\rLoginResponse\x12&\n\x02ok\x18\x01 \x01(\x0b\x32\x1a.spotify.login5.v3.LoginOk\x12,\n\x05\x65rror\x18\x02 \x01(\x0e\x32\x1d.spotify.login5.v3.LoginError\x12\x31\n\nchallenges\x18\x03 \x01(\x0b\x32\x1d.spotify.login5.v3.Challenges\x12;\n\x08warnings\x18\x04 \x03(\x0e\x32).spotify.login5.v3.LoginResponse.Warnings\x12\x15\n\rlogin_context\x18\x05 \x01(\x0c\x12\x18\n\x10identifier_token\x18\x06 \x01(\t\x12.\n\tuser_info\x18\x07 \x01(\x0b\x32\x1b.spotify.login5.v3.UserInfo"@\n\x08Warnings\x12\x13\n\x0fUNKNOWN_WARNING\x10\x00\x12\x1f\n\x1b\x44\x45PRECATED_PROTOCOL_VERSION\x10\x01*\xd3\x01\n\nLoginError\x12\x11\n\rUNKNOWN_ERROR\x10\x00\x12\x17\n\x13INVALID_CREDENTIALS\x10\x01\x12\x0f\n\x0b\x42\x41\x44_REQUEST\x10\x02\x12\x1e\n\x1aUNSUPPORTED_LOGIN_PROTOCOL\x10\x03\x12\x0b\n\x07TIMEOUT\x10\x04\x12\x16\n\x12UNKNOWN_IDENTIFIER\x10\x05\x12\x15\n\x11TOO_MANY_ATTEMPTS\x10\x06\x12\x17\n\x13INVALID_PHONENUMBER\x10\x07\x12\x13\n\x0fTRY_AGAIN_LATER\x10\x08\x42\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
serialized_pb=
b'\n\x1espotify/login5/v3/login5.proto\x12\x11spotify.login5.v3\x1a#spotify/login5/v3/client_info.proto\x1a!spotify/login5/v3/user_info.proto\x1a\'spotify/login5/v3/challenges/code.proto\x1a+spotify/login5/v3/challenges/hashcash.proto\x1a/spotify/login5/v3/credentials/credentials.proto\x1a/spotify/login5/v3/identifiers/identifiers.proto">\n\nChallenges\x12\x30\n\nchallenges\x18\x01 \x03(\x0b\x32\x1c.spotify.login5.v3.Challenge"\x89\x01\n\tChallenge\x12\x41\n\x08hashcash\x18\x01 \x01(\x0b\x32/.spotify.login5.v3.challenges.HashcashChallenge\x12\x39\n\x04\x63ode\x18\x02 \x01(\x0b\x32+.spotify.login5.v3.challenges.CodeChallenge"M\n\x12\x43hallengeSolutions\x12\x37\n\tsolutions\x18\x01 \x03(\x0b\x32$.spotify.login5.v3.ChallengeSolution"\x8f\x01\n\x11\x43hallengeSolution\x12@\n\x08hashcash\x18\x01 \x01(\x0b\x32..spotify.login5.v3.challenges.HashcashSolution\x12\x38\n\x04\x63ode\x18\x02 \x01(\x0b\x32*.spotify.login5.v3.challenges.CodeSolution"\xad\x05\n\x0cLoginRequest\x12\x32\n\x0b\x63lient_info\x18\x01 \x01(\x0b\x32\x1d.spotify.login5.v3.ClientInfo\x12\x15\n\rlogin_context\x18\x02 \x01(\x0c\x12\x42\n\x13\x63hallenge_solutions\x18\x03 \x01(\x0b\x32%.spotify.login5.v3.ChallengeSolutions\x12J\n\x11stored_credential\x18\x64 \x01(\x0b\x32/.spotify.login5.v3.credentials.StoredCredential\x12\x39\n\x08password\x18\x65 \x01(\x0b\x32\'.spotify.login5.v3.credentials.Password\x12Q\n\x15\x66\x61\x63\x65\x62ook_access_token\x18\x66 \x01(\x0b\x32\x32.spotify.login5.v3.credentials.FacebookAccessToken\x12@\n\x0cphone_number\x18g \x01(\x0b\x32*.spotify.login5.v3.identifiers.PhoneNumber\x12\x43\n\x0eone_time_token\x18h \x01(\x0b\x32+.spotify.login5.v3.credentials.OneTimeToken\x12U\n\x17parent_child_credential\x18i \x01(\x0b\x32\x34.spotify.login5.v3.credentials.ParentChildCredential\x12V\n\x18\x61pple_sign_in_credential\x18j \x01(\x0b\x32\x34.spotify.login5.v3.credentials.AppleSignInCredential"m\n\x07LoginOk\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x14\n\x0c\x61\x63\x63\x65ss_token\x18\x02 \x01(\t\x12\x19\n\x11stored_credential\x18\x03 \x01(\x0c\x12\x1f\n\x17\x61\x63\x63\x65ss_token_expires_in\x18\x04 \x01(\x05"\xf8\x02\n\rLoginResponse\x12&\n\x02ok\x18\x01 \x01(\x0b\x32\x1a.spotify.login5.v3.LoginOk\x12,\n\x05\x65rror\x18\x02 \x01(\x0e\x32\x1d.spotify.login5.v3.LoginError\x12\x31\n\nchallenges\x18\x03 \x01(\x0b\x32\x1d.spotify.login5.v3.Challenges\x12;\n\x08warnings\x18\x04 \x03(\x0e\x32).spotify.login5.v3.LoginResponse.Warnings\x12\x15\n\rlogin_context\x18\x05 \x01(\x0c\x12\x18\n\x10identifier_token\x18\x06 \x01(\t\x12.\n\tuser_info\x18\x07 \x01(\x0b\x32\x1b.spotify.login5.v3.UserInfo"@\n\x08Warnings\x12\x13\n\x0fUNKNOWN_WARNING\x10\x00\x12\x1f\n\x1b\x44\x45PRECATED_PROTOCOL_VERSION\x10\x01*\xd3\x01\n\nLoginError\x12\x11\n\rUNKNOWN_ERROR\x10\x00\x12\x17\n\x13INVALID_CREDENTIALS\x10\x01\x12\x0f\n\x0b\x42\x41\x44_REQUEST\x10\x02\x12\x1e\n\x1aUNSUPPORTED_LOGIN_PROTOCOL\x10\x03\x12\x0b\n\x07TIMEOUT\x10\x04\x12\x16\n\x12UNKNOWN_IDENTIFIER\x10\x05\x12\x15\n\x11TOO_MANY_ATTEMPTS\x10\x06\x12\x17\n\x13INVALID_PHONENUMBER\x10\x07\x12\x13\n\x0fTRY_AGAIN_LATER\x10\x08\x42\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
dependencies=[
spotify_dot_login5_dot_v3_dot_client__info__pb2.DESCRIPTOR,
spotify_dot_login5_dot_v3_dot_user__info__pb2.DESCRIPTOR,
spotify_dot_login5_dot_v3_dot_challenges_dot_code__pb2.DESCRIPTOR,
spotify_dot_login5_dot_v3_dot_challenges_dot_hashcash__pb2.DESCRIPTOR,
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2.DESCRIPTOR,
spotify_dot_login5_dot_v3_dot_identifiers_dot_identifiers__pb2.DESCRIPTOR,
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2.
DESCRIPTOR,
spotify_dot_login5_dot_v3_dot_identifiers_dot_identifiers__pb2.
DESCRIPTOR,
],
)
@ -836,69 +838,48 @@ _LOGINRESPONSE = _descriptor.Descriptor(
)
_CHALLENGES.fields_by_name["challenges"].message_type = _CHALLENGE
_CHALLENGE.fields_by_name["hashcash"].message_type = (
spotify_dot_login5_dot_v3_dot_challenges_dot_hashcash__pb2.
_HASHCASHCHALLENGE)
_CHALLENGE.fields_by_name[
"hashcash"
].message_type = (
spotify_dot_login5_dot_v3_dot_challenges_dot_hashcash__pb2._HASHCASHCHALLENGE
)
_CHALLENGE.fields_by_name[
"code"
].message_type = spotify_dot_login5_dot_v3_dot_challenges_dot_code__pb2._CODECHALLENGE
_CHALLENGESOLUTIONS.fields_by_name["solutions"].message_type = _CHALLENGESOLUTION
"code"].message_type = spotify_dot_login5_dot_v3_dot_challenges_dot_code__pb2._CODECHALLENGE
_CHALLENGESOLUTIONS.fields_by_name[
"solutions"].message_type = _CHALLENGESOLUTION
_CHALLENGESOLUTION.fields_by_name["hashcash"].message_type = (
spotify_dot_login5_dot_v3_dot_challenges_dot_hashcash__pb2.
_HASHCASHSOLUTION)
_CHALLENGESOLUTION.fields_by_name[
"hashcash"
].message_type = (
spotify_dot_login5_dot_v3_dot_challenges_dot_hashcash__pb2._HASHCASHSOLUTION
)
_CHALLENGESOLUTION.fields_by_name[
"code"
].message_type = spotify_dot_login5_dot_v3_dot_challenges_dot_code__pb2._CODESOLUTION
"code"].message_type = spotify_dot_login5_dot_v3_dot_challenges_dot_code__pb2._CODESOLUTION
_LOGINREQUEST.fields_by_name[
"client_info"
].message_type = spotify_dot_login5_dot_v3_dot_client__info__pb2._CLIENTINFO
_LOGINREQUEST.fields_by_name["challenge_solutions"].message_type = _CHALLENGESOLUTIONS
"client_info"].message_type = spotify_dot_login5_dot_v3_dot_client__info__pb2._CLIENTINFO
_LOGINREQUEST.fields_by_name[
"stored_credential"
].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2._STOREDCREDENTIAL
)
_LOGINREQUEST.fields_by_name[
"password"
].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2._PASSWORD
)
_LOGINREQUEST.fields_by_name[
"facebook_access_token"
].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2._FACEBOOKACCESSTOKEN
)
_LOGINREQUEST.fields_by_name[
"phone_number"
].message_type = (
"challenge_solutions"].message_type = _CHALLENGESOLUTIONS
_LOGINREQUEST.fields_by_name["stored_credential"].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2.
_STOREDCREDENTIAL)
_LOGINREQUEST.fields_by_name["password"].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2._PASSWORD)
_LOGINREQUEST.fields_by_name["facebook_access_token"].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2.
_FACEBOOKACCESSTOKEN)
_LOGINREQUEST.fields_by_name["phone_number"].message_type = (
spotify_dot_login5_dot_v3_dot_identifiers_dot_identifiers__pb2._PHONENUMBER
)
_LOGINREQUEST.fields_by_name[
"one_time_token"
].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2._ONETIMETOKEN
)
_LOGINREQUEST.fields_by_name[
"parent_child_credential"
].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2._PARENTCHILDCREDENTIAL
)
_LOGINREQUEST.fields_by_name[
"apple_sign_in_credential"
].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2._APPLESIGNINCREDENTIAL
)
_LOGINREQUEST.fields_by_name["one_time_token"].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2.
_ONETIMETOKEN)
_LOGINREQUEST.fields_by_name["parent_child_credential"].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2.
_PARENTCHILDCREDENTIAL)
_LOGINREQUEST.fields_by_name["apple_sign_in_credential"].message_type = (
spotify_dot_login5_dot_v3_dot_credentials_dot_credentials__pb2.
_APPLESIGNINCREDENTIAL)
_LOGINRESPONSE.fields_by_name["ok"].message_type = _LOGINOK
_LOGINRESPONSE.fields_by_name["error"].enum_type = _LOGINERROR
_LOGINRESPONSE.fields_by_name["challenges"].message_type = _CHALLENGES
_LOGINRESPONSE.fields_by_name["warnings"].enum_type = _LOGINRESPONSE_WARNINGS
_LOGINRESPONSE.fields_by_name[
"user_info"
].message_type = spotify_dot_login5_dot_v3_dot_user__info__pb2._USERINFO
"user_info"].message_type = spotify_dot_login5_dot_v3_dot_user__info__pb2._USERINFO
_LOGINRESPONSE_WARNINGS.containing_type = _LOGINRESPONSE
DESCRIPTOR.message_types_by_name["Challenges"] = _CHALLENGES
DESCRIPTOR.message_types_by_name["Challenge"] = _CHALLENGE
@ -912,7 +893,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Challenges = _reflection.GeneratedProtocolMessageType(
"Challenges",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CHALLENGES,
"__module__": "spotify.login5.v3.login5_pb2"
@ -923,7 +904,7 @@ _sym_db.RegisterMessage(Challenges)
Challenge = _reflection.GeneratedProtocolMessageType(
"Challenge",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CHALLENGE,
"__module__": "spotify.login5.v3.login5_pb2"
@ -934,7 +915,7 @@ _sym_db.RegisterMessage(Challenge)
ChallengeSolutions = _reflection.GeneratedProtocolMessageType(
"ChallengeSolutions",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CHALLENGESOLUTIONS,
"__module__": "spotify.login5.v3.login5_pb2"
@ -945,7 +926,7 @@ _sym_db.RegisterMessage(ChallengeSolutions)
ChallengeSolution = _reflection.GeneratedProtocolMessageType(
"ChallengeSolution",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CHALLENGESOLUTION,
"__module__": "spotify.login5.v3.login5_pb2"
@ -956,7 +937,7 @@ _sym_db.RegisterMessage(ChallengeSolution)
LoginRequest = _reflection.GeneratedProtocolMessageType(
"LoginRequest",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _LOGINREQUEST,
"__module__": "spotify.login5.v3.login5_pb2"
@ -967,7 +948,7 @@ _sym_db.RegisterMessage(LoginRequest)
LoginOk = _reflection.GeneratedProtocolMessageType(
"LoginOk",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _LOGINOK,
"__module__": "spotify.login5.v3.login5_pb2"
@ -978,7 +959,7 @@ _sym_db.RegisterMessage(LoginOk)
LoginResponse = _reflection.GeneratedProtocolMessageType(
"LoginResponse",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _LOGINRESPONSE,
"__module__": "spotify.login5.v3.login5_pb2"

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto3",
serialized_options=b"\n\024com.spotify.login5v3",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n!spotify/login5/v3/user_info.proto\x12\x11spotify.login5.v3"\x97\x02\n\x08UserInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x65mail\x18\x02 \x01(\t\x12\x16\n\x0e\x65mail_verified\x18\x03 \x01(\x08\x12\x11\n\tbirthdate\x18\x04 \x01(\t\x12\x32\n\x06gender\x18\x05 \x01(\x0e\x32".spotify.login5.v3.UserInfo.Gender\x12\x14\n\x0cphone_number\x18\x06 \x01(\t\x12\x1d\n\x15phone_number_verified\x18\x07 \x01(\x08\x12 \n\x18\x65mail_already_registered\x18\x08 \x01(\x08"8\n\x06Gender\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x08\n\x04MALE\x10\x01\x12\n\n\x06\x46\x45MALE\x10\x02\x12\x0b\n\x07NEUTRAL\x10\x03\x42\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
serialized_pb=
b'\n!spotify/login5/v3/user_info.proto\x12\x11spotify.login5.v3"\x97\x02\n\x08UserInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x65mail\x18\x02 \x01(\t\x12\x16\n\x0e\x65mail_verified\x18\x03 \x01(\x08\x12\x11\n\tbirthdate\x18\x04 \x01(\t\x12\x32\n\x06gender\x18\x05 \x01(\x0e\x32".spotify.login5.v3.UserInfo.Gender\x12\x14\n\x0cphone_number\x18\x06 \x01(\t\x12\x1d\n\x15phone_number_verified\x18\x07 \x01(\x08\x12 \n\x18\x65mail_already_registered\x18\x08 \x01(\x08"8\n\x06Gender\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x08\n\x04MALE\x10\x01\x12\n\n\x06\x46\x45MALE\x10\x02\x12\x0b\n\x07NEUTRAL\x10\x03\x42\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
)
_USERINFO_GENDER = _descriptor.EnumDescriptor(
@ -249,7 +250,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
UserInfo = _reflection.GeneratedProtocolMessageType(
"UserInfo",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _USERINFO,
"__module__": "spotify.login5.v3.user_info_pb2"

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto3",
serialized_options=b"\n\024com.spotify.login5v3",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\'spotify/login5/v3/challenges/code.proto\x12\x1cspotify.login5.v3.challenges"\xbc\x01\n\rCodeChallenge\x12\x42\n\x06method\x18\x01 \x01(\x0e\x32\x32.spotify.login5.v3.challenges.CodeChallenge.Method\x12\x13\n\x0b\x63ode_length\x18\x02 \x01(\x05\x12\x12\n\nexpires_in\x18\x03 \x01(\x05\x12\x1e\n\x16\x63\x61nonical_phone_number\x18\x04 \x01(\t"\x1e\n\x06Method\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03SMS\x10\x01"\x1c\n\x0c\x43odeSolution\x12\x0c\n\x04\x63ode\x18\x01 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
serialized_pb=
b'\n\'spotify/login5/v3/challenges/code.proto\x12\x1cspotify.login5.v3.challenges"\xbc\x01\n\rCodeChallenge\x12\x42\n\x06method\x18\x01 \x01(\x0e\x32\x32.spotify.login5.v3.challenges.CodeChallenge.Method\x12\x13\n\x0b\x63ode_length\x18\x02 \x01(\x05\x12\x12\n\nexpires_in\x18\x03 \x01(\x05\x12\x1e\n\x16\x63\x61nonical_phone_number\x18\x04 \x01(\t"\x1e\n\x06Method\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03SMS\x10\x01"\x1c\n\x0c\x43odeSolution\x12\x0c\n\x04\x63ode\x18\x01 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
)
_CODECHALLENGE_METHOD = _descriptor.EnumDescriptor(
@ -118,7 +119,8 @@ _CODECHALLENGE = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="canonical_phone_number",
full_name="spotify.login5.v3.challenges.CodeChallenge.canonical_phone_number",
full_name=
"spotify.login5.v3.challenges.CodeChallenge.canonical_phone_number",
index=3,
number=4,
type=9,
@ -198,7 +200,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
CodeChallenge = _reflection.GeneratedProtocolMessageType(
"CodeChallenge",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CODECHALLENGE,
"__module__": "spotify.login5.v3.challenges.code_pb2"
@ -209,7 +211,7 @@ _sym_db.RegisterMessage(CodeChallenge)
CodeSolution = _reflection.GeneratedProtocolMessageType(
"CodeSolution",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _CODESOLUTION,
"__module__": "spotify.login5.v3.challenges.code_pb2"

View File

@ -13,14 +13,14 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name="spotify/login5/v3/challenges/hashcash.proto",
package="spotify.login5.v3.challenges",
syntax="proto3",
serialized_options=b"\n\024com.spotify.login5v3",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n+spotify/login5/v3/challenges/hashcash.proto\x12\x1cspotify.login5.v3.challenges\x1a\x1egoogle/protobuf/duration.proto"3\n\x11HashcashChallenge\x12\x0e\n\x06prefix\x18\x01 \x01(\x0c\x12\x0e\n\x06length\x18\x02 \x01(\x05"O\n\x10HashcashSolution\x12\x0e\n\x06suffix\x18\x01 \x01(\x0c\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.DurationB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
serialized_pb=
b'\n+spotify/login5/v3/challenges/hashcash.proto\x12\x1cspotify.login5.v3.challenges\x1a\x1egoogle/protobuf/duration.proto"3\n\x11HashcashChallenge\x12\x0e\n\x06prefix\x18\x01 \x01(\x0c\x12\x0e\n\x06length\x18\x02 \x01(\x05"O\n\x10HashcashSolution\x12\x0e\n\x06suffix\x18\x01 \x01(\x0c\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.DurationB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
dependencies=[
google_dot_protobuf_dot_duration__pb2.DESCRIPTOR,
],
@ -145,15 +145,14 @@ _HASHCASHSOLUTION = _descriptor.Descriptor(
)
_HASHCASHSOLUTION.fields_by_name[
"duration"
].message_type = google_dot_protobuf_dot_duration__pb2._DURATION
"duration"].message_type = google_dot_protobuf_dot_duration__pb2._DURATION
DESCRIPTOR.message_types_by_name["HashcashChallenge"] = _HASHCASHCHALLENGE
DESCRIPTOR.message_types_by_name["HashcashSolution"] = _HASHCASHSOLUTION
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
HashcashChallenge = _reflection.GeneratedProtocolMessageType(
"HashcashChallenge",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _HASHCASHCHALLENGE,
"__module__": "spotify.login5.v3.challenges.hashcash_pb2"
@ -164,7 +163,7 @@ _sym_db.RegisterMessage(HashcashChallenge)
HashcashSolution = _reflection.GeneratedProtocolMessageType(
"HashcashSolution",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _HASHCASHSOLUTION,
"__module__": "spotify.login5.v3.challenges.hashcash_pb2"

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto3",
serialized_options=b"\n\024com.spotify.login5v3",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n/spotify/login5/v3/credentials/credentials.proto\x12\x1dspotify.login5.v3.credentials"2\n\x10StoredCredential\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c"9\n\x08Password\x12\n\n\x02id\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\x12\x0f\n\x07padding\x18\x03 \x01(\x0c";\n\x13\x46\x61\x63\x65\x62ookAccessToken\x12\x0e\n\x06\x66\x62_uid\x18\x01 \x01(\t\x12\x14\n\x0c\x61\x63\x63\x65ss_token\x18\x02 \x01(\t"\x1d\n\x0cOneTimeToken\x12\r\n\x05token\x18\x01 \x01(\t"|\n\x15ParentChildCredential\x12\x10\n\x08\x63hild_id\x18\x01 \x01(\t\x12Q\n\x18parent_stored_credential\x18\x02 \x01(\x0b\x32/.spotify.login5.v3.credentials.StoredCredential"S\n\x15\x41ppleSignInCredential\x12\x11\n\tauth_code\x18\x01 \x01(\t\x12\x14\n\x0credirect_uri\x18\x02 \x01(\t\x12\x11\n\tbundle_id\x18\x03 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
serialized_pb=
b'\n/spotify/login5/v3/credentials/credentials.proto\x12\x1dspotify.login5.v3.credentials"2\n\x10StoredCredential\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c"9\n\x08Password\x12\n\n\x02id\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\x12\x0f\n\x07padding\x18\x03 \x01(\x0c";\n\x13\x46\x61\x63\x65\x62ookAccessToken\x12\x0e\n\x06\x66\x62_uid\x18\x01 \x01(\t\x12\x14\n\x0c\x61\x63\x63\x65ss_token\x18\x02 \x01(\t"\x1d\n\x0cOneTimeToken\x12\r\n\x05token\x18\x01 \x01(\t"|\n\x15ParentChildCredential\x12\x10\n\x08\x63hild_id\x18\x01 \x01(\t\x12Q\n\x18parent_stored_credential\x18\x02 \x01(\x0b\x32/.spotify.login5.v3.credentials.StoredCredential"S\n\x15\x41ppleSignInCredential\x12\x11\n\tauth_code\x18\x01 \x01(\t\x12\x14\n\x0credirect_uri\x18\x02 \x01(\t\x12\x11\n\tbundle_id\x18\x03 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
)
_STOREDCREDENTIAL = _descriptor.Descriptor(
@ -167,7 +168,8 @@ _FACEBOOKACCESSTOKEN = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="fb_uid",
full_name="spotify.login5.v3.credentials.FacebookAccessToken.fb_uid",
full_name=
"spotify.login5.v3.credentials.FacebookAccessToken.fb_uid",
index=0,
number=1,
type=9,
@ -186,7 +188,8 @@ _FACEBOOKACCESSTOKEN = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="access_token",
full_name="spotify.login5.v3.credentials.FacebookAccessToken.access_token",
full_name=
"spotify.login5.v3.credentials.FacebookAccessToken.access_token",
index=1,
number=2,
type=9,
@ -266,7 +269,8 @@ _PARENTCHILDCREDENTIAL = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="child_id",
full_name="spotify.login5.v3.credentials.ParentChildCredential.child_id",
full_name=
"spotify.login5.v3.credentials.ParentChildCredential.child_id",
index=0,
number=1,
type=9,
@ -285,7 +289,8 @@ _PARENTCHILDCREDENTIAL = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="parent_stored_credential",
full_name="spotify.login5.v3.credentials.ParentChildCredential.parent_stored_credential",
full_name=
"spotify.login5.v3.credentials.ParentChildCredential.parent_stored_credential",
index=1,
number=2,
type=11,
@ -325,7 +330,8 @@ _APPLESIGNINCREDENTIAL = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name="auth_code",
full_name="spotify.login5.v3.credentials.AppleSignInCredential.auth_code",
full_name=
"spotify.login5.v3.credentials.AppleSignInCredential.auth_code",
index=0,
number=1,
type=9,
@ -344,7 +350,8 @@ _APPLESIGNINCREDENTIAL = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="redirect_uri",
full_name="spotify.login5.v3.credentials.AppleSignInCredential.redirect_uri",
full_name=
"spotify.login5.v3.credentials.AppleSignInCredential.redirect_uri",
index=1,
number=2,
type=9,
@ -363,7 +370,8 @@ _APPLESIGNINCREDENTIAL = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="bundle_id",
full_name="spotify.login5.v3.credentials.AppleSignInCredential.bundle_id",
full_name=
"spotify.login5.v3.credentials.AppleSignInCredential.bundle_id",
index=2,
number=3,
type=9,
@ -394,19 +402,20 @@ _APPLESIGNINCREDENTIAL = _descriptor.Descriptor(
)
_PARENTCHILDCREDENTIAL.fields_by_name[
"parent_stored_credential"
].message_type = _STOREDCREDENTIAL
"parent_stored_credential"].message_type = _STOREDCREDENTIAL
DESCRIPTOR.message_types_by_name["StoredCredential"] = _STOREDCREDENTIAL
DESCRIPTOR.message_types_by_name["Password"] = _PASSWORD
DESCRIPTOR.message_types_by_name["FacebookAccessToken"] = _FACEBOOKACCESSTOKEN
DESCRIPTOR.message_types_by_name["OneTimeToken"] = _ONETIMETOKEN
DESCRIPTOR.message_types_by_name["ParentChildCredential"] = _PARENTCHILDCREDENTIAL
DESCRIPTOR.message_types_by_name["AppleSignInCredential"] = _APPLESIGNINCREDENTIAL
DESCRIPTOR.message_types_by_name[
"ParentChildCredential"] = _PARENTCHILDCREDENTIAL
DESCRIPTOR.message_types_by_name[
"AppleSignInCredential"] = _APPLESIGNINCREDENTIAL
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
StoredCredential = _reflection.GeneratedProtocolMessageType(
"StoredCredential",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _STOREDCREDENTIAL,
"__module__": "spotify.login5.v3.credentials.credentials_pb2"
@ -417,7 +426,7 @@ _sym_db.RegisterMessage(StoredCredential)
Password = _reflection.GeneratedProtocolMessageType(
"Password",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _PASSWORD,
"__module__": "spotify.login5.v3.credentials.credentials_pb2"
@ -428,7 +437,7 @@ _sym_db.RegisterMessage(Password)
FacebookAccessToken = _reflection.GeneratedProtocolMessageType(
"FacebookAccessToken",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _FACEBOOKACCESSTOKEN,
"__module__": "spotify.login5.v3.credentials.credentials_pb2"
@ -439,7 +448,7 @@ _sym_db.RegisterMessage(FacebookAccessToken)
OneTimeToken = _reflection.GeneratedProtocolMessageType(
"OneTimeToken",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _ONETIMETOKEN,
"__module__": "spotify.login5.v3.credentials.credentials_pb2"
@ -450,7 +459,7 @@ _sym_db.RegisterMessage(OneTimeToken)
ParentChildCredential = _reflection.GeneratedProtocolMessageType(
"ParentChildCredential",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _PARENTCHILDCREDENTIAL,
"__module__": "spotify.login5.v3.credentials.credentials_pb2"
@ -461,7 +470,7 @@ _sym_db.RegisterMessage(ParentChildCredential)
AppleSignInCredential = _reflection.GeneratedProtocolMessageType(
"AppleSignInCredential",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _APPLESIGNINCREDENTIAL,
"__module__": "spotify.login5.v3.credentials.credentials_pb2"

View File

@ -17,7 +17,8 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax="proto3",
serialized_options=b"\n\024com.spotify.login5v3",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n/spotify/login5/v3/identifiers/identifiers.proto\x12\x1dspotify.login5.v3.identifiers"U\n\x0bPhoneNumber\x12\x0e\n\x06number\x18\x01 \x01(\t\x12\x18\n\x10iso_country_code\x18\x02 \x01(\t\x12\x1c\n\x14\x63ountry_calling_code\x18\x03 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
serialized_pb=
b'\n/spotify/login5/v3/identifiers/identifiers.proto\x12\x1dspotify.login5.v3.identifiers"U\n\x0bPhoneNumber\x12\x0e\n\x06number\x18\x01 \x01(\t\x12\x18\n\x10iso_country_code\x18\x02 \x01(\t\x12\x1c\n\x14\x63ountry_calling_code\x18\x03 \x01(\tB\x16\n\x14\x63om.spotify.login5v3b\x06proto3',
)
_PHONENUMBER = _descriptor.Descriptor(
@ -49,7 +50,8 @@ _PHONENUMBER = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="iso_country_code",
full_name="spotify.login5.v3.identifiers.PhoneNumber.iso_country_code",
full_name=
"spotify.login5.v3.identifiers.PhoneNumber.iso_country_code",
index=1,
number=2,
type=9,
@ -68,7 +70,8 @@ _PHONENUMBER = _descriptor.Descriptor(
),
_descriptor.FieldDescriptor(
name="country_calling_code",
full_name="spotify.login5.v3.identifiers.PhoneNumber.country_calling_code",
full_name=
"spotify.login5.v3.identifiers.PhoneNumber.country_calling_code",
index=2,
number=3,
type=9,
@ -103,7 +106,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
PhoneNumber = _reflection.GeneratedProtocolMessageType(
"PhoneNumber",
(_message.Message,),
(_message.Message, ),
{
"DESCRIPTOR": _PHONENUMBER,
"__module__": "spotify.login5.v3.identifiers.identifiers_pb2"

View File

@ -3,16 +3,20 @@ from librespot.standard.FilterInputStream import FilterInputStream
class DataInputStream(FilterInputStream, DataInput):
def read(self, b: bytearray = None, offset: int = None, length: int = None) -> int:
def read(self,
b: bytearray = None,
offset: int = None,
length: int = None) -> int:
if b is not None and offset is None and length is None:
return self.input_stream.read(b, 0, len(b))
if b is not None and offset is not None and length is not None:
return self.input_stream.read(b, offset, length)
raise TypeError()
def read_fully(
self, b: bytearray = None, offset: int = None, length: int = None
) -> None:
def read_fully(self,
b: bytearray = None,
offset: int = None,
length: int = None) -> None:
if b is not None and offset is None and length is None:
offset = 0
length = len(b)
@ -90,16 +94,14 @@ class DataInputStream(FilterInputStream, DataInput):
def read_long(self) -> int:
self.read_fully(self.read_buffer, 0, 8)
return (
(self.read_buffer[0] << 56)
+ ((self.read_buffer[1] & 255) << 48)
+ ((self.read_buffer[2] & 255) << 40)
+ ((self.read_buffer[3] & 255) << 32)
+ ((self.read_buffer[4] & 255) << 24)
+ ((self.read_buffer[5] & 255) << 16)
+ ((self.read_buffer[6] & 255) << 8)
+ ((self.read_buffer[7] & 255) << 0)
)
return ((self.read_buffer[0] << 56) +
((self.read_buffer[1] & 255) << 48) +
((self.read_buffer[2] & 255) << 40) +
((self.read_buffer[3] & 255) << 32) +
((self.read_buffer[4] & 255) << 24) +
((self.read_buffer[5] & 255) << 16) +
((self.read_buffer[6] & 255) << 8) +
((self.read_buffer[7] & 255) << 0))
def read_float(self) -> float:
pass

View File

@ -18,9 +18,11 @@ class Zeroconf(Closeable):
def __init__(self):
try:
self.__BROADCAST4 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.__BROADCAST4 = socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)
self.__BROADCAST4.connect(("224.0.0.251", 5353))
self.__BROADCAST6 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
self.__BROADCAST6 = socket.socket(socket.AF_INET6,
socket.SOCK_DGRAM)
self.__BROADCAST6.connect(("FF02::FB", 5353))
except Exception as e:
pass
@ -31,12 +33,9 @@ class Zeroconf(Closeable):
def get_or_create_local_host_name() -> str:
host = socket.gethostname()
if host == "localhost":
host = (
base64.b64encode(
random.randint(-9223372036854775808, 9223372036854775807)
).decode()
+ ".local"
)
host = (base64.b64encode(
random.randint(-9223372036854775808,
9223372036854775807)).decode() + ".local")
return host
def set_use_ipv4(self, ipv4: bool) -> Zeroconf: