Merge spotify module ( #53 )
This commit is contained in:
parent
6297fc78f0
commit
24d5795396
23
README.rst
23
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
|
||||
++++
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user