Pep8 lint
This commit is contained in:
parent
47fcf40ec6
commit
5d4c7224d9
3 changed files with 15 additions and 11 deletions
|
@ -70,7 +70,7 @@ class MattchBox(Controller):
|
||||||
self.ser = serial.serial_for_url(port, do_not_open=True)
|
self.ser = serial.serial_for_url(port, do_not_open=True)
|
||||||
if self.ser:
|
if self.ser:
|
||||||
self.ser.baudrate = 2400
|
self.ser.baudrate = 2400
|
||||||
self.ser.timeout = 0.1 # Speed up waiting for a byte.
|
self.ser.timeout = 0.1 # Speed up waiting for a byte.
|
||||||
try:
|
try:
|
||||||
self.ser.open()
|
self.ser.open()
|
||||||
self.logger.log.info("Connected to serial port {}".format(port))
|
self.logger.log.info("Connected to serial port {}".format(port))
|
||||||
|
|
|
@ -49,6 +49,7 @@ def startServer(notifications=False):
|
||||||
def printer(msg: Any):
|
def printer(msg: Any):
|
||||||
print("LAUNCHER:{}".format(msg))
|
print("LAUNCHER:{}".format(msg))
|
||||||
|
|
||||||
|
|
||||||
def notif(msg: str):
|
def notif(msg: str):
|
||||||
print("NOTIFICATION:{}".format(msg))
|
print("NOTIFICATION:{}".format(msg))
|
||||||
|
|
||||||
|
|
23
player.py
23
player.py
|
@ -132,7 +132,9 @@ class Player:
|
||||||
if not self.state.get()["loaded_item"] or not self.isInit:
|
if not self.state.get()["loaded_item"] or not self.isInit:
|
||||||
loaded = False
|
loaded = False
|
||||||
elif not self.isPlaying:
|
elif not self.isPlaying:
|
||||||
# Because this function can be called very often, only some (less frequent) checks will initiate a full trial of loading success, for efficiency.
|
# Because this function can be called very often, only some (less
|
||||||
|
# frequent) checks will initiate a full trial of loading success, for
|
||||||
|
# efficiency.
|
||||||
if not short_test:
|
if not short_test:
|
||||||
# We're not playing now, so we can quickly test run
|
# We're not playing now, so we can quickly test run
|
||||||
# If that works, we're truely loaded.
|
# If that works, we're truely loaded.
|
||||||
|
@ -184,9 +186,9 @@ class Player:
|
||||||
|
|
||||||
# Audio Playout Related Methods
|
# Audio Playout Related Methods
|
||||||
|
|
||||||
|
|
||||||
# Loads a plan item into the player, ready for playing.
|
# Loads a plan item into the player, ready for playing.
|
||||||
# This includes some retry logic to try and double-down on ensuring it plays successfully.
|
# This includes some retry logic to try and double-down on ensuring it plays successfully.
|
||||||
|
|
||||||
def load(self, weight: int):
|
def load(self, weight: int):
|
||||||
if not self.isPlaying:
|
if not self.isPlaying:
|
||||||
# If we have something loaded already, unload it first.
|
# If we have something loaded already, unload it first.
|
||||||
|
@ -350,7 +352,7 @@ class Player:
|
||||||
self.logger.log.exception("Failed to unload channel.")
|
self.logger.log.exception("Failed to unload channel.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
#self._potentially_end_tracklist()
|
# self._potentially_end_tracklist()
|
||||||
# If we unloaded successfully, reset the tracklist_id, ready for the next item.
|
# If we unloaded successfully, reset the tracklist_id, ready for the next item.
|
||||||
if not self.isLoaded:
|
if not self.isLoaded:
|
||||||
self.state.update("tracklist_id", None)
|
self.state.update("tracklist_id", None)
|
||||||
|
@ -358,8 +360,8 @@ class Player:
|
||||||
# If we successfully unloaded, this will return true, for success!
|
# If we successfully unloaded, this will return true, for success!
|
||||||
return not self.isLoaded
|
return not self.isLoaded
|
||||||
|
|
||||||
|
|
||||||
# Starts playing the loaded item, from a given position (secs)
|
# Starts playing the loaded item, from a given position (secs)
|
||||||
|
|
||||||
def play(self, pos: float = 0):
|
def play(self, pos: float = 0):
|
||||||
self.logger.log.info("Playing from pos: " + str(pos))
|
self.logger.log.info("Playing from pos: " + str(pos))
|
||||||
if not self.isLoaded:
|
if not self.isLoaded:
|
||||||
|
@ -513,9 +515,9 @@ class Player:
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.log.exception("Failed to quit mixer.")
|
self.logger.log.exception("Failed to quit mixer.")
|
||||||
|
|
||||||
|
|
||||||
# Sets whether auto advance is on or off
|
# Sets whether auto advance is on or off
|
||||||
# Auto advance is where the next item in the list is selected after the current item is finished playing.
|
# Auto advance is where the next item in the list is selected after the current item is finished playing.
|
||||||
|
|
||||||
def set_auto_advance(self, message: bool) -> bool:
|
def set_auto_advance(self, message: bool) -> bool:
|
||||||
self.state.update("auto_advance", message)
|
self.state.update("auto_advance", message)
|
||||||
return True
|
return True
|
||||||
|
@ -534,7 +536,6 @@ class Player:
|
||||||
self.state.update("play_on_load", message)
|
self.state.update("play_on_load", message)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# Show Plan Related Methods
|
# Show Plan Related Methods
|
||||||
|
|
||||||
def _check_ghosts(self, item: PlanItem):
|
def _check_ghosts(self, item: PlanItem):
|
||||||
|
@ -775,7 +776,8 @@ class Player:
|
||||||
# If we're going to live (potentially from not live/PFL), potentially tracklist if it's playing.
|
# If we're going to live (potentially from not live/PFL), potentially tracklist if it's playing.
|
||||||
if live:
|
if live:
|
||||||
self._potentially_tracklist()
|
self._potentially_tracklist()
|
||||||
# If the fader is now not live, don't bother stopping the tracklist, incase it's faded up again during the same playback.
|
# If the fader is now not live, don't bother stopping the tracklist,
|
||||||
|
# incase it's faded up again during the same playback.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Helper functions
|
# Helper functions
|
||||||
|
@ -786,9 +788,9 @@ class Player:
|
||||||
|
|
||||||
time: int = -1
|
time: int = -1
|
||||||
if mode == "on":
|
if mode == "on":
|
||||||
time = 0 # Let's do it pretty quickly.
|
time = 0 # Let's do it pretty quickly.
|
||||||
if mode == "fader-live":
|
if mode == "fader-live":
|
||||||
time = 4 # Give presenter a bit of a grace period in case they accidentally fade up the wrong one.
|
time = 4 # Give presenter a bit of a grace period in case they accidentally fade up the wrong one.
|
||||||
elif mode == "delayed":
|
elif mode == "delayed":
|
||||||
# Let's do it in a bit, once we're sure it's been playing. (Useful if we've got no idea if it's live or cueing.)
|
# Let's do it in a bit, once we're sure it's been playing. (Useful if we've got no idea if it's live or cueing.)
|
||||||
time = TRACKLISTING_DELAYED_S
|
time = TRACKLISTING_DELAYED_S
|
||||||
|
@ -1049,7 +1051,8 @@ class Player:
|
||||||
"Message return Queue is missing!!!! Can't send message."
|
"Message return Queue is missing!!!! Can't send message."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Send the current status to all other modules/clients. Used for updating all client UIs when one of them causes a change etc.
|
# Send the current status to all other modules/clients. Used for updating
|
||||||
|
# all client UIs when one of them causes a change etc.
|
||||||
def _send_status(self):
|
def _send_status(self):
|
||||||
self._retMsg(str(self.status), okay_str=True,
|
self._retMsg(str(self.status), okay_str=True,
|
||||||
custom_prefix="ALL:STATUS:")
|
custom_prefix="ALL:STATUS:")
|
||||||
|
|
Loading…
Reference in a new issue