escape url-problematic characters like # in gstplayer

This commit is contained in:
Adrian Sampson 2010-06-08 14:30:00 -07:00
parent 84d5ef9807
commit 10b4d31784

View file

@ -23,6 +23,7 @@ import gobject
import thread
import os
import copy
import urllib
class GstPlayer(object):
"""A music player abstracting GStreamer's Playbin element.
@ -101,7 +102,10 @@ class GstPlayer(object):
path.
"""
self.player.set_state(gst.STATE_NULL)
self.player.set_property("uri", ("file://" + path).encode('utf-8'))
if isinstance(path, unicode):
path = path.encode('utf8')
uri = 'file://' + urllib.quote(path)
self.player.set_property("uri", uri)
self.player.set_state(gst.STATE_PLAYING)
self.playing = True