banshee r4630 - in trunk/banshee: . src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod src/Dap/Banshee.Dap/Banshee.Dap
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4630 - in trunk/banshee: . src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod src/Dap/Banshee.Dap/Banshee.Dap
- Date: Mon, 29 Sep 2008 23:09:49 +0000 (UTC)
Author: gburt
Date: Mon Sep 29 23:09:49 2008
New Revision: 4630
URL: http://svn.gnome.org/viewvc/banshee?rev=4630&view=rev
Log:
2008-09-29 Gabriel Burt <gabriel burt gmail com>
* src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs: Add SupportsVideo and
SupportsPodcast bools with protected setters so subclasses can turn off
the Video and Podcast child sources.
* src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs: Only enable
video support (syncing and the child source) for devices that support it.
Also don't sync playlists to iPod shuffle devices. Give feedback about
out-of-space errors.
* src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs: Don't show/sync video if not
supported. Sync Music library first. Improve/fix auto-syncing when you
change your libraries it should work better now.
* src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs: Delete playlists if
they end up having no tracks when put on the device.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
Modified: trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs Mon Sep 29 23:09:49 2008
@@ -84,6 +84,15 @@
name_path = Path.Combine (Path.GetDirectoryName (ipod_device.TrackDatabasePath), "BansheeIPodName");
Name = GetDeviceName ();
+ SupportsPlaylists = ipod_device.ModelInfo.DeviceClass != "shuffle";
+
+ // TODO disable this later, but right now it won't disable it in Sync, so might as well
+ // leave it enabled
+ //SupportsPodcasts = ipod_device.ModelInfo.HasCapability ("podcast");
+ SupportsVideo = ipod_device.ModelInfo.DeviceClass == "video" ||
+ ipod_device.ModelInfo.DeviceClass == "classic" ||
+ (ipod_device.ModelInfo.DeviceClass == "nano" && ipod_device.ModelInfo.Generation >= 3);
+
Initialize ();
AddDapProperty (Catalog.GetString ("Device"), ipod_device.ModelInfo.DeviceClass);
@@ -574,21 +583,23 @@
}
}
device_playlists.Clear ();
-
- // Add playlists from Banshee to the device
- foreach (Source child in Children) {
- PlaylistSource from = child as PlaylistSource;
- if (from != null && from.Count > 0) {
- IPod.Playlist playlist = ipod_device.TrackDatabase.CreatePlaylist (from.Name);
- foreach (int track_id in ServiceManager.DbConnection.QueryEnumerable<int> (String.Format (
- "SELECT CoreTracks.TrackID FROM CoreTracks{0} WHERE {1}",
- from.DatabaseTrackModel.JoinFragment, from.DatabaseTrackModel.Condition)))
- {
- playlist.AddTrack (tracks_map[track_id].IpodTrack);
+
+ if (SupportsPlaylists) {
+ // Add playlists from Banshee to the device
+ foreach (Source child in Children) {
+ PlaylistSource from = child as PlaylistSource;
+ if (from != null && from.Count > 0) {
+ IPod.Playlist playlist = ipod_device.TrackDatabase.CreatePlaylist (from.Name);
+ foreach (int track_id in ServiceManager.DbConnection.QueryEnumerable<int> (String.Format (
+ "SELECT CoreTracks.TrackID FROM CoreTracks{0} WHERE {1}",
+ from.DatabaseTrackModel.JoinFragment, from.DatabaseTrackModel.Condition)))
+ {
+ playlist.AddTrack (tracks_map[track_id].IpodTrack);
+ }
}
}
}
-
+
// Sync podcast playlist
/*IPod.Playlist podcast_playlist = GetPodcastPlaylist ();
podcast_playlist.Clear ();
@@ -604,6 +615,8 @@
ipod_device.TrackDatabase.SaveEnded += OnIpodDatabaseSaveEnded;
ipod_device.TrackDatabase.SaveProgressChanged += OnIpodDatabaseSaveProgressChanged;
ipod_device.Save ();
+ } catch (InsufficientSpaceException) {
+ ErrorSource.AddMessage (Catalog.GetString ("Out of space on device"), Catalog.GetString ("Please manually remove some songs"));
} catch (Exception e) {
Log.Exception ("Failed to save iPod database", e);
} finally {
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs Mon Sep 29 23:09:49 2008
@@ -203,7 +203,7 @@
sync.Dap.AddAllTracks (to_add);
}
- if (library.SupportsPlaylists) {
+ if (library.SupportsPlaylists && sync.Dap.SupportsPlaylists) {
sync.Dap.RemovePlaylists ();
// Then create the playlists, taking snapshots of smart playlists and saving them
@@ -225,7 +225,13 @@
to.DbId, sync.Dap.DbId
);
to.UpdateCounts ();
- sync.Dap.AddChildSource (to);
+
+ if (to.Count == 0) {
+ // If it's empty, don't leave it on the device
+ to.Unmap ();
+ } else {
+ sync.Dap.AddChildSource (to);
+ }
}
}
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs Mon Sep 29 23:09:49 2008
@@ -140,6 +140,18 @@
{
}
+ private bool supports_video = true;
+ public bool SupportsVideo {
+ get { return supports_video; }
+ protected set { supports_video = value; }
+ }
+
+ private bool supports_podcasts = true;
+ public bool SupportsPodcasts {
+ get { return supports_podcasts; }
+ protected set { supports_podcasts = value; }
+ }
+
#region Source
protected override void Initialize ()
@@ -184,8 +196,14 @@
}
AddChildSource (music_group_source = new MusicGroupSource (this));
- AddChildSource (video_group_source = new VideoGroupSource (this));
- AddChildSource (podcast_group_source = new PodcastGroupSource (this));
+
+ if (SupportsVideo) {
+ AddChildSource (video_group_source = new VideoGroupSource (this));
+ }
+
+ if (SupportsPodcasts) {
+ AddChildSource (podcast_group_source = new PodcastGroupSource (this));
+ }
BuildPreferences ();
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs Mon Sep 29 23:09:49 2008
@@ -152,9 +152,7 @@
library_syncs.Add (library_sync);
pref_sections.Add (library_sync.PrefsSection);
library_sync.PrefsSection.Order = ++i;
- }
-
- foreach (LibrarySource source in Libraries) {
+
source.TracksAdded += OnLibraryChanged;
source.TracksDeleted += OnLibraryChanged;
}
@@ -197,10 +195,14 @@
private void OnLibraryChanged (Source sender, TrackEventArgs args)
{
+ if (!Enabled) {
+ return;
+ }
+
foreach (DapLibrarySync lib_sync in library_syncs) {
if (lib_sync.Library == sender) {
if (AutoSync) {
- lib_sync.Sync ();
+ Sync ();
} else {
lib_sync.CalculateSync ();
OnUpdated ();
@@ -213,6 +215,14 @@
private IEnumerable<LibrarySource> Libraries {
get {
List<Source> sources = new List<Source> (ServiceManager.SourceManager.Sources);
+ sources.Sort (delegate (Source a, Source b) {
+ return a.Order.CompareTo (b.Order);
+ });
+
+ if (!dap.SupportsVideo) {
+ sources.Remove (ServiceManager.SourceManager.VideoLibrary);
+ }
+
foreach (Source source in sources) {
if (source is LibrarySource) {
yield return source as LibrarySource;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]