Skip to main content

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

librespot_spotizerr_phoenix-0.0.12.tar.gz (126.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

librespot_spotizerr_phoenix-0.0.12-py3-none-any.whl (141.6 kB view details)

Uploaded Python 3

File details

Details for the file librespot_spotizerr_phoenix-0.0.12.tar.gz.

File metadata

File hashes

Hashes for librespot_spotizerr_phoenix-0.0.12.tar.gz
Algorithm Hash digest
SHA256 37b590e343d635455cfa52f42344b749d7882abdabb3e998dca102bc4edeea9a
MD5 9eeb8ec81e0b67bdb756fdfa2effa5a3
BLAKE2b-256 e56b42fd914016c922bf63ed0b5172b15f197f903ebc9e0400afa66f31a2dc86

See more details on using hashes here.

File details

Details for the file librespot_spotizerr_phoenix-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for librespot_spotizerr_phoenix-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 b857d58e3377ec4a96fa1b3064f3741ac73ec87936e2f430e20831e57b8cfe02
MD5 04367259c7d8fd20a0660838851f0555
BLAKE2b-256 4e1fc47c65e0dcc4a7a2ae6a582c9e493995fb6e83fe0c86df2e1d9424e2edb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page