[banshee] Xspf: Handle Amazon's new cloud .amz files (bgo#646237)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Xspf: Handle Amazon's new cloud .amz files (bgo#646237)
- Date: Wed, 30 Mar 2011 21:06:31 +0000 (UTC)
commit 2ed8f10a2ca5827b0e743adac472e5368a24f1a1
Author: Gabriel Burt <gabriel burt gmail com>
Date: Wed Mar 30 15:52:51 2011 -0500
Xspf: Handle Amazon's new cloud .amz files (bgo#646237)
They don't include a XSPF version number, and they don't have a proper
xspf namespace set.
.../Mono.Media/Media.Playlists.Xspf/Playlist.cs | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/Libraries/Mono.Media/Media.Playlists.Xspf/Playlist.cs b/src/Libraries/Mono.Media/Media.Playlists.Xspf/Playlist.cs
index 610ab38..f187ef0 100644
--- a/src/Libraries/Mono.Media/Media.Playlists.Xspf/Playlist.cs
+++ b/src/Libraries/Mono.Media/Media.Playlists.Xspf/Playlist.cs
@@ -58,7 +58,7 @@ namespace Media.Playlists.Xspf
private static XmlNamespaceManager BuildNamespaceManager (XmlDocument doc)
{
- XmlNamespaceManager xmlns = new XmlNamespaceManager (doc.NameTable);
+ var xmlns = new XmlNamespaceManager (doc.NameTable);
xmlns.AddNamespace ("xspf", XspfNamespace);
return xmlns;
}
@@ -129,11 +129,12 @@ namespace Media.Playlists.Xspf
}
XmlAttribute version_attr = playlist_node.Attributes["version"];
- if(version_attr == null || version_attr.Value == null) {
+ if(version_attr != null && version_attr.Value == null) {
throw new ApplicationException("XSPF playlist version must be specified");
} else {
try {
- int version = Int32.Parse(version_attr.Value);
+ // If the version attr is missing, assume it's version 1; Fixes bgo#646237
+ int version = version_attr == null ? 1 : Int32.Parse (version_attr.Value);
if(version < 0 || version > 1) {
throw new ApplicationException("Only XSPF versions 0 and 1 are supported");
}
@@ -168,12 +169,12 @@ namespace Media.Playlists.Xspf
protected bool IsExtensionNode(XmlNode node)
{
- return node.Name == "extension" && node.NamespaceURI == XspfNamespace;
+ return node.Name == "extension" && (node.NamespaceURI == XspfNamespace || node.NamespaceURI == "");
}
protected bool IsTrackListNode(XmlNode node)
{
- return node.Name == "trackList" && node.NamespaceURI == XspfNamespace;
+ return node.Name == "trackList" && (node.NamespaceURI == XspfNamespace || node.NamespaceURI == "");
}
protected virtual void LoadExtensionNode(XmlNode extensionNode, XmlNamespaceManager xmlns)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]