Schlaubischlump / shairport-metadatareader-python

A shairport-metadata-reader package written in Python, which supports reading the metadata from the pipe file, the UDP-server and the MQTT server if configured.
GNU General Public License v3.0
9 stars 4 forks source link
airplay airplay-remote daap daap-codes dmap kivy metadata mqtt mqtt-client remote shairport shairport-decoder shairport-metadata-reader shairport-remote shairport-sync shairport-sync-metadata-reader shairport-sync-reader

Shairport-Metadatareader-Python

What is this?

This python (>= 2.7 or >= 3.4) library includes a package shairportmetadatareader which parses the airplay metadata from the shairport-sync pipe, the specified shairport-sync udp server or the shairport-sync mqtt server. In addition, it includes a remote sub-package to remotely control the Airplay client.

Requirements

optional:

Installation

pip install git+https://github.com/Schlaubischlump/shairport-metadatareader-python

Bugs

Example (Read Metadata)

from time import sleep
from shairportmetadatareader import AirplayUDPListener #, AirplayPipeListener

def on_track_info(lis, info):
    """
    Print the current track information.
    :param lis: listener instance
    :param info: track information
    """
    print(info)

listener = AirplayUDPListener() # You can use AirplayPipeListener or AirplayMQTTListener
listener.bind(track_info=on_track_info) # receive callbacks for metadata changes
listener.start_listening() # read the data asynchronously from the udp server
sleep(60) # receive data for 60 seconds
listener.stop_listening()

Events

Beside the current track information you can listen for the following events in the same manner as in the above example:

For more advanced examples take a look at the examples folder.

Special thanks goes to