What are valid gstreamer song names?
<p>I'm trying to understand what song names can I use in my gstreamer python based audioplayer. Can't find any docs about it. For example song with name <code>test%.mp3</code> produce the error:</p>

<pre><code>Error: [&lt;GError at 0x7f8a8c001620&gt;, 'gstgiosrc.c(324): gst_gio_src_get_stream (): /GstPlayBin:playbin0/GstGioSrc:source:\nCould not open location file:///home/austinnikov/work/daemon_player/program_root/test%.mp3 for reading: Operation not supported'], 
</code></pre>

<p>Songs without <code>%</code> are played. And of cause I have <code>test%.mp3</code> on the hard drive in that directory. </p>

<p>Rolf's answer is great, but I wanted to add that if your songs_names are in unicode as mine then <code>pathname2url</code> will fail with <code>KeyError</code>. So I did it in slightly another way, note also <a href="http://stackoverflow.com/questions/11687478/convert-a-filename-to-a-file-url">Convert a filename to a file:// URL</a>.
This function is a part of <code>Player</code> class. <code>Player</code> instance has <code>player</code> variable <code>self.player = gst.element_factory_make("playbin")</code>:</p>

<pre><code>def set_song(self, song_name):
    song_name = song_name.encode('utf8')
    path = urlparse.urljoin("file://", urllib.pathname2url(song_name))
    path = path.decode('utf8')
    self.player.set_property("uri", path))
</code></pre>

<p>And now I'm pretty happy cause my song names can be in unicode and contain any weird symbols.</p>

python gstreamer