[Banshee-List] Patch to get njb-sharp to work with my Nomad Jukebox 1



Hi all,

I don't know if this is the right place, but I could find any list or
bugzilla about njb-sharp.

On my Nomad Jukebox 1, the "Year" and "PlayOnly" fields are marked as
strings. But njb-sharp wants them to be ushort, so trying to use banshee
with my Nomad would cause a crash.

This patch applies to the njb-sharp source and modifies the
GetFrameShort method so that it tries to convert the data to ushort if
it's marked as string or int.
It shouldn't break anything...

Please test it with your Nomad devices, and let me know how it goes.

Cheers,

-- 
Bertrand Lorentz <bertrand lorentz free fr>
Index: src/Song.cs
===================================================================
--- src/Song.cs	(revision 60351)
+++ src/Song.cs	(working copy)
@@ -138,12 +138,27 @@
         
         private ushort GetFrameShort(string label)
         {
+            ushort uval = 0;
+        	
             SongFrame frame = FindFrame(label);
             if(frame == null) {
                 return 0;
             }
+	            
+            switch(frame.FrameType)
+            {
+                case SongFrameType.String :
+            	    uval = ushort.Parse(frame.DataString);
+            	    break;
+            	case SongFrameType.UInt32 :
+            	    uval = ushort.Parse(frame.DataInt.ToString());
+            	    break;
+            	default :
+            	    uval = frame.DataShort;
+            	    break;
+            }
             
-            return frame.DataShort;
+            return uval;
         }
         
         private uint GetFrameInt(string label)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 60351)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2006-05-08  Bertrand Lorentz  <bertrand lorentz free fr>
+
+	* src/Song.cs: GetFrameShort now tries to convert the data to short if 
+	the frame type is wrong.
+
 2006-04-17  Aaron Bockover  <aaron abock org>
 
 	0.3.0 Release

Attachment: signature.asc
Description: This is a digitally signed message part



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