Skip to content

Commit

Permalink
playerctl module: apply code qa
Browse files Browse the repository at this point in the history
  • Loading branch information
ultrabug committed Sep 10, 2023
1 parent 534cdac commit 3bc4946
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions py3status/modules/playerctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
from threading import Thread

import gi
from gi.repository import GLib, Playerctl

gi.require_version("Playerctl", "2.0")
from gi.repository import GLib, Playerctl


class Py3status:
Expand All @@ -99,9 +99,7 @@ class Py3status:
format_player_separator = " "
players = []
seek_delta = 5
thresholds = {
"status": [("Playing", "good"), ("Paused", "degraded"), ("Stopped", "bad")]
}
thresholds = {"status": [("Playing", "good"), ("Paused", "degraded"), ("Stopped", "bad")]}
volume_delta = 10

class Meta:
Expand Down Expand Up @@ -277,11 +275,7 @@ def playerctl(self):
player_data = self._get_player_data(player)

# Check if the player should cause the module to continuously update
if (
self.position
and player_data["status"] == "Playing"
and player_data["position"]
):
if self.position and player_data["status"] == "Playing" and player_data["position"]:
cached_until = self.cache_timeout

# Set the color of a player
Expand All @@ -299,9 +293,7 @@ def playerctl(self):

return {
"cached_until": self.py3.time_in(cached_until),
"full_text": self.py3.safe_format(
self.format, {"format_player": format_players}
),
"full_text": self.py3.safe_format(self.format, {"format_player": format_players}),
}

def on_click(self, event):
Expand Down

0 comments on commit 3bc4946

Please sign in to comment.