Skip to content

Commit

Permalink
LINT fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JamiePhonic authored and JamiePhonic committed Aug 24, 2024
1 parent 9ba6de8 commit d98e150
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
14 changes: 8 additions & 6 deletions aioslimproto/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,12 +745,13 @@ def _process_ir(self, data: bytes) -> None:
"code": code,
},
)

def _process_dsco(self, data: bytes) -> None:
"""Process incoming stat DSCO message (data stream disconnected)."""
self.logger.debug("DSCO received - data stream disconnected.")
# Some players may send this to indicate they have disconnected from the data stream
# Either becasue the stream ended, or because they have finished buffering the current file
# Some players may send this to indicate they have disconnected
# from the data stream either because the stream ended, or because
# they have finished buffering the current file

def _process_stat(self, data: bytes) -> None:
"""Redirect incoming STAT event from player to correct method."""
Expand Down Expand Up @@ -971,12 +972,13 @@ def _process_setd(self, data: bytes) -> None:
self.display_control.width = display_width
if display_height:
self.display_control.height = display_height
resolution = (f"{display_width} x {display_height}")

resolution = f"{display_width} x {display_height}"
self.callback(self, EventType.PLAYER_DISPLAY_RESOLUTION, resolution)

if self.display_control.image.width != display_width:
# If the display resolution reported by the player doesn't match the display resolution we're currently using
# If the display resolution reported by the player doesn't match
# the display resolution we're currently using
self.display_control = None
self.display_control = SlimProtoDisplay(self, display_width)
# Re-instanciate SlimProtoDisplay with the correct resolution parameters
Expand Down
10 changes: 8 additions & 2 deletions aioslimproto/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from __future__ import annotations

import asyncio
import logging
import os
import struct
import logging
from typing import TYPE_CHECKING

from PIL import Image, ImageDraw, ImageFont
Expand Down Expand Up @@ -174,7 +174,13 @@ async def _render_display(
def pack() -> bytes:
"""Return the packed frame ready for transmission."""
if self.width != self.image.width:
self.logger.warn("Attempted to render %s x %s Image to %s x %s Display", self.image.width, self.image.height, self.width, self.height)
self.logger.warning(
"Attempted to render %s x %s Image to %s x %s Display",
self.image.width,
self.image.height,
self.width,
self.height,
)
pixmap = self.image.load()
words = []
for col in range(self.width):
Expand Down
6 changes: 2 additions & 4 deletions aioslimproto/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,12 @@ def __init__(self) -> None:
def increment(self) -> None:
"""Increment the volume."""
self.volume += self.step
if self.volume > self.maximum:
self.volume = self.maximum
self.volume = min(self.volume, self.maximum)

def decrement(self) -> None:
"""Decrement the volume."""
self.volume -= self.step
if self.volume < self.minimum:
self.volume = self.minimum
self.volume = max(self.volume, self.minimum)

def old_gain(self) -> int:
"""Return the "Old" gain value as required by the squeezebox."""
Expand Down

0 comments on commit d98e150

Please sign in to comment.