all repos — dotfiles @ 9689c8d78ba688312f01bc493f75743e6528ba33

my *nix dotfiles

bin/spoti.py (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
#!/usr/bin/python 

import os

cmd = os.popen('playerctl -p spotify status').read()
cmd = cmd.split('\n')
cmd = cmd[0]

meta_artist = os.popen('playerctl -p spotify metadata xesam:artist').read()
meta_title = os.popen('playerctl -p spotify metadata xesam:title').read()

if cmd == "Playing":
    print(meta_title + ' - ' + meta_artist)

elif cmd == 'Paused':
    print(meta_title + ' - ' + meta_artist)

else:
    print('no music playing')