[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/scripts/lyrics_astraweb
From:       Mark Kretschmann <markey () web ! de>
Date:       2006-01-23 16:22:50
Message-ID: 1138033370.815604.32068.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 501659 by markey:

more regexp fun

 M  +15 -1     lyrics_astraweb.rb  


--- trunk/extragear/multimedia/amarok/src/scripts/lyrics_astraweb/lyrics_astraweb.rb #501658:501659
@@ -31,7 +31,17 @@
     body = response.body()
     body = body[body.index( '<tr><td bgcolor="#BBBBBB"' )..body.index( "More Songs &gt;" ) - 1]
 
-    puts( body )
+    entries = body.split( '<tr><td bgcolor="#BBBBBB"' )
+    entries.delete_at( 0 )
+
+    lyrics = "Suggestions : <br>"
+    entries.each do |entry|
+        url = /http:\/\/display.[^"]*/.match( entry ).to_s()
+        title = /(http:\/\/display.*">)([^<]*)/.match( entry )[2].to_s()
+        lyrics += title + "\n"
+    end
+
+    puts( lyrics )
 #     showLyrics( lyrics )
 end
 
@@ -40,6 +50,10 @@
 # MAIN
 ##################################################################
 
+fetchLyrics( "radio", "gaga" )
+exit()
+
+
 loop do
     message = gets().chomp()
     command = /[A-Za-z]*/.match( message ).to_s()
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic