Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if connection_status.status == "CONNECTED":
self._mz.update_members()
class mzlistener:
def multizone_member_added(self, uuid):
print("New member: {}".format(uuid))
def multizone_member_removed(self, uuid):
print("Removed member: {}".format(uuid))
def multizone_status_received(self):
print("Members: {}".format(mz.members))
chromecasts = pychromecast.get_listed_chromecasts(friendly_names=[args.cast])
if not chromecasts:
print('No chromecast with name "{}" discovered'.format(args.cast))
sys.exit(1)
cast = chromecasts[0]
# Add listeners
mz = MultizoneController(cast.uuid)
mz.register_listener(mzlistener())
cast.register_handler(mz)
cast.register_connection_listener(connlistener(mz))
# Start socket client's worker thread and wait for initial status update
cast.wait()
while True:
time.sleep(1)
print(status)
parser = argparse.ArgumentParser(
description="Example on how to create a simple Chromecast event listener."
)
parser.add_argument("--show-debug", help="Enable debug log", action="store_true")
parser.add_argument(
"--cast", help='Name of cast device (default: "%(default)s")', default=CAST_NAME
)
args = parser.parse_args()
if args.show_debug:
logging.basicConfig(level=logging.DEBUG)
chromecasts = pychromecast.get_listed_chromecasts(friendly_names=[args.cast])
if not chromecasts:
print('No chromecast with name "{}" discovered'.format(args.cast))
sys.exit(1)
chromecast = chromecasts[0]
# Start socket client's worker thread and wait for initial status update
chromecast.wait()
listenerCast = StatusListener(chromecast.name, chromecast)
chromecast.register_status_listener(listenerCast)
listenerMedia = StatusMediaListener(chromecast.name, chromecast)
chromecast.media_controller.register_status_listener(listenerMedia)
input("Listening for Chromecast events...\n\n")
parser = argparse.ArgumentParser(
description="Example on how to use the Youtube Controller."
)
parser.add_argument("--show-debug", help="Enable debug log", action="store_true")
parser.add_argument(
"--cast", help='Name of cast device (default: "%(default)s")', default=CAST_NAME
)
parser.add_argument(
"--videoid", help='Youtube video ID (default: "%(default)s")', default=VIDEO_ID
)
args = parser.parse_args()
if args.show_debug:
logging.basicConfig(level=logging.DEBUG)
chromecasts = pychromecast.get_listed_chromecasts(friendly_names=[args.cast])
if not chromecasts:
print('No chromecast with name "{}" discovered'.format(args.cast))
sys.exit(1)
cast = chromecasts[0]
# Start socket client's worker thread and wait for initial status update
cast.wait()
yt = YouTubeController()
cast.register_handler(yt)
yt.play_video(VIDEO_ID)