1. Vladimir Kolev
  2. gSharkDown

Commits

Vladimir Kolev  committed 8725305

Fixed problem with escaping special characters in pango markup.

  • Participants
  • Parent commits f781325
  • Branches default

Comments (0)

Files changed (1)

File gsharkdown.py

View file
  • Ignore whitespace
         self.prefsmenu.popup(None, None, None, 0, 0)
 
     def add_song_to_playlist(self, song):
-        song_string = "<span>%s</span>\n<span fgcolor='#777777'>%s</span>" % (self.get_sliced_string(song['SongName'], 25), self.get_sliced_string(song['ArtistName'], 20))
+        song_string = "<span>%s</span>\n<span fgcolor='#777777'>%s</span>" % (self.get_sliced_string(glib.markup_escape_text(song['SongName']), 25),
+                                                                              self.get_sliced_string(glib.markup_escape_text(song['ArtistName']), 20))
         #if len(song_string) > 14:
         #    song_string = song_string[:13] + "..."
-        tooltip = _("<b>Title:</b> {title}\n").format(title = song['SongName'])
-        tooltip += _("<b>Artist:</b> {artist}\n").format(artist = song['ArtistName'])
-        tooltip += _("<b>Album:</b> {album}\n").format(album = song['AlbumName'])
+        tooltip = _("<b>Title:</b> {title}\n").format(title = glib.markup_escape_text(song['SongName']))
+        tooltip += _("<b>Artist:</b> {artist}\n").format(artist = glib.markup_escape_text(song['ArtistName']))
+        tooltip += _("<b>Album:</b> {album}\n").format(album = glib.markup_escape_text(song['AlbumName']))
         tooltip += _("<b>Year:</b> {year}").format(year = song['Year'])
 
         appended_iter = self.playlist.append([
                                       0, gtk.BUTTONS_OK,)
             dialog.set_title(_("Song Information - {songid}").format(songid = song['SongID']))
             _filename = _("<b>Filename:</b> {artist} - {title}.mp3\n").format(artist = song['ArtistName'],
-                                                       title = song['SongName'])
+                                                       title = glib.markup_escape_text(song['SongName']))
             _artist = _("<b>Artist:</b> {artist}\n").format(artist = song['ArtistName'])
-            _title = _("<b>Title:</b> {title}\n").format(title = song['SongName'])
+            _title = _("<b>Title:</b> {title}\n").format(title = glib.markup_escape_text(song['SongName']))
             _duration = "%.2f" % (float(song['EstimateDuration']) / 60)
             _duration = _("<b>Duration:</b> {mins}:{secs} min\n").format(mins = _duration.split(".")[0],
                                                       secs = _duration.split(".")[1])
             self.playlist.set(playing, 1, image1)
 
             self.songinfo.set_markup(
-                _("<b>Playing:</b> {artist} - {title}").format(artist = self.current_song['ArtistName'],
-                                         title = self.current_song['SongName'])
+                _("<b>Playing:</b> {artist} - {title}").format(artist = glib.markup_escape_text(self.current_song['ArtistName']),
+                                         title = glib.markup_escape_text(self.current_song['SongName']))
             )
             if int(CONFIG['show_notification']) == 1:
                 n = pynotify.Notification(_("Now playing"),