[banshee] Dap.MassStorage: Add custom support for the Barnes and Noble Nook



commit 08f57370df24c16557dba7d0cef0ba8f1127642f
Author: Mark Saunders <mscoolnerd gmail com>
Date:   Sat Jul 9 19:29:42 2011 -0700

    Dap.MassStorage: Add custom support for the Barnes and Noble Nook
    
    Add a NookDevice class for custom support of the Barnes and Noble Nook
    along with icons (bgo#634868).
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 .../Banshee.Dap.MassStorage.addin.xml              |    3 +
 .../Banshee.Dap.MassStorage.csproj                 |    1 +
 .../Banshee.Dap.MassStorage/NookDevice.cs          |  124 ++++++++++++++++++++
 src/Dap/Banshee.Dap.MassStorage/Makefile.am        |    1 +
 .../ThemeIcons/128x128/devices/phone-nook.png      |  Bin 0 -> 17312 bytes
 .../ThemeIcons/16x16/devices/phone-nook.png        |  Bin 0 -> 631 bytes
 .../ThemeIcons/22x22/devices/phone-nook.png        |  Bin 0 -> 724 bytes
 .../ThemeIcons/24x24/devices/phone-nook.png        |  Bin 0 -> 739 bytes
 .../ThemeIcons/256x256/devices/phone-nook.png      |  Bin 0 -> 63044 bytes
 .../ThemeIcons/32x32/devices/phone-nook.png        |  Bin 0 -> 878 bytes
 .../ThemeIcons/48x48/devices/phone-nook.png        |  Bin 0 -> 3325 bytes
 11 files changed, 129 insertions(+), 0 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.addin.xml b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.addin.xml
index 2403e79..5df832e 100644
--- a/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.addin.xml
+++ b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.addin.xml
@@ -84,6 +84,9 @@
     <MassStorageDevice class="Banshee.Dap.MassStorage.WebOSDevice"
         vendor-name="Palm" product-name="Pre"
         vendor-id="0x0830" product-id="0x8004,0x8002"/>
+    <MassStorageDevice class="Banshee.Dap.MassStorage.NookDevice"
+        vendor-name="Barnes and Noble" product-name="Nook Classic"
+        vendor-id="0x2080" product-id="0x001"/>
   </Extension>
 
 </Addin>
diff --git a/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.csproj b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.csproj
index f774a23..c13e829 100644
--- a/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.csproj
+++ b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.csproj
@@ -72,6 +72,7 @@
     <Compile Include="Banshee.Dap.MassStorage\AmazonMp3GroupSource.cs" />
     <Compile Include="Banshee.Dap.MassStorage\WebOSDevice.cs" />
     <Compile Include="Banshee.Dap.MassStorage\MaemoDevice.cs" />
+    <Compile Include="Banshee.Dap.MassStorage\NookDevice.cs" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Banshee.Dap.MassStorage.addin.xml">
diff --git a/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/NookDevice.cs b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/NookDevice.cs
new file mode 100644
index 0000000..cadc7f2
--- /dev/null
+++ b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/NookDevice.cs
@@ -0,0 +1,124 @@
+// 
+// NookDevice.cs
+// 
+// Author:
+//   Mark Saunders <mscoolnerd gmail com>
+// 
+// Copyright 2010 Mark Saunders
+// 
+// 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;
+
+using Banshee.Base;
+using Banshee.Hardware;
+using Banshee.Library;
+using Banshee.Collection;
+using Banshee.Collection.Database;
+
+namespace Banshee.Dap.MassStorage
+{
+    public class NookDevice : CustomMassStorageDevice
+    {
+        private static string [] playback_mime_types = new string [] {
+            "audio/mpeg",
+        };
+
+        private static string [] audio_folders = new string [] {
+            "my music/",
+        };
+
+        public override void SourceInitialize ()
+        {
+        }
+
+        public override bool LoadDeviceConfiguration ()
+        {
+            LoadConfig ();
+            return true;
+        }
+
+        protected override string [] DefaultAudioFolders {
+            get { return audio_folders; }
+        }
+
+        protected override string [] DefaultVideoFolders {
+            get { return new string[0]; }
+        }
+
+        protected override string [] DefaultPlaylistFormats {
+            get { return new string[0]; }
+        }
+
+        protected override string DefaultPlaylistPath {
+            get { return null; }
+        }
+
+        protected override string [] DefaultPlaybackMimeTypes {
+            get { return playback_mime_types; }
+        }
+
+        protected override int DefaultFolderDepth {
+            get { return 2; }
+        }
+
+        protected override string DefaultCoverArtFileName {
+            get { return "AlbumArt.jpg"; }
+        }
+
+        protected override string DefaultCoverArtFileType {
+            get { return "jpeg"; }
+        }
+
+        protected override int DefaultCoverArtSize {
+            get { return 320; }
+        }
+
+        public override string [] GetIconNames ()
+        {
+            string [] icon_names = new string [] {
+                null, DapSource.FallbackIcon
+            };
+            switch (Name) {
+                case "Nook Classic":
+                    icon_names[0] = "phone-nook";
+                    break;
+                default:
+                    icon_names[0] = "phone-htc-g1-white";
+                    break;
+            }
+
+            return icon_names;
+        }
+
+        public override bool GetTrackPath (TrackInfo track, out string path)
+        {
+            path = MusicLibrarySource.MusicFileNamePattern.CreateFromTrackInfo (
+                "%artist%%path_sep%%album%%path_sep%{%track_number%. }%title%",
+                track);
+            return true;
+        }
+
+        public override bool DeleteTrackHook (DatabaseTrackInfo track)
+        {
+            return true;
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/Dap/Banshee.Dap.MassStorage/Makefile.am b/src/Dap/Banshee.Dap.MassStorage/Makefile.am
index 78eb8cd..c0e8495 100644
--- a/src/Dap/Banshee.Dap.MassStorage/Makefile.am
+++ b/src/Dap/Banshee.Dap.MassStorage/Makefile.am
@@ -12,6 +12,7 @@ SOURCES =  \
 	Banshee.Dap.MassStorage/MaemoDevice.cs \
 	Banshee.Dap.MassStorage/MassStorageDevice.cs \
 	Banshee.Dap.MassStorage/MassStorageSource.cs \
+	Banshee.Dap.MassStorage/NookDevice.cs \
 	Banshee.Dap.MassStorage/WebOSDevice.cs
 
 RESOURCES = Banshee.Dap.MassStorage.addin.xml
diff --git a/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/128x128/devices/phone-nook.png b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/128x128/devices/phone-nook.png
new file mode 100644
index 0000000..9c9a399
Binary files /dev/null and b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/128x128/devices/phone-nook.png differ
diff --git a/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/16x16/devices/phone-nook.png b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/16x16/devices/phone-nook.png
new file mode 100644
index 0000000..103c3f1
Binary files /dev/null and b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/16x16/devices/phone-nook.png differ
diff --git a/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/22x22/devices/phone-nook.png b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/22x22/devices/phone-nook.png
new file mode 100644
index 0000000..ff34422
Binary files /dev/null and b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/22x22/devices/phone-nook.png differ
diff --git a/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/24x24/devices/phone-nook.png b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/24x24/devices/phone-nook.png
new file mode 100644
index 0000000..7358c8e
Binary files /dev/null and b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/24x24/devices/phone-nook.png differ
diff --git a/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/256x256/devices/phone-nook.png b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/256x256/devices/phone-nook.png
new file mode 100644
index 0000000..fb97a81
Binary files /dev/null and b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/256x256/devices/phone-nook.png differ
diff --git a/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/32x32/devices/phone-nook.png b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/32x32/devices/phone-nook.png
new file mode 100644
index 0000000..b16d49f
Binary files /dev/null and b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/32x32/devices/phone-nook.png differ
diff --git a/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/48x48/devices/phone-nook.png b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/48x48/devices/phone-nook.png
new file mode 100644
index 0000000..d1a037c
Binary files /dev/null and b/src/Dap/Banshee.Dap.MassStorage/ThemeIcons/48x48/devices/phone-nook.png differ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]