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.11.tar.gz (127.1 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.11-py3-none-any.whl (142.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for librespot_spotizerr_phoenix-0.0.11.tar.gz
Algorithm Hash digest
SHA256 bab2ff70e89a4b5882833d240ab20d6355c3e12151486bb1eda35eceb745904d
MD5 fcf097e3d33f1711c494118f3b48c9dd
BLAKE2b-256 7f5b2471482df96cf145b2e17b7b85953a4649ce716b6043ecacf8a13206b90f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for librespot_spotizerr_phoenix-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 46c5c14132988f92f2e43432d983ed4c426d70daeae642bc1016fc98b504bd72
MD5 903421ab4652115cb84083711041abac
BLAKE2b-256 f05a4d2bf73ce00b7e20800071dffa97a8e4d29a5c9021ad8c6b1203d3ae867c

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