From b179d29abf40c7f2d02aacd9b00dc1d8d5c093e3 Mon Sep 17 00:00:00 2001 From: ncoop Date: Sat, 30 Jul 2016 00:04:46 -0700 Subject: [PATCH] pep8 compliance. --- i3pystatus/mpd.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/i3pystatus/mpd.py b/i3pystatus/mpd.py index f0b94d6..0529449 100644 --- a/i3pystatus/mpd.py +++ b/i3pystatus/mpd.py @@ -13,10 +13,13 @@ class MPD(IntervalModule): .. rubric:: Available formatters (uses :ref:`formatp`) * `{title}` — (the title of the current song) - * `{album}` — (the album of the current song, can be an empty string (e.g. for online streams)) + * `{album}` — (the album of the current song, can be an empty string \ +(e.g. for online streams)) * `{artist}` — (can be empty, too) - * `{filename}` — (file name with out extension and path; empty unless title is empty) - * `{song_elapsed}` — (Position in the currently playing song, uses :ref:`TimeWrapper`, default is `%m:%S`) + * `{filename}` — (file name with out extension and path; empty unless \ +title is empty) + * `{song_elapsed}` — (Position in the currently playing song, uses \ +:ref:`TimeWrapper`, default is `%m:%S`) * `{song_length}` — (Length of the current song, same as song_elapsed) * `{pos}` — (Position of current song in playlist, one-based) * `{len}` — (Songs in playlist) @@ -31,15 +34,23 @@ class MPD(IntervalModule): settings = ( ("host"), - ("port", "MPD port. If set to 0, host will we interpreted as a Unix socket."), + ("port", "MPD port. If set to 0, host will we interpreted as a Unix \ +socket."), ("format", "formatp string"), ("status", "Dictionary mapping pause, play and stop to output"), ("color", "The color of the text"), - ("max_field_len", "Defines max length for in truncate_fields defined fields, if truncated, ellipsis are appended as indicator. It's applied *before* max_len. Value of 0 disables this."), - ("max_len", "Defines max length for the hole string, if exceeding fields specefied in truncate_fields are truncated equaly. If truncated, ellipsis are appended as indicator. It's applied *after* max_field_len. Value of 0 disables this."), - ("truncate_fields", "fields that will be truncated if exceeding max_field_len or max_len."), + ("max_field_len", "Defines max length for in truncate_fields defined \ +fields, if truncated, ellipsis are appended as indicator. It's applied \ +*before* max_len. Value of 0 disables this."), + ("max_len", "Defines max length for the hole string, if exceeding \ +fields specefied in truncate_fields are truncated equaly. If truncated, \ +ellipsis are appended as indicator. It's applied *after* max_field_len. Value \ +of 0 disables this."), + ("truncate_fields", "fields that will be truncated if exceeding \ +max_field_len or max_len."), ("hide_inactive", "Hides status information when MPD is not running"), - ("password", "A password for access to MPD. (This is sent in cleartext to the server.)"), + ("password", "A password for access to MPD. (This is sent in \ +cleartext to the server.)"), ) host = "localhost" @@ -74,7 +85,8 @@ class MPD(IntervalModule): sock = self.s sock.recv(8192) if self.password is not None: - sock.send('password "{}"\n'.format(self.password).encode("utf-8")) + sock.send('password "{}"\n'.format(self.password). + encode("utf-8")) sock.recv(8192) sock.send((command + "\n").encode("utf-8")) try: @@ -144,8 +156,9 @@ class MPD(IntervalModule): def switch_playpause(self): try: - self._mpd_command(self.s, "%s" % - ("play" if self._mpd_command(self.s, "status")["state"] in ["pause", "stop"] else "pause")) + self._mpd_command(self.s, "play" + if self._mpd_command(self.s, "status")["state"] + in ["pause", "stop"] else "pause") except Exception as e: pass