Re: [Banshee-List] Boston Summit - Banshee Lyrics Plugin



Okay, the lyrics website is back up but they've changed their HTML
format a little, so I've attached a patch that accounts for that (also
includes changes from other patches).

I've experienced some weird behavior but I can't tell if it comes from
the plugin... the GUI seems to freeze up in strange ways, like it
won't resize properly, or I can change songs but the arrow doesn't
move to the selected song and the line doesn't turn bold like it
should.  I can't reliably reproduce these.  I'm using 0.11.0 from the
Edgy package.

Next feature needed for this cool plugin: ability to resize lyrics pane.

Hope people find this patch useful,
Sandy

On 10/15/06, Sanford Armstrong <sanfordarmstrong gmail com> wrote:
Sorry for all the spam... here's an updated patch that puts the lyrics
pane showing stuff in a separate thread so you don't have to wait 10
seconds to hear your song.

I'm really looking forward to this website coming back online so I can
play with this plugin more!

Sandy

On 10/15/06, Sanford Armstrong <sanfordarmstrong gmail com> wrote:
> Patch attached to suppress error (but you still have to wait a few
> seconds for your song to start).
>
> On 10/15/06, Sanford Armstrong <sanfordarmstrong gmail com> wrote:
> > I think the lyrc website is just down.  I'm getting the same problem
> > as you, and I think it's just because I can't resolve
> > http://lyrc.com.ar .
> >
> > Sandy
> >
> > On 10/15/06, Nil Gradisnik <ghaefbgtk gmail com> wrote:
> > > Running Ubuntu Edgy updated, mono 1.1.7.1, banshee 0.11.0,
> > > banshee-lyrics-plugin-0.1.
> > >
> > > When I enable plugin and start the playback banshee pauses for a few
> > > seconds, I get warrning message in a window: Playback Error, The
> > > request timed out.
> > >
> > > And this is the --debug output:
> > >
> > > Could not fetch recommendations: Text node cannot appear in this
> > > state.  Line 903, position 18.
> > > System.Net.WebException: The request timed out
> > >   at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult
> > > asyncResult) [0x0006e] in
> > > /build/buildd/mono-1.1.17.1/mcs/class/System/System.Net/HttpWebRequest.cs:721
> > >   at System.Net.HttpWebRequest.GetResponse () [0x0000e] in
> > > /build/buildd/mono-1.1.17.1/mcs/class/System/System.Net/HttpWebRequest.cs:726
> > >   at Banshee.Plugins.Lyrics.Base.GetSource (System.String url) [0x00000]
> > >   at Banshee.Plugins.Lyrics.Lyrc.GetLyrics (System.String Artist,
> > > System.String Song) [0x00000]
> > >   at Banshee.Plugins.Lyrics.LyricsPane.ShowPane (System.String artist,
> > > System.String title) [0x00000]
> > >   at Banshee.Plugins.Lyrics.LyricsPlugin.ShowPane (System.String
> > > artist, System.String title) [0x00000]
> > >   at Banshee.Plugins.Lyrics.LyricsPlugin.OnPlayerEngineEventChanged
> > > (System.Object o, Banshee.MediaEngine.PlayerEngineEventArgs args)
> > > [0x00000]
> > >   at (wrapper delegate-invoke)
> > > System.MulticastDelegate:invoke_void_object_PlayerEngineEventArgs
> > > (object,Banshee.MediaEngine.PlayerEngineEventArgs)
> > >   at Banshee.Base.PlayerEngineCore.OnEngineEventChanged (System.Object
> > > o, Banshee.MediaEngine.PlayerEngineEventArgs args) [0x00018] in
> > > /build/buildd/banshee-0.11.0/src/Banshee.Base/PlayerEngineCore.cs:127
> > >   at (wrapper delegate-invoke)
> > > System.MulticastDelegate:invoke_void_object_PlayerEngineEventArgs
> > > (object,Banshee.MediaEngine.PlayerEngineEventArgs)
> > >   at Banshee.MediaEngine.PlayerEngine.RaiseEventChanged
> > > (PlayerEngineEvent evnt, System.String message, Double
> > > bufferingPercent) [0x00028] in
> > > /build/buildd/banshee-0.11.0/src/Banshee.Base/MediaEngine/PlayerEngine.cs:202
> > >   at Banshee.MediaEngine.PlayerEngine.OnEventChanged
> > > (PlayerEngineEvent evnt, System.String message, Double
> > > bufferingPercent) [0x0002c] in
> > > /build/buildd/banshee-0.11.0/src/Banshee.Base/MediaEngine/PlayerEngine.cs:186
> > >   at Banshee.MediaEngine.PlayerEngine.OnEventChanged
> > > (PlayerEngineEvent evnt) [0x00000] in
> > > /build/buildd/banshee-0.11.0/src/Banshee.Base/MediaEngine/PlayerEngine.cs:175
> > >   at Banshee.MediaEngine.PlayerEngine.HandleOpen (Banshee.Base.SafeUri
> > > uri) [0x00018] in
> > > /build/buildd/banshee-0.11.0/src/Banshee.Base/MediaEngine/PlayerEngine.cs:122
> > > Error: [10/15/2006 3:21:30 PM] (Playback Error) - The request timed out
> > >
> > >
> > >
> > > On 10/13/06, Aaron Bockover <abockover novell com> wrote:
> > > > Adam gave a great demo of this on Monday after his work throughout the
> > > > weekend at the GNOME Summit in Boston. I'd encourage everyone to give
> > > > this plugin a try!
> > > >
> > > > --Aaron
> > > >
> > > > On Wed, 2006-10-11 at 03:10 -0500, Adam Israel wrote:
> > > > > I hacked together my first Banshee plugin during the Boston Summit this
> > > > > past weekend.  It is a simple plugin that will fetch and display the
> > > > > lyrics for the currently-playing song.
> > > > >
> > > > > http://battleaxe.net/projects/banshee/plugins/lyrics/
> > > > >
> > > > > -- Adam
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Banshee-list mailing list
> > > > > Banshee-list gnome org
> > > > > http://mail.gnome.org/mailman/listinfo/banshee-list
> > > >
> > > > _______________________________________________
> > > > Banshee-list mailing list
> > > > Banshee-list gnome org
> > > > http://mail.gnome.org/mailman/listinfo/banshee-list
> > > >
> > > _______________________________________________
> > > Banshee-list mailing list
> > > Banshee-list gnome org
> > > http://mail.gnome.org/mailman/listinfo/banshee-list
> > >
> >
>
>
>



=== modified file 'src/Lyrics/Base.cs'
--- src/Lyrics/Base.cs	2006-10-09 18:12:09 +0000
+++ src/Lyrics/Base.cs	2006-10-15 17:06:24 +0000
@@ -34,7 +34,13 @@
 
             request.Timeout = 10000;
 
-            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+            HttpWebResponse response;
+            
+            try {
+                response = (HttpWebResponse)request.GetResponse();
+            } catch (System.Net.WebException) {
+                return source;
+            }
 
 
             if(response.ContentLength == 0) {

=== modified file 'src/Lyrics/Lyrc.cs'
--- src/Lyrics/Lyrc.cs	2006-10-09 18:12:09 +0000
+++ src/Lyrics/Lyrc.cs	2006-10-18 01:48:59 +0000
@@ -26,7 +26,7 @@
 
             string lyrics = "";
 
-            Regex r = new Regex ("</table>(.*?)<p>",
+            Regex r = new Regex ("</table>(.*?)<br><br>",
                                  RegexOptions.IgnorePatternWhitespace |
                                  RegexOptions.Multiline|RegexOptions.IgnoreCase |
                                  RegexOptions.Singleline);

=== modified file 'src/LyricsPlugin.cs'
--- src/LyricsPlugin.cs	2006-10-09 18:46:39 +0000
+++ src/LyricsPlugin.cs	2006-10-15 17:08:22 +0000
@@ -1,4 +1,5 @@
 using System;
+using System.Threading;
 using Gtk;
 using GConf;
 
@@ -10,6 +11,27 @@
 
 namespace Banshee.Plugins.Lyrics
 {
+    public class PaneShower
+    {
+        private string artist;
+        private string title;
+        private LyricsPane pane;
+
+        public PaneShower (string artist, string title, LyricsPane pane)
+        {
+            this.artist = artist;
+            this.title = title;
+            this.pane = pane;
+        }
+
+        public void ShowPane ()
+        {
+            pane.ShowPane(artist,title);
+        }
+    }
+
+
+
     public class LyricsPlugin : Banshee.Plugins.Plugin
     {
         private GConf.Client gconf;
@@ -103,8 +125,9 @@
                     HidePane();
                 }
 
-                pane.ShowPane(artist, title);
-
+                PaneShower paneShower = new PaneShower(artist,title,pane);
+                Thread thread = new Thread(paneShower.ShowPane);
+                thread.Start();
             }
         }
 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]