Commits

Damián Nohales  committed 87e74fa Merge

Merge vkolev changes

  • Participants
  • Parent commits c9df2ba, 828a35f

Comments (0)

Files changed (4)

File lib/SharkDown.py

         """
         Tries to retrieve lyrics for selected song from the playlist.
         """
-        if self.current_song != None:
-            t = LyricsThread(self, self.current_song)
+        if self.playlist.playing_song != None:
+            t = LyricsThread(self, self.playlist.playing_song)
             t.start()
         else:
             info = guihelpers.InfoDialog(self.window,

File lib/guihelpers.py

         @param message : The error message to be shown
         """
         gtk.MessageDialog.__init__(self, parent,
-                            gtk.DIALOG_DESTROY_WITH_PARENT,
+                            gtk.DIALOG_MODAL,
                             gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message)
         self.set_default_response(gtk.RESPONSE_OK)
         self.set_title(_("Error"))

File lib/lyrdblib.py

         query = artist.replace(" ", "+")
         query += "+"
         query += track.replace(" ", "+")
-
-    req = urllib2.urlopen(LOOKUP_URL % (query, method))
-    result = req.read()
-    resp = ""
-    if "error" in result:
+    try:
+        req = urllib2.urlopen(LOOKUP_URL % (query, method))
+        result = req.read()
+        resp = ""
+        if "error" in result:
+            resp = "error"
+        elif result == "":
+            resp = "error"
+        else:
+            t = result.splitlines()
+            resp = t[0].split("\\")[0]
+    except:
         resp = "error"
-    elif result == "":
-        resp = "error"
-    else:
-        t = result.splitlines()
-        resp = t[0].split("\\")[0]
     return resp
 
 def searchchart(artist, track):
     """
     artist = artist.replace(" ", "%20")
     track = track.replace(" ", "%20")
-
-    req = urllib2.urlopen(CHART_URL % (artist, track))
-    result = req.read()
-    resp = ""
-    if "<LyricChecksum>" in result:
-        lyric = ElementTree.fromstring(result)
-        lyr = lyric.getchildren()[len(lyric.getchildren()) - 1]
-        resp = lyr.text
-    else:
+    try:
+        req = urllib2.urlopen(CHART_URL % (artist, track))
+        result = req.read()
+        resp = ""
+        if "<LyricChecksum>" in result:
+            lyric = ElementTree.fromstring(result)
+            lyr = lyric.getchildren()[len(lyric.getchildren()) - 1]
+            resp = lyr.text
+        else:
+            resp = "error"
+    except:
         resp = "error"
     return resp

File lib/tfuncs.py

                     self.app.result.append_song(Song(song_data))
         except Exception, e:
             print e.args
+        
+        self.__stop()
 
 
 class UpdateThread(threading.Thread):
         if "ERROR:" in lyrics:
             error = guihelpers.ErrorMessage(None,
                 lyrics)
-            error.show_all()
+            error.run()
         else:
             lyrdiag = guihelpers.LyricsDialog(self.song, lyrics)
             lyrdiag.show_all()