Skip to content

Commit

Permalink
Merge pull request #14 from George-lewis/master
Browse files Browse the repository at this point in the history
Adds Album Name to Label
  • Loading branch information
Jvanrhijn committed Aug 28, 2019
2 parents 456625b + d9527a5 commit 50cfd6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -38,10 +38,10 @@ The argument "-f" is optional and sets the format. You can specify how to displa
Override example:

``` ini
exec = python /path/to/spotify/script -f '{play_pause} {song} - {artist}'
exec = python /path/to/spotify/script -f '{play_pause} {song} - {artist} - {album}'
```

This would output "Lone Digger - Caravan Palace" in your polybar, instead of what is shown in the screenshot.
This would output "Lone Digger - Caravan Palace - <I°_°I>" in your polybar, instead of what is shown in the screenshot.

##### Status indicator

Expand Down
7 changes: 4 additions & 3 deletions spotify_status.py
Expand Up @@ -4,7 +4,6 @@
import dbus
import argparse


parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
Expand Down Expand Up @@ -99,8 +98,9 @@ def fix_string(string):

artist = fix_string(metadata['xesam:artist'][0]) if metadata['xesam:artist'] else ''
song = fix_string(metadata['xesam:title']) if metadata['xesam:title'] else ''
album = fix_string(metadata['xesam:album']) if metadata['xesam:album'] else ''

if not artist and not song:
if not artist and not song and not album:
print('')
else:
if len(song) > trunclen:
Expand All @@ -112,8 +112,9 @@ def fix_string(string):
if font:
artist = label_with_font.format(font=font, label=artist)
song = label_with_font.format(font=font, label=song)
album = label_with_font.format(font=font, label=album)

print(output.format(artist=artist, song=song, play_pause=play_pause))
print(output.format(artist=artist, song=song, play_pause=play_pause, album=album))

except Exception as e:
if isinstance(e, dbus.exceptions.DBusException):
Expand Down

0 comments on commit 50cfd6b

Please sign in to comment.