39 lines
651 B
Python
39 lines
651 B
Python
import logging
|
|
from librespot.zeroconf import ZeroconfServer
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
|
|
class SpotifyManager:
|
|
|
|
def __init__(self):
|
|
self.server = None
|
|
|
|
|
|
def start(self):
|
|
print("Starte Spotify Connect...")
|
|
|
|
self.server = (
|
|
ZeroconfServer
|
|
.Builder()
|
|
.create()
|
|
)
|
|
|
|
print("Spotify Connect bereit")
|
|
|
|
|
|
def stop(self):
|
|
if self.server:
|
|
self.server.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
spotify = SpotifyManager()
|
|
spotify.start()
|
|
|
|
try:
|
|
while True:
|
|
pass
|
|
except KeyboardInterrupt:
|
|
spotify.stop() |