1 diff --git a/plugins/lyrics/lyrics.py b/plugins/lyrics/lyrics.py
2 index 13124b3..45b054a 100644
3 --- a/plugins/lyrics/lyrics.py
4 +++ b/plugins/lyrics/lyrics.py
5 @@ -32,6 +32,7 @@ import urllib.request
7 from gi.repository import Gtk, Gio, GObject, Peas
8 from gi.repository import RB
9 +from gi.repository import Gst, GstPbutils
12 from LyricsConfigureDialog import LyricsConfigureDialog
13 @@ -142,10 +143,36 @@ class LyricGrabber(object):
15 def verify_lyric(self):
16 return os.path.exists(self.cache_path)
19 + def lyric_from_tag(self):
21 + Extract lyrics from the file meta data (tags)
22 + Currently supported formats:
23 + - ogg/vorbis files with "LYRICS" tag
25 + location = self.entry.get_playback_uri()
26 + print("discovering %s" % location)
27 + self.discoverer = GstPbutils.Discoverer(timeout=Gst.SECOND*1)
28 + info = self.discoverer.discover_uri(location)
29 + tags = info.get_tags()
33 + for i in range(tags.get_tag_size("extended-comment")):
34 + (exists, value) = tags.get_string_index("extended-comment", i)
35 + if exists and value.startswith("LYRICS"):
36 + text = value.replace("LYRICS=", "")
39 def search_lyrics(self, callback, cache_only=False):
40 self.callback = callback
43 + text = self.lyric_from_tag()
44 + if text is not None:
48 status = self.verify_lyric()