Code: Alles auswählen
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from kdecore import KApplication
import dcopext
app = KApplication(sys.argv, "NowPlaying")
player = dcopext.DCOPObj("amarok", app.dcopClient(), "player")
isPlaying = player.isPlaying()[1]
song = player.nowPlaying()[1]
album =player.album()[1]
if (isPlaying):
print song
print album
Code: Alles auswählen
[~/bin]>python nowplaying.py
Die Toten Hosen - Goldener Westen
Traceback (most recent call last):
File "nowplaying.py", line 16, in ?
print album
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 3: ordinal not in range(128)