Metadata-Version: 2.4
Name: librespot-spotizerr-phoenix
Version: 0.0.13
Summary: Spotizerr's python librespot implementation - Phoenix fork
Home-page: https://lavaforge.org/spotizerrphoenix/librespot-spotizerr-phoenix
Author: spotizerrphoenix
License: Apache-2.0
Classifier: Development Status :: 1 - Planning
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Multimedia :: Sound/Audio
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: defusedxml==0.7.1
Requires-Dist: protobuf==3.20.1
Requires-Dist: pycryptodomex==3.21.0
Requires-Dist: pyogg==0.6.14a.1
Requires-Dist: requests==2.32.3
Requires-Dist: websocket-client==1.8.0
Requires-Dist: zeroconf==0.139.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# 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](https://github.com/kokarare1212/librespot-python) and [librespot-spotizerr](https://github.com/Xoconoch/librespot-spotizerr)

## Getting Started

### Prerequisites

- [Python](https://python.org/)

### Installation

```commandline
pip install librespot-spotizerr-phoenix
```

## Usage

### Use Zeroconf for Login (no premium required)

```python
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.<br>

```python
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.

```python
import logging


logging.basicConfig(level=logging.DEBUG)
```

## Contributing

Pull requests are welcome.

## License

Licensed under the Apache License, Version 2.0. See
[LICENSE](https://lavaforge.org/spotizerr/librespot-spotizerr/src/branch/main/LICENSE)
for more information.

## Related Projects

- [Librespot](https://github.com/librespot-org/librespot) (Concept)
- [Librespot-Java](https://github.com/librespot-org/librespot-java) (Core)
