Click to See Complete Forum and Search --> : .net 2.0 Cant call XML correctly (I dont know how)


OnyxBlack
March 22nd, 2009, 12:50 AM
This is a bit over my head...

Everything else seems to be in order it compiles fine but when i go to play it on my ps3 nothing shows in the folders (the vids aren't being added to to folder) my guess is it has something to do with line 250 and how its being called... though im not 100% sure and yeah like i said... im in over my head.

I need help from line 207 to 282

ABCNewsProvider.cs




namespace ABCNews
{
using MediaMallTechnologies.Util;
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text.RegularExpressions;

public class ABCNewsProvider : IPlayOnProvider
{
private Hashtable folderLookup = new Hashtable();
private IPlayOnHost host;
private VirtualFolder rootFolder;
private Hashtable titleLookup = new Hashtable();

public ABCNewsProvider()
{
this.rootFolder = new VirtualFolder(this.Name.ToLower(), this.Name);

VirtualFolder folder = new VirtualFolder(this.createGuid(), "Top Videos", "http://feeds2.feedburner.com/AbcNews_Top_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "i-CAUGHT", "http://feeds2.feedburner.com/AbcNews_i-Caught_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Extreme Video", "http://feeds2.feedburner.com/AbcNews_Extreme_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;


folder = new VirtualFolder(this.createGuid(), "Archives", "http://feeds2.feedburner.com/AbcNews_Video_Archives?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Talk Back", "http://feeds2.feedburner.com/AbcNews_TalkBack_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "U.S.", "http://feeds2.feedburner.com/AbcNews_US_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Politics", "http://feeds2.feedburner.com/AbcNews_Politics_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Bob Woodruff Reports", "http://feeds2.feedburner.com/AbcNews_Bob_Woodruff_Reports_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "World", "http://feeds2.feedburner.com/AbcNews_International_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Brian Ross:The Blotter", "http://feeds2.feedburner.com/AbcNews_Brian_Ross_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Money & Business", "http://feeds2.feedburner.com/AbcNews_Business_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Technology & Science", "http://feeds2.feedburner.com/AbcNews_Technology_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Health", "http://feeds2.feedburner.com/AbcNews_Health_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Entertainment", "http://feeds2.feedburner.com/AbcNews_Entertainment_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "GMA", "http://feeds2.feedburner.com/AbcNews_GMA_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "GMA Concert Series", "http://feeds2.feedburner.com/AbcNews_GMA_Concert_Series_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "World News with Charles Gibson", "http://feeds2.feedburner.com/AbcNews_WN_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "20/20", "http://feeds2.feedburner.com/AbcNews_2020_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "John Stossel's 'Myths'", "http://feeds2.feedburner.com/AbcNews_Stossel_Myths_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Primetime", "http://feeds2.feedburner.com/AbcNews_Primetime_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Nightline", "http://feeds2.feedburner.com/AbcNews_Nightline_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "This Week", "http://feeds2.feedburner.com/AbcNews_This_Week_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "ABC News Audio", "http://feeds2.feedburner.com/AbcNews_Audio", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;
}

private string createGuid()
{
return (this.ID + "-" + Guid.NewGuid());
}

private ArrayList getRange(ArrayList list, int startIndex, int requestCount)
{
if (requestCount == 0)
{
requestCount = 0x7fffffff;
}
if (startIndex > list.Count)
{
return new ArrayList(0);
}
return list.GetRange(startIndex, Math.Min(requestCount, list.Count - startIndex));
}

public Payload GetSharedMedia(string id, bool includeChildren, int startIndex, int requestCount)
{
ArrayList list;
if ((id == null) || (id.Length == 0))
{
return new Payload("-1", "-1", "[Unknown]", 0, new ArrayList(0));
}
if (id == this.ID)
{
list = new ArrayList();
foreach (VirtualFolder folder in this.rootFolder.Items)
{
folder.ParentId = this.ID;
list.Add(new SharedMediaFolderInfo(folder.Id, id, folder.Title, folder.Items.Count));
}
return new Payload(id, "0", this.Name, list.Count, this.getRange(list, startIndex, requestCount));
}
if (this.titleLookup[id] != null)
{
SharedOnlineMediaInfo info = (SharedOnlineMediaInfo) this.titleLookup[id];
list = new ArrayList();
list.Add(info);
return new Payload(id, info.OwnerId, info.Title, 1, list, false);
}
if (this.folderLookup[id] == null)
{
return new Payload("-1", "-1", "[Unknown]", 0, new ArrayList(0));
}
list = new ArrayList();
VirtualFolder vf = (VirtualFolder) this.folderLookup[id];
if (vf.Dynamic && (startIndex == 0))
{
TimeSpan span = (TimeSpan) (DateTime.Now - vf.LastLoad);
if (span.TotalSeconds > 60.0)
{
this.loadFeed(vf);
vf.LastLoad = DateTime.Now;
}
}
foreach (object obj2 in vf.Items)
{
if (obj2 is VirtualFolder)
{
VirtualFolder folder3 = obj2 as VirtualFolder;
list.Add(new SharedMediaFolderInfo(folder3.Id, vf.Id, folder3.Title, folder3.Items.Count));
}
else if (obj2 is SharedOnlineMediaInfo)
{
SharedOnlineMediaInfo info2 = obj2 as SharedOnlineMediaInfo;
list.Add(info2);
}
}
return new Payload(id, vf.ParentId, vf.Title, list.Count, this.getRange(list, startIndex, requestCount));
}

private void loadFeed(VirtualFolder vf)
{

try
{
vf.Reset();
this.log("Loading " + vf.SourceURL);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(vf.SourceURL);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string xml = reader.ReadToEnd();
reader.Close();

//parse the xml file using regular expressions, for some reason the XmlUtils hangs on this.
string videoProps = "";
//enumerate each video in the xml file
Regex outerRx = new Regex("<video>(?<innerVideo>.*?)</video>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
foreach (Match outerMatch in outerRx.Matches(xml))
{
try
{
videoProps = outerMatch.Groups["innerVideo"].Value;
}
catch (Exception)
{
continue;
}

string length = "";
string title = "";
string description = "";
string thumbnail = "";
string videourl = "";

//enumerate all the inner tags
Regex innerRx = new Regex(@"<(?<tag>[^>]*?)>(<!\[CDATA\[)?(?<value>.*?)(\]\]>)?</(?<tag>[^>]*?)>",
RegexOptions.IgnoreCase | RegexOptions.Singleline);

foreach (Match innerMatch in innerRx.Matches(videoProps))
{
string tag = "";
string value = "";

try
{
tag = innerMatch.Groups["tag"].Value;
value = innerMatch.Groups["value"].Value;
}
catch (Exception)
{
continue;
}

switch (tag.ToLower())
{
case "clipname":
title = value;
break;
case "videourl":
videourl = value;
break;
case "length":
length = value;
break;
case "thumbnailurl":
thumbnail = value;
break;
case "abstract":
description = value;
break;
}
}

//done enumerating the inner tags, add the video to the folder
NameValueCollection props = new NameValueCollection();
props["Icon"] = thumbnail;
props["Description"] = description;
props["Date"] = DateTime.Today.ToString("s");
props["Duration"] = length;
string id = vf.FindGuid(videourl);
if (id == null)
{
id = this.createGuid();
}

this.log("adding show : " + vf.Title + " : " + title + " : " + videourl);
SharedOnlineMediaInfo info = new SharedOnlineMediaInfo(id, vf.Id, title, videourl, 2, props, videourl);
vf.AddMedia(info);
this.titleLookup[info.Id] = info;
}
//done enumerating the <video> tags


}
catch (Exception exception)
{
this.log("ERROR: Failure in load: " + exception);
}
}

private void log(string message)
{
this.host.LogMessage("ABCNews: " + message);
}

private string ResolveAsf(string url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());

string ret = "";
string asfData = reader.ReadToEnd();
reader.Close();

Regex rx = new Regex("^ref1=(?<newUrl>.*)$", RegexOptions.Multiline | RegexOptions.IgnoreCase);
Match m = rx.Match(asfData);

ret = m.Groups["newUrl"].Value;

ret = ret.Trim();

return ret;

}

public string Resolve(SharedMediaFileInfo fileInfo)
{
//string newPath = fileInfo.Path;
//try
//{
// newPath = ResolveAsf(fileInfo.Path);
// this.log("Resolve() : " + fileInfo.Path + " -> " + newPath);
// newPath = ResolveAsf(newPath);
// this.log("Resolve(2) : -> " + newPath);
// newPath = ResolveAsf(newPath);
// this.log("Resolve(3) : -> " + newPath);

//}
//catch (Exception)
//{
// this.log("Resolve() : " + newPath + " couldn't resolve asf");
//}

return ("<media><url>" + fileInfo.Path + "</url></media>");
}

public void SetPlayOnHost(IPlayOnHost h)
{
this.host = h;
}

public string ID
{
get
{
return this.Name.ToLower();
}
}

public System.Drawing.Image Image
{
get
{
System.Drawing.Image image = null;
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ABC.logo.jpg");
if (manifestResourceStream != null)
{
image = System.Drawing.Image.FromStream(manifestResourceStream);
manifestResourceStream.Close();
}
return image;
}
}

public string Name
{
get
{
return "ABCNews";
}
}
}
}



The origional code was written to read a xml file like
http://www.foodnetwork.com/food/channel/xml/0,,14363,00.xml

But I'm trying to modify it to read a xml file like
http://feeds2.feedburner.com/AbcNews_Extreme_Video?format=xml

OnyxBlack
March 23rd, 2009, 06:43 PM
well did some editing on it... this is where im at now - it compiles but there are no vids in my virtual folder...

(it still isn't reading the xml correctly)


namespace ABCNews
{
using MediaMallTechnologies.Util;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text.RegularExpressions;

public class ABCNewsProvider : IPlayOnProvider
{
private Hashtable folderLookup = new Hashtable();
private IPlayOnHost host;
private VirtualFolder rootFolder;
private Hashtable titleLookup = new Hashtable();
private object lockObject = new object();

public ABCNewsProvider()
{
this.rootFolder = new VirtualFolder(this.Name.ToLower(), this.Name);

VirtualFolder folder = new VirtualFolder(this.createGuid(), "Top Videos", "http://feeds2.feedburner.com/AbcNews_Top_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "i-CAUGHT", "http://feeds2.feedburner.com/AbcNews_i-Caught_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Extreme Video", "http://feeds2.feedburner.com/AbcNews_Extreme_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;


folder = new VirtualFolder(this.createGuid(), "Archives", "http://feeds2.feedburner.com/AbcNews_Video_Archives?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Talk Back", "http://feeds2.feedburner.com/AbcNews_TalkBack_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "U.S.", "http://feeds2.feedburner.com/AbcNews_US_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Politics", "http://feeds2.feedburner.com/AbcNews_Politics_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Bob Woodruff Reports", "http://feeds2.feedburner.com/AbcNews_Bob_Woodruff_Reports_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "World", "http://feeds2.feedburner.com/AbcNews_International_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Brian Ross:The Blotter", "http://feeds2.feedburner.com/AbcNews_Brian_Ross_Video?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Money & Business", "http://feeds2.feedburner.com/AbcNews_Business_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Technology & Science", "http://feeds2.feedburner.com/AbcNews_Technology_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Health", "http://feeds2.feedburner.com/AbcNews_Health_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Entertainment", "http://feeds2.feedburner.com/AbcNews_Entertainment_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "GMA", "http://feeds2.feedburner.com/AbcNews_GMA_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "GMA Concert Series", "http://feeds2.feedburner.com/AbcNews_GMA_Concert_Series_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "World News with Charles Gibson", "http://feeds2.feedburner.com/AbcNews_WN_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "20/20", "http://feeds2.feedburner.com/AbcNews_2020_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "John Stossel's 'Myths'", "http://feeds2.feedburner.com/AbcNews_Stossel_Myths_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Primetime", "http://feeds2.feedburner.com/AbcNews_Primetime_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "Nightline", "http://feeds2.feedburner.com/AbcNews_Nightline_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "This Week", "http://feeds2.feedburner.com/AbcNews_This_Week_Videos?format=xml", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;

folder = new VirtualFolder(this.createGuid(), "ABC News Audio", "http://feeds2.feedburner.com/AbcNews_Audio", true);
this.rootFolder.AddFolder(folder);
this.folderLookup[folder.Id] = folder;
}

private string createGuid()
{
return (this.ID + "-" + Guid.NewGuid());
}

private ArrayList getRange(ArrayList list, int startIndex, int requestCount)
{
if (requestCount == 0)
{
requestCount = 0x7fffffff;
}
if (startIndex > list.Count)
{
return new ArrayList(0);
}
return list.GetRange(startIndex, Math.Min(requestCount, list.Count - startIndex));
}

private string GetRealPath(string url)
{
lock (this.lockObject)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string input = new StreamReader(response.GetResponseStream()).ReadToEnd();
string str2 = "";
string pattern = @"http://video-cdn.abcnews.com/\d+/(?:[a-z][a-z0-9_]+).flv";
//string pattern = @"http://www.gametrailers.com/download/\d+/(?:[a-z][a-z0-9_]+).wmv";
//string pattern = @"http://www.gametrailers.com/download/\d+/(?:[a-z][a-z0-9_]+).mp4";
MatchCollection matchs = Regex.Matches(input, pattern);
foreach (Match match in matchs)
{
str2 = match.ToString().Replace(@"\", "");
break;
}
return str2;
}
}
public Payload GetSharedMedia(string id, bool includeChildren, int startIndex, int requestCount)
{
ArrayList list;
if ((id == null) || (id.Length == 0))
{
return new Payload("-1", "-1", "[Unknown]", 0, new ArrayList(0));
}
if (id == this.ID)
{
list = new ArrayList();
foreach (VirtualFolder folder in this.rootFolder.Items)
{
folder.ParentId = this.ID;
list.Add(new SharedMediaFolderInfo(folder.Id, id, folder.Title, folder.Items.Count));
}
return new Payload(id, "0", this.Name, list.Count, this.getRange(list, startIndex, requestCount));
}
if (this.titleLookup[id] != null)
{
SharedOnlineMediaInfo info = (SharedOnlineMediaInfo)this.titleLookup[id];
list = new ArrayList();
list.Add(info);
return new Payload(id, info.OwnerId, info.Title, 1, list, false);
}
if (this.folderLookup[id] == null)
{
return new Payload("-1", "-1", "[Unknown]", 0, new ArrayList(0));
}
list = new ArrayList();
VirtualFolder vf = (VirtualFolder)this.folderLookup[id];
if (vf.Dynamic && (startIndex == 0))
{
TimeSpan span = (TimeSpan)(DateTime.Now - vf.LastLoad);
if (span.TotalSeconds > 60.0)
{
this.loadFeed(vf);
vf.LastLoad = DateTime.Now;
}
}
foreach (object obj2 in vf.Items)
{
if (obj2 is VirtualFolder)
{
VirtualFolder folder3 = obj2 as VirtualFolder;
list.Add(new SharedMediaFolderInfo(folder3.Id, vf.Id, folder3.Title, folder3.Items.Count));
}
else if (obj2 is SharedOnlineMediaInfo)
{
SharedOnlineMediaInfo info2 = obj2 as SharedOnlineMediaInfo;
list.Add(info2);
}
}
return new Payload(id, vf.ParentId, vf.Title, list.Count, this.getRange(list, startIndex, requestCount));
}

private void loadFeed(VirtualFolder vf)
{
try
{
vf.Reset();
this.log("Loading " + vf.SourceURL);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(vf.SourceURL);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string xml = reader.ReadToEnd();
reader.Close();
foreach (SimpleElement element in XmlUtils.FindFirstElement(xml, "channel").ChildElements)
{
if (element.TagName == "item")
{
string title = "";
string str3 = "";
string s = "";
string onlineIdentifier = "";
string text = "";
string str7 = "";
foreach (SimpleElement element2 in element.ChildElements)
{
string tagName = element2.TagName;
if (tagName != null)
{
tagName = string.IsInterned(tagName);
if (tagName == "title")
{
title = element2.Text;
continue;
}
if (tagName == "description")
{
str3 = element2.Text.Trim();
continue;
}
if (tagName == "pubDate")
{
s = element2.Text;
try
{
s = DateTime.Parse(s, DateTimeFormatInfo.InvariantInfo).ToString("s");
}
catch (Exception)
{
}
continue;
}
if (tagName == "fileType")
{
onlineIdentifier = element2.ChildElements.Item(2).Text;
continue;
}

if ((tagName == "image") && (text == ""))
{
text = element2.Text;
}
}
}
if (str7.Length > 0)
{
TimeSpan span = TimeSpan.FromSeconds(double.Parse(str7));
str7 = span.Hours.ToString("d1") + ":" + span.Minutes.ToString("d2") + ":" + span.Seconds.ToString("d2");
}
NameValueCollection props = new NameValueCollection();
props["Icon"] = text;
props["Description"] = str3;
props["Date"] = s;
string id = vf.FindGuid(onlineIdentifier);
if (id == null)
{
id = this.createGuid();
}
this.log("adding show : " + vf.Title + " : " + title + " : " + onlineIdentifier);
SharedOnlineMediaInfo info = new SharedOnlineMediaInfo(id, vf.Id, title, onlineIdentifier, 2, props, onlineIdentifier);
vf.AddMedia(info);
this.titleLookup[info.Id] = info;
}
}
}
catch (Exception exception)
{
this.log("ERROR: Failure in load: " + exception);
}
}

private void log(string message)
{
this.host.LogMessage("ABCNews: " + message);
}

public string Resolve(SharedMediaFileInfo fileInfo)
{
string realPath = GetRealPath(fileInfo.Path);
this.log("Resolved " + fileInfo.Path + " -> " + realPath);
return ("<media><url>" + realPath + "</url></media>");
}

public void SetPlayOnHost(IPlayOnHost host)
{
this.host = host;
}


public string ID
{
get
{
return this.Name.ToLower();
}
}

public System.Drawing.Image Image
{
get
{
System.Drawing.Image image = null;
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ABC.logo.jpg");
if (manifestResourceStream != null)
{
image = System.Drawing.Image.FromStream(manifestResourceStream);
manifestResourceStream.Close();
}
return image;
}
}

public string Name
{
get
{
return "ABCNews";
}
}
}
}




You can download my complete project here

http://www.playonplugins.com/downloads/ABCNews.rar