Firstly, I can't think of a single reason why someone would want to look at the lyrics, without listening to the song. If you have some please share. Now that that's out of the system, people that want that can easily click on the desired song, bring it's properties, and look at the lyrics there. The two displays are totally independent. For the rest of us, I think that changing the lyrics with the song is a good thing (tm). p.s. Here's a second patch (It includes the first). It changes the title of the window to the current song. There's a bug when first showing the lyrics window, the lyrics don't get shown (only the "Searching for ..." part). They start changing when that current song changes. Perhaps someone that actually knows python can fix that. Ð ÐÐ, 2006-05-22 Ð 10:26 +1000, Jonathan Matthew ÐÐÐÐÑÐ: > On Sun, May 21, 2006 at 12:21:22AM +0300, ÐÐÐÑÐÑ ÐÐÐÑÑÐÑÐÐ wrote: > > this small patch makes the plugin search for new lyrics on song change. > > I simply copied the code from the coverart plugin. Also, since I don't > > know a thing about python or it's syntax, there's a posibility that i've > > introduced a bug or two. Seems to work here though. > > I'm not sure this is a good idea. If the user requests the lyrics for > one song, it doesn't mean they necessarily want the lyrics for the next > one. If we automatically get the lyrics for the next song, there's no > easy way to go back. If we don't, the user can just use View->Song > Lyrics again. > > _______________________________________________ > rhythmbox-devel mailing list > rhythmbox-devel gnome org > http://mail.gnome.org/mailman/listinfo/rhythmbox-devel -- ÐÐÐÑÐÑ ÐÐÐÑÑÐÑÐÐ /Viktor Kojouharov/ <vkojouharov gmail org>
Index: plugins/lyrics/lyrics.py =================================================================== RCS file: /cvs/gnome/rhythmbox/plugins/lyrics/lyrics.py,v retrieving revision 1.2 diff -u -r1.2 lyrics.py --- plugins/lyrics/lyrics.py 19 May 2006 08:46:26 -0000 1.2 +++ plugins/lyrics/lyrics.py 22 May 2006 07:22:56 -0000 @@ -212,6 +212,7 @@ self.window = None def activate (self, shell): + self.shell = shell self.action = gtk.Action ('ViewSongLyrics', _('Song L_yrics'), _('Display lyrics for the playing song'), 'rb-song-lyrics') @@ -227,11 +228,14 @@ sp = shell.get_player () self.pec_id = sp.connect('playing-song-changed', self.playing_entry_changed) + self.pc_id = sp.connect ('playing-changed', self.playing_changed) self.playing_entry_changed (sp, sp.get_playing_entry ()) self.csi_id = shell.connect('create_song_info', self.create_song_info) + self.current_entry = None def deactivate (self, shell): + self.shell = None uim = shell.get_ui_manager() uim.remove_ui (self.ui_id) @@ -242,32 +246,52 @@ sp = shell.get_player () sp.disconnect (self.pec_id) + sp.disconnect (self.pc_id) + sp.disconnect (self.csi_id) if self.window is not None: self.window.destroy () def playing_entry_changed (self, sp, entry): - if entry is not None: - self.action.set_sensitive (True) - else: - self.action.set_sensitive (False) + self.set_entry (entry) + + def playing_changed (self, sp, playing): + self.set_entry(sp.get_playing_entry ()) + + def set_entry (self, entry): + if entry is None: + return + + if entry == self.current_entry: + return + + if self.window is None: + return + + self.current_entry = entry + db = self.shell.get_property ("db") + sp = self.shell.get_player () + + self.window.buffer.set_text("Searching for lyrics...") + title = db.entry_get(entry, rhythmdb.PROP_TITLE) + artist = db.entry_get(entry, rhythmdb.PROP_ARTIST) + self.window.set_title(title + " - " + artist + " - Lyrics") + + lyrics_grabber = LyricGrabber() + lyrics_grabber.get_lyrics(db, entry, self.window.buffer.set_text) def show_song_lyrics (self, action, shell): if self.window is not None: self.window.destroy () + self.current_entry = None db = shell.get_property ("db") sp = shell.get_player () entry = sp.get_playing_entry () - - if entry is None: - return - self.window = LyricWindow(db, entry) - lyrics_grabber = LyricGrabber() - lyrics_grabber.get_lyrics(db, entry, self.window.buffer.set_text) + self.set_entry (entry) def create_song_info (self, shell, song_info, is_multiple):
Attachment:
signature.asc
Description: =?iso-8859-5?Q?=C2=DE=D2=D0?= =?iso-8859-5?Q?_=D5?= =?iso-8859-5?Q?_=E6=D8=E4=E0=DE=D2=DE?= =?iso-8859-5?Q?_=DF=DE=D4=DF=D8=E1=D0=DD=D0?= =?iso-8859-5?Q?_=E7=D0=E1=E2?= =?iso-8859-5?Q?_=DE=E2?= =?iso-8859-5?Q?_=DF=D8=E1=DC=DE=E2=DE?=