[banshee] Support unencrypted amz/xspf files



commit 6705a1adbc22d2794b7da74d80adb59646b4e369
Author: Aaron Bockover <abockover novell com>
Date:   Mon Aug 2 11:59:41 2010 -0400

    Support unencrypted amz/xspf files
    
    Not seen in the wild, but great for testing and debugging (I write my
    own amz files dawg).

 .../Banshee.AmazonMp3/AmzXspfPlaylist.cs           |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmzXspfPlaylist.cs b/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmzXspfPlaylist.cs
index bea6911..d0d89ab 100644
--- a/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmzXspfPlaylist.cs
+++ b/src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmzXspfPlaylist.cs
@@ -70,6 +70,20 @@ namespace Banshee.AmazonMp3
 
         private void Decrypt (Stream stream)
         {
+            // Useful for debugging, support loading an unencrypted XSPF file
+            var xml_magic = new byte [5];
+            if (stream.Read (xml_magic, 0, 5) == 5 &&
+                xml_magic[0] == 0x3c &&
+                xml_magic[1] == 0x3f &&
+                xml_magic[2] == 0x78 &&
+                xml_magic[3] == 0x6d &&
+                xml_magic[4] == 0x6c) {
+                stream.Seek (0, SeekOrigin.Begin);
+                Load (stream);
+                AmzLoad ();
+                return;
+            }
+
             var crypto_service = new DESCryptoServiceProvider () {
                 Key = amz_key,
                 IV = amz_iv,



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