31 lines
694 B
Python
31 lines
694 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
|
|
mocCommand = 'mocp-playing'
|
|
|
|
class Py3status:
|
|
|
|
def mocPlayer(self):
|
|
playing = os.popen(mocCommand).read().strip()
|
|
if not playing:
|
|
return {
|
|
'cached_until': self.py3.time_in(5),
|
|
'full_text': '',
|
|
}
|
|
return {
|
|
'cached_until': self.py3.time_in(5),
|
|
'composite': [
|
|
{
|
|
'full_text': '[ ',
|
|
},
|
|
{
|
|
'full_text': playing,
|
|
'color': '#22FFFF',
|
|
},
|
|
{
|
|
'full_text': ' ]',
|
|
}
|
|
]
|
|
}
|