mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 01:31:19 +00:00
64 lines
2.1 KiB
Python
64 lines
2.1 KiB
Python
import soco
|
|
import cgi
|
|
from soco.discovery import by_name
|
|
from soco.music_services import MusicService
|
|
|
|
device = soco.discovery.any_soco()
|
|
|
|
albums = device.music_library.get_albums(search_term='Black')
|
|
for album in albums:
|
|
print('Added:', album.title)
|
|
# device.add_to_queue(album)
|
|
|
|
for zone in soco.discover():
|
|
print(zone.player_name)
|
|
|
|
zone_list = list(soco.discover())
|
|
for zoneList in zone_list:
|
|
print(zoneList)
|
|
print(zoneList.player_name)
|
|
print(zoneList.volume)
|
|
|
|
device = by_name('Bureau')
|
|
print(device)
|
|
device.volume = 5
|
|
|
|
device.play()
|
|
print(device.get_current_track_info())
|
|
print(device.get_queue())
|
|
#print(MusicService.get_subscribed_services_names())
|
|
#spotify = MusicService('Spotify')
|
|
#print(spotify.available_search_categories)
|
|
|
|
#print(MusicService.get_subscribed_services_names())
|
|
#device.volume += 10
|
|
#device.pause()
|
|
|
|
|
|
print(device.get_speaker_info())
|
|
print(device.get_current_transport_info())
|
|
#device.next()
|
|
|
|
print(device.player_name)
|
|
print(device.get_sonos_playlists())
|
|
|
|
#device.play_uri('https://lasonotheque.org/UPLOAD/mp3/2249.mp3')
|
|
|
|
#device.play()
|
|
print(device.get_current_track_info())
|
|
|
|
def tts(message):
|
|
key = "30b5e38e083d40b5b5637060cd3a9ef4" # replace with your real key
|
|
lang = "fr-fr" # or whatever language
|
|
freq = "44khz_8bit_mono" # Sonos cannot play the default, this one is working...
|
|
device.play_uri("x-rincon-mp3radio://api.voicerss.org/?key=%s&hl=%s&f=%s&src='%s'" %(key, lang, freq, message),title="Computer speaking - Test Thomas")
|
|
#tts('lol ctest un test')
|
|
|
|
device.volume = 25
|
|
#device.play_uri('https://lasonotheque.org/UPLOAD/mp3/2333.mp3')
|
|
#device.play_uri('x-sonos-spotify:spotify:track:6z2iUdxsGg0ASb4wQzwhuK?sid=9&flags=0&sn=1')
|
|
#device.play_uri('x-sonos-spotify:spotify:track:7rNjupJkjsc3ANGeW0RCYj?sid=9&flags=0&sn=1')
|
|
#device.play_uri('http://192.168.31.140:8080/talks/428bf747af1dd44311ea5f6632bf7bb82b212dc149f915a37489d4836e944ad4.mp3')
|
|
device.play_uri('http://192.168.31.140:8080/talks/0eed83ca6ac7741c98c4d60120ec30c305e4613149c5387c8a0eac27815df606.mp3')
|
|
device.play_uri('http://192.168.31.140:8080/talks/8d27aadcd9d3d22b50c2428841dbe814c25666a7be93c0a38976570b4241d8d8.mp3')
|