[banshee] Dap: not purge at disconnect & virtualize load (bgo#732634)
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Dap: not purge at disconnect & virtualize load (bgo#732634)
- Date: Fri, 25 Jul 2014 18:29:50 +0000 (UTC)
commit ba87f8c8713434b0f7671a5de21ed62de1d26877
Author: Nicholas Little <arealityfarbetween googlemail com>
Date: Fri Jul 25 20:26:37 2014 +0200
Dap: not purge at disconnect & virtualize load (bgo#732634)
For DAP sources where metadata is difficult or costly to extract
(i.e. Bluetooth, as it's a much slower medium), it is useful to
keep the old metadata around to allow for speedy track enumeration
in the cases where files are still present.
To allow for those cases this patch:
- Adds two new virtual methods, PreLoad() and PostLoad(), which
allow subclasses to customise behaviour at those times
(Bluetooth extension will override PreLoad() avoiding the purge
of tracks; and will probably add caching strategies to both
methods).
- Removes calls to PurgeTracks() and PurgeTemporaryPlaylists()
from the Dispose() method, which is called when the device is
disconnected/ejected.
For sources that don't take advantage of this new functionality,
this shouldn't actually result in a change of behaviour (it is
true that the track records will not be deleted from the DB when
the device is disconnected; but this deletion will occur when
the device is connected again anyway, at PreLoad() via
PurgeTracks() and at Initialize() via PurgeTemporaryPlaylists(),
like it used to happen.)
Signed-off-by: Andrés G. Aragoneses <knocte gmail com>
src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs | 29 ++++++++++++++++---------
1 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs b/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
index 337f8a5..e4b7983 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
@@ -112,9 +112,6 @@ namespace Banshee.Dap
Flush ();
- PurgeTemporaryPlaylists ();
- PurgeTracks ();
-
if (dap_info_bar != null) {
var info_bar = dap_info_bar;
ThreadAssist.ProxyToMain (info_bar.Destroy);
@@ -303,21 +300,31 @@ namespace Banshee.Dap
private void ThreadedLoadDeviceContents ()
{
try {
- PurgeTracks ();
+ PreLoad ();
SetStatus (String.Format (Catalog.GetString ("Loading {0}"), Name), false);
LoadFromDevice ();
- HideStatus ();
-
- sync.DapLoaded ();
- sync.CalculateSync ();
- if (sync.AutoSync) {
- sync.Sync ();
- }
+ PostLoad ();
} catch (Exception e) {
Log.Error (e);
}
}
+ protected virtual void PreLoad ()
+ {
+ PurgeTracks ();
+ }
+
+ protected virtual void PostLoad ()
+ {
+ HideStatus ();
+
+ sync.DapLoaded ();
+ sync.CalculateSync ();
+ if (sync.AutoSync) {
+ sync.Sync ();
+ }
+ }
+
public void RemovePlaylists ()
{
// First remove any playlists on the device
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]