|
From: <moi...@us...> - 2007-01-29 21:25:07
|
Revision: 45
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=45&view=rev
Author: moiristo
Date: 2007-01-29 13:24:59 -0800 (Mon, 29 Jan 2007)
Log Message:
-----------
Latest UitGemist version
Added Paths:
-----------
trunk/plugins/UitzendingGemist/UitGemist/
trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.Designer.cs
trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.cs
trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.resx
trunk/plugins/UitzendingGemist/UitGemist/NLGemist.cs
trunk/plugins/UitzendingGemist/UitGemist/Properties/
trunk/plugins/UitzendingGemist/UitGemist/Properties/AssemblyInfo.cs
trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs
trunk/plugins/UitzendingGemist/UitGemist/SecondScreen.cs
trunk/plugins/UitzendingGemist/UitGemist/ShowWaitCursor.cs
trunk/plugins/UitzendingGemist/UitGemist/UitGemist.csproj
trunk/plugins/UitzendingGemist/UitGemist/UitGemist.csproj.user
trunk/plugins/UitzendingGemist/UitGemist/UitGemistMain.cs
trunk/plugins/UitzendingGemist/UitGemist/UitGemistPlugin.cs
Added: trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.Designer.cs
===================================================================
--- trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.Designer.cs (rev 0)
+++ trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.Designer.cs 2007-01-29 21:24:59 UTC (rev 45)
@@ -0,0 +1,117 @@
+namespace MediaPortal.GUI.UitGemist
+{
+ partial class ConfigurationForm
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.sbBtn = new System.Windows.Forms.RadioButton();
+ this.bbBtn = new System.Windows.Forms.RadioButton();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.okBtn = new System.Windows.Forms.Button();
+ this.button1 = new System.Windows.Forms.Button();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // sbBtn
+ //
+ this.sbBtn.AutoSize = true;
+ this.sbBtn.Location = new System.Drawing.Point(10, 19);
+ this.sbBtn.Name = "sbBtn";
+ this.sbBtn.Size = new System.Drawing.Size(74, 17);
+ this.sbBtn.TabIndex = 0;
+ this.sbBtn.TabStop = true;
+ this.sbBtn.Text = "Smallband";
+ this.sbBtn.UseVisualStyleBackColor = true;
+ //
+ // bbBtn
+ //
+ this.bbBtn.AutoSize = true;
+ this.bbBtn.Location = new System.Drawing.Point(10, 39);
+ this.bbBtn.Name = "bbBtn";
+ this.bbBtn.Size = new System.Drawing.Size(77, 17);
+ this.bbBtn.TabIndex = 1;
+ this.bbBtn.TabStop = true;
+ this.bbBtn.Text = "Broadband";
+ this.bbBtn.UseVisualStyleBackColor = true;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.bbBtn);
+ this.groupBox1.Controls.Add(this.sbBtn);
+ this.groupBox1.Location = new System.Drawing.Point(12, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(169, 70);
+ this.groupBox1.TabIndex = 2;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Default Speed";
+ //
+ // okBtn
+ //
+ this.okBtn.Location = new System.Drawing.Point(12, 88);
+ this.okBtn.Name = "okBtn";
+ this.okBtn.Size = new System.Drawing.Size(75, 23);
+ this.okBtn.TabIndex = 3;
+ this.okBtn.Text = "OK";
+ this.okBtn.UseVisualStyleBackColor = true;
+ this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(93, 88);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 4;
+ this.button1.Text = "Cancel";
+ this.button1.UseVisualStyleBackColor = true;
+
+ //
+ // ConfigurationForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(246, 120);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.okBtn);
+ this.Controls.Add(this.groupBox1);
+ this.Name = "ConfigurationForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "UitzendingGemist Configuration";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.RadioButton sbBtn;
+ private System.Windows.Forms.RadioButton bbBtn;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.Button okBtn;
+ private System.Windows.Forms.Button button1;
+ }
+}
\ No newline at end of file
Property changes on: trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.Designer.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.cs
===================================================================
--- trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.cs (rev 0)
+++ trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.cs 2007-01-29 21:24:59 UTC (rev 45)
@@ -0,0 +1,43 @@
+using MediaPortal.GUI.Library;
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace MediaPortal.GUI.UitGemist
+{
+ public partial class ConfigurationForm : Form
+ {
+ bool broadband;
+
+ public ConfigurationForm()
+ {
+ InitializeComponent();
+ broadband = ShowWaitCursor.getBroadBand();
+
+ this.sbBtn.Checked = !broadband;
+ this.bbBtn.Checked = broadband;
+ }
+
+ private void okBtn_Click(object sender, EventArgs e)
+ {
+ string dir = Directory.GetCurrentDirectory();
+ using (MediaPortal.Profile.Settings writer = new MediaPortal.Profile.Settings(dir + @"\UitGemist.xml", false))
+ {
+ writer.Clear();
+
+ if (sbBtn.Checked) broadband = false;
+ else broadband = true;
+
+ if(broadband) writer.SetValue("settings", "broadband", "yes");
+ else writer.SetValue("settings", "broadband", "no");
+ }
+ this.Dispose(true);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.resx
===================================================================
--- trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.resx (rev 0)
+++ trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.resx 2007-01-29 21:24:59 UTC (rev 45)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Property changes on: trunk/plugins/UitzendingGemist/UitGemist/ConfigurationForm.resx
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/plugins/UitzendingGemist/UitGemist/NLGemist.cs
===================================================================
--- trunk/plugins/UitzendingGemist/UitGemist/NLGemist.cs (rev 0)
+++ trunk/plugins/UitzendingGemist/UitGemist/NLGemist.cs 2007-01-29 21:24:59 UTC (rev 45)
@@ -0,0 +1,545 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Text;
+using System.Text.RegularExpressions;
+using MediaPortal.GUI.Library;
+using MediaPortal.Player;
+using MediaPortal.Util;
+using MediaPortal.Dialogs;
+using MediaPortal.Playlists;
+using System.Xml;
+using System.IO;
+
+namespace MediaPortal.GUI.UitGemist
+{
+ public class NLGemist : GUIWindow
+ {
+ #region SkinControlAttributes
+ [SkinControlAttribute(50)]
+ protected GUIFacadeControl facadeview = null;
+ [SkinControlAttribute(2)]
+ protected GUIButtonControl btnFavoriet = null;
+ [SkinControlAttribute(3)]
+ protected GUISelectButtonControl btnTitel = null;
+ [SkinControlAttribute(4)]
+ protected GUISelectButtonControl btnDag = null;
+ [SkinControlAttribute(5)]
+ protected GUISelectButtonControl btnZender = null;
+ [SkinControlAttribute(6)]
+ protected GUISelectButtonControl btnOmroep = null;
+ [SkinControlAttribute(7)]
+ protected GUISelectButtonControl btnRubriek = null;
+ [SkinControlAttribute(8)]
+ protected GUIButtonControl btnMoetJeZien = null;
+ [SkinControlAttribute(11)]
+ protected GUIImageList imgList = null;
+ [SkinControlAttribute(12)]
+ protected GUITextScrollUpControl textBox = null;
+ [SkinControlAttribute(13)]
+ protected GUILabelControl lblBekeken = null;
+
+ #endregion
+
+ #region Variables
+ private String MainUrlBody = String.Empty;
+
+ private StringCollection Names = new StringCollection();
+ private StringCollection Urls = new StringCollection();
+ private StringCollection UrlsSecondScreen = new StringCollection();
+ private StringCollection ImageUrls = new StringCollection();
+ private StringCollection Plot = new StringCollection();
+ private StringCollection Waardering = new StringCollection();
+ private StringCollection Bekeken = new StringCollection();
+
+ private StringCollection NavNames = new StringCollection();
+ private StringCollection NavUrls = new StringCollection();
+
+ private StringCollection FavNames = new StringCollection();
+ private StringCollection FavUrls = new StringCollection();
+ private StringCollection FavUrlsSecondScreen = new StringCollection();
+ private int FavCount = 0;
+
+ private bool ViewFavorieten = false;
+ private bool ViewMoetJeZien = false;
+
+ public static ShowWaitCursor wc = new ShowWaitCursor();
+ #endregion
+
+ public override int GetID
+ {
+ get
+ {
+ return 6800;
+ }
+ set
+ {
+ base.GetID = value;
+ }
+ }
+
+ public override bool Init()
+ {
+ return Load(GUIGraphicsContext.Skin + @"\UitGemist.xml");
+ }
+
+ public override void OnAction(Action action)
+ {
+ if (action.wID == Action.ActionType.ACTION_PLAY)
+ {
+ string mmsurl = string.Empty;
+ int index = 0;
+ GUIListItem item = facadeview.SelectedListItem;
+ if (ViewFavorieten)
+ {
+ index = FavNames.IndexOf(item.Label);
+ mmsurl = GetPlayUrl(FavUrls[index]);
+ }
+ else
+ {
+ index = Names.IndexOf(item.Label);
+ mmsurl = GetPlayUrl(Urls[index]);
+ }
+
+ PlayUitzending(mmsurl);
+ }
+
+ base.OnAction(action);
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
+ {
+ if (control == btnFavoriet)
+ {
+ ShowList(FavNames);
+ ViewFavorieten = true;
+ }
+ if (control == btnTitel)
+ {
+ GetNav("titel");
+ GetUitzending(NavUrls[btnTitel.SelectedItem]);
+ }
+ if (control == btnDag)
+ {
+ GetNav("dag");
+ GetUitzending(NavUrls[btnDag.SelectedItem]);
+ }
+ if (control == btnZender)
+ {
+ GetNav("net_zender");
+ GetUitzending(NavUrls[btnZender.SelectedItem]);
+ }
+ if (control == btnOmroep)
+ {
+ GetNav("omroep");
+ GetUitzending(NavUrls[btnOmroep.SelectedItem]);
+ }
+ if (control == btnRubriek)
+ {
+ GetNav("genre");
+ GetUitzending(NavUrls[btnRubriek.SelectedItem]);
+ }
+ if (control == btnMoetJeZien)
+ {
+ ShowMoetJeZien();
+ }
+ if (control == facadeview)
+ {
+ if (ViewFavorieten)
+ {
+ //SecondScreen.ViewVideo = true;
+ SecondScreen.Url = FavUrlsSecondScreen[facadeview.SelectedListItemIndex];
+ GUIWindowManager.ActivateWindow(6801);
+ }
+ else if (ViewMoetJeZien)
+ {
+ string mmsurl = string.Empty;
+ mmsurl = GetPlayUrl(Urls[facadeview.SelectedListItemIndex]);
+
+ PlayUitzending(mmsurl);
+ }
+ else
+ {
+ SecondScreen.Url = UrlsSecondScreen[facadeview.SelectedListItemIndex];
+ GUIWindowManager.ActivateWindow(6801);
+ }
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ public override bool OnMessage(GUIMessage message)
+ {
+ if(message.Message == GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS || message.Message== GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED)
+ if (facadeview.SelectedListItemIndex != -1 && ViewMoetJeZien==true)
+ {
+ GUIPropertyManager.SetProperty("#votes", Bekeken[facadeview.SelectedListItemIndex]);
+ GUIPropertyManager.SetProperty("#rating", Waardering[facadeview.SelectedListItemIndex]);
+ GUIPropertyManager.SetProperty("#plot", Plot[facadeview.SelectedListItemIndex]);
+ imgList.Dimmed = true;
+ lblBekeken.Dimmed = true;
+ }
+ return base.OnMessage(message);
+ }
+
+
+ protected override void OnPageLoad()
+ {
+ ShowGroep(false);
+ GetNav("titel", btnTitel);
+ GetNav("dag", btnDag);
+ GetNav("net_zender", btnZender);
+ GetNav("omroep", btnOmroep);
+ GetNav("genre", btnRubriek);
+ LoadFavorietenXML();
+ if (ViewFavorieten )
+ {
+ ViewFavorieten = true;
+ ShowList(FavNames);
+ }
+ else if (Names.Count <= 0 || ViewMoetJeZien == true)
+ {
+ ShowMoetJeZien();
+ }
+ else
+ {
+ ShowList(Names);
+ }
+ base.OnPageLoad();
+ }
+
+ protected override void OnPageDestroy(int new_windowId)
+ {
+ MainUrlBody = string.Empty;
+ SaveFavorietenXML();
+ FavNames.Clear();
+ FavUrls.Clear();
+ FavUrlsSecondScreen.Clear();
+ base.OnPageDestroy(new_windowId);
+ }
+ protected override void OnShowContextMenu()
+ {
+ GUIListItem item = facadeview.SelectedListItem;
+
+ GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ menu.Reset();
+ menu.SetHeading("Extra Opties:");
+ if (ViewFavorieten == false)
+ menu.Add("Toevoegen aan favorieten.");
+ if (ViewFavorieten == true)
+ menu.Add("Verwijderen van favorieten.");
+ menu.DoModal(GetID);
+ if (menu.SelectedId == -1) return;
+ if (menu.SelectedLabelText == "Toevoegen aan favorieten.")
+ {
+ FavNames.Add(Names[facadeview.SelectedListItemIndex]);
+ FavUrls.Add(Urls[facadeview.SelectedListItemIndex]);
+ FavUrlsSecondScreen.Add(UrlsSecondScreen[facadeview.SelectedListItemIndex]);
+ }
+ if (menu.SelectedLabelText == "Verwijderen van favorieten.")
+ {
+ FavNames.RemoveAt(facadeview.SelectedListItemIndex);
+ FavUrls.RemoveAt(facadeview.SelectedListItemIndex);
+ FavUrlsSecondScreen.RemoveAt(facadeview.SelectedListItemIndex);
+ ShowList(FavNames);
+ }
+ base.OnShowContextMenu();
+ }
+
+ private void GetUitzending(string url)
+ {
+ Names.Clear();
+ Urls.Clear();
+ UrlsSecondScreen.Clear();
+ ViewFavorieten = false;
+
+ string result = wc.GetUrl(url, true);
+
+
+ int i = 0;
+ MatchCollection mc = Regex.Matches(result, @"title.\shref=.(?<url>.*?).>(?<name>.*?)<");
+ foreach (Match m in mc)
+ {
+ Names.Add(m.Groups["name"].Value);
+ Names[i] = ConvertString(Names[i]);
+ UrlsSecondScreen.Add(@"http://www.uitzendinggemist.nl"+m.Groups["url"].Value);
+ UrlsSecondScreen[i] = ConvertString(UrlsSecondScreen[i]);
+ i++;
+ }
+ i = 0;
+ mc = Regex.Matches(result, @"><a\shref=.(?<url>http://player.*?).target");
+ foreach (Match m in mc)
+ {
+ Urls.Add(m.Groups["url"].Value);
+ Urls[i] = ConvertString(Urls[i]);
+ i++;
+ }
+ ShowList(Names);
+ }
+ public static string GetPlayUrl(string url)
+ {
+ Match m = Regex.Match(wc.GetUrl(url), @"var\smediaurl\s=\s.(http://.*?).;");
+
+ url = m.Groups[1].Value;
+ url = url.Replace(".rm", ".asf");
+ url = ConvertString(url);
+ return url;
+ }
+ /// <summary>
+ /// Fills the facadeview with item
+ /// </summary>
+ /// <param name="names">labels for the items</param>
+ private void ShowList(StringCollection names)
+ {
+ ViewMoetJeZien = false;
+ ShowGroep(false);
+ facadeview.View = GUIFacadeControl.ViewMode.List;
+ facadeview.Clear();
+ foreach (string label in names)
+ {
+ GUIListItem item = new GUIListItem();
+ item.Label = label;
+ item.IsFolder = true;
+ Util.Utils.SetDefaultIcons(item);
+ facadeview.Add(item);
+ }
+ focusFacade();
+ }
+
+ /// <summary>
+ /// Converts a string with wrong characters and replaces those with the good ones
+ /// </summary>
+ /// <param name="convertstring">input string</param>
+ /// <returns>converted string</returns>
+ public static string ConvertString(string convertstring)
+ {
+ convertstring = convertstring.Replace("&", "&");
+ convertstring = convertstring.Replace("'", "'");
+ convertstring = convertstring.Replace("é", "\xE9");
+ convertstring = convertstring.Replace("ö", "\xF6");
+ convertstring = convertstring.Replace("ë", "\xEB");
+ convertstring = convertstring.Replace("ü", "\xFC");
+ convertstring.Trim();
+ return convertstring;
+ }
+
+ /// <summary>
+ /// Get the options for the letterbuttons in the main screen
+ /// </summary>
+ /// <param name="search">letterbutton name fe. titel or genre</param>
+ private void GetNav(string search)
+ {
+ NavNames.Clear();
+ NavUrls.Clear();
+ if (MainUrlBody == String.Empty)
+ MainUrlBody = wc.GetUrl("http://www.uitzendinggemist.nl/");
+
+ Match m = Regex.Match(MainUrlBody, "id=." + search + ".*?</select>", RegexOptions.Singleline);
+ string temp = m.Value;
+
+ MatchCollection mc = Regex.Matches(temp, @"value=.(?<url>\d*).*?.>(?<name>.*?)<");
+ foreach (Match m1 in mc)
+ {
+ NavUrls.Add("http://www.uitzendinggemist.nl/index.php/selectie?searchitem=" + search + "&" + search + "=" + m1.Groups["url"].Value);
+ NavNames.Add(m1.Groups["name"].Value);
+ }
+ NavNames.RemoveAt(0);
+ NavUrls.RemoveAt(0);
+ }
+ /// <summary>
+ /// Get the options for the letterbuttons in the main screen
+ /// </summary>
+ /// <param name="search">letterbutton name fe. titel or genre</param>
+ /// <param name="btn">ButtonControlName that needs to be filled</param>
+ private void GetNav(string search, GUISelectButtonControl btn)
+ {
+ GetNav(search);
+
+ btn.Clear();
+ btn.Selected = false;
+ foreach (string label in NavNames)
+ {
+ btn.AddSubItem(label);
+ }
+ }
+
+ /// <summary>
+ /// Error Dialog
+ /// </summary>
+ /// <param name="text">error text</param>
+ private void ShowDialog(string text)
+ {
+ GUIDialogOK dialog = new GUIDialogOK();
+ dialog.SetHeading("Error");
+ dialog.SetLine(1, text);
+ dialog.DoModal(GetID);
+ }
+
+ /// <summary>
+ /// Save the favorites
+ /// </summary>
+ private void SaveFavorietenXML()
+ {
+ string dir = Directory.GetCurrentDirectory();
+
+ File.Delete(dir + @"\UitGemistFav.xml");
+ using(MediaPortal.Profile.Settings writer = new MediaPortal.Profile.Settings(dir+@"\UitGemistFav.xml",false))
+ {
+ writer.Clear();
+ int i = 0;
+ foreach(string favoriet in FavNames)
+ {
+ writer.SetValue(i.ToString(),"ProgrammaNaam", favoriet);
+ writer.SetValue(i.ToString(),"ProgrammaUrl", FavUrls[i]);
+ writer.SetValue(i.ToString(), "SecondScreenUrl", FavUrlsSecondScreen[i]);
+ i++;
+ }
+ while (i < FavCount)
+ {
+ writer.SetValue(i.ToString(), "ProgrammaNaam", "");
+ writer.SetValue(i.ToString(), "PorgrammaUrl", "");
+ writer.SetValue(i.ToString(), "SecondScreenUrl", "");
+ i++;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Load the favorites
+ /// </summary>
+ private void LoadFavorietenXML()
+ {
+ string dir = Directory.GetCurrentDirectory();
+ using(MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(dir+@"\UitGemistFav.xml",false))
+ {
+ int i = 0;
+ while(i!=100)
+ {
+ string result = reader.GetValueAsString(i.ToString(), "ProgrammaNaam", "");
+ if (result.Equals(""))
+ {
+ FavCount = i - 1;
+ return;
+ }
+ else
+ {
+ FavNames.Add(reader.GetValue(i.ToString(), "ProgrammaNaam"));
+ FavNames[i] = ConvertString(FavNames[i]);
+ FavUrls.Add(reader.GetValue(i.ToString(), "ProgrammaUrl"));
+ FavUrls[i] = ConvertString(FavUrls[i]);
+ FavUrlsSecondScreen.Add(reader.GetValue(i.ToString(), "SecondScreenUrl"));
+ FavUrlsSecondScreen[i] = ConvertString(FavUrlsSecondScreen[i]);
+ i++;
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Shows the first "top 3" items that were on yesteday
+ /// </summary>
+ private void ShowMoetJeZien()
+ {
+ Names.Clear();
+ Urls.Clear();
+ UrlsSecondScreen.Clear();
+ ImageUrls.Clear();
+ Plot.Clear();
+ ViewFavorieten = false;
+ ViewMoetJeZien = true;
+
+
+ if (MainUrlBody == String.Empty)
+ MainUrlBody = wc.GetUrl("http://www.uitzendinggemist.nl/");
+
+ Match m = Regex.Match(MainUrlBody, @"moet\sje\szien.*moet\sje\szien\s-->", RegexOptions.Singleline);
+ string result = m.Value;
+
+ int i = 0;
+ MatchCollection mc = Regex.Matches(result, @"img\ssrc=.(?<image>.*?.png).*?href=.(?<url2>/index.php.*?).\s.*?>(?<name>.*?)<");
+ foreach (Match m1 in mc)
+ {
+ ImageUrls.Add(@"http://www.uitzendinggemist.nl"+m1.Groups["image"].Value);
+ ImageUrls[i] = ConvertString(ImageUrls[i]);
+ Names.Add(m1.Groups["name"].Value);
+ Names[i] = ConvertString(Names[i]);
+ UrlsSecondScreen.Add(@"http://www.uitzendinggemist.nl"+m1.Groups["url2"].Value);
+ UrlsSecondScreen[i] = ConvertString(UrlsSecondScreen[i]);
+ i++;
+ }
+ i = 0;
+ mc = Regex.Matches(result, @"(http://player.*?).\starget");
+ foreach(Match m1 in mc)
+ {
+ Urls.Add(m1.Groups[1].Value);
+ Urls[i] = ConvertString(Urls[i]);
+ i++;
+ }
+ i= 0;
+ mc = Regex.Matches(result, @"margin:5px..>(.*?)<");
+ foreach (Match m1 in mc)
+ {
+ Plot.Add(m1.Groups[1].Value);
+ Plot[i] = ConvertString(Plot[i]);
+ i++;
+ }
+ mc = Regex.Matches(result, @"Waardering:\s(.*?)\s");
+ StringCollection temp = new StringCollection();
+ temp.Add(mc[0].Groups[1].Value);
+ temp.Add(mc[5].Groups[1].Value);
+ temp.Add(mc[10].Groups[1].Value);
+ foreach (string s in temp)
+ {
+ double r = double.Parse(s);
+ r = r * 2;
+ r = r / 10;
+ Waardering.Add(r.ToString());
+ }
+ mc = Regex.Matches(result, @"bekeken\s<span>(.*?)\s");
+ foreach (Match m1 in mc)
+ {
+ Bekeken.Add(m1.Groups[1].Value);
+ }
+
+ i = 0;
+ facadeview.View = GUIFacadeControl.ViewMode.LargeIcons;
+ facadeview.Clear();
+ foreach (string label in Names)
+ {
+ GUIListItem item = new GUIListItem();
+ item.Label = Names[i];
+ item.IconImageBig = wc.DownloadImage(ImageUrls[i]);
+ facadeview.Add(item);
+ i++;
+ }
+ ShowGroep(true);
+ focusFacade();
+ }
+
+ private void ShowGroep(bool show)
+ {
+ imgList.Visible = show;
+ textBox.Visible = show;
+ lblBekeken.Visible = show;
+ }
+
+ private void PlayUitzending(string url)
+ {
+ if (g_Player.Play(url))
+ {
+ GUIGraphicsContext.IsFullScreenVideo = true;
+ GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
+ }
+ }
+
+ private void focusFacade()
+ {
+ if (facadeview.Count > 0 && !facadeview.Focus) GUIControl.FocusControl(GUIWindowManager.ActiveWindow, facadeview.GetID);
+ else if(facadeview.Count == 0) GUIControl.FocusControl(GUIWindowManager.ActiveWindow, btnFavoriet.GetID);
+ }
+
+ }
+
+
+
+
+}
\ No newline at end of file
Property changes on: trunk/plugins/UitzendingGemist/UitGemist/NLGemist.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/plugins/UitzendingGemist/UitGemist/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/UitzendingGemist/UitGemist/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/UitzendingGemist/UitGemist/Properties/AssemblyInfo.cs 2007-01-29 21:24:59 UTC (rev 45)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("UitGemist")]
+[assembly: AssemblyDescription("A plugin for MediaPortal to view missed emissions")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UitGemist")]
+[assembly: AssemblyCopyright("Copyright © 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3ea4ca68-336f-42e6-99ec-04750996ebeb")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.2")]
+[assembly: AssemblyFileVersion("1.0.0.2")]
Property changes on: trunk/plugins/UitzendingGemist/UitGemist/Properties/AssemblyInfo.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs
===================================================================
--- trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs (rev 0)
+++ trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs 2007-01-29 21:24:59 UTC (rev 45)
@@ -0,0 +1,538 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Text;
+using System.Text.RegularExpressions;
+using MediaPortal.GUI.Library;
+using MediaPortal.Player;
+using MediaPortal.Util;
+using MediaPortal.Dialogs;
+using MediaPortal.Playlists;
+using System.Xml;
+using System.Xml.XPath;
+using System.IO;
+
+namespace MediaPortal.GUI.UitGemist
+{
+ public class RTLGemist : GUIWindow
+ {
+ #region SkinControlAttributes
+ [SkinControlAttribute(50)]
+ protected GUIFacadeControl facadeview = null;
+ [SkinControlAttribute(2)]
+ protected GUIButtonControl btnFavoriet = null;
+ [SkinControlAttribute(3)]
+ protected GUIButtonControl btnTopTen = null;
+ [SkinControlAttribute(4)]
+ protected GUIButtonControl btnPrograms = null;
+
+ #endregion
+
+ #region Variables
+ private String MainUrlBody = String.Empty;
+
+ private StringCollection Names = new StringCollection();
+ private StringCollection Urls = new StringCollection();
+ private StringCollection UrlHistory = new StringCollection();
+ private List<int> SelectHistory = new List<int>();
+ private List<bool> Folders = new List<bool>();
+
+ private StringCollection FavNames = new StringCollection();
+ private StringCollection FavUrls = new StringCollection();
+ private int FavCount = 0;
+
+ private bool ViewTopTen = false;
+ private bool ViewFavorieten = false;
+
+ private static string host = "http://www.rtl.nl";
+ private static string xmlroot = "/(vm=/experience/media/)/system/video/menu/";
+
+ private static string[] broadband = new string[] { "/805.wvx", "/796.wvx", "/364.wvx" };
+ private static string[] smallband = new string[] { "/225.wvx", "/224.wvx", "/364.wvx" };
+
+ public static ShowWaitCursor wc = new ShowWaitCursor();
+
+ #endregion
+
+ public override int GetID
+ {
+ get
+ {
+ return 6802;
+ }
+ set
+ {
+ base.GetID = value;
+ }
+ }
+
+ public override bool Init()
+ {
+ return Load(GUIGraphicsContext.Skin + @"\RtlGemist.xml");
+ }
+
+ public override void OnAction(Action action)
+ {
+ if (action.wID == Action.ActionType.ACTION_PLAY)
+ {
+ string mmsurl = string.Empty;
+ int index = 0;
+ GUIListItem item = facadeview.SelectedListItem;
+ if (ViewFavorieten)
+ {
+ index = FavNames.IndexOf(item.Label);
+ mmsurl = GetPlayUrl(FavUrls[index]);
+ }
+ else
+ {
+ index = Names.IndexOf(item.Label);
+ mmsurl = GetPlayUrl(Urls[index]);
+ }
+
+ PlayUitzending(mmsurl, 0);
+ }
+ else if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU && UrlHistory.Count > 1)
+ {
+ GetUitzending(UrlHistory[UrlHistory.Count - 2]);
+ UrlHistory.RemoveAt(UrlHistory.Count - 1);
+ facadeview.SelectedListItemIndex = SelectHistory[SelectHistory.Count - 1];
+ SelectHistory.RemoveAt(SelectHistory.Count - 1);
+ }
+ else base.OnAction(action);
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
+ {
+ if (control == btnFavoriet)
+ {
+ ShowList(FavNames);
+ ViewFavorieten = true;
+ }
+ if (control == btnPrograms)
+ {
+ GetUitzendingen();
+ }
+ if (control == btnTopTen)
+ {
+ ShowTopTen();
+ }
+ if (control == facadeview)
+ {
+ if (ViewFavorieten)
+ {
+ string url = string.Empty;
+ url = GetPlayUrl(FavUrls[facadeview.SelectedListItemIndex]);
+
+ PlayUitzending(url, 0);
+ }
+ else if (ViewTopTen)
+ {
+ string url = string.Empty;
+ url = GetPlayUrl(Urls[facadeview.SelectedListItemIndex]);
+
+ PlayUitzending(url, 0);
+ }
+ else
+ {
+ //ViewPrograms
+ //Folder: Get contents
+ if (facadeview.SelectedListItem.IsFolder)
+ LoadFolder(Urls[facadeview.SelectedListItemIndex]);
+ //Stream: Play stream
+ else
+ {
+ string url = string.Empty;
+ url = GetPlayUrl(Urls[facadeview.SelectedListItemIndex]);
+
+ PlayUitzending(url, 0);
+ }
+ }
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ public override bool OnMessage(GUIMessage message)
+ {
+ return base.OnMessage(message);
+ }
+
+
+ protected override void OnPageLoad()
+ {
+ LoadFavorietenXML();
+ if (ViewFavorieten)
+ {
+ ViewFavorieten = true;
+ ShowList(FavNames);
+ }
+ else if (Names.Count <= 0 || ViewTopTen == true)
+ {
+ ShowTopTen();
+ }
+ else
+ {
+ ShowList(Names);
+ }
+ base.OnPageLoad();
+ }
+
+ protected override void OnPageDestroy(int new_windowId)
+ {
+ MainUrlBody = string.Empty;
+ SaveFavorietenXML();
+ FavNames.Clear();
+ FavUrls.Clear();
+ base.OnPageDestroy(new_windowId);
+ }
+
+ protected override void OnShowContextMenu()
+ {
+ GUIListItem item = facadeview.SelectedListItem;
+ if (item.IsFolder) return;
+
+ GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ menu.Reset();
+ menu.SetHeading("Extra Opties:");
+ if (ViewFavorieten == false)
+ menu.Add("Toevoegen aan favorieten.");
+ if (ViewFavorieten == true)
+ menu.Add("Verwijderen van favorieten.");
+ menu.DoModal(GetID);
+ if (menu.SelectedId == -1) return;
+ if (menu.SelectedLabelText == "Toevoegen aan favorieten.")
+ {
+ FavNames.Add(Names[facadeview.SelectedListItemIndex]);
+ FavUrls.Add(Urls[facadeview.SelectedListItemIndex]);
+ }
+ if (menu.SelectedLabelText == "Verwijderen van favorieten.")
+ {
+ FavNames.RemoveAt(facadeview.SelectedListItemIndex);
+ FavUrls.RemoveAt(facadeview.SelectedListItemIndex);
+ Folders.Clear();
+ ShowList(FavNames);
+ }
+ base.OnShowContextMenu();
+ }
+
+ private void GetUitzendingen()
+ {
+ UrlHistory.Clear();
+ SelectHistory.Clear();
+ ViewFavorieten = false;
+ ViewTopTen = false;
+
+ //Root node: http://www.rtl.nl/(vm=/experience/media/)/system/video/menu/videomenu.xml
+ Log.Info("UitGemist: Getting root XML");
+ GetUitzending(host + xmlroot + "videomenu.xml");
+ }
+
+ private void LoadFolder(string folder)
+ {
+ Log.Info("UitGemist: Loading folder '" + folder + "'");
+ string vm = folder.Replace("videomenu.xml","");
+ GetUitzending(host + xmlroot.Replace(@"/experience/media/", vm) + folder);
+ }
+
+ private void GetUitzending(string xmlUrl)
+ {
+ if (!UrlHistory.Contains(xmlUrl))
+ {
+ UrlHistory.Add(xmlUrl);
+ SelectHistory.Add(facadeview.SelectedListItemIndex);
+ }
+ Log.Info("UitGemist: Getting XML");
+
+ Names.Clear();
+ Urls.Clear();
+ Folders.Clear();
+ ViewFavorieten = false;
+ ViewTopTen = false;
+
+ string result = wc.GetXML(xmlUrl);
+ try
+ {
+ XPathDocument document = new XPathDocument(new System.IO.StringReader(result));
+ XPathNavigator navigator = document.CreateNavigator();
+ XPathExpression programs = XPathExpression.Compile("//li"); //returns nodeset
+
+ XPathNodeIterator nodes = navigator.Select(programs);
+
+ if (nodes.Count == 0)
+ {
+ //Log.Info("UitGemist: No nodes found for url '" + xmlUrl + "'");
+ Names.Add("(Geen items aangetroffen)");
+ Urls.Add("");
+ Folders.Add(false);
+ }
+ else
+ {
+ int i = 0;
+ while (nodes.MoveNext())
+ {
+ //Log.Info("UitGemist: Found node '" + nodes.Current.ToString() + "'");
+
+ Names.Add(nodes.Current.ToString());
+ Names[i] = MakeFirstUpper(ConvertString(Names[i]));
+
+ Urls.Add(nodes.Current.GetAttribute("rel", "").ToString());
+ Urls[i] = ConvertString(Urls[i]);
+ i++;
+
+ string nClass = nodes.Current.GetAttribute("class", "").ToString().Trim();
+ if (nClass.Equals("folder")) Folders.Add(true);
+ else Folders.Add(false);
+ }
+ }
+
+ ShowList(Names);
+ }
+ catch (XmlException e)
+ {
+ Log.Info("UitGemist: Invalid xml document '" + xmlUrl + "'. Details follow.");
+ Log.Info("UitGemist: Line number: " + e.LineNumber + ":");
+ Log.Info(e.StackTrace);
+ }
+ }
+
+ public static string GetPlayUrl(string url)
+ {
+ if (url.Equals("")) return url;
+
+ if(url.Contains(@"/system/video/html/"))
+ {
+ //Top ten URL's
+ url = host + url.Replace(@"/system/video/html/",@"/system/video/wvx/");
+ }
+ else
+ {
+ //Other programs URL's
+ url = host + "/system/video/wvx" + url;
+ }
+
+ return url;
+ }
+
+ // RTL Gemist contains some streams with different bitrates.
+ // Try these when playing the others fail
+ public static string GetAltPlayUrl(string url)
+ {
+ if (url.Equals("")) return url;
+
+ if (url.EndsWith("225.wvx")) url = url.Replace("225.wvx", "224.wvx");
+ else if (url.EndsWith("805.wvx")) url = url.Replace("805.wvx", "796.wvx");
+
+ return url;
+ }
+
+ /// <summary>
+ /// Fills the facadeview with item
+ /// </summary>
+ /// <param name="names">labels for the items</param>
+ private void ShowList(StringCollection names)
+ {
+ ViewTopTen = false;
+ facadeview.View = GUIFacadeControl.ViewMode.List;
+ facadeview.Clear();
+
+ for (int i = 0;i<names.Count;i++)
+ {
+ string label = names[i];
+ GUIListItem item = new GUIListItem();
+ item.Label = label;
+
+ bool isFolder = true;
+ if (Folders.Count > 0) isFolder = Folders[i];
+
+ item.IsFolder = isFolder;
+ Util.Utils.SetDefaultIcons(item);
+ facadeview.Add(item);
+ }
+
+ focusFacade();
+ }
+
+ /// <summary>
+ /// Converts a string with wrong characters and replaces those with the good ones
+ /// </summary>
+ /// <param name="convertstring">input string</param>
+ /// <returns>converted string</returns>
+ public static string ConvertString(string convertstring)
+ {
+ convertstring = convertstring.Replace("&", "&");
+ convertstring = convertstring.Replace("'", "'");
+ convertstring = convertstring.Replace("é", "\xE9");
+ convertstring = convertstring.Replace("ö", "\xF6");
+ convertstring = convertstring.Replace("ë", "\xEB");
+ convertstring = convertstring.Replace("ü", "\xFC");
+ convertstring.Trim();
+ return convertstring;
+ }
+
+ /// <summary>
+ /// Error Dialog
+ /// </summary>
+ /// <param name="text">error text</param>
+ private void ShowDialog(string text)
+ {
+ GUIDialogOK dialog = new GUIDialogOK();
+ dialog.SetHeading("Error");
+ dialog.SetLine(1, text);
+ dialog.DoModal(GetID);
+ }
+
+ /// <summary>
+ /// Save the favorites
+ /// </summary>
+ private void SaveFavorietenXML()
+ {
+ string dir = Directory.GetCurrentDirectory();
+
+ File.Delete(dir + @"\RTLGemistFav.xml");
+
+ using (MediaPortal.Profile.Settings writer = new MediaPortal.Profile.Settings(dir + @"\RTLGemistFav.xml", false))
+ {
+ writer.Clear();
+ int i = 0;
+ foreach (string favoriet in FavNames)
+ {
+ writer.SetValue(i.ToString(), "ProgrammaNaam", favoriet);
+ writer.SetValue(i.ToString(), "ProgrammaUrl", FavUrls[i]);
+ i++;
+ }
+ while (i < FavCount)
+ {
+ writer.SetValue(i.ToString(), "ProgrammaNaam", "");
+ writer.SetValue(i.ToString(), "PorgrammaUrl", "");
+ i++;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Load the favorites
+ /// </summary>
+ private void LoadFavorietenXML()
+ {
+ string dir = Directory.GetCurrentDirectory();
+ using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(dir + @"\RTLGemistFav.xml", false))
+ {
+ int i = 0;
+ while (i != 100)
+ {
+ string result = reader.GetValueAsString(i.ToString(), "ProgrammaNaam", "");
+ if (result.Equals(""))
+ {
+ FavCount = i - 1;
+ return;
+ }
+ else
+ {
+ FavNames.Add(reader.GetValue(i.ToString(), "ProgrammaNaam"));
+ FavNames[i] = ConvertString(MakeFirstUpper(FavNames[i]));
+ FavUrls.Add(reader.GetValue(i.ToString(), "ProgrammaUrl"));
+ FavUrls[i] = ConvertString(FavUrls[i]);
+ i++;
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Shows the first "top 10" items that were on
+ /// </summary>
+ private void ShowTopTen()
+ {
+ Names.Clear();
+ Urls.Clear();
+ ViewFavorieten = false;
+ ViewTopTen = true;
+
+ string url = host + @"/experience/media/context/index.xml";
+ string result = wc.GetXML(url);
+ try
+ {
+ XPathDocument document = new XPathDocument(new System.IO.StringReader(result));
+ XPathNavigator navigator = document.CreateNavigator();
+ XPathExpression programs = XPathExpression.Compile("//li/a"); //returns nodeset
+
+ XPathNodeIterator nodes = navigator.Select(programs);
+
+ int i = 0;
+ while (nodes.MoveNext())
+ {
+ //Log.Info("UitGemist: Found node '" + nodes.Current.ToString() + "'");
+
+ Names.Add(@nodes.Current.ToString());
+ Names[i] = MakeFirstUpper(ConvertString(Names[i]));
+ Urls.Add(@nodes.Current.GetAttribute("href", "").ToString());
+ Urls[i] = ConvertString(Urls[i]);
+ i++;
+ }
+
+ // Show the results!
+
+ facadeview.View = GUIFacadeControl.ViewMode.List;
+ facadeview.Clear();
+
+ for (i = 0; i < Names.Count; i++)
+ {
+ string label = Names[i];
+ GUIListItem item = new GUIListItem();
+ item.Label = label;
+ item.IsFolder = false;
+ Util.Utils.SetDefaultIcons(item);
+ facadeview.Add(item);
+ }
+ }
+ catch (XmlException e)
+ {
+ Log.Info("UitGemist: Invalid xml document '" + url + "'. Details follow.");
+ Log.Info("UitGemist: Line number: " + e.LineNumber + ":");
+ Log.Info(e.StackTrace);
+ }
+ }
+
+ private void PlayUitzending(string url, int bandIndex)
+ {
+ string[] band;
+ if (ShowWaitCursor.getBroadBand()) band = broadband;
+ else band = smallband;
+
+ if (url.Equals("") || bandIndex == -1) return;
+ if (bandIndex >= band.Length)
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading("Stream not found");
+ dlg.SetLine(1, "The requested stream could not be found.");
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ return;
+ }
+
+ string streamfile = band[bandIndex];
+
+ Log.Info("UitGemist: Playing uitzending: '" + url + streamfile + "'");
+
+ if (g_Player.Play(url + streamfile))
+ {
+ GUIGraphicsContext.IsFullScreenVideo = true;
+ GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
+ }
+ else PlayUitzending(url, bandIndex+1);
+ }
+
+ private string MakeFirstUpper(string name)
+ {
+ if (name.Length <= 1) return name.ToUpper();
+ Char[] letters = name.ToCharArray();
+ letters[0] = Char.ToUpper(letters[0]);
+ return new string(letters);
+ }
+
+ private void focusFacade()
+ {
+ if (facadeview.Count > 0 && !facadeview.Focus) GUIControl.FocusControl(GUIWindowManager.ActiveWindow, facadeview.GetID);
+ else if (facadeview.Count == 0) GUIControl.FocusControl(GUIWindowManager.ActiveWindow, btnFavoriet.GetID);
+ }
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/plugins/UitzendingGemist/UitGemist/SecondScreen.cs
===================================================================
--- trunk/plugins/UitzendingGemist/UitGemist/SecondScreen.cs (rev 0)
+++ trunk/plugins/UitzendingGemist/UitGemist/SecondScreen.cs 2007-01-29 21:24:59 UTC (rev 45)
@@ -0,0 +1,211 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Text;
+using System.Text.RegularExpressions;
+using MediaPortal.GUI.Library;
+using MediaPortal.Player;
+using MediaPortal.Dialogs;
+using MediaPortal.Playlists;
+
+namespace MediaPortal.GUI.UitGemist
+{
+ public class SecondScreen: GUIWindow
+ {
+ //#region SkinControlAttributes
+ [SkinControlAttribute(10)]
+ protected GUIListControl listview = null;
+ [SkinControlAttribute(3)]
+ protected GUIImage image = null;
+ //[SkinControlAttribute(3)]
+ //protected GUIImage imgPrgramma = null;
+ //[SkinControlAttribute(4)]
+ //protected GUILabelControl lblGenre = null;
+ //[SkinControlAttribute(5)]
+ //protected GUILabelControl lblOmroep = null;
+ //[SkinControlAttribute(6)]
+ //protected GUISelectButtonControl btnRubriek = null;
+ //#endregion
+
+ public static string Url = string.Empty;
+ public static bool ViewVideo = false;
+ private string imageurl = string.Empty;
+ private StringCollection Datum = new StringCollection();
+ private StringCollection Omschrijving = new StringCollection();
+ private StringCollection Views = new StringCollection();
+ private StringCollection Waardering = new StringCollection();
+ private StringCollection StreamUrl = new StringCollection();
+
+ public override int GetID
+ {
+ get
+ {
+ return 6801;
+ }
+ set
+ {
+ base.GetID = value;
+ }
+ }
+
+ public override bool Init()
+ {
+ return Load(GUIGraphicsContext.Skin + @"\UitGemist2.xml");
+ }
+
+ protected override void OnPageLoad()
+ {
+ if (ViewVideo)
+ {
+ NLGemist.wc.GetUrl("http://www.uitzendinggemist.nl");
+ GetInfo(Url);
+ ViewVideo = false;
+ }
+ else
+ {
+ GetInfo(Url);
+ }
+ Showlist();
+ base.OnPageLoad();
+ }
+
+ protected override void OnPageDestroy(int new_windowId)
+ {
+ image.FileName = GUIGraphicsContext.Skin + @"\media\background.png";
+ base.OnPageDestroy(new_windowId);
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
+ {
+ if (control == listview)
+ {
+ string mmsurl = string.Empty;
+ mmsurl = NLGemist.GetPlayUrl(StreamUrl[listview.SelectedListItemIndex]);
+ GUIGraphicsContext.IsFullScreenVideo = true;
+ GUIWindowManager.ActivateWindow((int)GUIWindow.Windo...
[truncated message content] |