Skip to main content

Spotizerr's python librespot implementation

Project description

librespot-spotizerr

Spotizerr's librespot python integration

About The Project

This project is to further add more features for the spotizerr project, forked from librespot-python

Getting Started

Prerequisites

Installation

Stable Version

pip install librespot-spotizerr

Snapshot Version *Not recommended

pip install git+https://github.com/Xoconoch/librespot-spotizerr

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.

Other uses are examples or read this document for detailed specifications.

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

Distributed under the GPL yada yada, 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-0.2.9.tar.gz (113.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-0.2.9-py3-none-any.whl (130.5 kB view details)

Uploaded Python 3

File details

Details for the file librespot_spotizerr-0.2.9.tar.gz.

File metadata

  • Download URL: librespot_spotizerr-0.2.9.tar.gz
  • Upload date:
  • Size: 113.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for librespot_spotizerr-0.2.9.tar.gz
Algorithm Hash digest
SHA256 8f1b0fea72c16d5e1ce23a7d4e3b51e0bfc2977045efe5496c9840a7e220c3c8
MD5 092518d5bc2bb9a41610dede7fbf0ced
BLAKE2b-256 226a019c4d2a69631d646f7d72ac9078d602aeb482bce6dac82d37b53b63dd3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for librespot_spotizerr-0.2.9.tar.gz:

Publisher: publish-to-pypi.yml on Xoconoch/librespot-spotizerr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file librespot_spotizerr-0.2.9-py3-none-any.whl.

File metadata

File hashes

Hashes for librespot_spotizerr-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4dfcfd384d2e3c761e9a31fc0925d348c2bf743e31c0a13f97715be0cc29ad23
MD5 185a082805c17c72ad0ffb9f1c1f0b1e
BLAKE2b-256 ff4e9d5f5986efb92ef5e3f19b7d3035fae14b555af518c8860be0abd29877fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for librespot_spotizerr-0.2.9-py3-none-any.whl:

Publisher: publish-to-pypi.yml on Xoconoch/librespot-spotizerr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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