banshee r4797 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage src/Dap/Banshee.Dap/Banshee.Dap src/Dap/Banshee.Dap/Banshee.Dap.Gui
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4797 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage src/Dap/Banshee.Dap/Banshee.Dap src/Dap/Banshee.Dap/Banshee.Dap.Gui
- Date: Fri, 7 Nov 2008 15:36:43 +0000 (UTC)
Author: abock
Date: Fri Nov 7 15:36:43 2008
New Revision: 4797
URL: http://svn.gnome.org/viewvc/banshee?rev=4797&view=rev
Log:
* banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/AndroidDevice.cs:
Ensure a proper folder depth and path layout
* banshee/src/Dap/Banshee.Dap/Banshee.Dap/MediaGroupSource.cs: Removed
some overhead do to reworking of the PurchasedMusicActions
* banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs:
See if the device provides its own track path and use it if so,
otherwise create one
* banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs:
Do not use number formatting on what will always be integers; copy
and paste failbaug
* banshee/src/Dap/Banshee.Dap/Banshee.Dap.Gui/PurchasedMusicActions.cs:
Fixed bug where only one device per instance would show up due to the
UI actions already being registered
* banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageDevice.cs:
Allow the device to provide a preferred path layout
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/AndroidDevice.cs
trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageDevice.cs
trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.Gui/PurchasedMusicActions.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/MediaGroupSource.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs Fri Nov 7 15:36:43 2008
@@ -177,8 +177,8 @@
if (new_progress >= 0.0 && new_progress <= 1.0 && Math.Abs (new_progress - old_progress) > 0.001) {
lock (number_format) {
string disp_progress = String.Format (ProgressMessage,
- import_element.ProcessedCount.ToString ("N", number_format),
- import_element.TotalCount.ToString ("N", number_format));
+ import_element.ProcessedCount,
+ import_element.TotalCount);
user_job.Title = disp_progress;
user_job.Status = String.IsNullOrEmpty (message) ? Catalog.GetString ("Scanning...") : message;
Modified: trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/AndroidDevice.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/AndroidDevice.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/AndroidDevice.cs Fri Nov 7 15:36:43 2008
@@ -29,8 +29,10 @@
using System;
using Mono.Unix;
+using Banshee.Base;
using Banshee.Hardware;
using Banshee.Library;
+using Banshee.Collection;
using Banshee.Collection.Database;
namespace Banshee.Dap.MassStorage
@@ -101,6 +103,10 @@
// packages/apps/Music/src/com/android/music/MusicUtils.java
// <3 open source
+ public override int FolderDepth {
+ get { return 2; }
+ }
+
public override string CoverArtFileName {
get { return "AlbumArt.jpg"; }
}
@@ -113,6 +119,14 @@
get { return 320; }
}
+ public override bool GetTrackPath (TrackInfo track, out string path)
+ {
+ path = FileNamePattern.CreateFromTrackInfo (
+ "%artist%%path_sep%%album%%path_sep%%track_number%. %title%",
+ track);
+ return true;
+ }
+
#region Amazon MP3 Store Purchased Tracks Management
public override bool DeleteTrackHook (DatabaseTrackInfo track)
Modified: trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageDevice.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageDevice.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageDevice.cs Fri Nov 7 15:36:43 2008
@@ -34,6 +34,7 @@
using Banshee.Base;
using Banshee.Hardware;
+using Banshee.Collection;
using Banshee.Collection.Database;
namespace Banshee.Dap.MassStorage
@@ -106,6 +107,12 @@
return true;
}
+ public virtual bool GetTrackPath (TrackInfo track, out string path)
+ {
+ path = null;
+ return false;
+ }
+
private bool has_is_audio_player_file;
public bool HasIsAudioPlayerFile {
get { return has_is_audio_player_file; }
Modified: trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs Fri Nov 7 15:36:43 2008
@@ -534,8 +534,16 @@
private string GetTrackPath (TrackInfo track, string ext)
{
- string file_path = WritePath;
+ string file_path = null;
+ if (ms_device == null || !ms_device.GetTrackPath (track, out file_path)) {
+ file_path = FileNamePattern.CreateFromTrackInfo (track);
+ }
+
+ file_path = System.IO.Path.Combine (WritePath, file_path);
+ file_path += ext;
+ return file_path;
+
/*string artist = FileNamePattern.Escape (track.ArtistName);
string album = FileNamePattern.Escape (track.AlbumTitle);
string number_title = FileNamePattern.Escape (track.TrackNumberTitle);
@@ -572,11 +580,6 @@
file_path = System.IO.Path.Combine (file_path, FileNamePattern.CreateFromTrackInfo (track));
}
*/
-
- file_path = System.IO.Path.Combine (file_path, FileNamePattern.CreateFromTrackInfo (track));
- file_path += ext;
-
- return file_path;
}
}
}
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.Gui/PurchasedMusicActions.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.Gui/PurchasedMusicActions.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.Gui/PurchasedMusicActions.cs Fri Nov 7 15:36:43 2008
@@ -38,12 +38,16 @@
{
public class PurchasedMusicActions : BansheeActionGroup
{
- private IPurchasedMusicSource source;
-
- public PurchasedMusicActions (IPurchasedMusicSource source) : base ("dap-purchased-music")
+ private static PurchasedMusicActions instance;
+ public static void Create ()
+ {
+ if (instance == null) {
+ instance = new PurchasedMusicActions ();
+ }
+ }
+
+ private PurchasedMusicActions () : base ("dap-purchased-music")
{
- this.source = source;
-
AddImportant (
new ActionEntry ("PurchasedMusicImportAction", null,
Catalog.GetString ("Import Purchased Music"), null,
@@ -52,18 +56,21 @@
this["PurchasedMusicImportAction"].IconName = Stock.Save;
- Actions.AddActionGroup (this);
+ Actions.SourceActions.Updated += OnUpdateActions;
+ Register ();
}
-
- public override void Dispose ()
+
+ private void OnUpdateActions (Banshee.Sources.Source source)
{
- Actions.RemoveActionGroup (this);
- base.Dispose ();
+ UpdateAction ("PurchasedMusicImportAction", source is IPurchasedMusicSource);
}
-
+
private void OnImportPurchasedMusic (object o, EventArgs args)
{
- source.Import ();
+ IPurchasedMusicSource source = Actions.SourceActions.ActionSource as IPurchasedMusicSource;
+ if (source != null) {
+ source.Import ();
+ }
}
}
}
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/MediaGroupSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/MediaGroupSource.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/MediaGroupSource.cs Fri Nov 7 15:36:43 2008
@@ -41,10 +41,9 @@
namespace Banshee.Dap
{
- public abstract class MediaGroupSource : SmartPlaylistSource, IDisposable
+ public abstract class MediaGroupSource : SmartPlaylistSource
{
private DapSource parent;
- private PurchasedMusicActions actions;
public MediaGroupSource (DapSource parent, string name) : base (name, parent)
{
@@ -57,20 +56,12 @@
String.Format (Catalog.GetString ("Delete From {0}"), parent.Name));
if (this is IPurchasedMusicSource) {
- actions = new PurchasedMusicActions ((IPurchasedMusicSource)this);
+ PurchasedMusicActions.Create ();
Properties.Set<Assembly> ("ActiveSourceUIResource.Assembly", Assembly.GetExecutingAssembly ());
Properties.SetString ("ActiveSourceUIResource", "PurchasedMusicSourceUI.xml");
}
}
-
- public void Dispose ()
- {
- if (actions != null) {
- actions.Dispose ();
- actions = null;
- }
- }
protected override void AfterInitialized ()
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]