From: <an...@us...> - 2008-03-03 05:53:53
|
Revision: 1415 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1415&view=rev Author: and-81 Date: 2008-03-02 21:53:52 -0800 (Sun, 02 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Abstractor/Abstractor.csproj trunk/plugins/IR Server Suite/Applications/Keyboard Input Relay/Keyboard Input Relay.csproj trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/ServerAddress.cs trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003)/Virtual Remote (Smartphone2003).csproj trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs trunk/plugins/IR Server Suite/IR Server Suite.sln Added Paths: ----------- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Data.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Dbox Tuner.csproj trunk/plugins/IR Server Suite/Applications/Dbox Tuner/DboxFunctions.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/GuiDbox.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Icon.ico trunk/plugins/IR Server Suite/Applications/Dbox Tuner/MyDboxGui.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Program.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Properties/ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Request.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.Designer.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.cs trunk/plugins/IR Server Suite/Applications/Dbox Tuner/SetupForm.resx trunk/plugins/IR Server Suite/Applications/Virtual Remote (PocketPC2003) Installer/ trunk/plugins/IR Server Suite/Applications/Virtual Remote (PocketPC2003) Installer/Virtual Remote (PocketPC2003) Installer.vddproj trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003) Installer/ trunk/plugins/IR Server Suite/Applications/Virtual Remote (Smartphone2003) Installer/Virtual Remote (Smartphone2003) Installer.vddproj trunk/plugins/IR Server Suite/Applications/Virtual Remote (WinCE5) Installer/ trunk/plugins/IR Server Suite/Applications/Virtual Remote (WinCE5) Installer/Virtual Remote (WinCE5) Installer.vddproj Modified: trunk/plugins/IR Server Suite/Applications/Abstractor/Abstractor.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Abstractor/Abstractor.csproj 2008-03-02 16:34:31 UTC (rev 1414) +++ trunk/plugins/IR Server Suite/Applications/Abstractor/Abstractor.csproj 2008-03-03 05:53:52 UTC (rev 1415) @@ -23,12 +23,14 @@ <UseVSHostingProcess>false</UseVSHostingProcess> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> + <DebugType>none</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> + <DefineConstants> + </DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <UseVSHostingProcess>false</UseVSHostingProcess> </PropertyGroup> <ItemGroup> <Reference Include="System" /> Property changes on: trunk/plugins/IR Server Suite/Applications/Dbox Tuner ___________________________________________________________________ Name: svn:ignore + bin obj Added: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Data.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Data.cs (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Data.cs 2008-03-03 05:53:52 UTC (rev 1415) @@ -0,0 +1,293 @@ +#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; +using System.Data; +using System.IO; +using System.Xml; +using System.Text.RegularExpressions; + +namespace DboxTuner +{ + + public class Data + { + + string _url; + string _userName; + string _password; + + public static string _boxtype = String.Empty; + + private string _Command = "/control/"; + + public Data(string url, string username, string password, string boxtype) + { + _url = url; + _userName = username; + _password = password; + _boxtype = boxtype; + } + + + public DataSet UserTVBouquets + { + get + { + DboxFunctions dboxfunc = new DboxFunctions(_url, _userName, _password, _boxtype); + //dboxfunc.ErrorLog("data.cs box = " + _boxtype); + string command = ""; + string temp = ""; + string sreturn = ""; + Request request = new Request(_url, _userName, _password); + + switch (_boxtype) + { + case "Enigma v1": + // get userbouquets (ref=4097:7:0:6:0:0:0:0:0:0:) + sreturn = request.PostData("/cgi-bin/getServices?ref=4097:7:0:6:0:0:0:0:0:0:"); + + // get internal hdd recording + if (!request.PostData("/cgi-bin/getServices?ref=2:47:0:0:0:0:0:0:0:0:/var/media/movie/").Contains("E: ")) + sreturn += "2:47:0:0:0:0:0:0:0:0:/var/media/movie/;Recordings\n"; + + // replace neutrino split character with ; + sreturn = sreturn.Replace(";", " "); + sreturn = sreturn.Replace(" selected", ""); // removes enigma v1's selected tag in bouquets output + + //dboxfunc.ErrorLog("returned bouquets: " + sreturn); + // set the bouquet command for this boxtype + command = "/cgi-bin/getServices?ref="; + break; + + case "Enigma v2": + string serviceID = ""; + string serviceName = ""; + // xmlbased, return all userbouquets + XmlDocument doc = new XmlDocument(); + doc.LoadXml(request.PostData("/web/fetchchannels?ServiceListBrowse=1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET \"bouquets.tv\" ORDER BY bouquet")); + XmlNodeList nodelist = doc.GetElementsByTagName("e2service"); + + foreach (XmlNode docnode in nodelist) + { + foreach (XmlNode datanode in docnode) + { + switch (datanode.Name) + { + case "e2servicereference": + serviceID = datanode.InnerText; + break; + + case "e2servicename": + serviceName = datanode.InnerText.Replace(" (TV)", ""); + break; + } + } + sreturn += serviceID + ";" + serviceName + "\n"; // make a list of all the userbouquets + } + + command = "/web/fetchchannels?ServiceListBrowse="; + //dboxfunc.ErrorLog("returned bouquets: " + sreturn); + break; + + default: + sreturn = request.PostData(_Command + "getbouquets"); + // set the bouquet command for this boxtype + command = (_Command + "getbouquet?bouquet="); + break; + } + + string[] allBouquets = sreturn.Split('\n'); // split the list of userbouquets + + // convert to dataset + DataSet ds = new DataSet(); + DataTable table = new DataTable("BouquetsTV"); + DataRow row = null; + + try + { + table.Columns.Add("BouqNo", Type.GetType("System.String")); + table.Columns.Add("BouqName", Type.GetType("System.String")); + table.Columns.Add("Channel", Type.GetType("System.String")); + table.Columns.Add("ID", Type.GetType("System.String")); + table.Columns.Add("Name", Type.GetType("System.String")); + + int loopcount = 0; + foreach (string s in allBouquets) + { + if (s != "") + { + ////dboxfunc.ErrorLog("on top of foreach allbouquet"); + // split the bouquet id from bouquet name + // s = "0 ServiceID, 1 Name of the Bouquets" + if (_boxtype == "Enigma v2") + temp = s.Split(';')[0]; //enigma2 splitchar is ";" + else + temp = s.Split(' ')[0]; //otherboxes splitchar is " " + + //dboxfunc.ErrorLog("splitted string to temp: " + temp); + + if (_boxtype == "Neutrino") + _Command = command + temp + "&mode=TV"; //build neutrino command + else + _Command = command + temp; //build enigma command + + //dboxfunc.ErrorLog("sending command: " + _Command); + + sreturn = request.PostData(_Command); //request list of channels contained in bouquetID "temp" + sreturn = sreturn.Replace(";selected", ""); + //dboxfunc.ErrorLog("sent command and returned: " + sreturn); + + if (_boxtype == "Enigma v2") + { + string serviceID = ""; + string serviceName = ""; + XmlDocument doc = new XmlDocument(); + doc.LoadXml(sreturn); + XmlNodeList nodelist = doc.GetElementsByTagName("e2service"); + sreturn = ""; + foreach (XmlNode docnode in nodelist) + { + foreach (XmlNode datanode in docnode) + { + switch (datanode.Name) + { + case "e2servicereference": + serviceID = datanode.InnerText; + break; + case "e2servicename": + serviceName = datanode.InnerText; + break; + } + } + sreturn += serviceID + ";" + serviceName + "\n"; // make a list of all the channels + } + } + + string[] OneBouquet = sreturn.Split('\n'); + string bucket = ""; + ////dboxfunc.ErrorLog("starting onebouquet again"); + if (OneBouquet[0] != "") + { + + foreach (string bouquets in OneBouquet) + { + + //dboxfunc.ErrorLog("on top of onebouquets foreach"); + if (bouquets != "") + { + //dboxfunc.ErrorLog("string is: " + bouquets); + if ((bouquets.IndexOf(' ') > -1) || (bouquets.IndexOf(';') > -1)) + { + row = table.NewRow(); + //dboxfunc.ErrorLog("created new row"); + int start = 0; + // modifying the enigma string so it's the same as neutrino + // that way I don't need to rewrite this textfilter + // using xml for enigma 1 is a very bad solution as the xml functions do not accept bouquet ids. + // which => one webrequest for each channel in every bouquet + if (_boxtype == "Enigma v1" || _boxtype == "Enigma v2") + { + string chan_id = bouquets.Split(';')[0]; // f.ex.: 1:0:1:6D67:437:1:C00000:0:0:0: + string chan_name = bouquets.Split(';')[1]; //f.eks DISCOVERY CHANNEL + if (chan_id.StartsWith("1:0:1") || chan_id.StartsWith("1:0:0") && chan_name != "<n/a>" && chan_name != "") // if chan_id is a TV service and chan_name is NOT <n/a> or emty + bucket = Convert.ToString(++loopcount) + " " + chan_id + " " + chan_name; + + } + //dboxfunc.ErrorLog("starting string functions"); + //dboxfunc.ErrorLog("split tmp_ref: " + s + " number of chars: " + s.Length); + + if (_boxtype == "Neutrino") + bucket = bouquets; + + String tmp_Ref; + + if (_boxtype == "Enigma v2") + tmp_Ref = s.Split(';')[0]; //enigma2 splitchar is ";" + else + tmp_Ref = s.Split(' ')[0]; //otherboxes splitchar is " " + + start = tmp_Ref.Length + 1; + String tmp_Bouquet = s.Substring(start, s.Length - start); + //dboxfunc.ErrorLog("split tmp_bouq, bucket is: " + bucket); + + String tmp_Channel = bucket.Split(' ')[0]; + //dboxfunc.ErrorLog("split channel"); + String tmp_ID = bucket.Split(' ')[1]; + + if (_boxtype == "Enigma v1") + tmp_ID = tmp_ID.Replace("1:0:0:0:0:0:0:0:0:0:", _url + "/rootX"); //workaround for the inability to stream internal recordings from the enigma hdd + + //dboxfunc.ErrorLog("split ID"); + start = tmp_Channel.Length + tmp_ID.Length + 2; + String tmp_Name = bucket.Substring(start, bucket.Length - start); + //dboxfunc.ErrorLog("split name"); + tmp_Name = tmp_Name.Replace("\"", "'"); + //dboxfunc.ErrorLog("ended string functions"); + + row["BouqNo"] = tmp_Ref; + row["BouqName"] = tmp_Bouquet; + row["Channel"] = tmp_Channel; + row["ID"] = tmp_ID; + row["Name"] = @tmp_Name; + + //dboxfunc.ErrorLog("ended row functions"); + //dboxfunc.ErrorLog("added: " + tmp_Ref + "channel: " + tmp_Channel + "id: " + tmp_ID + "name: " + tmp_Name); + // test if enigma got a error on service list + //dboxfunc.ErrorLog("trying to add row" + tmp_Channel); + table.Rows.Add(row); + //dboxfunc.ErrorLog("Added row" + tmp_Channel); + + if (tmp_ID == "E:" || tmp_Name == "<n/a>") + { + // kill the row or we get error + //dboxfunc.ErrorLog("trying to remove row" + tmp_Channel); + table.Rows.Remove(row); + //dboxfunc.ErrorLog("removed row" + tmp_Channel); + } + } + } + } + } + } + + + } + ds.Tables.Add(table); + } + catch + { + + } + //dboxfunc.ErrorLog("returning bouquets dataset"); + return ds; + } + } + + } + +} Added: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Dbox Tuner.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Dbox Tuner.csproj (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Dbox Tuner.csproj 2008-03-03 05:53:52 UTC (rev 1415) @@ -0,0 +1,95 @@ +<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>{F8CC05AA-6306-459E-BD32-40C02489EFEC}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>DboxTuner</RootNamespace> + <AssemblyName>DboxTuner</AssemblyName> + <StartupObject>DboxTuner.Program</StartupObject> + <ApplicationIcon>Icon.ico</ApplicationIcon> + </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> + <UseVSHostingProcess>false</UseVSHostingProcess> + <DocumentationFile> + </DocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants> + </DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'MyDboxSVN|AnyCPU' "> + <OutputPath>..\..\Mediaportal\xbmc\bin\Debug\plugins\Windows\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <Optimize>false</Optimize> + <DebugType>pdbonly</DebugType> + <PlatformTarget>AnyCPU</PlatformTarget> + <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> + <ErrorReport>prompt</ErrorReport> + <DocumentationFile> + </DocumentationFile> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Web" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Data.cs" /> + <Compile Include="SetupForm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="SetupForm.Designer.cs"> + <DependentUpon>SetupForm.cs</DependentUpon> + </Compile> + <Compile Include="DboxFunctions.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Request.cs" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="SetupForm.resx"> + <SubType>Designer</SubType> + <DependentUpon>SetupForm.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Common\IrssUtils\IrssUtils.csproj"> + <Project>{CA15769C-232E-4CA7-94FD-206A06CA3ABB}</Project> + <Name>IrssUtils</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Content Include="Icon.ico" /> + </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> + --> +</Project> \ No newline at end of file Added: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/DboxFunctions.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/DboxFunctions.cs (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/DboxFunctions.cs 2008-03-03 05:53:52 UTC (rev 1415) @@ -0,0 +1,233 @@ +#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; +using System.Xml; +using System.IO; + +namespace DboxTuner +{ + + class DboxFunctions + { + + #region Variables + + string _url; + string _userName; + string _password; + string _command = "/control/"; + string _boxType; + + #endregion Variables + + #region Constructor + + public DboxFunctions(string url, string username, string password, string boxtype) + { + _url = "http://" + url; + _userName = username; + _password = password; + _boxType = boxtype; + } + + #endregion Constructor + + public string GetID() + { + //ErrorLog("entered getid with " +_Url + " "+_UserName+" "+_Password+" "+_Boxtype); + Request request = new Request(_url, _userName, _password); + XmlDocument doc = new XmlDocument(); + XmlNode elem = doc.DocumentElement; + + string s = ""; + //get actual channel (ID) + + switch (_boxType) + { + case "Enigma v1": + doc.LoadXml(request.PostData("/xml/streaminfo")); + elem = doc.SelectSingleNode("/streaminfo/service/reference"); + s = elem.InnerText; + break; + + case "Enigma v2": + doc.LoadXml(request.PostData("/web/subservices")); + elem = doc.SelectSingleNode("/e2servicelist/e2service/e2servicereference"); + s = elem.InnerText; + break; + + default: + s = request.PostData(_command + "zapto"); + s = s.Replace("\n", ""); + //ErrorLog("get channel "+s+" for "+_Boxtype); + break; + } + + return s; + } + public string ZapTo(string ID) + { + Request request = new Request(_url, _userName, _password); + string s = ""; + //zap to channel (ID) + switch (_boxType) + { + case "Enigma v1": + s = request.PostData("/cgi-bin/zapTo?path=" + ID); + return s; + case "Enigma v2": + s = request.PostData("/web/zap?ZapTo=" + ID); + return s; + default: + s = request.PostData(_command + "zapto?" + ID); + return s; + } + } + public void WakeUp() + { + Request request = new Request(_url, _userName, _password); + switch (_boxType) + { + case "Enigma v1": + request.PostData("/cgi-bin/admin?command=wakeup"); + break; + case "Enigma v2": // donno if wakeup is correct command + request.PostData("/web/powerstate?newstate=wakeup"); + break; + case "Neutrino": // off = wakeup + request.PostData("/control/standby?off"); + break; + } + + } + public string SetSPTS() + { + Request request = new Request(_url, _userName, _password); + string s = ""; + //set playback to spts only required for neutrino, (i think) + // return ok for enigma + if (_boxType != "Neutrino") + s = "ok"; + else //send neutrino command + s = request.PostData(_command + "system?setAViAExtPlayBack=spts"); + return s; + } + public string ToggleMute() + { + Request request = new Request(_url, _userName, _password); + string s = ""; + // get status + switch (_boxType) + { + case "Enigma v1": + s = request.PostData("/cgi-bin/audio?mute=0"); + return s; + case "Enigma v2": + s = request.PostData("/web/vol?set=mute"); + return s; + default: + s = request.PostData(_command + "volume?status"); + if (s == "0") + s = request.PostData(_command + "volume?mute"); + if (s == "1") + s = request.PostData(_command + "volume?unmute"); + + return s; + } + + } + public string GetEpgXml(string ID) + { + Request request = new Request(_url, _userName, _password); + string s = ""; + // get epg from box (xml formatted) + switch (_boxType) + { + case "Enigma v1": + s = request.PostData("/xml/serviceepg?ref=" + ID); + break; + case "Enigma v2": + s = request.PostData("/web/epgservice?ref=" + ID); + break; + default: + s = request.PostData(_command + "epg?xml=true&channelid=" + ID + "&details=true"); // &max=20 + break; + } + s = s.Replace("&", "&"); + return s; + + } + public void ShowMessage(string message) + { + Request request = new Request(_url, _userName, _password); + + switch (_boxType) + { + case "Enigma v1": + request.PostData("/cgi-bin/xmessage?timeout=10&caption=Message&body=" + message); + break; + + case "Enigma v2": + request.PostData("/web/message?type=1&timeout=10&text=" + message); + break; + + default: + request.PostData(_command + "message?popup=" + message); + break; + } + } + public string GetInfo() + { + Request request = new Request(_url, _userName, _password); + string s = String.Empty; + + switch (_boxType) + { + case "Enigma v1": + s = request.PostData("/xml/boxinfo"); + s = s.Replace("\n", " "); + s = s.Replace(" ", ""); + break; + + case "Enigma v2": + s = request.PostData("/web/about"); + s = s.Replace("\n", " "); + break; + + default: + s = request.PostData(_command + "info?version"); + s = s.Replace("\n", " "); + break; + } + + return s; + } + + } + +} Added: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/GuiDbox.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/GuiDbox.cs (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/GuiDbox.cs 2008-03-03 05:53:52 UTC (rev 1415) @@ -0,0 +1,181 @@ +#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.ComponentModel; +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.Configuration; +using MediaPortal.Playlists; +using System.Xml; +using System.IO; +using System.Data; +using MediaPortal.Util; + +namespace MediaPortal.GUI.Mydbox +{ + public class DboxGui : GUIWindow + { + public const int WindowID = 9900; + + #region Constructor + public DboxGui() + { + GetID = (int)MyDboxGui.WindowID; + } + #endregion + + #region SkinControlAttributes + [SkinControlAttribute(50)] + protected GUIFacadeControl facadeview = null; + [SkinControlAttribute(2)] + protected GUIButtonControl btnFavoriet = null; + [SkinControlAttribute(3)] + protected GUIButtonControl btnRadio = null; + [SkinControlAttribute(4)] + protected GUIButtonControl btnRecordings = null; + #endregion + + #region Variables + //private DBox.Core _Dreambox = null; + //PlayListPlayer playlistPlayer; + + // bools + //private bool _ShowChannels = false; + + private static string server; + private static string username; + private static string password; + + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + + private static DataTable _TV_Bouquets = null; + //private static DataTable _Radio_Bouquets = null; + + #endregion + + #region Overrides + public override bool Init() + { + //playlistPlayer = PlayListPlayer.SingletonPlayer; + LoadSettings(); + + return Load(GUIGraphicsContext.Skin + @"\mydbox.xml"); + } + + #endregion + + #region Private Methods + void LoadSettings() + { + string path = Path.Combine(Config.GetFolder(Config.Dir.Config), "MediaPortal.xml"); + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(path)) + //using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + server = xmlreader.GetValue("mydbox", "IP"); + username = xmlreader.GetValue("mydbox", "UserName"); + password = xmlreader.GetValue("mydbox", "Password"); + } + + ShowBoutiques(); + + } + + void ShowBoutiques() + { + _Url = "http://" + server ; + _UserName = ""; + _Password = ""; + + //_ShowChannels = false; + facadeview.Clear(); + + //get bouquets + Data _DBox = new Data(_Url, _UserName, _Password); + _TV_Bouquets = _DBox.UserTVBouquets.Tables[0]; + + foreach (DataRow row in _TV_Bouquets.Rows) + { + GUIListItem li = new GUIListItem(); + li.Label = row["Name"].ToString(); + facadeview.Add(li); + } + } + void ShowChannels(GUIListItem guiListItem) + { + _Url = "http://192.168.0.100/"; + _UserName = ""; + _Password = ""; + + //_ShowChannels = true; + facadeview.Clear(); + Data _DBox = new Data(_Url, _UserName, _Password); + string reference = GetChannelReference(guiListItem); + //DataTable dt = _DBox.Channels(reference).Tables[0]; + //foreach (DataRow row in dt.Rows) + { + // GUIListItem li = new GUIListItem(); + // li.Label = row["Name"].ToString(); + // facadeview.Add(li); + } + try + { + //string currentChannelName = _Dbox.CurrentChannel.Name; + //GUIPropertyManager.SetProperty("#Play.Current.File", currentChannelName); + //GUIPropertyManager.SetProperty("#Play.Current.Title", currentChannelName); + } + catch (Exception) { } + } + string GetChannelReference(GUIListItem guiListItem) + { + string reference = ""; + Data _DBox = new Data(_Url, _UserName, _Password); + DataTable dt = _DBox.UserTVBouquets.Tables[0]; + foreach (DataRow row in dt.Rows) + { + if (guiListItem.Label == row["Name"].ToString()) + { + reference = row["Ref"].ToString(); + break; + } + } + return reference; + } + #endregion + + + } + + + + +} \ No newline at end of file Added: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Icon.ico =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/Icon.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/Applications/Dbox Tuner/MyDboxGui.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Dbox Tuner/MyDboxGui.cs (rev 0) +++ trunk/plugins/IR Server Suite/Applications/Dbox Tuner/MyDboxGui.cs 2008-03-03 05:53:52 UTC (rev 1415) @@ -0,0 +1,1677 @@ +#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.ComponentModel; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Diagnostics; +using System.Text; +using System.Text.RegularExpressions; +using MediaPortal.GUI.Library; +using MediaPortal.Player; +using MediaPortal.Dialogs; +using MediaPortal.Playlists; +using MediaPortal.Localisation; +using System.Xml; +using System.IO; +using System.Data; +using System.Drawing; +using MediaPortal.Util; +using AXVLC; +using System.Net; + +namespace DboxTuner +{ + public class MyDboxGui : GUIWindow + { + #region SkinControlAttributes + [SkinControlAttribute(2)] + protected GUIButtonControl btnTVGuide = null; + [SkinControlAttribute(3)] + protected GUIToggleButtonControl btnRecord = null; + [SkinControlAttribute(4)] + protected GUIButtonControl btnSnap = null; + [SkinControlAttribute(6)] + protected GUIButtonControl btnBouquet = null; + [SkinControlAttribute(7)] + protected GUIButtonControl btnChannel = null; + [SkinControlAttribute(8)] + protected GUIToggleButtonControl btnTVOnOff = null; + [SkinControlAttribute(9)] + protected GUIToggleButtonControl btnShiftOnOff = null; + [SkinControlAttribute(11)] + protected GUIButtonControl btnRecordings = null; + [SkinControlAttribute(13)] + protected GUIButtonControl btnWhatsThis = null; + [SkinControlAttribute(24)] + protected GUIImage imgRecord; + [SkinControlAttribute(99)] + protected GUIVideoControl videoWindow = null; + #endregion + + #region Private Variables + + private static string server; + private static string username; + private static string password; + public static string boxtype; + + private static string AutoOn; + private static bool BoxConn = false; + + private static DateTime startRecord; + + DataRow row = null; + DataTable _TV_Bouquets = new DataTable("BouquetsTV"); + + private static int ActBouquetNo; + private static string ActBouquet; + public static string ActChannel; + + private static VirtualDirectory recDirectory = new VirtualDirectory(); + private static string RecDir = String.Empty; + private static string SnapDir = String.Empty; + + private string LogPathName = Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + @"\log\MyDbox.log"; + + private static OnActionHandler ah; + + public static VideoLanControl vlcControl = null; + // osd for channel + public static MyOSD osd; + public int t_OSD = 0; + // select direct the channel + public static MySelect sel; + public int t_Sel = 0; + public string SelStr = "...."; + // info screen + public static MyOSD_Info info; + public int t_Info = 0; + // info screen + public static MyOSD_Chan chan; + public int t_Chan = 0; + public ArrayList SelChan; + public int MaxBouq; + // global functions dbox (faster) + static DboxFunctions func; + + public AxAXVLC.AxVLCPlugin Control + { + get + { + return vlcControl.Player; + } + } + + string _currentGroup = String.Empty; + string _currentChannel = String.Empty; + + bool _started; + bool _paused; + bool _isFullScreen; + bool _wasFullscreen; // true if we are in fullscreen and ACTION_PREVIOUS_MENU is sent to action handler + + + int _cnt_Ply = 0; + bool _Ply_VLC = false; + + int _positionX = 10, _positionY = 10, _videoWidth = 100, _videoHeight = 100; + int _PreviousWindowID = 0; + + // ticker for updates + private System.Windows.Forms.Timer _Update = new System.Windows.Forms.Timer(); + private System.Windows.Forms.Timer _OSDTimer = new System.Windows.Forms.Timer(); + + //thread for EPG updates + System.Threading.Thread EPG_Thread; + + static cGlobal cGlobal; + + #endregion + + #region Private Enumerations + enum Controls + { + BouquetButton = 6, + ChannelButton = 7, + TVButton = 3, + TVOnOff = 8, + RecordingsButton = 11, + RadioButton = 12, + DirectButton = 13, + List = 50 + } + #endregion + + public override int GetID + { + get + { + return 75642203; + } + set + { + base.GetID = value; + } + } + + public override bool Init() + { + bool result = Load(GUIGraphicsContext.Skin + @"\mydboxmain.xml"); + Mydbox.GUILocalizeStrings.Load(GUI.Library.GUILocalizeStrings.CurrentLanguage()); + + LoadSettings(); + + Data dboxdata = new Data(server, username, password, boxtype); + dboxdata.loadEPGdata(); //load epg data from file + + if (File.Exists(LogPathName)) File.Delete(LogPathName); + ErrorLog("Init plugin"); + + SelChan = new ArrayList(); + + // get bouquets + ParseXML(); + ErrorLog("XML parsed " + _TV_Bouquets.Rows.Count); + + recDirectory.AddExtension(".dat"); + recDirectory.ShowFilesWithoutExtension = false; + + Share share2 = new Share(); + share2.Name = "Recordings"; + share2.Path = RecDir; + recDirectory.IsRootShare(RecDir); + + if (ah == null) ah = new OnActionHandler(OnAction2); + + #region get some data from box + try + { + // get actual ID + func = new DboxFunctions(server, username, password, boxtype); + func.wakeup(); + cGlobal.currentID = func.getID(); + if (cGlobal.currentID != "") + { + ErrorLog("Actual ID " + cGlobal.currentID); + func.setSPTS(); + ErrorLog("SetSPTS has been set"); + ErrorLog("Version=> " + func.getInfo()); + func.showMessage("Mediaportal%20connected"); + // looks box is working + BoxConn = true; + } + else + { + ErrorLog("Receiver is not reachable ?"); + } + } + + catch + { + ErrorLog("Receiver is not reachable ?"); + } + + // get group/channel + ActBouquetNo = 1; + for (int i = 0; i < _TV_Bouquets.Rows.Count; i++) + { + if (_TV_Bouquets.Rows[i]["ID"].ToString() == cGlobal.currentID) + { + ActBouquetNo = Convert.ToInt16(_TV_Bouquets.Rows[i]["BouqNo"].ToString()); + + ActBouquet = _TV_Bouquets.Rows[i]["BouqName"].ToString(); + ActChannel = _TV_Bouquets.Rows[i]["Name"].ToString(); + + ErrorLog("Actual group " + ActBouquet + " actual channel " + ActChannel); + } + } + + #endregion + + return result; + } + + #region Actions + + public void OnAction2(Action action) + { + Debug.WriteLine("Action2:" + action.wID.ToString()); + + if (GUIWindowManager.ActiveWindowEx == (int)GUIWindow.Window.WINDOW_DIALOG_MENU) return; + //bool actionTaken = true; + + //Debug.WriteLine(action.wID.ToString()); + + object key; + switch (action.wID) + { + case Action.ActionType.ACTION_EXIT: + { // prepare for exit + OnPageDestroy(0); + break; + } + case Action.ActionType.ACTION_PREVIOUS_MENU: + { + if (_isFullScreen) + { + if (t_Chan > 0) t_Chan = 0; // channel osd is up, kill it + else if (t_OSD > 0) t_OSD = 0; // epg is up, kill it + else if (t_Info > 0) + { + t_Info = 0; + t_OSD = 2; // info is up, go back to epg + } + else // no osd is up, exit fullscreen + { + _isFullScreen = false; + _wasFullscreen = true; + SetWindows(); + } + } + break; + } + case Action.ActionType.ACTION_MOVE_LEFT: + if ((_isFullScreen == true) && (cGlobal.VLC_Live == true)) + { + if (t_Chan > 0) + { // only if already visible + ActBouquetNo--; + } + + if (ActBouquetNo == 0) + ActBouquetNo = MaxBouq; + + t_Chan = 10; + t_OSD = 0; + chan.DisplayBouq(ActBouquetNo.ToString(), "0"); + } + break; + case Action.ActionType.ACTION_MOVE_RIGHT: + if ((_isFullScreen == true) && (cGlobal.VLC_Live == true)) + { + if (t_Chan > 0) + { // only if already visible + ActBouquetNo++; + } + if (ActBouquetNo > MaxBouq) + ActBouquetNo = 1; + + t_Chan = 10; + t_OSD = 0; + chan.DisplayBouq(ActBouquetNo.ToString(), "-1"); + } + break; + case Action.ActionType.ACTION_MOVE_DOWN: + case Action.ActionType.ACTION_MOVE_UP: + if ((_isFullScreen == true) && (cGlobal.VLC_Live == true)) + { + t_Chan = 10; + t_OSD = 0; + } + break; + case Action.ActionType.ACTION_VOLUME_MUTE: + DboxFunctions func = new DboxFunctions(server, username, password, boxtype); + func.toggleMute(); + break; + case Action.ActionType.ACTION_FORWARD: + case Action.ActionType.ACTION_MUSIC_FORWARD: + key = vlcControl.Player.getVariable("key-faster"); + vlcControl.Player.setVariable("key-pressed", key); + break; + case Action.ActionType.ACTION_MUSIC_REWIND: + case Action.ActionType.ACTION_REWIND: + key = vlcControl.Player.getVariable("key-slower"); + vlcControl.Player.setVariable("key-pressed", key); + break; + case Action.ActionType.ACTION_PREV_CHANNEL: + OnPreviousChannel(); + PlayCurrentChannel(); + break; + case Action.ActionType.ACTION_PAGE_DOWN: + OnPreviousChannel(); + PlayCurrentChannel(); + break; + case Action.ActionType.ACTION_NEXT_CHANNEL: + OnNextChannel(); + PlayCurrentChannel(); + break; + case Action.ActionType.ACTION_PAGE_UP: + OnNextChannel(); + PlayCurrentChannel(); + break; + case Action.ActionType.ACTION_PLAY: + case Action.ActionType.ACTION_MUSIC_PLAY: + PlayCurrentChannel(); + break; + case Action.ActionType.ACTION_STOP: + StopPlaying(); + btnTVOnOff.Selected = false; + break; + case Action.ActionType.ACTION_PAUSE: + if (_started) + { + if (!vlcControl.Player.Playing) + { + _paused = false; + vlcControl.Player.play(); + } + else + { + _paused = true; + vlcControl.Player.pause(); + } + } + break; + case (Action.ActionType.ACTION_RECORD): + if (btnRecord.Selected) + { + btnRecord.Selected = false; + imgRecord.Visible = false; + } + else + { + btnRecord.Selected = true; + imgRecord.Visible = true; + OnRecord(); + } + break; + case (Action.ActionType.ACTION_SHOW_FULLSCREEN): + SetWindows(); + break; + case (Action.ActionType.ACTION_SHOW_GUI): + if (_isFullScreen == false) + { + //vlcControl.Player.fullscreen(); + _isFullScreen = true; + SetWindows(); + } + else + { + if (chan.Visible == false) + { + //vlcControl.Player.fullscreen(); + _isFullScreen = false; + SetWindows(); + } + else + { + + } + } + break; + case Action.ActionType.ACTION_SELECT_ITEM: + string t = chan.GetChannel(ActBouquet); + if ((t != "") && (_isFullScreen == true)) + { + if (t_Chan > 0) + { + t_Chan = 0; + ChangeChannel(t); + PlayCurrentChannel(); + } + } + break; + case (Action.ActionType.ACTION_CONTEXT_MENU): + if (t_OSD > 0) + { + if (cGlobal.VLC_Live == true) + { + t_OSD = 0; + t_Info = 10; + } + else + t_OSD = 0; + } + else + { + t_OSD = 10; + t_Info = 0; + t_Chan = 0; + } + break; + case Action.ActionType.ACTION_KEY_PRESSED: + if (cGlobal.VLC_Live == true) + { + switch (action.m_key.KeyChar) + { + case '1': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "1"; + SelStr = callSelect(SelStr); + break; + case '2': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "2"; + SelStr = callSelect(SelStr); + break; + case '3': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "3"; + SelStr = callSelect(SelStr); + break; + case '4': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "4"; + SelStr = callSelect(SelStr); + break; + case '5': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "5"; + SelStr = callSelect(SelStr); + break; + case '6': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "6"; + SelStr = callSelect(SelStr); + break; + case '7': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "7"; + SelStr = callSelect(SelStr); + break; + case '8': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "8"; + SelStr = callSelect(SelStr); + break; + case '9': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "9"; + SelStr = callSelect(SelStr); + break; + case '0': + t_Sel = 2; + t_Info = 0; + SelStr = SelStr + "0"; + SelStr = callSelect(SelStr); + break; + case '#': + if ((SelStr != "....") & (SelStr != "") & (SelStr.Length > 0) & (t_Sel > 0)) + { + int x = Convert.ToInt16(SelStr) - 1; + try + { + t_Sel = 0; + ChangeChannel(_TV_Bouquets.Rows[x]["ID"].ToString()); + PlayCurrentChannel(); + } + catch + { + } + } + break; + } + } + break; + case (Action.ActionType.ACTION_ASPECT_RATIO): + if ((SelStr != "....") & (SelStr != "") & (SelStr.Length > 0) & (t_Sel > 0)) + { + int x = Convert.ToInt16(SelStr) - 1; + try + { + t_Sel = 0; + ChangeChannel(_TV_Bouquets.Rows[x]["ID"].ToString()); + PlayCurrentChannel(); + } + catch + { + } + } + break; + + default: + //actionTaken = false; + break; + } + } + + private string callSelect(string selNo) + { + selNo = selNo.Replace(".", ""); + if (selNo.Length > 4) + { + selNo = selNo.Substring(4, selNo.Length - 4); + } + + string ch = ""; + int x = Convert.ToInt32(selNo); + if (x > 0) + { + x = x - 1; + // valid no ?? + if (x <= _TV_Bouquets.Rows.Count) + { + ch = _TV_Bouquets.Rows[x]["Name"].ToString(); + } + else + { + ch = ""; + } + } + sel.SetSelction(selNo, ch); + + return selNo; + } + + public override void OnAction(Action action) + { + if (_isFullScreen || _wasFullscreen) + { // disable "right click"/previous menu when in fullscreen + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + action = new Action(Action.ActionType.ACTION_SHOW_GUI, 0, 0); + _wasFullscreen = false; + } + base.OnAction(action); + } + else + { // if windowed still the same + base.OnAction(action); + } + } + + #endregion + + #region overrides + + public override bool OnMessage(GUIMessage message) + { + return base.OnMessage(message); + } + + protected override void OnPageLoad() + { + base.OnPageLoad(); + + ErrorLog("Load plugin"); + + // set actions + //GUIGraphicsContext.OnNewAction -= ah; + GUIGraphicsContext.OnNewAction += ah; + + // disable exclusive mode + Log.Info("DBox2 plugin: Disabling DX9 exclusive mode"); + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SWITCH_FULL_WINDOWED, 0, 0, 0, 0, 0, null); + GUIWindowManager.SendMessage(msg); + + // init record fields + GUIPropertyManager.SetProperty("#Dbox.Record.channel", " "); + GUIPropertyManager.SetProperty("#Dbox.Record.title", " "); + GUIPropertyManager.SetProperty("#Dbox.Record.start", " "); + GUIPropertyManager.SetProperty("#Dbox.Record.stop", " "); + + + #region set timer + // start update ticker + _Update.Interval = 2000; + _Update.Tick += new EventHandler(_Update_Tick); + _Update.Start(); + // start OSD ticker + _OSDTimer.Interval = 1000; + _OSDTimer.Tick += new EventHandler(_OSDTimer_Tick); + _OSDTimer.Start(); + #endregion + + //set video window position + if (videoWindow != null) + { + GUIGraphicsContext.VideoWindow = new Rectangle(videoWindow.XPosition, videoWindow.YPosition, videoWindow.Width, videoWindow.Height); + } + + // TV is off + btnTVOnOff.Selected = false; + + #region init vlc + // close last instance + if (vlcControl != null) + vlcControl = null; + + // SaveDir exits ? + if (!Directory.Exists(RecDir)) Directory.CreateDirectory(RecDir); + if (!Directory.Exists(SnapDir)) Directory.CreateDirectory(SnapDir); + + // new instance + vlcControl = new VideoLanControl(); + vlcControl = VideoLanControl.Instance; + // control is now visible + vlcControl.Visible = false; + vlcControl.Enabled = false; + // add control to GUI + GUIGraphicsContext.form.Controls.Add(vlcControl); + // set focus + GUIGraphicsContext.form.Focus(); + #endregion + + #region init osd + // prepare osd + if (osd == null) + { + osd = new MyOSD(); + osd.Visible = false; + GUIGraphicsContext.form.Controls.Add(osd); + GUIGraphicsContext.form.Focus(); + } + // prepare select + if (sel == null) + { + sel = new MySelect(); + sel.Visible = false; + GUIGraphicsContext.form.Controls.Add(sel); + GUIGraphicsContext.form.Focus(); + } + if (info == null) + { + info = new MyOSD_Info(); + info.Visible = false; + GUIGraphicsContext.form.Controls.Add(info); + GUIGraphicsContext.form.Focus(); + } + if (chan == null) + { + chan = new MyOSD_Chan(_TV_Bouquets); + chan.Visible = false; + GUIGraphicsContext.form.Controls.Add(chan); + GUIGraphicsContext.form.Focus(); + } + #endregion + + // init channel display + chan.DisplayBouq(ActBouquetNo.ToString(), "1"); + + // set windows + SetWindows(); + + //Disable program & timeshift for now + GUIControl.DisableControl(GetID, 2); + GUIControl.DisableControl(GetID, 9); + //focus on/off + GUIControl.FocusControl(GetID, 8); + + // set localized labels for static controls + GUIPropertyManager.SetProperty("#header_label", Mydbox.GUILocalizeStrings.Get(0)); // MyDreamDboxTV + GUIControl.SetControlLabel(GetID, btnTVGuide.GetID, Mydbox.GUILocalizeStrings.Get(600)); // Program + GUIControl.SetControlLabel(GetID, btnRecord.GetID, Mydbox.GUILocalizeStrings.Get(601)); // Record + GUIControl.SetControlLabel(GetID, btnSnap.GetID, Mydbox.GUILocalizeStrings.Get(602)); // Snapshot + GUIControl.SetControlLabel(GetID, btnBouquet.GetID, Mydbox.GUILocalizeStrings.Get(603)); // Group + GUIControl.SetControlLabel(GetID, btnChannel.GetID, Mydbox.GUILocalizeStrings.Get(604)); // Channel + GUIControl.SetControlLabel(GetID, btnTVOnOff.GetID, Mydbox.GUILocalizeStrings.Get(605)); //On/Off + GUIControl.SetControlLabel(GetID, btnShiftOnOff.GetID, Mydbox.GUILocalizeStrings.Get(606)); // Shift + GUIControl.SetControlLabel(GetID, btnRecordings.GetID, Mydbox.GUILocalizeStrings.Get(607)); // Recordings + GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, Mydbox.GUILocalizeStrings.Get(608)); // Whats .. + + if (AutoOn == "yes") + { + _isFullScreen = true; + SetWindows(); + btnTVOnOff.Selected = true; + AutoOn = "no"; + PlayCurrentChannel(); + } + + EPG_Thread = new System.Threading.Thread(new System.Threading.ThreadStart(EPG_Refresh)); + EPG_Thread.Start(); + System.Threading.Thread.Sleep(0); + + } + + protected override void OnPageDestroy(int new_windowId) + { + _Update.Stop(); + _Update.Tick -= new EventHandler(_Update_Tick); + + _OSDTimer.Stop(); + _OSDTimer.Tick -= new EventHandler(_Update_Tick); + + EPG_Thread.Interrupt(); + EPG_Thread.Abort(); + + Data dboxdata = new Data(server, username, password, boxtype); + dboxdata.saveEPGdata(); + + if (_started) + StopPlaying(); + + ErrorLog("Unload plugin"); + + if (new_windowId != (int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO) GUIGraphicsContext.OnNewAction -= ah; + base.OnPageDestroy(35); //(new_windowId); + } + + protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) + { + if (!_isFullScreen) + { + if (control == btnRecord) + { + OnRecord(); + } + if (control == btnSnap) + { + object key = vlcControl.Player.getVariable("key-snapshot"); + vlcControl.Player.setVariable("key-pressed", key); + } + if (control == btnBouquet) + showBouquet(); + if (control == btnChannel) + showChannel(); + if (control == btnTVOnOff) + switchOnOff(); + if (control == btnWhatsThis) + OnBtnWhatsThis(); + if (control == btnShiftOnOff) + { + } + if (control == btnRecordings) + { + t_OSD = 0; + osd.Visible = false; + t_Sel = 0; + sel.Visible = false; + + if (_started) + StopVLC(); + + // Play recording + cGlobal.VLC_Live = false; + //display tv on + btnTVOnOff.Selected = false; + + //activate Recordings Screen + GUIWindowManager.ActivateWindow(75642204); + + } + } + base.OnClicked(controlId, control, actionType); + } + + protected override void OnShowContextMenu() + { + base.OnShowContextMenu(); + } + + #endregion overrides + + private void showBouquet() + { + //show list with bouquets + GUIDialogMenuBottomRight menu = (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT); + menu.Reset(); + menu.SetHeading(GUILocalizeStrings.Get(971) + ": "); + + int act = 0; + String actRef = ""; + + for (int i = 0; i < _TV_Bouquets.Rows.Count; i++) + { + actRef = _TV_Bouquets.Rows[i]["BouqNo"].ToString(); + if (act != Convert.ToInt16(actRef)) + { + menu.Add(_TV_Bouquets.Rows[i]["BouqName"].ToString()); + act = Convert.ToInt16(actRef); + } + } + menu.DoModal(GetID); + string bouquetName = menu.SelectedLabelText; + if (bouquetName != "") + { + for (int i = 0; i < _TV_Bouquets.Rows.Count; i++) + { + if (_TV_Bouquets.Rows[i]["BouqName"].ToString() == bouquetName) + { + ActBouquetNo = Convert.ToInt16(_TV_Bouquets.Rows[i]["BouqNo"].ToString()); + ActBouquet = _TV_Bouquets.Rows[i]["BouqName"].ToString(); + break; + } + } + } + + } + + private void showChannel() + { + //show list with bouquets + GUIDialogMenuBottomRight menu = (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT); + menu.Reset(); + menu.SetHeading(GUILocalizeStrings.Get(972) + ": "); + + String actRef = ""; + + for (int i = 0; i < _TV_B... [truncated message content] |