audio/spotify_manager.py hinzugefügt
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
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()
|
||||||
Reference in New Issue
Block a user