This python script gets information about current song in Title/Artist/Album format. You can save it to ~/.scripts/mpdnow.py
This script connects to the server directly, and displays information about the song only if it is playing.
# -*- coding: utf-8 -*-
import mpd
try:
client = mpd.MPDClient()
client.connect("localhost", 6600)
if (client.status()['state']) == 'play':
print(client.currentsong()['title']+'\n'+client.currentsong()['artist']+'\n'+client.currentsong()['album'])
except:
2+2
Check the address and port of your MPD server.
Second script was written on UNIX Shell:
#!/bin/shIn this simple code you must check the address of first script.
while true
rm ~/.psi/tune
touch /tmp/tune
ln -s /tmp/tune ~/.psi/tune
do
python ~/.scripts/mpdnow.py > ~/.psi/tune
sleep 1
done;
After theese steps, you may add second script to autostart.
No comments:
Post a Comment