Commits

Damián Nohales committed c9df2ba

Some minor improvements on the player and some typo fixed.

Comments (0)

Files changed (2)

                 self.lovebutton.set_sensitive(True)
             except pylast.WSError:
                 error = guihelpers.ErrorMessage(self.window,
-                            _("Check your password and username for Last.fm"))
+                            _("Please check your username and password for Last.fm"))
                 error.show_all()
                 pass
 
                 _("<b>Playing:</b> {artist} - {title}").format(artist = glib.markup_escape_text(song.get_artist()),
                                          title = glib.markup_escape_text(song.get_title()))
             )
-            if int(config()['show_notification']) == 1:
+            if int(config()['show_notification']) == 1 and env().HAVE_NOTIFY:
                 n = pynotify.Notification(_("Now playing"),
                     "%s - %s" % (glib.markup_escape_text(song.get_artist()),
                                  glib.markup_escape_text(song.get_title())),
             if self.play_thread != None:
                 # Avoid the current song streaming
                 self.play_thread.stop()
-                self.play_thread.join();
+                self.play_thread.join()
             self.play_thread = PlayThread(self, song)
             self.play_thread.start()
         else:
+            if self.play_thread != None:
+                self.play_thread.stop()
+            
             self.staticon.change_status_stopped()
             play_stop_image = gtk.Image()
             play_stop_image.set_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_MENU)
                     time.sleep(1)
                 else:
                     error = guihelpers.ErrorMessage(None,
-                                    "grooveshark service has probably changed!\n" +
+                                    "GrooveShark service has probably changed!\n" +
                                     "gSharkDown will not function propperly, so please" +
-                                    "be patient till we find a sallution")
+                                    "be patient until we find a solution.")
                     error.show_all()
                     p = 0
                     self.stop()
             key = groove.getStreamKeyFromSongIDEx(self.song.get_id())
         except Exception, e:
             print e
+            
+        if self.stopped():
+            return
+        
         playurls = "http://%s/stream.php?streamKey=%s"
         play_url = playurls % (key["result"]["%s" % self.song.get_id()]["ip"],
                                key["result"]["%s" % self.song.get_id()]["streamKey"])
 #        return gst.BUS_PASS
 
     def on_stopped(self, config, widget = None, data = None):
-        """
-        Called when the player reaches the end of the stream
-        sets state gst.STATE_NULL and calls the play_next 
-        method.
-        """
         gobject.idle_add(self.app.play_next)
 
-#    def update_buttons(self, state):
-#        if state == gst.STATE_NULL:
-#            self.win.play_button.set_stock_id(gtk.STOCK_MEDIA_PLAY)
-#        else:
-#            self.win.play_button.set_stock_id(gtk.STOCK_MEDIA_STOP)
-
     def stop(self):
         self._stop.set()