summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorjerous <jerous@gmail.com>2008-09-28 18:28:04 +0200
committerjerous <jerous@gmail.com>2008-09-28 18:28:04 +0200
commit2bdbcf85001abd79a2c9ca5c844cbc86b73db3f8 (patch)
tree0f8623c20e18d612620a41a4266698df14b4da63 /plugins
parente4b3429a5a57affde50f8368f8cba4f1ee252e4e (diff)
Lyrics: button to open browser for searching the lyrics
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Lyrics.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/Lyrics.py b/plugins/Lyrics.py
index 99bc499..8c4f67e 100644
--- a/plugins/Lyrics.py
+++ b/plugins/Lyrics.py
@@ -4,6 +4,8 @@ import re
import os
from thread import start_new_thread
from traceback import print_exc
+import webbrowser
+import urllib
from misc import *
from clSettings import settings,mpdSettings
@@ -33,6 +35,7 @@ class wgLyrics(QtGui.QWidget):
btnEdit=None
btnRefetch=None
btnSave=None
+ btnSearch=None
editMode=False
p=None # plugin
def __init__(self, parent=None):
@@ -41,6 +44,7 @@ class wgLyrics(QtGui.QWidget):
self.btnEdit=Button("Edit lyrics", self.onBtnEditClick)
self.btnRefetch=Button("Refetch", self.onBtnRefetchClick)
self.btnSave=Button("Save lyrics", self.onBtnSaveClick)
+ self.btnSearch=Button("Search www", self.onBtnSearch)
self.txtView=QtGui.QTextEdit(parent)
self.txtView.setReadOnly(True)
@@ -53,6 +57,7 @@ class wgLyrics(QtGui.QWidget):
hlayout.addWidget(self.btnEdit)
hlayout.addWidget(self.btnSave)
hlayout.addWidget(self.btnRefetch)
+ hlayout.addWidget(self.btnSearch)
layout.addWidget(self.txtView)
self.setLayout(layout)
@@ -64,6 +69,12 @@ class wgLyrics(QtGui.QWidget):
self.txtView.setReadOnly(not mode)
+ def onBtnSearch(self):
+ SE=settings.get('lyrics.engine', LY_DEFAULT_ENGINE)
+ f=format.compile(SE)
+ SE_url=toAscii(f(format.params(monty.getCurrentSong())))
+ webbrowser.open(urllib.quote(SE_url, ":/+?="))
+
def onBtnEditClick(self):
self.setMode(True)
self.txtView.setText(self.curLyrics)
@@ -173,7 +184,7 @@ class wgLyrics(QtGui.QWidget):
# probably a wrong path!
pass
else:
- txt="No lyrics found :'(<br /><br /><a href='%s'>Search yourself!</a>"%(SE)
+ txt="No lyrics found :'("
self.p.extended("Lyrics not found!")
self.curLyrics=""