Spotizerr's python librespot implementation - Phoenix fork
Project description
librespot-spotizerr-phoenix
Spotizerr's librespot python integration - Phoenix fork
About The Project
This project is to further add more features for the Spotizerr project, forked from librespot-python and librespot-spotizerr
Getting Started
Prerequisites
Installation
pip install librespot-spotizerr-phoenix
Usage
Use Zeroconf for Login (no premium required)
from librespot.zeroconf import ZeroconfServer
import time
import logging
import pathlib
zs = ZeroconfServer.Builder().create()
logging.warning("Transfer playback from desktop client to librespot-spotizerr via Spotify Connect in order to store session")
while True:
time.sleep(1)
if zs._ZeroconfServer__session:
logging.warning(f"Grabbed {zs._ZeroconfServer__session} for {zs._ZeroconfServer__session.username()}")
if pathlib.Path("credentials.json").exists():
logging.warning("Session stored in credentials.json. Now you can Ctrl+C")
break
Get Music Stream
*Currently, music streaming is supported, but it may cause unintended behavior.
from librespot.core import Session
from librespot.metadata import TrackId
from librespot.audio.decoders import AudioQuality, VorbisOnlyAudioQuality
session = Session.Builder() \
.user_pass("Username", "Password") \
.create()
track_id = TrackId.from_uri("spotify:track:xxxxxxxxxxxxxxxxxxxxxx")
stream = session.content_feeder().load(track_id, VorbisOnlyAudioQuality(AudioQuality.VERY_HIGH), False, None)
# stream.input_stream.stream().read() to get one byte of the music stream.
Debug
To display the debug information, you need to inject the following code at the top of the code.
import logging
logging.basicConfig(level=logging.DEBUG)
Contributing
Pull requests are welcome.
License
Licensed under the Apache License, Version 2.0. See LICENSE for more information.
Related Projects
- Librespot (Concept)
- Librespot-Java (Core)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file librespot_spotizerr_phoenix-0.0.13.tar.gz.
File metadata
- Download URL: librespot_spotizerr_phoenix-0.0.13.tar.gz
- Upload date:
- Size: 126.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9f6f8903c7b8b40c841b5b6b587e7f229ed94a6d4d1fcb95e27476029165f36
|
|
| MD5 |
8773ac6fe9bd883e4a3941da983f334e
|
|
| BLAKE2b-256 |
fd5f7c3e61e37fb9eaf6223114d71452fc3062595dccbdcf2102dc146e843569
|
File details
Details for the file librespot_spotizerr_phoenix-0.0.13-py3-none-any.whl.
File metadata
- Download URL: librespot_spotizerr_phoenix-0.0.13-py3-none-any.whl
- Upload date:
- Size: 141.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdf7528f26327549943d72e9b78e8f7b94ed1eed04d9a3b8b479e19916a7c553
|
|
| MD5 |
a4bed8aa345a4518e8a59896689be75a
|
|
| BLAKE2b-256 |
96bcb3711e84333a8dc56150076e242c4d23bee6986b8b706da9d26e3cb980a5
|