Skip to main content

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

Release files for librespot-spotizerr-phoenix 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for librespot-spotizerr-phoenix 0.0.13
File Size Uploaded
librespot_spotizerr_phoenix-0.0.13.tar.gz 126.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for librespot-spotizerr-phoenix 0.0.13
File Interpreter ABI Platform
librespot_spotizerr_phoenix-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 268.5 kB

Release files / librespot_spotizerr_phoenix-0.0.13.tar.gz

Download URL librespot_spotizerr_phoenix-0.0.13.tar.gz
Size 126.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e9f6f8903c7b8b40c841b5b6b587e7f229ed94a6d4d1fcb95e27476029165f36
BLAKE2b-256 checksum
How to use checksums
fd5f7c3e61e37fb9eaf6223114d71452fc3062595dccbdcf2102dc146e843569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / librespot_spotizerr_phoenix-0.0.13-py3-none-any.whl

Download URL librespot_spotizerr_phoenix-0.0.13-py3-none-any.whl
Size 141.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdf7528f26327549943d72e9b78e8f7b94ed1eed04d9a3b8b479e19916a7c553
BLAKE2b-256 checksum
How to use checksums
96bcb3711e84333a8dc56150076e242c4d23bee6986b8b706da9d26e3cb980a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.12

2 release files

0.0.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page