banshee r3476 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3476 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue
- Date: Tue, 18 Mar 2008 19:17:13 +0000 (GMT)
Author: gburt
Date: Tue Mar 18 19:17:13 2008
New Revision: 3476
URL: http://svn.gnome.org/viewvc/banshee?rev=3476&view=rev
Log:
2008-03-18 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs: If a
file contains video, put it in the VideoLibrary instead of the
MusicLibrary.
* src/Core/Banshee.Services/Makefile.am:
* src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs:
* src/Core/Banshee.Services/Banshee.Library/VideoLibrarySource.cs: New
files. VideoLibrarySource turns off the browser.
* src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs: Changed to
not be music specific. Subclassed by new Music/VideoLibrarySource classes.
* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
* src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs:
Update SourceManager.Library references to SourceManager.MusicLibrary.
* src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs: Create
VideoLibrarySource.
* src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs: Rename
Library property to MusicLibrary, and add VideoLibrary property.
* src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs: Check the
executing assembly for the resource file if it's not found in the given
assembly.
* src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs:
* src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml:
Rename ImportMusicAction to ImportAction.
* src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
Change icon to normal playlist icon for now since the Music Library now
uses our old icon. Listen for events on the VideoLibrary too.
Added:
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/VideoLibrarySource.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs
trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs Tue Mar 18 19:17:13 2008
@@ -518,7 +518,7 @@
{
if (args.Service is UserJobManager) {
ServiceManager.ServiceStarted -= OnServiceStarted;
- if (ServiceManager.SourceManager.Library != null) {
+ if (ServiceManager.SourceManager.MusicLibrary != null) {
RefreshMetadataDelayed ();
} else {
ServiceManager.SourceManager.SourceAdded += OnSourceAdded;
@@ -528,7 +528,7 @@
private void OnSourceAdded (SourceAddedArgs args)
{
- if (args.Source is Banshee.Library.LibrarySource) {
+ if (args.Source is Banshee.Library.MusicLibrarySource) {
ServiceManager.SourceManager.SourceAdded -= OnSourceAdded;
RefreshMetadataDelayed ();
}
@@ -588,7 +588,7 @@
}
job.Finish ();
- ServiceManager.SourceManager.Library.NotifyTracksChanged ();
+ ServiceManager.SourceManager.MusicLibrary.NotifyTracksChanged ();
}
#endregion
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs Tue Mar 18 19:17:13 2008
@@ -112,7 +112,9 @@
return AddTrackToLibrary (new SafeUri (path));
}
- private int count = 0;
+ private int music_count = 0;
+ private int video_count = 0;
+
public DatabaseTrackInfo AddTrackToLibrary (SafeUri uri)
{
DatabaseTrackInfo track = null;
@@ -137,7 +139,15 @@
DatabaseAlbumInfo album = DatabaseAlbumInfo.FindOrCreate (artist, track.AlbumTitle);
track.DateAdded = DateTime.Now;
- track.PrimarySource = ServiceManager.SourceManager.Library;
+
+ if ((track.MediaAttributes & TrackMediaAttributes.VideoStream) != 0) {
+ track.PrimarySource = ServiceManager.SourceManager.VideoLibrary;
+ video_count++;
+ } else {
+ track.PrimarySource = ServiceManager.SourceManager.MusicLibrary;
+ music_count++;
+ }
+
track.ArtistId = artist.DbId;
track.AlbumId = album.DbId;
track.Save (false);
@@ -148,8 +158,12 @@
throw;
}
- if (++count % 250 == 0) {
- ServiceManager.SourceManager.Library.NotifyTracksAdded ();
+ if (music_count > 0 && music_count % 250 == 0) {
+ ServiceManager.SourceManager.MusicLibrary.NotifyTracksAdded ();
+ }
+
+ if (video_count > 0 && video_count % 250 == 0) {
+ ServiceManager.SourceManager.VideoLibrary.NotifyTracksAdded ();
}
return track;
@@ -166,7 +180,7 @@
private void LogError (string path, string msg)
{
- ErrorSource error_source = ServiceManager.SourceManager.Library.ErrorSource;
+ ErrorSource error_source = ServiceManager.SourceManager.MusicLibrary.ErrorSource;
error_source.AddMessage (Path.GetFileName (path), msg);
Log.Error (path, msg, false);
@@ -174,8 +188,16 @@
protected override void OnImportFinished ()
{
- count = 0;
- ServiceManager.SourceManager.Library.NotifyTracksAdded ();
+ if (music_count > 0) {
+ ServiceManager.SourceManager.MusicLibrary.NotifyTracksAdded ();
+ }
+
+ if (video_count > 0) {
+ ServiceManager.SourceManager.VideoLibrary.NotifyTracksAdded ();
+ }
+
+ music_count = 0;
+ video_count = 0;
base.OnImportFinished ();
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs Tue Mar 18 19:17:13 2008
@@ -46,13 +46,11 @@
{
public class LibrarySource : PrimarySource
{
- public LibrarySource () : base (Catalog.GetString ("Library"), Catalog.GetString ("Library"), "Library", 1)
+ public LibrarySource (string label, string name, int order) : base (label, label, name, order)
{
- Properties.SetStringList ("Icon.Name", "go-home", "user-home", "source-library");
Properties.SetString ("GtkActionPath", "/LibraryContextMenu");
- AfterInitialized ();
-
Properties.SetString ("RemoveTracksActionLabel", Catalog.GetString ("Remove From Library"));
+ AfterInitialized ();
}
protected override void DeleteTrackRange (TrackListDatabaseModel model, RangeCollection.Range range)
Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs Tue Mar 18 19:17:13 2008
@@ -0,0 +1,42 @@
+//
+// MusicLibrarySource.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2005-2008 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 Mono.Unix;
+
+namespace Banshee.Library
+{
+ public class MusicLibrarySource : LibrarySource
+ {
+ public MusicLibrarySource () : base (Catalog.GetString ("Music Library"), "Library", 1)
+ {
+ Properties.SetStringList ("Icon.Name", "audio-x-generic", "source-library");
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ThreadPoolImportSource.cs Tue Mar 18 19:17:13 2008
@@ -87,7 +87,7 @@
protected void LogError (string path, string msg)
{
- ErrorSource error_source = ServiceManager.SourceManager.Library.ErrorSource;
+ ErrorSource error_source = ServiceManager.SourceManager.MusicLibrary.ErrorSource;
error_source.AddMessage (Path.GetFileName (path), msg);
Log.Error (path, msg, false);
Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/VideoLibrarySource.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/VideoLibrarySource.cs Tue Mar 18 19:17:13 2008
@@ -0,0 +1,46 @@
+//
+// VideoLibrarySource.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2005-2008 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 Mono.Unix;
+
+namespace Banshee.Library
+{
+ public class VideoLibrarySource : LibrarySource
+ {
+ public VideoLibrarySource () : base (Catalog.GetString ("Video Library"), "VideoLibrary", 2)
+ {
+ Properties.SetStringList ("Icon.Name", "video-x-generic", "video", "source-library");
+ }
+
+ public override bool ShowBrowser {
+ get { return false; }
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs Tue Mar 18 19:17:13 2008
@@ -58,10 +58,13 @@
ServiceManager.Run ();
if (ServiceManager.SourceManager != null) {
- ServiceManager.SourceManager.AddSource (new LibrarySource (), true);
+ ServiceManager.SourceManager.AddSource (new MusicLibrarySource (), true);
+ ServiceManager.SourceManager.AddSource (new VideoLibrarySource (), false);
+ // FIXME add each playlist as a childsource of the PrimarySource it belongs to,
+ // not just to the MusicLibrary.
foreach (PlaylistSource pl in PlaylistSource.LoadAll ()) {
- ServiceManager.SourceManager.Library.AddChildSource (pl);
+ ServiceManager.SourceManager.MusicLibrary.AddChildSource (pl);
}
ServiceManager.SourceManager.LoadExtensionSources ();
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs Tue Mar 18 19:17:13 2008
@@ -54,7 +54,8 @@
private List<Source> sources = new List<Source>();
private Source active_source;
private Source default_source;
- private LibrarySource library_source;
+ private MusicLibrarySource music_library;
+ private VideoLibrarySource video_library;
public event SourceEventHandler SourceUpdated;
public event SourceAddedHandler SourceAdded;
@@ -107,8 +108,10 @@
handler(args);
}
- if (source is LibrarySource) {
- library_source = source as LibrarySource;
+ if (source is MusicLibrarySource) {
+ music_library = source as MusicLibrarySource;
+ } else if (source is VideoLibrarySource) {
+ video_library = source as VideoLibrarySource;
}
ServiceManager.DBusServiceManager.RegisterObject(source);
@@ -218,8 +221,12 @@
set { default_source = value; }
}
- public LibrarySource Library {
- get { return library_source; }
+ public MusicLibrarySource MusicLibrary {
+ get { return music_library; }
+ }
+
+ public VideoLibrarySource VideoLibrary {
+ get { return video_library; }
}
public Source ActiveSource {
Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am Tue Mar 18 19:17:13 2008
@@ -40,6 +40,8 @@
Banshee.Library/ImportSourceManager.cs \
Banshee.Library/LibraryImportManager.cs \
Banshee.Library/LibrarySource.cs \
+ Banshee.Library/MusicLibrarySource.cs \
+ Banshee.Library/VideoLibrarySource.cs \
Banshee.Library/ThreadPoolImportSource.cs \
Banshee.MediaEngine/IEqualizer.cs \
Banshee.MediaEngine/IPlayerEngineService.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs Tue Mar 18 19:17:13 2008
@@ -49,9 +49,9 @@
new ActionEntry ("MusicMenuAction", null,
Catalog.GetString ("_Music"), null, null, null),
- new ActionEntry ("ImportMusicAction", Stock.Open,
+ new ActionEntry ("ImportAction", Stock.Open,
Catalog.GetString ("Import _Music..."), "<control>I",
- Catalog.GetString ("Import music from a variety of sources"), OnImportMusic),
+ Catalog.GetString ("Import music from a variety of sources"), OnImport),
new ActionEntry ("ImportPlaylistAction", null,
Catalog.GetString ("Import Playlist..."), null,
@@ -124,7 +124,7 @@
#region Music Menu Actions
- private void OnImportMusic (object o, EventArgs args)
+ private void OnImport (object o, EventArgs args)
{
Banshee.Library.Gui.ImportDialog dialog = new Banshee.Library.Gui.ImportDialog ();
try {
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs Tue Mar 18 19:17:13 2008
@@ -98,6 +98,18 @@
return new Gdk.Pixbuf (assembly, desired_resource_name_with_size);
} catch {}
+ if (assembly != executing_assembly) {
+ try {
+ if (executing_assembly.GetManifestResourceInfo (desired_resource_name) != null)
+ return new Gdk.Pixbuf (executing_assembly, desired_resource_name);
+ } catch {}
+
+ try {
+ if (executing_assembly.GetManifestResourceInfo (desired_resource_name_with_size) != null)
+ return new Gdk.Pixbuf (executing_assembly, desired_resource_name_with_size);
+ } catch {}
+ }
+
return null;
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml Tue Mar 18 19:17:13 2008
@@ -21,7 +21,7 @@
<menuitem name="NewSmartPlaylist" action="NewSmartPlaylistAction"/>
<!--<menuitem name="NewSmartPlaylistFromSearch" action="NewSmartPlaylistFromSearchAction"/>-->
<separator/>
- <menuitem name="ImportMusic" action="ImportMusicAction"/>
+ <menuitem name="Import" action="ImportAction"/>
<!--<menuitem name="ImportPlaylist" action="ImportPlaylistAction"/>-->
<menuitem name="OpenLocation" action="OpenLocationAction"/>
<separator/>
@@ -102,7 +102,7 @@
<menuitem name="NewPlaylist" action="NewPlaylistAction"/>
<menuitem name="NewSmartPlaylist" action="NewSmartPlaylistAction"/>
<separator/>
- <menuitem name="ImportMusic" action="ImportMusicAction"/>
+ <menuitem name="Import" action="ImportAction"/>
<separator/>
<menu name="SortChildren" action="SortChildrenAction">
<menuitem name="SortChildrenNameAsc" action="SortChildrenNameAscAction"/>
Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs Tue Mar 18 19:17:13 2008
@@ -59,7 +59,7 @@
BindToDatabase ();
Order = 0;
- Properties.SetString ("Icon.Name", "audio-x-generic");
+ Properties.SetString ("Icon.Name", "source-playlist");
Properties.SetString ("RemoveTracksActionLabel", Catalog.GetString ("Remove From Play Queue"));
((TrackListDatabaseModel)TrackModel).ForcedSortQuery = "CorePlaylistEntries.EntryID ASC";
@@ -101,8 +101,11 @@
UpdateActions ();
ServiceManager.SourceManager.ActiveSourceChanged += delegate { UpdateActions (); };
- ServiceManager.SourceManager.Library.TracksChanged += HandleTracksChanged;
- ServiceManager.SourceManager.Library.TracksDeleted += HandleTracksDeleted;
+ // TODO listen to all primary sources
+ ServiceManager.SourceManager.MusicLibrary.TracksChanged += HandleTracksChanged;
+ ServiceManager.SourceManager.MusicLibrary.TracksDeleted += HandleTracksDeleted;
+ ServiceManager.SourceManager.VideoLibrary.TracksChanged += HandleTracksChanged;
+ ServiceManager.SourceManager.VideoLibrary.TracksDeleted += HandleTracksDeleted;
}
public void Dispose ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]