|
From: <se...@us...> - 2007-02-28 05:30:12
|
Revision: 140
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=140&view=rev
Author: sergem1
Date: 2007-02-27 21:30:01 -0800 (Tue, 27 Feb 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/plugins/ETVNet/
trunk/plugins/ETVNet/ETVNet/
trunk/plugins/ETVNet/ETVNet/ClassDiagram1.cd
trunk/plugins/ETVNet/ETVNet/DialogRuKeyboard.cs
trunk/plugins/ETVNet/ETVNet/ETVBrowser.cs
trunk/plugins/ETVNet/ETVNet/ETVNet.csproj
trunk/plugins/ETVNet/ETVNet/ETVNet.csproj.user
trunk/plugins/ETVNet/ETVNet/ETVNetStreamInfo.cs
trunk/plugins/ETVNet/ETVNet/PathLink.cs
trunk/plugins/ETVNet/ETVNet/PathNode.cs
trunk/plugins/ETVNet/ETVNet/PathPage.cs
trunk/plugins/ETVNet/ETVNet/PathTerminal.cs
trunk/plugins/ETVNet/ETVNet/Plugin.cs
trunk/plugins/ETVNet/ETVNet/Properties/
trunk/plugins/ETVNet/ETVNet/Properties/AssemblyInfo.cs
trunk/plugins/ETVNet/ETVNet/SetupForm.Designer.cs
trunk/plugins/ETVNet/ETVNet/SetupForm.cs
trunk/plugins/ETVNet/ETVNet/SetupForm.resx
trunk/plugins/ETVNet/ETVNet/TODO.txt
trunk/plugins/ETVNet/ETVNet/TopList.cs
trunk/plugins/ETVNet/ETVNet/skinfiles/
trunk/plugins/ETVNet/ETVNet/skinfiles/DialogETVNetStreamInfo.xml
trunk/plugins/ETVNet/ETVNet/skinfiles/DialogRuKeyboard.xml
trunk/plugins/ETVNet/ETVNet/skinfiles/ETVNet_logo.png
trunk/plugins/ETVNet/ETVNet/skinfiles/etvnet.main.xml
trunk/plugins/ETVNet/ETVNet/skinfiles/wide/
trunk/plugins/ETVNet/ETVNet/skinfiles/wide/DialogETVNetStreamInfo.xml
trunk/plugins/ETVNet/ETVNet/skinfiles/wide/DialogRuKeyboard.xml
trunk/plugins/ETVNet/ETVNet/skinfiles/wide/etvnet.main.xml
trunk/plugins/ETVNet/ETVNet.sln
trunk/plugins/ETVNet/ETVNet.suo
trunk/plugins/ETVNet/Readme.build.txt
Added: trunk/plugins/ETVNet/ETVNet/ClassDiagram1.cd
===================================================================
--- trunk/plugins/ETVNet/ETVNet/ClassDiagram1.cd (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/ClassDiagram1.cd 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1 @@
+
\ No newline at end of file
Added: trunk/plugins/ETVNet/ETVNet/DialogRuKeyboard.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/DialogRuKeyboard.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/DialogRuKeyboard.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,250 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Drawing;
+using System.Net;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Util;
+
+namespace ETVNet
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public class DialogRuKeyboard : GUIWindow, IRenderLayer
+ {
+ #region keyButtons
+
+ [SkinControlAttribute(20)]
+ protected GUILabelControl inputLabel = null;
+ [SkinControlAttribute(21)]
+ protected GUIButtonControl doneButton = null;
+ #endregion
+
+ public string inputString;
+ public bool done;
+ Hashtable keyTable;
+
+ #region Base Dialog Variables
+ bool m_bRunning = false;
+ int m_dwParentWindowID = 0;
+ GUIWindow m_pParentWindow = null;
+ #endregion
+
+ bool m_bOverlay = false;
+
+ public DialogRuKeyboard()
+ {
+ GetID = 7767;
+ inputString = "";
+ keyTable = new Hashtable(33);
+ // 1
+ keyTable.Add(9011, "А");
+ keyTable.Add(9012, "Б");
+ keyTable.Add(9013, "В");
+ keyTable.Add(9014, "Г");
+ keyTable.Add(9015, "Д");
+ keyTable.Add(9016, "Е");
+ // 2
+ keyTable.Add(9021, "Ё");
+ keyTable.Add(9022, "Ж");
+ keyTable.Add(9023, "З");
+ keyTable.Add(9024, "И");
+ keyTable.Add(9025, "Й");
+ keyTable.Add(9026, "К");
+ // 3
+ keyTable.Add(9031, "Л");
+ keyTable.Add(9032, "М");
+ keyTable.Add(9033, "Н");
+ keyTable.Add(9034, "О");
+ keyTable.Add(9035, "П");
+ keyTable.Add(9036, "Р");
+ // 4
+ keyTable.Add(9041, "С");
+ keyTable.Add(9042, "Т");
+ keyTable.Add(9043, "У");
+ keyTable.Add(9044, "Ф");
+ keyTable.Add(9045, "Х");
+ keyTable.Add(9046, "Ц");
+ // 5
+ keyTable.Add(9051, "Ч");
+ keyTable.Add(9052, "Ш");
+ keyTable.Add(9053, "Щ");
+ keyTable.Add(9054, "Ъ");
+ keyTable.Add(9055, "Ы");
+ keyTable.Add(9056, "Ь");
+ // 6
+ keyTable.Add(9061, "Э");
+ keyTable.Add(9062, "Ю");
+ keyTable.Add(9063, "Я");
+ }
+
+ public override bool Init()
+ {
+ done = false;
+ return Load(GUIGraphicsContext.Skin + @"\DialogRuKeyboard.xml");
+ }
+
+ public override void PreInit()
+ {
+ }
+
+ public override void OnAction(Action action)
+ {
+ if (action.wID == Action.ActionType.ACTION_CONTEXT_MENU)
+ {
+ Close();
+ return;
+ }
+ if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
+ {
+ if (doneButton.Focus)
+ {
+ Close();
+ return;
+ }
+ else
+ {
+ if (inputString.Length > 0)
+ {
+ inputString = inputString.Substring(0, inputString.Length - 1);
+ if (inputString.Length > 0)
+ inputLabel.Label = inputString;
+ else
+ inputLabel.Label = "<...>";
+ }
+ return;
+ }
+ }
+ base.OnAction(action);
+ }
+
+ #region Base Dialog Members
+ public void RenderDlg(float timePassed)
+ {
+ base.Render(timePassed);
+ }
+
+ void Close()
+ {
+ GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null);
+ OnMessage(msg);
+
+ GUIWindowManager.UnRoute();
+ m_pParentWindow = null;
+ m_bRunning = false;
+ }
+
+ public void DoModal(int dwParentId)
+ {
+ m_dwParentWindowID = dwParentId;
+ m_pParentWindow = GUIWindowManager.GetWindow(m_dwParentWindowID);
+ if (null == m_pParentWindow)
+ {
+ m_dwParentWindowID = 0;
+ return;
+ }
+
+ GUIWindowManager.RouteToWindow(GetID);
+
+ // activate this window...
+ GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, 0, 0, null);
+ OnMessage(msg);
+
+ GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog);
+ m_bRunning = true;
+ GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog);
+ while (m_bRunning && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING)
+ {
+ GUIWindowManager.Process();
+ }
+ GUILayerManager.UnRegisterLayer(this);
+ }
+ #endregion
+
+
+ protected override void OnPageDestroy(int newWindowId)
+ {
+ if (m_bRunning)
+ {
+ // Probably user pressed H (SWITCH_HOME)
+ GUIWindowManager.UnRoute();
+ m_pParentWindow = null;
+ m_bRunning = false;
+ }
+ GUIGraphicsContext.Overlay = m_bOverlay;
+ base.OnPageDestroy(newWindowId);
+ }
+
+ protected override void OnPageLoad()
+ {
+ base.OnPageLoad();
+ m_bOverlay = GUIGraphicsContext.Overlay;
+ Update();
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
+ {
+ base.OnClicked(controlId, control, actionType);
+ if (control == doneButton)
+ {
+ done = true;
+ Close();
+ }
+ if (keyTable.ContainsKey(controlId))
+ {
+ inputString += (string)keyTable[controlId];
+ inputLabel.Label = inputString;
+ }
+ }
+
+ void Update()
+ {
+ if(inputString.Length>0)
+ inputLabel.Label = inputString;
+ else
+ inputLabel.Label = "<...>";
+ }
+
+ public override void Render(float timePassed)
+ {
+ RenderDlg(timePassed);
+ }
+
+ #region IRenderLayer
+ public bool ShouldRenderLayer()
+ {
+ return true;
+ }
+
+ public void RenderLayer(float timePassed)
+ {
+ Render(timePassed);
+ }
+ #endregion
+ }
+}
Added: trunk/plugins/ETVNet/ETVNet/ETVBrowser.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/ETVBrowser.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/ETVBrowser.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,436 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Text;
+using System.Net;
+using System.Xml;
+using System.Web;
+using System.Collections;
+using System.Text.RegularExpressions;
+
+namespace ETVNet
+{
+ // the component that goes to etvnet.ca and returns structured data
+ // most of the site intricacies is hidden here
+ class ETVBrowser
+ {
+ CookieContainer cookies;
+ Regex regexTopLinks;
+ Regex regexCategories;
+ Regex regexLetters;
+ Regex regexArchivedEntries;
+ Regex regexPrev;
+ Regex regexNext;
+ Regex regexInfo;
+ Regex regexMMS;
+ Regex regexJSOpen;
+ Regex regexDeQuote;
+ Regex regexTodayEntries;
+ bool traceHTML;
+
+ public ETVBrowser(bool pTraceHTML)
+ {
+ traceHTML = pTraceHTML;
+ cookies = new CookieContainer();
+ regexTopLinks = new Regex(
+ @"<th.*?>(.*?)</th>.*?(?:<a.*?href=""(.*?)"".*?>([^<]*)?</a>.*"
+ + @"?(?=<(?:a|th)))+",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexCategories = new Regex(
+ @"<a\s+href=""([^""]*?)""\s*>([^<]*?)</a>\s+\((\d+)\)",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexLetters = new Regex(
+ @"<a\s+href=""([^""]*?start_letter[^""]*?)""\s*>([^<]*?)</a>",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexArchivedEntries = new Regex(
+ @"<td[^>]*?>\d\d(\d\d-\d\d-\d\d)\s(\d\d:\d\d)</td>\s*" + "\r\n" + @"<td[^>]"
+ + @"*?>(\d+)</td>\s*" + "\r\n" + @"<td[^>]*?>\s*\[<a\s+href=""([^""]*?)""\s*>"
+ + @"[^<]*?</a>\]\s*</td>\s*" + "\r\n" + @"<td[^>]*?>.*?<a\s+href=""([^""]*?)""\s"
+ + @"*>([^<]*?)</a>.*?</td>\s*" + "\r\n" + @"<td[^>]*?>(.*?)</td>" + "\r\n" + @"",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexPrev = new Regex(
+ @"\[<a\s+href=""([^""]*?)""\s*>\d+</a>\].*?(?=\[<b>\d+</b>\])",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexNext = new Regex(
+ @"(?<=\[<b>\d+</b>\]).*?\[<a\s+href=""([^""]*?)""\s*>\d+</a>\]",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexInfo = new Regex(
+ @"(?<!(?:<style[^>]*?|<a[^>]*?))>(?:[\s]+|([^<]*?))<",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexMMS = new Regex(
+ @"<a\s+href=""(mms:[^""]+)""",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexJSOpen = new Regex(
+ @"open\(([^,]+),",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexDeQuote = new Regex(
+ @"'([^']+)'",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+ regexTodayEntries = new Regex(
+ @"<td[^>]*?>\d\d(\d\d-\d\d-\d\d)\s(\d\d:\d\d)</td>\s*"+"\r\n"+ @"
+ <td[^>"
+ + @"]*?>\s*\[<a\s+href=""([^""]*?)""\s*>[^<]*?</a>\]\s*</td>\s*" +"\r\n"
+ + @"<td[^>]*?>.*?<a\s+href=""([^""]*?)""\s*>([^<]*?)</a>.*?</td>"
+ + @"\s*"+"\r\n"+ @"<td[^>]*?>(.*?)</td>"+"\r\n"+ @"",
+ RegexOptions.IgnoreCase
+ | RegexOptions.Singleline
+ | RegexOptions.CultureInvariant
+ | RegexOptions.IgnorePatternWhitespace
+ | RegexOptions.Compiled
+ );
+
+ }
+
+ public void login(string username, string password)
+ {
+ System.Collections.Hashtable postData = new System.Collections.Hashtable(3);
+ postData.Add("action","login");
+ postData.Add("login",username);
+ postData.Add("pwd",password);
+ Stream s = getHTML("http://www.etvnet.ca/cgi-bin/video/eitv_login.cgi", null, postData); // non-compliant
+ // how to check result ???
+ byte[] buffer = new byte[1024];
+ s.Read(buffer,0,1024);
+ String x = System.Text.Encoding.GetEncoding(0).GetString(buffer);
+ }
+
+ public Hashtable getTopDirectoryPage()
+ {
+ Uri baseUrl = new Uri("http://www.etvnet.ca/main.html");
+ String todayPage = getHTMLAsString(baseUrl.AbsoluteUri, null, null);
+ MatchCollection matches = regexTopLinks.Matches(todayPage, 0);
+ //
+ // find all stream types - archive, today, live
+ Hashtable streams = new Hashtable(3);
+ foreach (Match match in matches)
+ {
+ foreach (Capture streamtype in match.Groups[3].Captures)
+ {
+ streams[streamtype.Value] = new System.Collections.ArrayList();
+ }
+ }
+ //
+ // fill in stream directory links
+ foreach (string stream in streams.Keys)
+ {
+ System.Collections.ArrayList list = (System.Collections.ArrayList)streams[stream];
+ foreach (Match match in matches)
+ {
+ for (int i = 0; i < match.Groups[3].Captures.Count; i++)
+ {
+ if (match.Groups[3].Captures[i].Value == stream)
+ {
+ Hashtable entry = new Hashtable(2);
+ entry.Add("name", HttpUtility.HtmlDecode(match.Groups[1].Value));
+ entry.Add("url", new Uri(baseUrl, match.Groups[2].Captures[i].Value).AbsoluteUri);
+ // ??? insert if video link analysis
+ list.Add(entry);
+ }
+ }
+ }
+ }
+ return streams;
+ }
+
+ public Hashtable getDirectoryPage(string url)
+ {
+ Uri baseUrl = new Uri(url);
+ String dirPageString = getHTMLAsString(baseUrl.AbsoluteUri, null, null);
+
+ Hashtable dirPage = new Hashtable(5);
+ System.Collections.ArrayList list;
+ MatchCollection matches;
+
+ matches = regexCategories.Matches(dirPageString, 0);
+ list = new ArrayList();
+ foreach (Match match in matches)
+ {
+ Hashtable entry = new Hashtable(2);
+ entry.Add("name", HttpUtility.HtmlDecode(match.Groups[2].Value));
+ entry.Add("url", new Uri(baseUrl, match.Groups[1].Value).AbsoluteUri);
+ entry.Add("secondary", HttpUtility.HtmlDecode(match.Groups[2].Value));
+ list.Add(entry);
+ }
+ dirPage.Add("categories", list);
+
+ matches = regexLetters.Matches(dirPageString, 0);
+ list = new ArrayList();
+ foreach (Match match in matches)
+ {
+ Hashtable entry = new Hashtable(2);
+ entry.Add("name", HttpUtility.HtmlDecode(match.Groups[2].Value));
+ entry.Add("url", new Uri(baseUrl, match.Groups[1].Value).AbsoluteUri);
+ list.Add(entry);
+ }
+ dirPage.Add("letters", list);
+
+ matches = regexArchivedEntries.Matches(dirPageString, 0);
+ list = new ArrayList();
+ foreach (Match match in matches)
+ {
+ Hashtable entry = new Hashtable(2);
+ entry.Add("date", match.Groups[1].Value);
+ entry.Add("time", match.Groups[2].Value);
+ entry.Add("rating", match.Groups[3].Value);
+ entry.Add("infoUrl", new Uri(baseUrl, match.Groups[4].Value).AbsoluteUri);
+ entry.Add("url", new Uri(baseUrl, match.Groups[5].Value).AbsoluteUri);
+ entry.Add("name", HttpUtility.HtmlDecode(match.Groups[6].Value));
+ entry.Add("length", HttpUtility.HtmlDecode(match.Groups[7].Value));
+ entry.Add("pageType", "archive");
+ list.Add(entry);
+ }
+ if (list.Count < 1) // today page
+ {
+ matches = regexTodayEntries.Matches(dirPageString, 0);
+ list = new ArrayList();
+ foreach (Match match in matches)
+ {
+ Hashtable entry = new Hashtable(2);
+ entry.Add("date", match.Groups[1].Value);
+ entry.Add("time", match.Groups[2].Value);
+ entry.Add("rating", "0");
+ entry.Add("infoUrl", new Uri(baseUrl, match.Groups[3].Value).AbsoluteUri);
+ entry.Add("url", new Uri(baseUrl, match.Groups[4].Value).AbsoluteUri);
+ entry.Add("name", HttpUtility.HtmlDecode(match.Groups[5].Value));
+ entry.Add("length", HttpUtility.HtmlDecode(match.Groups[6].Value));
+ entry.Add("pageType", "today");
+ list.Add(entry);
+ }
+ }
+ dirPage.Add("entries", list);
+
+ {
+ Match match;
+ match = regexPrev.Match(dirPageString, 0);
+ if (match.Groups[1].Success)
+ {
+ dirPage.Add("prev", new Uri(baseUrl, match.Groups[1].Value).AbsoluteUri);
+ }
+
+ match = regexNext.Match(dirPageString, 0);
+ if (match.Groups[1].Success)
+ {
+ dirPage.Add("next", new Uri(baseUrl, match.Groups[1].Value).AbsoluteUri);
+ }
+ }
+
+ return dirPage;
+ }
+
+ public String getInfoPage(string url)
+ {
+ Uri baseUrl = new Uri(url);
+ String dirPageString = getHTMLAsString(baseUrl.AbsoluteUri, null, null);
+
+ MatchCollection matches;
+ matches = regexInfo.Matches(dirPageString, 0);
+ string info = "";
+ foreach (Match match in matches)
+ {
+ string text = match.Groups[1].Value;
+ if (text.Length > 0)
+ {
+ text = HttpUtility.HtmlDecode(text);
+ char [] trimChars = {' ','\t','\n','\r','<','>',';'};
+ text = text.Trim(trimChars);
+ if (text.Length > 0)
+ {
+ info += text.Trim() + "\r\n";
+ }
+ }
+ }
+ return info;
+ }
+
+ public string getMMSURL(string paramUrl)
+ {
+ Match match = regexJSOpen.Match(paramUrl, 0);
+ if (!match.Groups[1].Success)
+ return null;
+ string url = "";
+ MatchCollection matches = regexDeQuote.Matches(match.Groups[1].Value);
+ foreach (Match stringMatch in matches)
+ {
+ url+=stringMatch.Groups[1].Value;
+ }
+ if(url.Length < 1)
+ return null;
+
+ String MMSPageString = getHTMLAsString(url, null, null);
+ match = regexMMS.Match(MMSPageString, 0);
+ if (!match.Groups[1].Success)
+ return null;
+ return match.Groups[1].Value;
+ }
+
+ public String getHTMLAsString(string URL, Hashtable GETData, Hashtable POSTData)
+ {
+ Stream responseStream = getHTML(URL, GETData, POSTData);
+ // default encoding for non-unicode programs, set in control panel, in all reality should be win-1251
+ StreamReader urlRdr = new StreamReader(new StreamReader(responseStream).BaseStream, Encoding.GetEncoding(0));
+ string result = urlRdr.ReadToEnd();
+ if (traceHTML)
+ {
+ StreamWriter writer;
+ writer = File.CreateText("htmltrace-"+HttpUtility.UrlEncode(URL));
+ writer.Write(result);
+ writer.Close();
+ }
+ return result;
+ }
+
+ /*
+ * If etvnet was XHTML-compliant, we'd use this
+ public XmlDocument getXHTML(string URL, Hashtable GETData, Hashtable POSTData)
+ {
+ Stream responseStream = getHTML(URL, GETData, POSTData);
+ XmlTextReader reader = new XmlTextReader(responseStream);
+ reader.XmlResolver = null;
+ XmlDocument xmlDoc = new XmlDocument();
+ xmlDoc.Load(reader);
+ return xmlDoc;
+ }
+ */
+
+ public Stream getHTML(string URL, Hashtable GETData, Hashtable POSTData)
+ {
+ // URL encode GET querystring data, if any
+ string GETDataString = "";
+ if (GETData!=null && GETData.Count > 0)
+ {
+ foreach(string key in GETData.Keys)
+ {
+ if(GETDataString.Length > 0)
+ GETDataString += "&";
+ GETDataString += HttpUtility.UrlEncode(key, Encoding.GetEncoding(0))
+ + "=" + HttpUtility.UrlEncode(GETData[key].ToString(), Encoding.GetEncoding(0));
+ }
+ }
+ // URL encode POST data, if any
+ string POSTDataString = "";
+ if (POSTData!=null && POSTData.Count > 0)
+ {
+ foreach(string key in POSTData.Keys)
+ {
+ if(POSTDataString.Length > 0)
+ POSTDataString += "&";
+ POSTDataString += HttpUtility.UrlEncode(key,Encoding.GetEncoding(0))
+ + "=" + HttpUtility.UrlEncode(POSTData[key].ToString(), Encoding.GetEncoding(0));
+ }
+ }
+
+ HttpWebRequest webRequest;
+ Uri url;
+ if (GETData != null && GETData.Count > 0)
+ {
+ url = new Uri(URL);
+ if(url.Query.Length > 0) // some querystring is present already
+ url = new Uri(URL + "?" + GETDataString);
+ else
+ url = new Uri(URL + "&" + GETDataString);
+ }
+ else
+ {
+ url = new Uri(URL);
+ }
+
+ if(POSTData!=null && POSTData.Count > 0)
+ {
+ webRequest = (HttpWebRequest)WebRequest.Create(url);
+ webRequest.CookieContainer = cookies;
+ webRequest.ContentType = "application/x-www-form-urlencoded"; // no file uploads supported so far
+ webRequest.Method = "POST";
+ webRequest.UserAgent = "MediaPortal-ETVNet-Plugin/1.0";
+ webRequest.ContentLength = POSTDataString.Length;
+ Stream postStream = webRequest.GetRequestStream();
+ byte[] postBuffer = System.Text.Encoding.GetEncoding(0).GetBytes(POSTDataString);
+ postStream.Write(postBuffer,0,postBuffer.Length);
+ postStream.Close();
+ }else
+ {
+ webRequest = (HttpWebRequest)WebRequest.Create(url);
+ webRequest.CookieContainer = cookies;
+ webRequest.Method = "GET";
+ webRequest.UserAgent = "MediaPortal-ETVNet-Plugin/1.0";
+ }
+
+ WebResponse response = webRequest.GetResponse();
+ return response.GetResponseStream();
+ }
+ }
+}
Added: trunk/plugins/ETVNet/ETVNet/ETVNet.csproj
===================================================================
--- trunk/plugins/ETVNet/ETVNet/ETVNet.csproj (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/ETVNet.csproj 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,98 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{35AD720D-DC3B-46D8-BC67-C67335F1CB4C}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ETVNet</RootNamespace>
+ <AssemblyName>ETVNet</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Core, Version=1.0.2605.21111, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\mediaportal\xbmc\bin\Release\Core.dll</HintPath>
+ </Reference>
+ <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\mediaportal\xbmc\bin\Release\plugins\windows\Dialogs.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Utils, Version=1.0.2605.20848, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\mediaportal\xbmc\bin\Release\Utils.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DialogRuKeyboard.cs" />
+ <Compile Include="ETVBrowser.cs" />
+ <Compile Include="ETVNetStreamInfo.cs" />
+ <Compile Include="PathLink.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="PathNode.cs" />
+ <Compile Include="PathPage.cs" />
+ <Compile Include="PathTerminal.cs" />
+ <Compile Include="Plugin.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SetupForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="SetupForm.Designer.cs">
+ <DependentUpon>SetupForm.cs</DependentUpon>
+ </Compile>
+ <Compile Include="TopList.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="ClassDiagram1.cd" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="TODO.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="SetupForm.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>SetupForm.cs</DependentUpon>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>copy $(TargetPath) ..\..\mediaportal\xbmc\bin\Release\plugins\windows
+copy $(ProjectDir)skinfiles\*.xml $(ProjectDir)..\..\mediaportal\xbmc\bin\Release\skin\BlueTwo
+copy $(ProjectDir)skinfiles\*.png $(ProjectDir)..\..\mediaportal\xbmc\bin\Release\skin\BlueTwo\Media
+copy $(ProjectDir)skinfiles\wide\*.xml "$(ProjectDir)..\..\mediaportal\xbmc\bin\Release\skin\BlueTwo Wide"
+copy $(ProjectDir)skinfiles\*.png "$(ProjectDir)..\..\mediaportal\xbmc\bin\Release\skin\BlueTwo Wide\Media"
+</PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/ETVNet/ETVNet/ETVNet.csproj.user
===================================================================
--- trunk/plugins/ETVNet/ETVNet/ETVNet.csproj.user (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/ETVNet.csproj.user 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,9 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectView>ProjectFiles</ProjectView>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>C:\projects\mp-0.2.2.0\xbmc\bin\Release\MediaPortal.exe</StartProgram>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/ETVNet/ETVNet/ETVNetStreamInfo.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/ETVNetStreamInfo.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/ETVNetStreamInfo.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,187 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Drawing;
+using System.Net;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Util;
+
+namespace ETVNet
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public class ETVNetStreamInfo : GUIWindow, IRenderLayer
+ {
+ [SkinControlAttribute(20)]
+ protected GUILabelControl streamLabel = null;
+ [SkinControlAttribute(4)]
+ protected GUITextControl streamInfo = null;
+ [SkinControlAttribute(5)]
+ protected GUIButtonControl playButton = null;
+
+ #region Base Dialog Variables
+ bool m_bRunning = false;
+ int m_dwParentWindowID = 0;
+ GUIWindow m_pParentWindow = null;
+ #endregion
+
+ public string streamInfoText;
+ public string streamTitleText;
+ public bool playPressed;
+
+ bool m_bOverlay = false;
+
+ public ETVNetStreamInfo()
+ {
+ GetID = 7768;
+ streamInfoText = "info";
+ streamTitleText = "info";
+ playPressed = false;
+ }
+
+ public override bool Init()
+ {
+ playPressed = false;
+ return Load(GUIGraphicsContext.Skin + @"\DialogETVNetStreamInfo.xml");
+ }
+
+ public override void PreInit()
+ {
+ }
+
+ public override void OnAction(Action action)
+ {
+ if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU || action.wID == Action.ActionType.ACTION_CONTEXT_MENU)
+ {
+ Close();
+ return;
+ }
+ base.OnAction(action);
+ }
+
+ #region Base Dialog Members
+ public void RenderDlg(float timePassed)
+ {
+ base.Render(timePassed);
+ }
+
+ void Close()
+ {
+ GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null);
+ OnMessage(msg);
+
+ GUIWindowManager.UnRoute();
+ m_pParentWindow = null;
+ m_bRunning = false;
+ }
+
+ public void DoModal(int dwParentId)
+ {
+ m_dwParentWindowID = dwParentId;
+ m_pParentWindow = GUIWindowManager.GetWindow(m_dwParentWindowID);
+ if (null == m_pParentWindow)
+ {
+ m_dwParentWindowID = 0;
+ return;
+ }
+
+ GUIWindowManager.RouteToWindow(GetID);
+
+ // active this window...
+ GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, 0, 0, null);
+ OnMessage(msg);
+
+ GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog);
+ m_bRunning = true;
+ GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog);
+ while (m_bRunning && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING)
+ {
+ GUIWindowManager.Process();
+ }
+ GUILayerManager.UnRegisterLayer(this);
+ }
+ #endregion
+
+
+ protected override void OnPageDestroy(int newWindowId)
+ {
+ if (m_bRunning)
+ {
+ // Probably user pressed H (SWITCH_HOME)
+ GUIWindowManager.UnRoute();
+ m_pParentWindow = null;
+ m_bRunning = false;
+ }
+ GUIGraphicsContext.Overlay = m_bOverlay;
+ base.OnPageDestroy(newWindowId);
+ }
+
+ protected override void OnPageLoad()
+ {
+ base.OnPageLoad();
+ m_bOverlay = GUIGraphicsContext.Overlay;
+ Update();
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
+ {
+ base.OnClicked(controlId, control, actionType);
+ if (control == playButton)
+ {
+ // ??? set result var, exit
+ playPressed = true;
+ Close();
+ }
+ }
+
+ void Update()
+ {
+ playPressed = false;
+ streamLabel.Label = streamTitleText;
+ streamInfo.Clear();
+ streamInfo.Label = streamInfoText;
+ }
+
+ public override void Render(float timePassed)
+ {
+ RenderDlg(timePassed);
+ }
+
+ #region IRenderLayer
+ public bool ShouldRenderLayer()
+ {
+ return true;
+ }
+
+ public void RenderLayer(float timePassed)
+ {
+ Render(timePassed);
+ }
+ #endregion
+ }
+}
Added: trunk/plugins/ETVNet/ETVNet/PathLink.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/PathLink.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/PathLink.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,55 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Text;
+using System.Xml;
+
+namespace ETVNet
+{
+ // this is a list link class, sort of a keychain/placeholder, no data processing here
+ class PathLink: PathNode
+ {
+ public PathLink(string paramTitle, ETVBrowser browser, PathNode predecessor): base(browser, predecessor)
+ {
+ title = paramTitle;
+ nodeType = PathNodeType.Branch;
+ }
+
+ public void setList(System.Collections.ArrayList paramList)
+ {
+ list = paramList;
+ }
+
+ public override System.Collections.ArrayList getList()
+ {
+ if (list != null)
+ return list;
+ throw new SystemException("list is not set");
+ }
+ }
+}
Added: trunk/plugins/ETVNet/ETVNet/PathNode.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/PathNode.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/PathNode.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,95 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ETVNet
+{
+ enum PathNodeType
+ {
+ Branch,
+ Terminal
+ };
+ // base path node class, mostly pure virtual
+ class PathNode
+ {
+ protected System.Collections.ArrayList list;
+ public ETVBrowser browser;
+ protected PathNode predecessor;
+ protected PathNodeType nodeType;
+ protected string title;
+ protected string title2;
+
+ public PathNode(ETVBrowser paramBrowser, PathNode paramPredecessor)
+ {
+ list = null;
+ browser = paramBrowser;
+ predecessor = paramPredecessor;
+ nodeType = PathNodeType.Branch;
+ title = null;
+ title2 = null;
+ }
+
+ public virtual PathNodeType getType()
+ {
+ return nodeType;
+ }
+
+ public virtual string getPointInfo()
+ {
+ throw new SystemException("call to virtual method");
+ }
+
+ public virtual string getPointURL()
+ {
+ throw new SystemException("call to virtual method");
+ }
+
+
+ public virtual System.Collections.ArrayList getList()
+ {
+ throw new SystemException("call to virtual method");
+ }
+
+ public virtual string getLabel()
+ {
+ if (title != null)
+ return title;
+ throw new SystemException("call to virtual method");
+ }
+
+ public virtual string getSecondaryLabel()
+ {
+ return title2; // null == none
+ }
+
+ public PathNode getPredecessor()
+ {
+ return predecessor;
+ }
+ }
+}
Added: trunk/plugins/ETVNet/ETVNet/PathPage.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/PathPage.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/PathPage.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,109 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Text;
+
+namespace ETVNet
+{
+ class PathPage: PathNode
+ {
+ string url;
+
+ public PathPage(string paramTitle, string paramUrl, ETVBrowser browser, PathNode predecessor): base(browser, predecessor)
+ {
+ title = paramTitle;
+ url = paramUrl;
+ }
+
+ public override System.Collections.ArrayList getList()
+ {
+ list = new ArrayList();
+ Hashtable dirPage = browser.getDirectoryPage(url);
+ if (dirPage.ContainsKey("prev"))
+ {
+ list.Add(new PathPage("- previous",(string)dirPage["prev"], browser, this));
+ }
+ // categories, if present
+ if (((ArrayList)dirPage["categories"]).Count > 0)
+ {
+ PathLink link = new PathLink("- categories", browser, this);
+ System.Collections.ArrayList newList = new ArrayList();
+ foreach(Hashtable item in (ArrayList)dirPage["categories"])
+ {
+ newList.Add(new PathPage((string)item["name"], (string)item["url"], browser, this));
+ }
+ link.setList(newList);
+ list.Add(link);
+ }
+ // letters, if present
+ if (((ArrayList)dirPage["letters"]).Count > 0)
+ {
+ PathLink link = new PathLink("- jump to letter", browser, this);
+ System.Collections.ArrayList newList = new ArrayList();
+ foreach(Hashtable item in (ArrayList)dirPage["letters"])
+ {
+ newList.Add(new PathPage((string)item["name"], (string)item["url"], browser, this));
+ }
+ link.setList(newList);
+ list.Add(link);
+ }
+
+ // entries, if present
+ if (((ArrayList)dirPage["entries"]).Count > 0)
+ {
+ foreach(Hashtable node in (ArrayList)dirPage["entries"])
+ {
+ PathNode pathnode;
+ if (((string)node["url"]).StartsWith("javascript:")) // stream link
+ {
+ string secondaryTitle = null;
+ if ((string)node["pageType"] == "today")
+ secondaryTitle = (string)node["time"];
+ else
+ secondaryTitle = (string)node["date"];
+ pathnode = new PathTerminal((string)node["name"], secondaryTitle, (string)node["url"], (string)node["infoUrl"], browser, this);
+ }
+ else
+ {
+ // archive or today page
+ pathnode = new PathPage((string)node["name"], (string)node["url"], browser, this);
+ }
+ list.Add(pathnode);
+ }
+ }
+
+ if (dirPage.ContainsKey("next"))
+ {
+ list.Add(new PathPage("- next", (string)dirPage["next"], browser, this));
+ }
+
+ return list;
+ }
+
+ }
+}
Added: trunk/plugins/ETVNet/ETVNet/PathTerminal.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/PathTerminal.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/PathTerminal.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,71 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Text;
+using System.Xml;
+
+namespace ETVNet
+{
+ class PathTerminal: PathNode
+ {
+ string url;
+ string infoUrl;
+ string info;
+
+ public PathTerminal(string paramTitle, string secondaryTitle, string paramUrl, string paramInfoUrl, ETVBrowser browser, PathNode predecessor): base(browser, predecessor)
+ {
+ title = paramTitle;
+ url = paramUrl;
+ infoUrl = paramInfoUrl;
+ info = null;
+ nodeType = PathNodeType.Terminal;
+ title2 = secondaryTitle;
+ }
+
+ public override string getPointInfo()
+ {
+ if (info!=null)
+ return info;
+ if (infoUrl != null)
+ info = browser.getInfoPage(infoUrl);
+ else
+ info = "";
+ return info;
+ }
+
+ public override string getPointURL()
+ {
+ return url;
+ }
+
+ public string getMMS()
+ {
+ return browser.getMMSURL(url);
+ }
+ }
+}
Added: trunk/plugins/ETVNet/ETVNet/Plugin.cs
===================================================================
--- trunk/plugins/ETVNet/ETVNet/Plugin.cs (rev 0)
+++ trunk/plugins/ETVNet/ETVNet/Plugin.cs 2007-02-28 05:30:01 UTC (rev 140)
@@ -0,0 +1,342 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Text;
+using System.Web;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using MediaPortal.Player;
+using MediaPortal.Profile;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+
+namespace ETVNet
+{
+ /// <summary>
+ /// Summary description for Plugin.
+ /// </summary>
+ public class Plugin : GUIWindow, ISetupForm
+ {
+ [SkinControlAttribute(2)]
+ protected GUIButtonControl buttonRefresh = null;
+ [SkinControlAttribute(3)]
+ protected GUIButtonControl buttonSearchTitles = null;
+ [SkinControlAttribute(4)]
+ protected GUIButtonControl buttonSearchAll = null;
+
+ [SkinControlAttribute(50)]
+ protected GUIFacadeControl facadeView = null;
+
+ PathNode currentNode;
+ string username;
+ string password;
+ bool traceHTML;
+
+ public Plugin()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ #region ISetupForm Members
+
+ // Returns the name of the plugin which is shown in the plugin menu
+ public string PluginName()
+ {
+ return "ETVNet";
+ }
+
+ // Returns the description of the plugin is shown in the plugin menu
+ public string Description()
+ {
+ return "ETVNet.ca Russian TV-on-demand access plugin";
+ }
+
+ // Returns the author of the plugin which is shown in the plugin menu
+ public string Author()
+ {
+ return "Sergey Menshikov";
+ }
+
+ // show the setup dialog
+ public void ShowPlugin()
+ {
+ // ??? add configuration dialog for username and password
+ System.Windows.Forms.Form setup = new SetupForm();
+ setup.ShowDialog();
+ }
+
+ // Indicates whether plugin can be enabled/disabled
+ public bool CanEnable()
+ {
+ return true;
+ }
+
+ // get ID of windowplugin belonging to this setup
+ public int GetWindowId()
+ {
+ return 7769;
+ }
+
+ // Indicates if plugin is enabled by default;
+
+ public bool DefaultEnabled()
+ {
+ return true;
+ }
+
+ // indicates if a plugin has its own setup screen
+ public bool HasSetup()
+ {
+ return true;
+ }
+
+ /// <summary>
+ /// If the plugin should have its own button on the main menu of Mediaportal then it
+ /// should return true to this method, otherwise if it should not be on home
+ /// it should return false
+ /// </summary>
+ /// <param name="strButtonText">text the button should have</param>
+ /// <param name="strButtonImage">image for the button, or empty for default</param>
+ /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
+ /// <param name="strPictureImage">subpicture for the button or empty for none</param>
+ /// <returns>true : plugin needs its own button on home
+ /// false : plugin does not need its own button on home</returns>
+
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = PluginName();
+ strButtonImage = String.Empty;
+ strButtonImageFocus = String.Empty;
+ strPictureImage = String.Empty;
+ return true;
+ }
+
+ #endregion
+
+ #region CoreFunctionality
+ public override int GetID
+ {
+ get
+ {
+ return 7769;
+ }
+
+ set
+ {
+
+ }
+ }
+
+ public override bool Init()
+ {
+ // ??? get from configuration
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
+ {
+ username = xmlreader.GetValueAsString("ETVNet", "username", "demo");
+ password = xmlreader.GetValueAsString("ETVNet", "password", "demo");
+ string traceHTMLstr = xmlreader.GetValueAsString("ETVNet", "traceHTML", "false");
+ if (traceHTMLstr == "true")
+ traceHTML = true;
+ else
+ traceHTML = false;
+ }
+ currentNode = new TopList(username, password,traceHTML);
+ return Load(GUIGraphicsContext.Skin + @"\etvnet.main.xml");
+ }
+
+ public override void OnAction(Action action)
+ {
+ if ((action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) && (facadeView.Focus))
+ {
+ // select and render predecessor
+ PathNode predecessor = currentNode.getPredecessor();
+ if (predecessor != null)
+ {
+ currentNode = predecessor;
+ RenderNode();
+ return;
+ }
+ // allow to leave plugin from list only if there is no predecessor
+ }
+
+ base.OnAction(action);
+ }
+
+ protected void RenderNode()
+ {
+ System.Collections.ArrayList list = currentNode.getList();
+
+ facadeView.Clear();
+ int i = 0;
+ foreach (PathNode listItem in list)
+ {
+ GUIListItem item = new GUIListItem(listItem.getLabel());
+ if(listItem.getSecondaryLabel()!=null)
+ item.Label2 = listItem.getSecondaryLabel();
+ item.ItemId = i++;
+ facadeView.Add(item);
+ }
+ }
+
+ protected override void OnPageLoad()
+ {
+ base.OnPageLoad();
+ // initial fill
+ RenderNode();
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
+ {
+ if (control == buttonRefresh)
+ OnButtonRefresh();
+ else if (control == buttonSearchTitles)
+ OnButtonSearchTitles();
+ else if (control == buttonSearchAll)
+ OnButtonSearchAll();
+ else if (control == facadeView)
+ {
+ GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, controlId, 0, 0, null);
+ OnMessage(msg);
+ int iItem = (int)msg.Param1;
+ if (actionType == Action.ActionType.ACTION_SHOW_INFO)
+ {
+ // ??? auxiliary functions ?
+ }
+ if (actionType == Action.ActionType.ACTION_SELECT_ITEM)
+ {
+ // navigate forward
+ int index = facadeView.SelectedListItemIndex;
+ System.Collections.ArrayList list = currentNode.getList();
+ PathNode newNode = (PathNode)list[index];
+ if (newNode.getType() == PathNodeType.Branch)
+ {
+ currentNode = newNode;
+ RenderNode();
+ }
+ else
+ {
+ ETVNetStreamInfo streamInfoDialog = (ETVNetStreamInfo)GUIWindowManager.GetWindow(7768);
+ if (null != streamInfoDialog)
+ {
+ streamInfoDialog.streamTitleText = newNode.getLabel();
+ streamInfoDialog...
[truncated message content] |