venjum / bluesound

Bluesound API for for controlling a Bluesound player. API written in Python 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bluesound Python 3 API

Bluesound API for for controlling a Bluesound player. see: http://www.bluesound.com

Install (program is in beta, must install with github address)

pip3 install git+https://github.com/venjum/bluesound.git

Example of usage:

Make a subscription handler:

def handelTitle1(new_title):
    print(new_title)

from bluesound.bluesound_subscribe import SubscriptionObject
title1 = SubscriptionObject(['status', 'title1'], handelTitle1)

Or use some of the predefined subscription objects, but remember to set callback

from bluesound_subscription_objects import secondsInTrack

def handelSecondsInTrack(sec):
    print(sec)

secondsInTrack.setCallback(handelSecondsInTrack)

Then initiate and start Bluesound thread

from bluosesound.bluesound_control import Bluesound
bluos = Bluesound("192.168.1.87", 1.0, set([title1, secondsInTrack]))
bluos.start()

Use the API

bluos.skip()

When stopping application, remember to stop the thread as well.

bluos.stop()

About

Bluesound API for for controlling a Bluesound player. API written in Python 3


Languages

Language:Python 100.0%