[banshee: 7/61] [InternetArchive] Add more columns, feedback



commit 2b35f775032daaf93004168ed3456ed7ff9e0121
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Oct 7 15:42:11 2009 -0700

    [InternetArchive] Add more columns, feedback
    
    Average rating, total downloads, publisher, year and more now shown.
    Collection filter fixed.  Search entry added.  Context menu action to
    open an item's webpage added. Live Music Archive set as default
    collection.  Refresh button changed to Search button.  Year added as
    sort option.  Searching now happens off the GUI thread, and we show
    status messages while searching.  Total matches and matches shown now
    displayed in the status bar.

 .../Banshee.InternetArchive/Actions.cs             |   56 ++++++++++++
 .../Banshee.InternetArchive/HeaderFilters.cs       |   51 +++++++----
 .../Banshee.InternetArchive/Source.cs              |   94 ++++++++++++++++----
 .../InternetArchive/Field.cs                       |   28 +++---
 .../InternetArchive/Item.cs                        |   23 +++++-
 .../InternetArchive/JsonItem.cs                    |   10 ++-
 .../InternetArchive/JsonResults.cs                 |    5 -
 .../InternetArchive/MediaType.cs                   |   76 ++++++++--------
 .../InternetArchive/Search.cs                      |   23 +++--
 src/Extensions/Banshee.InternetArchive/Makefile.am |    5 +-
 .../Resources/ActiveSourceUI.xml                   |   31 +++++++
 11 files changed, 297 insertions(+), 105 deletions(-)
---
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Actions.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Actions.cs
new file mode 100644
index 0000000..3ee97cd
--- /dev/null
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Actions.cs
@@ -0,0 +1,56 @@
+//
+// Actions.cs
+//
+// Authors:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2009 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Mono.Unix;
+using Gtk;
+
+using IA=InternetArchive;
+
+namespace Banshee.InternetArchive
+{
+    public class Actions : Banshee.Gui.BansheeActionGroup
+    {
+        public Actions (Source source) : base ("InternetArchive")
+        {
+            Add (
+                new ActionEntry ("OpenItemWebsite", Stock.JumpTo, Catalog.GetString ("Open Webpage"), null, null, (o, a) => {
+                    var item = source.TrackModel.FocusedItem;
+                    if (item != null && item.Uri != null) {
+                        Banshee.Web.Browser.Open (item.Uri.AbsoluteUri);
+                    }
+                })
+            );
+
+            Register ();
+        }
+    }
+}
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs
index c6090db..4d217e5 100644
--- a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/HeaderFilters.cs
@@ -43,6 +43,7 @@ namespace Banshee.InternetArchive
 
         private ComboBox sort_combo, media_type_combo;
         private TreeStore media_type_store;
+        private Banshee.Widgets.SearchEntry search_entry;
 
         public HeaderFilters (Source source)
         {
@@ -50,9 +51,10 @@ namespace Banshee.InternetArchive
 
             Spacing = 6;
 
-            BuildSortCombo ();
             BuildMediaTypeCombo ();
-            BuildRefreshButton ();
+            BuildSortCombo ();
+            BuildSearchEntry ();
+            BuildSearchButton ();
 
             UpdateSearch ();
         }
@@ -60,30 +62,44 @@ namespace Banshee.InternetArchive
         private void BuildMediaTypeCombo ()
         {
             var store = media_type_store = new TreeStore (typeof (IA.MediaType), typeof (string));
+            var combo = media_type_combo = new ComboBox ();
+            combo.Model = store;
+
             foreach (var mediatype in IA.MediaType.Options.OrderBy (t => t.Name)) {
                 if (mediatype.Id != "software") {
                     var iter = store.AppendValues (mediatype, mediatype.Name);
 
                     if (mediatype.Children != null) {
                         foreach (var child in mediatype.Children.OrderBy (t => t.Name)) {
-                            store.AppendValues (iter, child, child.Name);
+                            var child_iter = store.AppendValues (iter, child, child.Name);
+
+                            // FIXME should remember the last selected one in a schema or per-source in the db
+                            if (child.Id == "etree")
+                                combo.SetActiveIter (child_iter);
                         }
                     }
                 }
             }
 
-            var combo = media_type_combo = new ComboBox ();
-            combo.Model = store;
-
             var cell = new CellRendererText ();
             combo.PackStart (cell, true);
             combo.AddAttribute (cell, "text", 1);
-            combo.Active = 0;
 
-            //PackStart (new Label (Catalog.GetString ("Show")), false, false, 0);
+            PackStart (new Label (Catalog.GetString ("Collection:")), false, false, 0);
             PackStart (combo, false, false, 0);
         }
 
+        private void BuildSearchEntry ()
+        {
+            var entry = search_entry = new Banshee.Widgets.SearchEntry () {
+                WidthRequest = 200,
+                Visible = true,
+                EmptyMessage = String.Format (Catalog.GetString ("Optional Query"))
+            };
+
+            PackStart (entry, false, false, 0);
+        }
+
         private void BuildSortCombo ()
         {
             var combo = sort_combo = ComboBox.NewText ();
@@ -91,15 +107,16 @@ namespace Banshee.InternetArchive
             combo.AppendText (Catalog.GetString ("Popular"));
             combo.AppendText (Catalog.GetString ("Popular This Week"));
             combo.AppendText (Catalog.GetString ("Highly Rated"));
+            combo.AppendText (Catalog.GetString ("Year"));
             combo.Active = 0;
 
-            //PackStart (new Label (Catalog.GetString ("Sort by")), false, false, 0);
+            PackStart (new Label (Catalog.GetString ("Sort by:")), false, false, 0);
             PackStart (combo, false, false, 0);
         }
 
-        private void BuildRefreshButton ()
+        private void BuildSearchButton ()
         {
-            var button = new Button (Stock.Refresh);
+            var button = new Hyena.Widgets.ImageButton (Catalog.GetString ("_Search"), Stock.Find);
             button.Clicked += (o, a) => {
                 UpdateSearch ();
                 source.Reload ();
@@ -112,17 +129,17 @@ namespace Banshee.InternetArchive
         {
             source.Search.Sorts.Clear ();
 
-            string [] sorts = { "downloads desc", "week asc", "avg_rating desc" };
+            string [] sorts = { "downloads desc", "week asc", "avg_rating desc", "year asc" };
             source.Search.Sorts.Add (new IA.Sort () { Id = sorts[sort_combo.Active] });
 
-            Console.WriteLine ("sort = {0}", sorts[sort_combo.Active]);
-
             TreeIter iter;
             if (media_type_combo.GetActiveIter (out iter)) {
-                var media_type = media_type_store.GetValue (iter, 0) as IA.MediaType;
-                Console.WriteLine ("media_type_combo.Active = {0}", media_type.Id);
-
+                var media_type = media_type_store.GetValue (iter, 0) as IA.FieldValue;
                 source.Search.Query = media_type.ToString ();
+
+                if (!String.IsNullOrEmpty (search_entry.Query)) {
+                    source.Search.Query += String.Format (" AND (title:\"{0}\" OR description:\"{0}\" OR creator:\"{0}\")", search_entry.Query);
+                }
             }
         }
     }
diff --git a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Source.cs b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Source.cs
index 309d2e6..3af5278 100644
--- a/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Source.cs
+++ b/src/Extensions/Banshee.InternetArchive/Banshee.InternetArchive/Source.cs
@@ -35,6 +35,7 @@ using Mono.Unix;
 using Hyena.Collections;
 using Hyena.Data.Sqlite;
 
+using Banshee.Base;
 using Banshee.Collection;
 using Banshee.Collection.Database;
 using Banshee.Configuration;
@@ -56,8 +57,10 @@ namespace Banshee.InternetArchive
     {
         private static string name = Catalog.GetString ("Internet Archive");
 
+        private Actions actions;
         private Gtk.Widget header_widget;
         private IA.Search search;
+        private string status_text = "";
 
         public IA.Search Search { get { return search; } }
 
@@ -77,6 +80,7 @@ namespace Banshee.InternetArchive
                   <add-default column=""IndicatorColumn"" visible=""true"" />
                   <add-default column=""TitleColumn"" visible=""true"" />
                   <add-default column=""ArtistColumn"" visible=""true"" />
+                  <add-default column=""ComposerColumn"" visible=""true"" />
                   <add-default column=""CommentColumn"" visible=""true"" />
                   <add-default column=""RatingColumn"" />
                   <add-default column=""DurationColumn"" visible=""true"" />
@@ -95,10 +99,19 @@ namespace Banshee.InternetArchive
                   <column modify-default=""CommentColumn"">
                     <title>{2}</title><long-title>{2}</long-title>
                   </column>
+                  <column modify-default=""ComposerColumn"">
+                    <title>{3}</title><long-title>{3}</long-title>
+                  </column>
                 </column-controller>",
-                Catalog.GetString ("Creator"), Catalog.GetString ("Downloads"), Catalog.GetString ("Description")
+                Catalog.GetString ("Creator"), Catalog.GetString ("Downloads"),
+                Catalog.GetString ("Description"), Catalog.GetString ("Publisher")
             ));
 
+            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
+            Properties.Set<bool> ("ActiveSourceUIResourcePropagate", true);
+
+            actions = new Actions (this);
+
             AfterInitialized ();
 
             DatabaseTrackModel.ForcedSortQuery = "CoreTracks.TrackID ASC";
@@ -111,47 +124,92 @@ namespace Banshee.InternetArchive
             }
         }
 
-        public override void Activate ()
+        public override void Reload ()
         {
-            base.Activate ();
+            ThreadAssist.SpawnFromMain (ThreadedReload);
         }
 
-        public override void Reload ()
+        private void ThreadedReload ()
         {
             bool success = false;
+            int total_results = 0;
+            status_text = "";
+
+            ThreadAssist.ProxyToMain (delegate {
+                SetStatus (Catalog.GetString ("Searching the Internet Archive"), false, true, "gtk-find");
+            });
 
             try {
                 var results = new IA.JsonResults (search.GetResults ());
+                total_results = results.TotalResults;
 
-                // TODO set the status bar w/ this
-                Console.WriteLine ("Have {0} total results, {1} current rows, and {2} is the offset", results.TotalResults, results.Count, results.Offset);
+                ServiceManager.DbConnection.BeginTransaction ();
 
-                RemoveTrackRange (DatabaseTrackModel, new RangeCollection.Range (0, Count - 1));
+                ServiceManager.DbConnection.Execute ("DELETE FROM CoreTracks WHERE PrimarySourceID = ?", this.DbId);
                 DatabaseTrackModel.Clear ();
 
                 foreach (var item in results.Items) {
                     var track = new DatabaseTrackInfo () {
                         PrimarySource = this,
-                        ArtistName = item.Get (IA.Field.Creator) ?? Catalog.GetString ("Unknown"),
-                        TrackTitle = item.Get (IA.Field.Title),
-                        Comment    = Hyena.StringUtil.RemoveHtml (item.Get (IA.Field.Description))
+                        ArtistName = item.GetJoined (IA.Field.Creator, ", ") ?? "",
+                        Comment    = Hyena.StringUtil.RemoveHtml (item.Get<string> (IA.Field.Description)),
+                        Composer   = item.GetJoined (IA.Field.Publisher, ", ") ?? "",
+                        LicenseUri = item.Get<string> (IA.Field.LicenseUrl),
+                        PlayCount  = (int) item.Get<double> (IA.Field.Downloads),
+                        Rating     = (int) Math.Round (item.Get<double> (IA.Field.AvgRating)),
+                        TrackTitle = item.Get<string> (IA.Field.Title),
+                        Uri        = new Banshee.Base.SafeUri (item.Url),
+                        MimeType   = item.GetJoined (IA.Field.Format, ", "),
+                        Year       = (int) item.Get<double> (IA.Field.Year)
                     };
 
+                    if (track.Comment == "There is currently no description for this item.")
+                        track.Comment = null;
+
                     track.Save (false);
                 }
 
-                base.Reload ();
+                ServiceManager.DbConnection.CommitTransaction ();
                 success = true;
             } catch (Exception e) {
-                Hyena.Log.Exception ("Error refreshing internet archive", e);
+                ServiceManager.DbConnection.RollbackTransaction ();
+                Hyena.Log.Exception ("Error searching the Internet Archive", e);
             }
 
-            if (!success) {
+            if (success) {
+                base.Reload ();
+
+                int count = DatabaseTrackModel.Count;
+                if (total_results == 0) {
+                    ThreadAssist.ProxyToMain (delegate {
+                        SetStatus (Catalog.GetString ("No matches. Try another search?"), false, false, "gtk-info");
+                    });
+                } else {
+                    ThreadAssist.ProxyToMain (ClearMessages);
+                    status_text = String.Format (Catalog.GetPluralString (
+                        "Showing 1 match", "Showing 1 to {0:N0} of {1:N0} total matches", total_results),
+                        count, total_results
+                    );
+                }
+            } else {
                 // TODO differentiate between various errors types (network, invalid search, etc)
-                SetStatus (Catalog.GetString ("Error refreshing Internet Archive"), true);
+                ThreadAssist.ProxyToMain (delegate {
+                    SetStatus (Catalog.GetString ("Error searching the Internet Archive"), true);
+                });
             }
         }
 
+        public override int Count {
+            get { return 0; }
+        }
+
+        protected override int StatusFormatsCount { get { return 1; } }
+
+        public override string GetStatusText ()
+        {
+            return status_text;
+        }
+
         /*public override bool AcceptsInputFromSource (Source source)
         {
             return false;
@@ -198,13 +256,15 @@ namespace Banshee.InternetArchive
             //InstallPreferences ();
         }
 
-        /*public void Dispose ()
+        public override void Dispose ()
         {
             if (actions != null) {
                 actions.Dispose ();
             }
 
-            UninstallPreferences ();
-        }*/
+            base.Dispose ();
+
+            //UninstallPreferences ();
+        }
     }
 }
diff --git a/src/Extensions/Banshee.InternetArchive/InternetArchive/Field.cs b/src/Extensions/Banshee.InternetArchive/InternetArchive/Field.cs
index aa3d5f2..19ef91e 100644
--- a/src/Extensions/Banshee.InternetArchive/InternetArchive/Field.cs
+++ b/src/Extensions/Banshee.InternetArchive/InternetArchive/Field.cs
@@ -41,19 +41,12 @@ namespace InternetArchive
         coverage
 
         date
-        description
-        downloads
         foldoutcount
-        format
         headerImage
-        identifier
         imagecount
 
-        language
-        licenseurl
         mediatype
         month
-        num_reviews
         oai_updatedate
         publicdate
         rights
@@ -61,21 +54,26 @@ namespace InternetArchive
         scanningcentre
         source
         subject
-        title
         type
         volume
         week
-        year*/
+        */
 
-        public static Field MediaType  = new Field ("mediatype",  Catalog.GetString ("Media Type"));
-        public static Field Identifier = new Field ("identifier", Catalog.GetString ("ID"));
-        public static Field Title      = new Field ("title",      Catalog.GetString ("Title"));
+        public static Field AvgRating  = new Field ("avg_rating", Catalog.GetString ("Rating"));
         public static Field Creator    = new Field ("creator",    Catalog.GetString ("Creator"));
-        public static Field Publisher  = new Field ("publisher",  Catalog.GetString ("Publisher"));
-        public static Field Downloads  = new Field ("downloads",  Catalog.GetString ("Downloads"));
+        public static Field Collection = new Field ("collection", Catalog.GetString ("Collection"));
+        public static Field Date       = new Field ("date",       Catalog.GetString ("Created"));
         public static Field Description= new Field ("description",Catalog.GetString ("Description"));
-        public static Field AvgRating  = new Field ("avg_rating", Catalog.GetString ("Rating"));
+        public static Field Downloads  = new Field ("downloads",  Catalog.GetString ("Downloads"));
         public static Field Format     = new Field ("format",     Catalog.GetString ("Format"));
+        public static Field Identifier = new Field ("identifier", Catalog.GetString ("ID"));
+        public static Field Language   = new Field ("language",   Catalog.GetString ("Language"));
+        public static Field LicenseUrl = new Field ("licenseurl", Catalog.GetString ("License"));
+        public static Field MediaType  = new Field ("mediatype",  Catalog.GetString ("Media Type"));
+        public static Field NumReviews = new Field ("num_reviews",Catalog.GetString ("# Reviews"));
+        public static Field Publisher  = new Field ("publisher",  Catalog.GetString ("Publisher"));
+        public static Field Title      = new Field ("title",      Catalog.GetString ("Title"));
+        public static Field Year       = new Field ("year",       Catalog.GetString ("Year"));
 
         public string Name { get; private set; }
         public string Id { get; private set; }
diff --git a/src/Extensions/Banshee.InternetArchive/InternetArchive/Item.cs b/src/Extensions/Banshee.InternetArchive/InternetArchive/Item.cs
index 4370458..b8373db 100644
--- a/src/Extensions/Banshee.InternetArchive/InternetArchive/Item.cs
+++ b/src/Extensions/Banshee.InternetArchive/InternetArchive/Item.cs
@@ -38,6 +38,27 @@ namespace InternetArchive
         {
         }
 
-        public abstract string Get (Field field);
+        public string GetJoined (Field field, string with)
+        {
+            var ary = Get<System.Collections.IEnumerable> (field);
+            if (ary != null) {
+                return String.Join (with, ary.Cast<object> ().Select (o => o.ToString ()).ToArray ());
+            }
+
+            return null;
+        }
+
+        public string Url {
+            get {
+                string id = Get<string> (Field.Identifier);
+                if (id != null) {
+                    return String.Format ("http://www.archive.org/details/{0}";, id);
+                }
+
+                return null;
+            }
+        }
+
+        public abstract T Get<T> (Field field);
     }
 }
diff --git a/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonItem.cs b/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonItem.cs
index 118710b..0d09495 100644
--- a/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonItem.cs
+++ b/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonItem.cs
@@ -43,14 +43,18 @@ namespace InternetArchive
             this.item = item;
         }
 
-        public override string Get (Field field)
+        public override T Get<T> (Field field)
         {
             object result;
             if (item.TryGetValue (field.Id, out result)) {
-                return result as string;
+                try {
+                return (T)result;
+                } catch {
+                    Console.WriteLine ("Couldn't cast {0} ({1}) as {2}", result, result.GetType (), typeof(T));
+                }
             }
 
-            return null;
+            return default (T);
         }
     }
 }
diff --git a/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonResults.cs b/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonResults.cs
index 12342e7..a8a836b 100644
--- a/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonResults.cs
+++ b/src/Extensions/Banshee.InternetArchive/InternetArchive/JsonResults.cs
@@ -46,11 +46,6 @@ namespace InternetArchive
         {
             var json = new Deserializer (resultsString).Deserialize () as JsonObject;
 
-            if (Hyena.Log.Debugging) {
-                Hyena.Log.Debug ("Got JSON results from Internet Archive:");
-                json.Dump ();
-            }
-
             response_header = (JsonObject) json["responseHeader"];
             response_header_params = (JsonObject) response_header["params"];
 
diff --git a/src/Extensions/Banshee.InternetArchive/InternetArchive/MediaType.cs b/src/Extensions/Banshee.InternetArchive/InternetArchive/MediaType.cs
index 5c57cb4..bb66cbe 100644
--- a/src/Extensions/Banshee.InternetArchive/InternetArchive/MediaType.cs
+++ b/src/Extensions/Banshee.InternetArchive/InternetArchive/MediaType.cs
@@ -35,10 +35,10 @@ namespace InternetArchive
     {
         private MediaType (string id, string name) : base (Field.MediaType, id, name) {}
 
-        private MediaType AddChildren (params MediaType [] children)
+        private MediaType AddChildren (params FieldValue [] children)
         {
             if (Children == null) {
-                Children = new List<MediaType> ();
+                Children = new List<FieldValue> ();
             }
 
             foreach (var child in children) {
@@ -48,52 +48,52 @@ namespace InternetArchive
             return this;
         }
 
-        public IList<MediaType> Children { get; set; }
+        public IList<FieldValue> Children { get; set; }
 
         public static MediaType [] Options = new MediaType [] {
             new MediaType ("movies", Catalog.GetString ("Moving Images")).AddChildren (
-                new MediaType ("movies.animationandcartoons", Catalog.GetString ("Animation & Cartoons")),
-                new MediaType ("movies.artsandmusicvideos", Catalog.GetString ("Arts & Music")),
-                new MediaType ("movies.computersandtechvideos", Catalog.GetString ("Computers & Technology")),
-                new MediaType ("movies.culturalandacademicfilms", Catalog.GetString ("Cultural & Academic Films")),
-                new MediaType ("movies.ephemera", Catalog.GetString ("Ephemeral Films")),
-                new MediaType ("movies.home_movies", Catalog.GetString ("Home Movies")),
-                new MediaType ("movies.moviesandfilms", Catalog.GetString ("Movies")),
-                new MediaType ("movies.newsandpublicaffairs", Catalog.GetString ("News & Public Affairs")),
-                new MediaType ("movies.opensource_movies", Catalog.GetString ("Open Source Movies")),
-                new MediaType ("movies.prelinger", Catalog.GetString ("Prelinger Archives")),
-                new MediaType ("movies.spiritualityandreligion", Catalog.GetString ("Spirituality & Religion")),
-                new MediaType ("movies.sports", Catalog.GetString ("Sports Videos")),
-                new MediaType ("movies.gamevideos", Catalog.GetString ("Videogame Videos")),
-                new MediaType ("movies.vlogs", Catalog.GetString ("Vlogs")),
-                new MediaType ("movies.youth_media", Catalog.GetString ("Youth Media"))
+                new FieldValue (Field.Collection, "animationandcartoons", Catalog.GetString ("Animation & Cartoons")),
+                new FieldValue (Field.Collection, "artsandmusicvideos", Catalog.GetString ("Arts & Music")),
+                new FieldValue (Field.Collection, "computersandtechvideos", Catalog.GetString ("Computers & Technology")),
+                new FieldValue (Field.Collection, "culturalandacademicfilms", Catalog.GetString ("Cultural & Academic Films")),
+                new FieldValue (Field.Collection, "ephemera", Catalog.GetString ("Ephemeral Films")),
+                new FieldValue (Field.Collection, "home_movies", Catalog.GetString ("Home Movies")),
+                new FieldValue (Field.Collection, "moviesandfilms", Catalog.GetString ("Movies")),
+                new FieldValue (Field.Collection, "newsandpublicaffairs", Catalog.GetString ("News & Public Affairs")),
+                new FieldValue (Field.Collection, "opensource_movies", Catalog.GetString ("Open Source Movies")),
+                new FieldValue (Field.Collection, "prelinger", Catalog.GetString ("Prelinger Archives")),
+                new FieldValue (Field.Collection, "spiritualityandreligion", Catalog.GetString ("Spirituality & Religion")),
+                new FieldValue (Field.Collection, "sports", Catalog.GetString ("Sports Videos")),
+                new FieldValue (Field.Collection, "gamevideos", Catalog.GetString ("Videogame Videos")),
+                new FieldValue (Field.Collection, "vlogs", Catalog.GetString ("Vlogs")),
+                new FieldValue (Field.Collection, "youth_media", Catalog.GetString ("Youth Media"))
             ),
             new MediaType ("texts", Catalog.GetString ("Texts")).AddChildren (
-                new MediaType ("texts.americana", Catalog.GetString ("American Libraries")),
-                new MediaType ("texts.toronto", Catalog.GetString ("Canadian Libraries")),
-                new MediaType ("texts.universallibrary", Catalog.GetString ("Universal Library")),
-                new MediaType ("texts.gutenberg", Catalog.GetString ("Project Gutenberg")),
-                new MediaType ("texts.iacl", Catalog.GetString ("Children's Library")),
-                new MediaType ("texts.biodiversity", Catalog.GetString ("Biodiversity Heritage Library")),
-                new MediaType ("texts.additional_collections", Catalog.GetString ("Additional Collections"))
+                new FieldValue (Field.Collection, "americana", Catalog.GetString ("American Libraries")),
+                new FieldValue (Field.Collection, "toronto", Catalog.GetString ("Canadian Libraries")),
+                new FieldValue (Field.Collection, "universallibrary", Catalog.GetString ("Universal Library")),
+                new FieldValue (Field.Collection, "gutenberg", Catalog.GetString ("Project Gutenberg")),
+                new FieldValue (Field.Collection, "iacl", Catalog.GetString ("Children's Library")),
+                new FieldValue (Field.Collection, "biodiversity", Catalog.GetString ("Biodiversity Heritage Library")),
+                new FieldValue (Field.Collection, "additional_collections", Catalog.GetString ("Additional Collections"))
             ),
             new MediaType ("audio", Catalog.GetString ("Audio")).AddChildren (
-                new MediaType ("audio.audio_bookspoetry", Catalog.GetString ("Audio Books & Poetry")),
-                new MediaType ("audio.audio_tech", Catalog.GetString ("Computers & Technology")),
-                new MediaType ("audio.GratefulDead", Catalog.GetString ("Grateful Dead")),
-                new MediaType ("audio.etree", Catalog.GetString ("Live Music Archive")),
-                new MediaType ("audio.audio_music", Catalog.GetString ("Music & Arts")),
-                new MediaType ("audio.netlabels", Catalog.GetString ("Netlabels")),
-                new MediaType ("audio.audio_news", Catalog.GetString ("News & Public Affairs")),
-                new MediaType ("audio.audio_foreign", Catalog.GetString ("Non-English Audio")),
-                new MediaType ("audio.opensource_audio", Catalog.GetString ("Open Source Audio")),
-                new MediaType ("audio.audio_podcast", Catalog.GetString ("Podcasts")),
-                new MediaType ("audio.radioprograms", Catalog.GetString ("Radio Programs")),
-                new MediaType ("audio.audio_religion", Catalog.GetString ("Spirituality & Religion"))
+                new FieldValue (Field.Collection, "audio_bookspoetry", Catalog.GetString ("Audio Books & Poetry")),
+                new FieldValue (Field.Collection, "audio_tech", Catalog.GetString ("Computers & Technology")),
+                new FieldValue (Field.Collection, "GratefulDead", Catalog.GetString ("Grateful Dead")),
+                new FieldValue (Field.Collection, "etree", Catalog.GetString ("Live Music Archive")),
+                new FieldValue (Field.Collection, "audio_music", Catalog.GetString ("Music & Arts")),
+                new FieldValue (Field.Collection, "netlabels", Catalog.GetString ("Netlabels")),
+                new FieldValue (Field.Collection, "audio_news", Catalog.GetString ("News & Public Affairs")),
+                new FieldValue (Field.Collection, "audio_foreign", Catalog.GetString ("Non-English Audio")),
+                new FieldValue (Field.Collection, "opensource_audio", Catalog.GetString ("Open Source Audio")),
+                new FieldValue (Field.Collection, "audio_podcast", Catalog.GetString ("Podcasts")),
+                new FieldValue (Field.Collection, "radioprograms", Catalog.GetString ("Radio Programs")),
+                new FieldValue (Field.Collection, "audio_religion", Catalog.GetString ("Spirituality & Religion"))
             ),
             new MediaType ("education", Catalog.GetString ("Education")),
             new MediaType ("software", Catalog.GetString ("Software")).AddChildren (
-                new MediaType ("software.clasp", Catalog.GetString ("CLASP"))
+                new FieldValue (Field.Collection, "clasp", Catalog.GetString ("CLASP"))
             )
         };
     }
diff --git a/src/Extensions/Banshee.InternetArchive/InternetArchive/Search.cs b/src/Extensions/Banshee.InternetArchive/InternetArchive/Search.cs
index 536517e..c78ecb2 100644
--- a/src/Extensions/Banshee.InternetArchive/InternetArchive/Search.cs
+++ b/src/Extensions/Banshee.InternetArchive/InternetArchive/Search.cs
@@ -73,14 +73,21 @@ namespace InternetArchive
         {
             NumResults = 50;
 
-            result_fields.Add (Field.Identifier);
-            result_fields.Add (Field.Title);
-            result_fields.Add (Field.Creator);
-            result_fields.Add (Field.Publisher);
-            result_fields.Add (Field.Downloads);
-            result_fields.Add (Field.AvgRating);
-            result_fields.Add (Field.Description);
-            result_fields.Add (Field.Format);
+            result_fields.AddRange (new Field [] {
+                Field.AvgRating,
+                Field.Creator,
+                Field.Date,
+                Field.Description,
+                Field.Downloads,
+                Field.Format,
+                Field.Identifier,
+                Field.Language,
+                Field.LicenseUrl,
+                Field.NumReviews,
+                Field.Publisher,
+                Field.Title,
+                Field.Year
+            });
 
             sorts.Add (new Sort () { Id = "avg_rating desc" });
         }
diff --git a/src/Extensions/Banshee.InternetArchive/Makefile.am b/src/Extensions/Banshee.InternetArchive/Makefile.am
index 67d27fd..08b281d 100644
--- a/src/Extensions/Banshee.InternetArchive/Makefile.am
+++ b/src/Extensions/Banshee.InternetArchive/Makefile.am
@@ -14,9 +14,12 @@ SOURCES = \
 	InternetArchive/JsonResults.cs \
 	InternetArchive/JsonItem.cs \
 	InternetArchive/Sort.cs \
+	Banshee.InternetArchive/Actions.cs \
 	Banshee.InternetArchive/HeaderFilters.cs \
 	Banshee.InternetArchive/Source.cs
 
-RESOURCES = Banshee.InternetArchive.addin.xml
+RESOURCES = \
+	Banshee.InternetArchive.addin.xml \
+	Resources/ActiveSourceUI.xml
 
 include $(top_srcdir)/build/build.mk
diff --git a/src/Extensions/Banshee.InternetArchive/Resources/ActiveSourceUI.xml b/src/Extensions/Banshee.InternetArchive/Resources/ActiveSourceUI.xml
new file mode 100644
index 0000000..c7a7694
--- /dev/null
+++ b/src/Extensions/Banshee.InternetArchive/Resources/ActiveSourceUI.xml
@@ -0,0 +1,31 @@
+<ui>
+  <toolbar name="HeaderToolbar">
+    <placeholder name="SourceActions">
+        <!--<toolitem name="PodcastAdd" action="PodcastAddAction" />
+        <toolitem name="PodcastUpdateAll" action="PodcastUpdateAllAction" />-->
+    </placeholder>
+  </toolbar>
+
+  <menubar name="MainMenu" action="MainMenuAction">
+    <menu name="EditMenu" action="EditMenuAction">
+      <placeholder name="BelowAddToPlaylist">
+        <separator />
+        <!--<menuitem name="PodcastItemDownload" action="PodcastItemDownloadAction" />
+        <menuitem name="PodcastItemDeleteFile" action="PodcastItemDeleteFileAction" />-->
+        <!--
+        <menuitem name="PodcastItemCancel" action="PodcastItemCancelAction" />-->
+        <!--<menuitem name="PodcastItemMarkNew" action="PodcastItemMarkNewAction" />
+        <menuitem name="PodcastItemMarkOld" action="PodcastItemMarkOldAction" />-->
+        <separator />
+      </placeholder>
+    </menu>
+  </menubar>
+
+  <popup name="TrackContextMenu" action="TrackContextMenuAction">
+    <placeholder name="BelowAddToPlaylist">
+        <separator />
+        <menuitem action="OpenItemWebsite" />
+        <separator />
+    </placeholder>
+  </popup>
+</ui>



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