From 91c10ab8d7e2d997d12fc3d0e2756e541a963609 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 14 May 2021 22:07:45 +0000 Subject: [PATCH 01/13] Format code with yapf This commit fixes the style issues introduced in 4a016f5 according to the output from yapf. Details: https://deepsource.io/gh/kokarare1212/librespot-python/transform/74dc3b43-9daa-43d1-9a5f-092dccfff164/ --- librespot/metadata/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/librespot/metadata/__init__.py b/librespot/metadata/__init__.py index e2ce5ae..21ca2c6 100644 --- a/librespot/metadata/__init__.py +++ b/librespot/metadata/__init__.py @@ -260,5 +260,3 @@ class TrackId(PlayableId, SpotifyId): def get_gid(self) -> bytes: return Utils.hex_to_bytes(self._hexId) - - From 08caeb19ed6abcfa58448f0197c9c537c2a1fb31 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 14 May 2021 22:07:58 +0000 Subject: [PATCH 02/13] Restyled by black --- librespot/metadata/__init__.py | 45 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/librespot/metadata/__init__.py b/librespot/metadata/__init__.py index 21ca2c6..dcf7d90 100644 --- a/librespot/metadata/__init__.py +++ b/librespot/metadata/__init__.py @@ -47,9 +47,11 @@ 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): @@ -94,8 +96,7 @@ 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 @@ -108,7 +109,8 @@ 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 @@ -127,14 +129,12 @@ 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: @@ -145,7 +145,8 @@ 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 @@ -164,14 +165,13 @@ 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: @@ -182,7 +182,8 @@ 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 @@ -204,8 +205,7 @@ 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 @@ -221,7 +221,8 @@ 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 @@ -239,14 +240,12 @@ 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: From 18532c98dc5756279f642306277da5a197640ad6 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 14 May 2021 22:08:00 +0000 Subject: [PATCH 03/13] Restyled by isort --- librespot/metadata/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/librespot/metadata/__init__.py b/librespot/metadata/__init__.py index dcf7d90..9c31da4 100644 --- a/librespot/metadata/__init__.py +++ b/librespot/metadata/__init__.py @@ -1,9 +1,10 @@ from __future__ import annotations -from librespot.common import Base62 -from librespot.common import Utils -from librespot.proto.ContextTrack import ContextTrack + import re +from librespot.common import Base62, Utils +from librespot.proto.ContextTrack import ContextTrack + class SpotifyId: STATIC_FROM_URI = "fromUri" From 9a22d5bc8444e10559f318d54974bfe3414735c7 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 14 May 2021 22:08:04 +0000 Subject: [PATCH 04/13] Restyled by reorder-python-imports --- librespot/metadata/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/librespot/metadata/__init__.py b/librespot/metadata/__init__.py index 9c31da4..53dcf1e 100644 --- a/librespot/metadata/__init__.py +++ b/librespot/metadata/__init__.py @@ -2,7 +2,8 @@ from __future__ import annotations import re -from librespot.common import Base62, Utils +from librespot.common import Base62 +from librespot.common import Utils from librespot.proto.ContextTrack import ContextTrack From 71060fc2c8f31e0a66b5377339b3c49122b07c46 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 14 May 2021 22:08:08 +0000 Subject: [PATCH 05/13] Restyled by yapf --- librespot/metadata/__init__.py | 45 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/librespot/metadata/__init__.py b/librespot/metadata/__init__.py index 53dcf1e..46204d2 100644 --- a/librespot/metadata/__init__.py +++ b/librespot/metadata/__init__.py @@ -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: From f03c100f06c8c9edc76a23f5b3b0a8f00e852416 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 15 May 2021 00:01:51 +0000 Subject: [PATCH 06/13] Format code with yapf This commit fixes the style issues introduced in 145e9a7 according to the output from yapf. Details: https://deepsource.io/gh/kokarare1212/librespot-python/transform/67a153b1-288c-42c3-b483-041e162b9474/ --- librespot/ZeroconfServer.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index d1a551a..36590ba 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -16,7 +16,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() @@ -39,7 +40,11 @@ class ZeroconfServer(Closeable): return self def create(self) -> ZeroconfServer: - return ZeroconfServer(ZeroconfServer.Inner(self.device_type, self.device_name, self.preferred_locale, self.conf, self.device_id), self.__listenPort, self.__listenAll) + return ZeroconfServer( + ZeroconfServer.Inner(self.device_type, self.device_name, + self.preferred_locale, self.conf, + self.device_id), self.__listenPort, + self.__listenAll) class Inner: device_type: Connect.DeviceType = None @@ -63,7 +68,8 @@ class ZeroconfServer(Closeable): class HttpRunner(Runnable, Closeable): __sock: socket - __executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor() + __executorService: concurrent.futures.ThreadPoolExecutor = concurrent.futures.ThreadPoolExecutor( + ) __shouldStop: bool = False def __init__(self, port: int): @@ -86,4 +92,3 @@ class ZeroconfServer(Closeable): def close(self) -> None: super().close() - From 1c2c6b5b94bfe1e34e36202813eed117a928ffe0 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:04 +0000 Subject: [PATCH 07/13] Restyled by black --- librespot/ZeroconfServer.py | 39 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index 36590ba..d0ee0ad 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -16,8 +16,7 @@ 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() @@ -41,10 +40,16 @@ class ZeroconfServer(Closeable): def create(self) -> ZeroconfServer: return ZeroconfServer( - ZeroconfServer.Inner(self.device_type, self.device_name, - self.preferred_locale, self.conf, - self.device_id), self.__listenPort, - self.__listenAll) + ZeroconfServer.Inner( + self.device_type, + self.device_name, + self.preferred_locale, + self.conf, + self.device_id, + ), + self.__listenPort, + self.__listenAll, + ) class Inner: device_type: Connect.DeviceType = None @@ -53,22 +58,26 @@ class ZeroconfServer(Closeable): preferred_locale: str = None conf = None - def __init__(self, - device_type: Connect.DeviceType, - device_name: str, - preferred_locale: str, - conf: Session.Configuration, - device_id: str = None): + def __init__( + self, + device_type: Connect.DeviceType, + device_name: str, + preferred_locale: str, + conf: Session.Configuration, + device_id: str = None, + ): self.preferred_locale = preferred_locale 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( + __executorService: concurrent.futures.ThreadPoolExecutor = ( + concurrent.futures.ThreadPoolExecutor() ) __shouldStop: bool = False From 74c1d9d3e8422bdaf791db417d05366686276a91 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:06 +0000 Subject: [PATCH 08/13] Restyled by isort --- librespot/ZeroconfServer.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index d0ee0ad..353a74c 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -1,13 +1,15 @@ from __future__ import annotations -from librespot.common import Utils -from librespot.core import Session -from librespot.crypto import DiffieHellman -from librespot.standard import Closeable, Runnable -from librespot.proto import Connect + import concurrent.futures import random import socket +from librespot.common import Utils +from librespot.core import Session +from librespot.crypto import DiffieHellman +from librespot.proto import Connect +from librespot.standard import Closeable, Runnable + class ZeroconfServer(Closeable): __MAX_PORT = 65536 From 4aa72c73696b74718727898e7ef2ca1f240092d3 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:10 +0000 Subject: [PATCH 09/13] Restyled by reorder-python-imports --- librespot/ZeroconfServer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index 353a74c..b691ad2 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -8,7 +8,8 @@ from librespot.common import Utils from librespot.core import Session from librespot.crypto import DiffieHellman from librespot.proto import Connect -from librespot.standard import Closeable, Runnable +from librespot.standard import Closeable +from librespot.standard import Runnable class ZeroconfServer(Closeable): From f81b4bcf53270131a72369ca62723acb6fb94ec8 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 15 May 2021 00:02:15 +0000 Subject: [PATCH 10/13] Restyled by yapf --- librespot/ZeroconfServer.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/librespot/ZeroconfServer.py b/librespot/ZeroconfServer.py index b691ad2..bb2c6f4 100644 --- a/librespot/ZeroconfServer.py +++ b/librespot/ZeroconfServer.py @@ -19,7 +19,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() @@ -73,15 +74,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): From c46026e25e3e25f69a2671a22445f5ae3214f9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=86=E3=81=8B=E3=82=89?= Date: Sun, 16 May 2021 16:05:30 +0900 Subject: [PATCH 11/13] Create SECURITY.md --- SECURITY.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..034e848 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. From 07ed23cca1e737c43f95480353d9a7fc1885e746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=86=E3=81=8B=E3=82=89?= Date: Mon, 17 May 2021 12:58:04 +0900 Subject: [PATCH 12/13] update document --- docs/index.md | 52 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/docs/index.md b/docs/index.md index a884a67..9203d64 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,32 +2,54 @@ ![](https://img.shields.io/github/stars/kokarare1212/librespot-python.svg) ![](https://img.shields.io/github/forks/kokarare1212/librespot-python.svg) [![](https://deepsource.io/gh/kokarare1212/librespot-python.svg/?label=active+issues&show_trend=true)](https://deepsource.io/gh/kokarare1212/librespot-python/?ref=repository-badge) + # Get Started + ## Contents + * [Supported Futures](supported.md) * [API Reference](api.md) + ## What's librespot-python? -| librespot-python is a python port of Spotify's open source client library [librespot](https://github.com/librespot-org/librespot). -| It was created to play Spotify on various platforms and devices. + +librespot-python is a python port of Spotify's open source client library [librespot](https://github.com/librespot-org/librespot). + +It was created to play Spotify on various platforms and devices. + ## What do you need? -| In order to develop with this library, you need to use Python. -| Python can be downloaded from [the official website here](https://python.org/). + +In order to develop with this library, you need to use Python. + +Python can be downloaded from [the official website here](https://python.org/). + ## Disclaimer -| Please keep in mind that this library is not like Spotify approved. -| Therefore, the worst that can happen is that you will be banned from Spotify. -| Also, please keep in mind that this library is in alpha and may behave in unintended ways. + +Please keep in mind that this library is not like Spotify approved. + +Therefore, the worst that can happen is that you will be banned from Spotify. + +Also, please keep in mind that this library is in alpha and may behave in unintended ways. + ## Installation -| You can download this library in the following way. -| Stable Version ***still not working.** + +You can download this library in the following way. + +Stable Version ***still not working.** + ```commandline pip install librespot ``` -| Snapshot Version ***Recommended** + +Snapshot Version ***Recommended** + ```commandline pip install git+https://github.com/kokarare1212/librespot-python ``` + ## Usage + ### Get Spotify's OAuth token + ```python from librespot.core import Session @@ -38,8 +60,11 @@ session = Session.Builder() \ aceess_token = session.tokens().get("playlist-read") ``` + ### Get Music Stream -| *Currently, music streaming is supported, but it may cause unintended behavior. + +*Currently, music streaming is supported, but it may cause unintended behavior. + ```python from librespot.core import Session from librespot.metadata import TrackId @@ -55,8 +80,11 @@ stream = session.content_feeder().load(track_id, VorbisOnlyAudioQuality(AudioQua # stream.input_stream.stream().read() to get one byte of the music stream. # ex: 1 (If there is no more voice data, -1 is received as the result.) ``` + ## Debug -| To display the debug information, you need to inject the following code at the top of the code. + +To display the debug information, you need to inject the following code at the top of the code. + ```python import logging From 03f074ff431ce8827dcb81003cc61f13aefab579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=86=E3=81=8B=E3=82=89?= Date: Mon, 17 May 2021 13:45:34 +0900 Subject: [PATCH 13/13] update document --- docs/index.md | 1 + docs/supported.md | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 9203d64..e0aa4d2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,6 +7,7 @@ ## Contents +* [Get Started](index.md) * [Supported Futures](supported.md) * [API Reference](api.md) diff --git a/docs/supported.md b/docs/supported.md index f656187..4b6f968 100644 --- a/docs/supported.md +++ b/docs/supported.md @@ -1,8 +1,15 @@ ## Supported Futures -| Futures | Supported | + +| Futures | Supported | + | --- | --- | + | Get Metadata | 〇 | + | Play Music | △*1 | + | Spotify Connect | ×*2 | -*1 It is currently possible to retrieve the music stream, but it requires separate software for decoding. + +*1 It is currently possible to retrieve the music stream, but it requires separate software for decoding. + *2 This feature will be added in the future. \ No newline at end of file