[banshee] Lastfm: Use one standard directory for last.fm caching (bgo#548636)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Lastfm: Use one standard directory for last.fm caching (bgo#548636)
- Date: Wed, 8 Feb 2012 17:47:13 +0000 (UTC)
commit 76cbc54291945b48ff1a4a0bc0337944a3f6ec14
Author: Udesh Liyanaarachchi <la udesh1987 gmail com>
Date: Tue Feb 7 15:27:55 2012 -0500
Lastfm: Use one standard directory for last.fm caching (bgo#548636)
Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>
.../Banshee.Lastfm.Audioscrobbler/Queue.cs | 26 ++++++++++++++++---
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs
index ac9a883..a259cd4 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs
@@ -139,17 +139,35 @@ namespace Banshee.Lastfm.Audioscrobbler
public Queue ()
{
- string xmlfilepath = Path.Combine (Hyena.Paths.ExtensionCacheRoot, "last.fm");
- xml_path = Path.Combine (xmlfilepath, "audioscrobbler-queue.xml");
+ string xml_dir_path = Path.Combine (Hyena.Paths.ExtensionCacheRoot, "lastfm");
+ xml_path = Path.Combine (xml_dir_path, "audioscrobbler-queue.xml");
queue = new List<QueuedTrack> ();
- if (!Directory.Exists(xmlfilepath)) {
- Directory.CreateDirectory (xmlfilepath);
+ if (!Directory.Exists(xml_dir_path)) {
+ Directory.CreateDirectory (xml_dir_path);
}
+ MigrateQueueFile ();
+
Load ();
}
+ private void MigrateQueueFile ()
+ {
+ string old_xml_dir_path = Path.Combine (Hyena.Paths.ExtensionCacheRoot, "last.fm");
+ string old_xml_path = Path.Combine (old_xml_dir_path, "audioscrobbler-queue.xml");
+
+ if (Banshee.IO.Directory.Exists (old_xml_dir_path)) {
+ var old_file = new SafeUri (old_xml_path);
+ var file = new SafeUri (xml_path);
+ if (Banshee.IO.File.Exists (old_file)) {
+ Banshee.IO.File.Copy (old_file, file, true);
+ Banshee.IO.File.Delete (old_file);
+ }
+ Banshee.IO.Directory.Delete (old_xml_dir_path, true);
+ }
+ }
+
public void Save ()
{
if (!dirty)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]