Skip to content

Commit

Permalink
fix: Make status command more useful (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
theychx authored and skorokithakis committed Feb 9, 2018
1 parent 9fee4e5 commit 9742790
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions catt/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,21 @@ def volumedown(self, delta):
self.cast.volume_down(delta)

def status(self):
status = self.cast.media_controller.status.__dict__
status = self.cast.media_controller.status

if status["duration"]:
dur, cur = int(status["duration"]), int(status["current_time"])
if status.title:
echo("Title: %s" % status.title)

if status.duration:
dur, cur = int(status.duration), int(status.current_time)
duration, current = self._human_time(dur), self._human_time(cur)
remaining = self._human_time(dur - cur)
progress = int((1.0 * cur / dur) * 100)

echo("Time: %s / %s (%s%%)" % (current, duration, progress))
echo("Remaining time: %s" % remaining)

echo("State: %s" % status["player_state"])
echo("State: %s" % status.player_state)
echo("Volume: %s" % int(self.cast.status.volume_level * 100))

def info(self):
# Values in media_controller.status for the keys "volume_level" and "volume_muted"
Expand Down

0 comments on commit 9742790

Please sign in to comment.