Fixed bug where if pychromecast is not imported, type annotations break things

This commit is contained in:
Sumner Evans
2020-06-15 20:54:48 -06:00
parent fee0e4e507
commit 3acd8d8a49

View File

@@ -5,7 +5,7 @@ import multiprocessing
import os import os
import socket import socket
from datetime import timedelta from datetime import timedelta
from typing import Callable, Dict, Optional, Set, Tuple, Type, Union from typing import Any, Callable, Dict, Optional, Set, Tuple, Type, Union
from urllib.parse import urlparse from urllib.parse import urlparse
from uuid import UUID from uuid import UUID
@@ -102,7 +102,7 @@ class ChromecastPlayer(Player):
self._current_chromecast.register_status_listener(self) self._current_chromecast.register_status_listener(self)
self._current_chromecast.wait() self._current_chromecast.wait()
def new_cast_status(self, status: pychromecast.socket_client.CastStatus): def new_cast_status(self, status: Any):
self.on_player_event( self.on_player_event(
PlayerEvent( PlayerEvent(
PlayerEvent.EventType.VOLUME_CHANGE, PlayerEvent.EventType.VOLUME_CHANGE,
@@ -121,9 +121,7 @@ class ChromecastPlayer(Player):
time_increment_order_token = 0 time_increment_order_token = 0
def new_media_status( def new_media_status(self, status: Any):
self, status: pychromecast.controllers.media.MediaStatus,
):
# Detect the end of a track and go to the next one. # Detect the end of a track and go to the next one.
if ( if (
status.idle_reason == "FINISHED" status.idle_reason == "FINISHED"