podsleuth r66 - in trunk: . data src/PodSleuth/PodSleuth



Author: gburt
Date: Mon Sep 29 17:55:56 2008
New Revision: 66
URL: http://svn.gnome.org/viewvc/podsleuth?rev=66&view=rev

Log:
2008-09-29  Gabriel Burt  <gabriel burt gmail com>

	* src/PodSleuth/PodSleuth/Device.cs: Add support for new plist format that
	specifies support image formats in an array instead of as entries in a
	dictionary.  This fix means that 4th gen Nano devices and their
	comtemporaries should properly detect whether they support album art
	again.

	* data/ipod-model-table: Fix duplicate serial number and missing comment
	semicolons.



Modified:
   trunk/ChangeLog
   trunk/data/ipod-model-table
   trunk/src/PodSleuth/PodSleuth/Device.cs

Modified: trunk/data/ipod-model-table
==============================================================================
--- trunk/data/ipod-model-table	(original)
+++ trunk/data/ipod-model-table	Mon Sep 29 17:55:56 2008
@@ -13,7 +13,7 @@
 ;;;       and edit by hand, and add too much text overhead. No complaints.
 ;;;
 ;;; VERY USEFUL: http://support.apple.com/kb/HT1353
-                 http://yabb.jriver.com/interact/index.php?topic=36033
+;;;              http://yabb.jriver.com/interact/index.php?topic=36033
 
 ;-----		----		-----	--------		------	----------	------------
 ;Class		Gen.		Color	Capacity		Model#	Attributes	Serial Codes
@@ -118,7 +118,7 @@
 
 Video		5.5		White	30			A444	None		V9K,V9L,WU9
 Video		5.5		Black	30			A446	None		VQM,V9M,V9N
-Video		5.5		White	80			A448	None		V9S,V9P
+Video		5.5		White	80			A448	None		V9P
 Video		5.5		Black	80			A450	None		V9R,V9S,V95,V96
 Video		5.5		Black 	80			A450	U2		WUC
 

Modified: trunk/src/PodSleuth/PodSleuth/Device.cs
==============================================================================
--- trunk/src/PodSleuth/PodSleuth/Device.cs	(original)
+++ trunk/src/PodSleuth/PodSleuth/Device.cs	Mon Sep 29 17:55:56 2008
@@ -140,25 +140,44 @@
             if(plist_dict.ContainsKey("FireWireGUID")) {
                 firewire_id = ((PlistString)plist_dict["FireWireGUID"]).Value;
             }
-            
+
             foreach(string img_class in new string [] { "ImageSpecifications", "AlbumArt", "ChapterImageSpecs" }) {
                 if(!plist_dict.ContainsKey(img_class)) {
                     continue;
                 }
+
+                bool added_any = false;
                 
                 PlistDictionary formats = plist_dict[img_class] as PlistDictionary;
-                if(formats == null || formats.Count == 0) {
+                if(formats != null && formats.Count > 0) {
+                    foreach(KeyValuePair<string, PlistObjectBase> kvp in formats) {
+                        try {
+                            ImageFormat format = new ImageFormat((PlistDictionary)kvp.Value, img_class);
+                            image_formats.Add(format);
+                            added_any = true;
+                        } catch {
+                        }
+                    }
+                } else {
+                    // In 4th gen Nanos, the plist format was changed to list the image
+                    // types supported in an array instead of as entries in a dict.
+                    PlistArray formats_array = plist_dict[img_class] as PlistArray;
+                    if (formats_array != null) {
+                        foreach(PlistObjectBase val in formats_array) {
+                            try {
+                                ImageFormat format = new ImageFormat((PlistDictionary)val, img_class);
+                                image_formats.Add(format);
+                                added_any = true;
+                            } catch {
+                            }
+                        }
+                    }
+                }
+
+                if(!added_any) {
                     continue;
                 }
                 
-                foreach(KeyValuePair<string, PlistObjectBase> kvp in formats) {
-                    try {
-				        ImageFormat format = new ImageFormat((PlistDictionary)kvp.Value, img_class);
-				        image_formats.Add(format);
-				    } catch {
-				    }
-				}
-                
                 switch(img_class) {
                     case "ImageSpecifications": photos_supported = true; break;
                     case "AlbumArt": album_art_supported = true; break;
@@ -194,9 +213,11 @@
             }
             
             string model = sysinfo["ModelNumStr"];
-            
-            model = model.Substring(1);
-            model = model.Substring(0, 4);
+            if (model != null && model.Length >= 5) {
+                model = model.Substring(1);
+                model = model.Substring(0, 4);
+            }
+
             return model;
         }
         



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