Index: configure.ac
===================================================================
--- configure.ac	(revision 5494)
+++ configure.ac	(working copy)
@@ -1093,6 +1093,7 @@
 plugins/power-manager/Makefile
 plugins/visualizer/Makefile
 plugins/mmkeys/Makefile
+plugins/infobrowser/Makefile
 bindings/Makefile
 bindings/python/Makefile
 bindings/vala/Makefile
Index: plugins/infobrowser/infobrowser.py
===================================================================
--- plugins/infobrowser/infobrowser.py	(revision 0)
+++ plugins/infobrowser/infobrowser.py	(revision 0)
@@ -0,0 +1,153 @@
+#
+# Copyright 2006 Alex Lancaster
+# Copyright 2007 John Daiker
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation
+
+import os, string
+import gtk, gobject
+import urllib
+from xml.dom import minidom
+import threading
+from gettext import gettext as _
+import rb
+import rhythmdb
+
+site_list = \
+	{
+	'allmusic': ('All Music Guide', "http://www.allmusic.com/cg/amg.dll?p=amg&opt1=1&sql=%s","http://www.allmusic.com/cg/amg.dll?p=amg&opt1=2&sql=%s", '+', 0),
+	'discogs': ('Discogs', "http://www.discogs.com/search?type=artists&q=%s", "http://www.discogs.com/search?type=releases&q=%s+-+%s", '+', 1),
+	'google': ('Google music', "http://www.google.com/musicsearch?q=%s&res=artist", "http://www.google.com/musicsearch?q=%s&res=album", '+', 0),
+	'lastfm': ('Last.fm', "http://www.lastfm.com/music/%s", "http://www.lastfm.com/music/%s/%s", '+', 1),
+	'wikipedia': ('Wikipedia', "http://en.wikipedia.org/wiki/%s","http://en.wikipedia.org/wiki/%s", '_', 0),
+	}
+
+site_menu_headers = \
+	[('ViewArtistInfo', 'rb-artist-info', _("Artist _Info")),
+	 ('ViewAlbumInfo', 'rb-album-info', _("Album I_nfo"))]
+
+class InfoBrowserPlugin(rb.Plugin):
+
+    def __init__ (self):
+	rb.Plugin.__init__ (self)
+
+    def activate (self, shell):
+	self.action_group = gtk.ActionGroup ('InfoBrowserPluginActions')
+
+	uim = shell.get_ui_manager ()
+
+	ui_file = self.find_file("infobrowser-ui.xml")
+	uim.add_ui_from_file(ui_file)
+       
+	site_menu_album_entries = \
+		[('ViewAlbumInfoAllmusic', 'rb-album-info', _("_AllMusic"), None, None, self.show_info_album),
+		('ViewAlbumInfoDiscogs', 'rb-album-info', _("_Discogs"), None, None, self.show_info_album),
+		('ViewAlbumInfoGoogle', 'rb-album-info', _("_Google"), None, None, self.show_info_album),
+		('ViewAlbumInfoLastfm', 'rb-album-info', _("_Last.fm"), None, None, self.show_info_album),
+		('ViewAlbumInfoWikipedia', 'rb-album-info', _("_Wikipedia"), None, None, self.show_info_album)]
+
+	site_menu_artist_entries = \
+		[('ViewArtistInfoAllmusic', 'rb-artist-info', _("_AllMusic"), None, None, self.show_info_artist),
+		('ViewArtistInfoDiscogs', 'rb-artist-info', _("_Discogs"), None, None, self.show_info_artist),
+		('ViewArtistInfoGoogle', 'rb-artist-info', _("_Google"), None, None, self.show_info_artist),
+		('ViewArtistInfoLastfm', 'rb-artist-info', _("_Last.fm"), None, None, self.show_info_artist),
+		('ViewArtistInfoWikipedia', 'rb-artist-info', _("_Wikipedia"), None, None, self.show_info_artist)]
+
+	self.action_group.add_actions (site_menu_headers)
+
+	self.action_group.add_actions (site_menu_artist_entries, user_data=shell)
+
+	self.action_group.add_actions (site_menu_album_entries, user_data=shell)
+
+	uim.insert_action_group (self.action_group, 0)
+	uim.ensure_update ()
+
+    def deactivate (self, shell):
+	uim = shell.get_ui_manager()
+	uim.remove_action_group (self.action_group)
+
+	self.action = None
+	self.action_group = None
+
+
+    def show_info_artist (self, action, shell):
+
+	db = shell.get_property ("db")
+	sp = shell.get_player ()
+	selected_source = shell.get_property("selected-source")
+	ev = selected_source.get_entry_view()
+
+	# take first entry in list
+	entry = ev.get_selected_entries()[0]
+
+	artist = db.entry_get(entry, rhythmdb.PROP_ARTIST)
+	artist = urllib.quote(artist)
+
+	if(action.get_name() == "ViewArtistInfoAllmusic"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["allmusic"]
+	elif(action.get_name() == "ViewArtistInfoDiscogs"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["discogs"]
+	if(action.get_name() == "ViewArtistInfoGoogle"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["google"]
+	elif(action.get_name() == "ViewArtistInfoLastfm"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["lastfm"]
+	elif(action.get_name() == "ViewArtistInfoWikipedia"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["wikipedia"]
+	else:
+		print "The following action was not defined: %s" % action.get_name()
+
+	# Generate URL
+	url = baseurl_artist % string.replace(artist, ' ', escape)
+
+	print "Artistbrowser link: %s\n" % url
+
+	#webbrowser.open(data)
+	## use gnome-open, less Pythonic, but uses current GNOME browser
+	os.system("gnome-open '%s'" % url)
+
+
+    def show_info_album (self, action, shell):
+
+	db = shell.get_property ("db")
+	sp = shell.get_player ()
+	selected_source = shell.get_property("selected-source")
+	ev = selected_source.get_entry_view()
+
+	# take first entry in list
+	entry = ev.get_selected_entries()[0]
+
+	artist = db.entry_get(entry, rhythmdb.PROP_ARTIST)
+	artist = urllib.quote(artist)
+
+	album = db.entry_get(entry, rhythmdb.PROP_ALBUM)
+	album = urllib.quote(album)
+
+	if(action.get_name() == "ViewAlbumInfoAllmusic"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["allmusic"]
+	elif(action.get_name() == "ViewAlbumInfoDiscogs"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["discogs"]
+	if(action.get_name() == "ViewAlbumInfoGoogle"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["google"]
+	elif(action.get_name() == "ViewAlbumInfoLastfm"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["lastfm"]
+	elif(action.get_name() == "ViewAlbumInfoWikipedia"):
+		site_name, baseurl_artist, baseurl_album, escape, both_for_album = site_list["wikipedia"]
+	else:
+		print "The following action was not defined: %s" % action.get_name()
+
+
+	# Generate URL
+	if both_for_album:
+	    url = baseurl_album % (string.replace(artist, ' ', escape), string.replace(album, ' ', escape))
+	else:
+	    url = baseurl_album % string.replace(album, ' ', escape)
+
+	print "Artistbrowser link: %s\n" % url
+
+	#webbrowser.open(data)
+	## use gnome-open, less Pythonic, but uses current GNOME browser
+	os.system("gnome-open '%s'" % url)
+
+
Index: plugins/infobrowser/infobrowser-ui.xml
===================================================================
--- plugins/infobrowser/infobrowser-ui.xml	(revision 0)
+++ plugins/infobrowser/infobrowser-ui.xml	(revision 0)
@@ -0,0 +1,84 @@
+<ui>
+  <popup name="BrowserSourceViewPopup">
+    <separator/>
+      <menu name="ViewArtistInfo" action="ViewArtistInfo">
+        <menuitem name="ViewArtistInfoAllmusic" action="ViewArtistInfoAllmusic"/>
+        <menuitem name="ViewArtistInfoDiscogs" action="ViewArtistInfoDiscogs"/>
+        <menuitem name="ViewArtistInfoGoogle" action="ViewArtistInfoGoogle"/>
+        <menuitem name="ViewArtistInfoLastfm" action="ViewArtistInfoLastfm"/>
+        <menuitem name="ViewArtistInfoWikipedia" action="ViewArtistInfoWikipedia"/>
+      </menu>
+      <menu name="ViewAlbumInfo" action="ViewAlbumInfo">
+        <menuitem name="ViewAlbumInfoAllmusic" action="ViewAlbumInfoAllmusic"/>
+        <menuitem name="ViewAlbumInfoDiscogs" action="ViewAlbumInfoDiscogs"/>
+        <menuitem name="ViewAlbumInfoGoogle" action="ViewAlbumInfoGoogle"/>
+        <menuitem name="ViewAlbumInfoLastfm" action="ViewAlbumInfoLastfm"/>
+        <menuitem name="ViewAlbumInfoWikipedia" action="ViewAlbumInfoWikipedia"/>
+      </menu>
+  </popup>
+  <popup name="PlaylistViewPopup">
+      <menu name="ViewArtistInfo" action="ViewArtistInfo">
+        <menuitem name="ViewArtistInfoAllmusic" action="ViewArtistInfoAllmusic"/>
+        <menuitem name="ViewArtistInfoDiscogs" action="ViewArtistInfoDiscogs"/>
+        <menuitem name="ViewArtistInfoGoogle" action="ViewArtistInfoGoogle"/>
+        <menuitem name="ViewArtistInfoLastfm" action="ViewArtistInfoLastfm"/>
+        <menuitem name="ViewArtistInfoWikipedia" action="ViewArtistInfoWikipedia"/>
+      </menu>
+      <menu name="ViewAlbumInfo" action="ViewAlbumInfo">
+        <menuitem name="ViewAlbumInfoAllmusic" action="ViewAlbumInfoAllmusic"/>
+        <menuitem name="ViewAlbumInfoDiscogs" action="ViewAlbumInfoDiscogs"/>
+        <menuitem name="ViewAlbumInfoGoogle" action="ViewAlbumInfoGoogle"/>
+        <menuitem name="ViewAlbumInfoLastfm" action="ViewAlbumInfoLastfm"/>
+        <menuitem name="ViewAlbumInfoWikipedia" action="ViewAlbumInfoWikipedia"/>
+      </menu>
+  </popup>
+  <popup name="AutoPlaylistSourcePopup">
+      <menu name="ViewArtistInfo" action="ViewArtistInfo">
+        <menuitem name="ViewArtistInfoAllmusic" action="ViewArtistInfoAllmusic"/>
+        <menuitem name="ViewArtistInfoDiscogs" action="ViewArtistInfoDiscogs"/>
+        <menuitem name="ViewArtistInfoGoogle" action="ViewArtistInfoGoogle"/>
+        <menuitem name="ViewArtistInfoLastfm" action="ViewArtistInfoLastfm"/>
+        <menuitem name="ViewArtistInfoWikipedia" action="ViewArtistInfoWikipedia"/>
+      </menu>
+      <menu name="ViewAlbumInfo" action="ViewAlbumInfo">
+        <menuitem name="ViewAlbumInfoAllmusic" action="ViewAlbumInfoAllmusic"/>
+        <menuitem name="ViewAlbumInfoDiscogs" action="ViewAlbumInfoDiscogs"/>
+        <menuitem name="ViewAlbumInfoGoogle" action="ViewAlbumInfoGoogle"/>
+        <menuitem name="ViewAlbumInfoLastfm" action="ViewAlbumInfoLastfm"/>
+        <menuitem name="ViewAlbumInfoWikipedia" action="ViewAlbumInfoWikipedia"/>
+      </menu>
+  </popup>
+  <popup name="QueueSidebarViewPopup">
+      <menu name="ViewArtistInfo" action="ViewArtistInfo">
+        <menuitem name="ViewArtistInfoAllmusic" action="ViewArtistInfoAllmusic"/>
+        <menuitem name="ViewArtistInfoDiscogs" action="ViewArtistInfoDiscogs"/>
+        <menuitem name="ViewArtistInfoGoogle" action="ViewArtistInfoGoogle"/>
+        <menuitem name="ViewArtistInfoLastfm" action="ViewArtistInfoLastfm"/>
+        <menuitem name="ViewArtistInfoWikipedia" action="ViewArtistInfoWikipedia"/>
+      </menu>
+      <menu name="ViewAlbumInfo" action="ViewAlbumInfo">
+        <menuitem name="ViewAlbumInfoAllmusic" action="ViewAlbumInfoAllmusic"/>
+        <menuitem name="ViewAlbumInfoDiscogs" action="ViewAlbumInfoDiscogs"/>
+        <menuitem name="ViewAlbumInfoGoogle" action="ViewAlbumInfoGoogle"/>
+        <menuitem name="ViewAlbumInfoLastfm" action="ViewAlbumInfoLastfm"/>
+        <menuitem name="ViewAlbumInfoWikipedia" action="ViewAlbumInfoWikipedia"/>
+      </menu>
+  </popup>
+  <popup name="QueuePlaylistViewPopup">
+      <menu name="ViewArtistInfo" action="ViewArtistInfo">
+        <menuitem name="ViewArtistInfoAllmusic" action="ViewArtistInfoAllmusic"/>
+        <menuitem name="ViewArtistInfoDiscogs" action="ViewArtistInfoDiscogs"/>
+        <menuitem name="ViewArtistInfoGoogle" action="ViewArtistInfoGoogle"/>
+        <menuitem name="ViewArtistInfoLastfm" action="ViewArtistInfoLastfm"/>
+        <menuitem name="ViewArtistInfoWikipedia" action="ViewArtistInfoWikipedia"/>
+      </menu>
+      <menu name="ViewAlbumInfo" action="ViewAlbumInfo">
+        <menuitem name="ViewAlbumInfoAllmusic" action="ViewAlbumInfoAllmusic"/>
+        <menuitem name="ViewAlbumInfoDiscogs" action="ViewAlbumInfoDiscogs"/>
+        <menuitem name="ViewAlbumInfoGoogle" action="ViewAlbumInfoGoogle"/>
+        <menuitem name="ViewAlbumInfoLastfm" action="ViewAlbumInfoLastfm"/>
+        <menuitem name="ViewAlbumInfoWikipedia" action="ViewAlbumInfoWikipedia"/>
+      </menu>
+  </popup>
+</ui>
+
Index: plugins/infobrowser/infobrowser.rb-plugin
===================================================================
--- plugins/infobrowser/infobrowser.rb-plugin	(revision 0)
+++ plugins/infobrowser/infobrowser.rb-plugin	(revision 0)
@@ -0,0 +1,9 @@
+[RB Plugin]
+Loader=python
+Module=infobrowser
+IAge=1
+Name=Artist/Album Info Browser
+Description=Launches web browser showing info for selected artist/album
+Authors=Alex Lancaster & John Daiker
+Copyright=Copyright © 2006-2007 Alex Lancaster and John Daiker
+Website=http://www.rhythmbox.org/
Index: plugins/Makefile.am
===================================================================
--- plugins/Makefile.am	(revision 5494)
+++ plugins/Makefile.am	(working copy)
@@ -25,7 +25,8 @@
 	magnatune					\
 	jamendo						\
 	coherence					\
-	rb
+	rb						\
+	infobrowser
 endif
 
 if ENABLE_VALA
