Permalink
Browse files

A fairly hacky fix to make unicode work.

  • Loading branch information...
1 parent 71fc921 commit cec54963360ebe11c0d0d21e434224d54e5ec994 @solson solson committed Aug 25, 2011
Showing with 9 additions and 9 deletions.
  1. +9 −9 xchat-mpris.py
View
18 xchat-mpris.py
@@ -37,7 +37,7 @@ def saveConfig():
f.write(player)
def status(str):
- xchat.prnt(u"[%s] %s" % (player, str))
+ xchat.prnt("[%s] %s" % (player, str))
# Pass in milliseconds, get (minutes, seconds)
def parseSongPosition(time):
@@ -72,9 +72,9 @@ def getSongInfo():
#if iface.IsPlaying():
data = iface.GetMetadata()
- title = data["title"]
- album = data["album"]
- artist = data["artist"]
+ title = data["title"].encode('utf-8')
+ album = data["album"].encode('utf-8')
+ artist = data["artist"].encode('utf-8')
pos = formatTime(parseSongPosition(iface.PositionGet()))
length = formatTime(getMinutesAndSeconds(data["time"]))
@@ -102,7 +102,7 @@ def mprisPlayerVersion(word, word_eol, userdata):
def mprisNp(word, word_eol, userdata):
if isPlayerSpecified():
- xchat.command(u"ME is listening to %s - %s [%s] [%s/%s]" % getSongInfo())
+ xchat.command("ME is listening to %s - %s [%s] [%s/%s]" % getSongInfo())
return xchat.EAT_ALL
def mprisPlayer(word, word_eol, userdata):
@@ -113,14 +113,14 @@ def mprisPlayer(word, word_eol, userdata):
if not isPlayerSpecified():
pass
elif oldplayer != '' and oldplayer != player:
- xchat.prnt(u"Media player changed from \"%s\" to \"%s\"" % (oldplayer, player))
+ xchat.prnt("Media player changed from \"%s\" to \"%s\"" % (oldplayer, player))
else:
- xchat.prnt(u"Media player set to \"%s\"" % player)
+ xchat.prnt("Media player set to \"%s\"" % player)
saveConfig()
return xchat.EAT_ALL
else:
pass
- xchat.prnt(u"USAGE: %s <player name>, set default meda player." % word[0])
+ xchat.prnt("USAGE: %s <player name>, set default meda player." % word[0])
return xchat.EAT_ALL
def mprisPlay(word, word_eol, userdata):
@@ -177,7 +177,7 @@ def mprisNext(word, word_eol, userdata):
xchat.prnt("MPRIS now playing script initialized")
if isConfigured():
loadConfig()
- xchat.prnt(u"Current media player is %s" % player)
+ xchat.prnt("Current media player is %s" % player)
xchat.prnt("Use /player <player name> to specify the media player you are using.")
xchat.prnt("Use /np to send information on the current song to the active channel.")

0 comments on commit cec5496

Please sign in to comment.