summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorjerous <jerous@gmail.com>2008-11-04 21:30:40 +0100
committerjerous <jerous@gmail.com>2008-11-04 21:30:40 +0100
commit6e61921c5dad2abef348b3874057fbd925bafe61 (patch)
treeaaad9600d94013db9178a62adf20ca4dc7b137ee /plugins
parentc6d056d2c48b419b8e5e0cb1df17131df481bbaf (diff)
Lyrics: discard HTML fetched from internet
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Lyrics.py10
-rw-r--r--plugins/Tabs.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/plugins/Lyrics.py b/plugins/Lyrics.py
index 97c7c8b..c5e7cf3 100644
--- a/plugins/Lyrics.py
+++ b/plugins/Lyrics.py
@@ -151,7 +151,7 @@ class wgLyrics(QtGui.QWidget):
file=open(lyFName, 'r')
self.curLyrics=file.read()
file.close()
- QtCore.QCoreApplication.postEvent(self, AddHtmlEvent(self.curLyrics))
+ QtCore.QCoreApplication.postEvent(self, AddHtmlEvent(self.curLyrics.replace('\n', '<br />')))
self._fetchCnt=0
self.p.extended("Fetch lyrics from file")
return
@@ -192,14 +192,14 @@ class wgLyrics(QtGui.QWidget):
self.curLyrics=""
QtCore.QCoreApplication.postEvent(self, ResetEvent(song))
- QtCore.QCoreApplication.postEvent(self, AddHtmlEvent(txt))
- except:
- print_exc()
+ QtCore.QCoreApplication.postEvent(self, AddHtmlEvent(txt.replace('\n', '<br />')))
+ except Exception, e:
QtCore.QCoreApplication.postEvent(self, ResetEvent(song))
QtCore.QCoreApplication.postEvent(self, AddHtmlEvent('Woops, error! Possible causes:'\
'<br />no internet connection?'\
'<br />site unavailable'\
- '<br />an error in the fetching regular expression'))
+ '<br />an error in the fetching regular expression'\
+ '<br />(exception: %s)'%(str(e))))
self._fetchCnt=0
def resetTxt(self, song=None):
diff --git a/plugins/Tabs.py b/plugins/Tabs.py
index 5dc2aa2..811096a 100644
--- a/plugins/Tabs.py
+++ b/plugins/Tabs.py
@@ -99,7 +99,7 @@ class wgTabs(QtGui.QWidget):
# construct URL to search!
SE=self.p.getSetting('engine')
try:
- ret=fetch(SE, sites, song, {})
+ ret=fetch(SE, sites, song, {}, stripHTML=False)
if ret:
txt='<pre>%s<br /><br /><a href="%s">%s</a></pre>'%(ret[0],ret[1],ret[1])
# save for later use!