/// here comes the xenim recent directory generator /*private static String generateRecentDirectory(xsnservice xsnService) * { * StringBuilder Output = new StringBuilder (); * StringBuilder Elements = new StringBuilder (); * Int32 Counter = 0; * * lock(xsnService.locker) { * * foreach (xsn_recent_feed_item Item in xsnService.GetCurrentRecentFeed().items) * { * if (Item.title != null) { * Counter++; * Elements.Append ("<ns1:mediaMetadata><ns1:id>RECENT:" + EncodeXMLString(Item.unique_id) + "</ns1:id><ns1:itemType>stream</ns1:itemType><ns1:title>" + EncodeXMLString(Item.title) + "</ns1:title>"); * Elements.Append ("<ns1:mimeType>audio/mpeg3</ns1:mimeType><ns1:trackMetadata><ns1:artistId>" + EncodeXMLString(Item.author_name) + "</ns1:artistId><ns1:artist />"); * Elements.Append ("<ns1:albumId>ALBUM:" + EncodeXMLString(Item.unique_id) + "</ns1:albumId><ns1:album></ns1:album><ns1:duration>0</ns1:duration><ns1:rating>5</ns1:rating><ns1:albumArtURI>" + Item.icon + "</ns1:albumArtURI>"); * Elements.Append ("<ns1:canPlay>true</ns1:canPlay></ns1:trackMetadata>"); * Elements.Append ("</ns1:mediaMetadata>"); * } * } * } * * Output.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"http://www.sonos.com/Services/1.1\"><SOAP-ENV:Body><ns1:getMetadataResponse><ns1:getMetadataResult>"); * Output.Append ("<ns1:index>0</ns1:index>"); * Output.Append ("<ns1:count>" + Counter+ "</ns1:count>"); * Output.Append ("<ns1:total>" + Counter + "</ns1:total>"); * * Output.Append (Elements.ToString ()); * * Output.Append ("</ns1:getMetadataResult></ns1:getMetadataResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>"); * * return Output.ToString(); * }*/ #endregion #region generateUpcomingDirectory /// <summary> /// this will generate the upcoming directory listing /// </summary> /// <returns>The upcoming directory xml</returns> /// <param name="xsnService">Xsn service.</param> private static String generateUpcomingDirectory(xsnservice xsnService) { StringBuilder Output = new StringBuilder(); StringBuilder Elements = new StringBuilder(); Int32 Counter = 0; lock (xsnService.locker) { foreach (xsn_upcoming_feed_item Item in xsnService.GetCurrentUpcomingFeed().items) { if (Item.title != null) { Counter++; Elements.Append("<ns1:mediaMetadata><ns1:id>UPCOMING:" + EncodeXMLString(Item.unique_id) + "</ns1:id><ns1:itemType>stream</ns1:itemType><ns1:title>" + EncodeXMLString(Item.title) + "</ns1:title>"); Elements.Append("<ns1:mimeType>audio/mpeg3</ns1:mimeType><ns1:trackMetadata><ns1:artistId>" + EncodeXMLString(Item.author_name) + "</ns1:artistId><ns1:artist />"); Elements.Append("<ns1:albumId>ALBUM:" + EncodeXMLString(Item.unique_id) + "</ns1:albumId><ns1:album></ns1:album><ns1:duration>0</ns1:duration><ns1:rating>5</ns1:rating><ns1:albumArtURI>" + Item.icon + "</ns1:albumArtURI>"); Elements.Append("<ns1:canPlay>true</ns1:canPlay></ns1:trackMetadata>"); Elements.Append("</ns1:mediaMetadata>"); } } } Output.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"http://www.sonos.com/Services/1.1\"><SOAP-ENV:Body><ns1:getMetadataResponse><ns1:getMetadataResult>"); Output.Append("<ns1:index>0</ns1:index>"); Output.Append("<ns1:count>" + Counter + "</ns1:count>"); Output.Append("<ns1:total>" + Counter + "</ns1:total>"); Output.Append(Elements.ToString()); Output.Append("</ns1:getMetadataResult></ns1:getMetadataResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>"); return(Output.ToString()); }
/// <summary> /// this will generate the root directory listing with Live, Recent and Upcoming Folders /// </summary> /// <returns>The root directory xml</returns> /// <param name="xsnService">Xsn service.</param> private static String generateRootDirectory(xsnservice xsnService) { StringBuilder Output = new StringBuilder(); Output.Append(@"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ns1=""http://www.sonos.com/Services/1.1""><soap:Body><ns1:getMetadataResponse><ns1:getMetadataResult><ns1:index>0</ns1:index><ns1:count>3</ns1:count><ns1:total>3</ns1:total>"); lock (xsnService.locker) { // Live Directory Output.Append(@"<ns1:mediaCollection><ns1:id>LIVE</ns1:id><ns1:itemType>collection</ns1:itemType><ns1:title>"); Output.Append("Live Shows (" + xsnService.GetCurrentLiveFeed().items.Count + ")"); Output.Append(@"</ns1:title><ns1:canPlay>false</ns1:canPlay></ns1:mediaCollection>"); // Recent Directory Output.Append(@"<ns1:mediaCollection><ns1:id>RECENT</ns1:id><ns1:itemType>collection</ns1:itemType><ns1:title>"); Output.Append("Recent Shows (" + xsnService.GetCurrentRecentReLiveBotFeed().feeds.recent.Count + ")"); Output.Append(@"</ns1:title><ns1:canPlay>false</ns1:canPlay></ns1:mediaCollection>"); // Upcoming Directory Output.Append(@"<ns1:mediaCollection><ns1:id>UPCOMING</ns1:id><ns1:itemType>collection</ns1:itemType><ns1:title>"); Output.Append("Upcoming Shows (" + xsnService.GetCurrentUpcomingFeed().items.Count + ")"); Output.Append(@"</ns1:title><ns1:canPlay>false</ns1:canPlay></ns1:mediaCollection>"); Output.Append(@"</ns1:getMetadataResult></ns1:getMetadataResponse></soap:Body></soap:Envelope>"); } return(Output.ToString()); }