From 24d5795396cd8dfc9e8c0f3c1f2c0a54503a31f2 Mon Sep 17 00:00:00 2001 From: enkore Date: Mon, 28 Apr 2014 10:43:55 +0200 Subject: [PATCH] Merge spotify module ( #53 ) --- README.rst | 23 +++++++++++++++++++++-- i3pystatus/spotify.py | 17 ++++++++--------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 5b21955..b787e36 100644 --- a/README.rst +++ b/README.rst @@ -377,7 +377,7 @@ Settings: :alert_format_title: The title of the notification, all formatters can be used (default: ``Low battery``) :alert_format_body: The body text of the notification, all formatters can be used (default: ``Battery {battery_ident} has only {percentage:.2f}% ({remaining:%E%hh:%Mm}) remaining!``) :path: Override the default-generated path (default: ``None``) -:status: A dictionary mapping ('DIS', 'CHR', 'FULL') to alternative names (default: ``{'DIS': 'DIS', 'FULL': 'FULL', 'CHR': 'CHR'}``) +:status: A dictionary mapping ('DIS', 'CHR', 'FULL') to alternative names (default: ``{'CHR': 'CHR', 'DIS': 'DIS', 'FULL': 'FULL'}``) :color: The text color (default: ``#ffffff``) :critical_color: The critical color (default: ``#ff0000``) :interval: (default: ``5``) @@ -664,7 +664,7 @@ Settings: :host: (default: ``localhost``) :port: MPD port (default: ``6600``) :format: formatp string (default: ``{title} {status}``) -:status: Dictionary mapping pause, play and stop to output (default: ``{'stop': '◾', 'pause': '▷', 'play': '▶'}``) +:status: Dictionary mapping pause, play and stop to output (default: ``{'play': '▶', 'stop': '◾', 'pause': '▷'}``) :interval: (default: ``1``) @@ -818,6 +818,25 @@ Settings: +spotify ++++++++ + + +This class shows information from Spotify. + +Left click will toggle pause/play of the current song. +Right click will skip the song. + +Dependent on Playerctl ( https://github.com/acrisci/playerctl ) and GLib + + +Settings: + +:format: Format string. {artist}, {title}, {album}, {volume}, and {length} are available for output. (default: ``{artist} - {title}``) +:color: color of the output (default: ``#ffffff``) + + + temp ++++ diff --git a/i3pystatus/spotify.py b/i3pystatus/spotify.py index 9ac3455..1599179 100644 --- a/i3pystatus/spotify.py +++ b/i3pystatus/spotify.py @@ -1,9 +1,11 @@ -from i3pystatus import IntervalModule +import threading +import math -import threading, math +from i3pystatus import Module from gi.repository import Playerctl, GLib -class Spotify(IntervalModule): + +class Spotify(Module): """ This class shows information from Spotify. @@ -11,7 +13,7 @@ class Spotify(IntervalModule): Left click will toggle pause/play of the current song. Right click will skip the song. - Dependent on Playerctl and GLib + Dependent on Playerctl ( https://github.com/acrisci/playerctl ) and GLib """ format = "{artist} - {title}" @@ -49,7 +51,8 @@ class Spotify(IntervalModule): time = e["mpris:length"] / 60.0e6 minutes = math.floor(time) seconds = round(time % 1 * 60) - if seconds < 10: seconds = "0" + str(seconds) + if seconds < 10: + seconds = "0" + str(seconds) length = "{}:{}".format(minutes, seconds) self.output = { @@ -65,7 +68,3 @@ class Spotify(IntervalModule): def on_rightclick(self): self.player.next() - - def run(self): - pass -