Metadata-Version: 2.1
Name: pyhifiberry
Version: 0.1.1
Summary: Python library to interface with Hifiberry OS API.
Home-page: https://github.com/schnabel/pyhifiberry
License: MIT
Author: Diogo Gomes
Author-email: diogogomes@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: aiohttp (>=3.8.1,<4.0.0)
Requires-Dist: bidict (>=0.22.0,<0.23.0)
Project-URL: Repository, https://github.com/schnabel/pyhifiberry
Description-Content-Type: text/markdown

# pyhifiberry
Python library to interface with Hifiberry OS API (audiocontrol2). There are two APIs available:
* [REST](https://github.com/hifiberry/audiocontrol2/blob/master/doc/api.md)
* [socketio](https://github.com/hifiberry/audiocontrol2/blob/master/doc/socketio_api.md)

This package is targeting mainly the needs for a [hifiberry integration for Home assistant](https://github.com/willholdoway/hifiberry).

## Usage example of the socketio API
Runs for 100 secs and prints artist name if metadata events occure.
``` python
import asyncio
from pyhifiberry.audiocontrol2sio import Audiocontrol2SIO

def metadata_callback(metadata):
    print(metadata['artist'])

async def main():
    api = await Audiocontrol2SIO.connect(<HIFIBERRY_IP>, <HIFIBERRY_PORT>)
    api.metadata.add_callback(metadata_callback)
    await asyncio.sleep(100)

if __name__ == '__main__':
    asyncio.run(main())
```
