Skip to content
Snippets Groups Projects
Commit 1b4c67c7 authored by Jess Ward's avatar Jess Ward
Browse files

put zeroconf into function, added get_client logic

parent e0d0ab6f
No related branches found
No related tags found
No related merge requests found
from zeroconf import ServiceBrowser, Zeroconf
import snapcast.control
class Scanner:
services = []
def remove_service(self, zeroconf, type, name):
print("Service %s removed" % (name,))
def add_service(self, zeroconf, type, name):
snapcast_server = []
info = zeroconf.get_service_info(type, name)
snapcast_server.append(name, info)
self.services.append(info)
zeroconf = Zeroconf()
listener = Scanner()
browser = ServiceBrowser(zeroconf, "_snapcast._tcp.local.", listener)
def get_snapcast_server(services):
'''scan for services then find snapcast server'''
zeroconf = Zeroconf()
listener = Scanner()
ServiceBrowser(zeroconf, "_snapcast._tcp.local.", listener)
server = snapcast.control.Snapserver(services, snapcast.control.
CONTROL.PORT)
try:
input("Press enter to exit...\n\n")
finally:
zeroconf.close()
while services == []:
pass
return server
def get_snapcast_client():
pass
def get_snapcast_client(server):
'''scan through list of clients to find correct one'''
for client in server.clients:
print(client.name)
print(client.identifier)
# TODO Scroll through list of clients and find right one
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment