From: <che...@us...> - 2008-04-21 23:14:56
|
Revision: 1691 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1691&view=rev Author: chef_koch Date: 2008-04-21 16:14:54 -0700 (Mon, 21 Apr 2008) Log Message: ----------- added MyDreambox and ExternalDreamboxTV plugin from mp svn revision 15748 Revision Links: -------------- http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=15748&view=rev Added Paths: ----------- trunk/plugins/ExternalDreamboxTV/ trunk/plugins/ExternalDreamboxTV/Dreambox/ trunk/plugins/ExternalDreamboxTV/Dreambox/BoxInfo.cs trunk/plugins/ExternalDreamboxTV/Dreambox/ChannelInfo.cs trunk/plugins/ExternalDreamboxTV/Dreambox/Core.cs trunk/plugins/ExternalDreamboxTV/Dreambox/Data.cs trunk/plugins/ExternalDreamboxTV/Dreambox/NowPlaying799.cs trunk/plugins/ExternalDreamboxTV/Dreambox/Remote.cs trunk/plugins/ExternalDreamboxTV/Dreambox/Request.cs trunk/plugins/ExternalDreamboxTV/Dreambox/XML.cs trunk/plugins/ExternalDreamboxTV/Dreambox/Zap.cs trunk/plugins/ExternalDreamboxTV/ExternalDreamBoxTVSettings.Designer.cs trunk/plugins/ExternalDreamboxTV/ExternalDreamBoxTVSettings.cs trunk/plugins/ExternalDreamboxTV/ExternalDreamBoxTVSettings.resx trunk/plugins/ExternalDreamboxTV/ExternalDreamboxTV.cs trunk/plugins/MyDreambox/ trunk/plugins/MyDreambox/AxInterop.AXVLC.dll trunk/plugins/MyDreambox/Dreambox/ trunk/plugins/MyDreambox/Dreambox/BoxInfo.cs trunk/plugins/MyDreambox/Dreambox/ChannelInfo.cs trunk/plugins/MyDreambox/Dreambox/Core.cs trunk/plugins/MyDreambox/Dreambox/Data.cs trunk/plugins/MyDreambox/Dreambox/EPG.cs trunk/plugins/MyDreambox/Dreambox/NowPlaying799.cs trunk/plugins/MyDreambox/Dreambox/Remote.cs trunk/plugins/MyDreambox/Dreambox/Request.cs trunk/plugins/MyDreambox/Dreambox/XML.cs trunk/plugins/MyDreambox/Dreambox/Zap.cs trunk/plugins/MyDreambox/DreamboxSetupForm.Designer.cs trunk/plugins/MyDreambox/DreamboxSetupForm.cs trunk/plugins/MyDreambox/DreamboxSetupForm.resx trunk/plugins/MyDreambox/GuiRecordings.cs trunk/plugins/MyDreambox/Interop.AXVLC.dll trunk/plugins/MyDreambox/MyDreamboxGui.cs trunk/plugins/MyDreambox/MyDreamboxPlugin.cs trunk/plugins/MyDreambox/MyDreamboxRadio.cs Added: trunk/plugins/ExternalDreamboxTV/Dreambox/BoxInfo.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/BoxInfo.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/BoxInfo.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,414 @@ +#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.Text.RegularExpressions; + +namespace DreamBox +{ + public class BoxInfo + { + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + private string _Command = "/data"; + + public BoxInfo(string url, string username, string password) + { + _Url = url; + _UserName = username; + _Password = password; + Request request = new Request(_Url, _UserName, _Password); + string s = request.PostData(_Command); + InternalParsing(s); + } + + public void Refresh() + { + Request request = new Request(_Url, _UserName, _Password); + string s = request.PostData(_Command); + InternalParsing(s); + } + void InternalParsing(string s) + { + Regex objAlphaPattern = new Regex("var ?.*\n"); + MatchCollection col = objAlphaPattern.Matches(s); + for (int i = 0; i < col.Count; i++) + { + string val = col[i].ToString().Replace("var ","").Replace("\n",""); + if (val.Contains("=") && val.Contains(";")) + { + val = val.Replace(";", "").Replace(" = ", "="); + Console.WriteLine("[" + val + "]"); + string[] arr = val.Split('='); + + string name = arr[0]; + string value = arr[1].Replace("\"", "") ; + switch (name) + { + case "updateCycleTime": + this.updateCycleTime = int.Parse(value.ToString()); + break; + case "standby": + if (value.ToString() == "0") + { + this.Standby = false; + } + else this.Standby = true; + break; + case "serviceName": + this.ServiceName = value.ToString(); + break; + case "nowT": + this.NowT = value.ToString(); + break; + case "nowD": + this.NowD = value.ToString(); + break; + case "nowSt": + this.NowSt = value.ToString(); + break; + case "nextT": + this.NextT = value.ToString(); + break; + case "nextD": + this.NextD = value.ToString(); + break; + case "nextSt": + this.NextSt = value.ToString(); + break; + case "diskGB": + this.DiskGB = value.ToString(); + break; + case "diskH": + this.DiskH = value.ToString(); + break; + case "apid": + this.Apid = value.ToString(); + break; + case "vpid": + this.Vpid = value.ToString(); + break; + case "ip": + this.IP = value.ToString(); + break; + case "lock": + this.Lock = value.ToString(); + break; + case "upTime": + this.UpTime = value.ToString(); + break; + case "volume": + this.Volume = int.Parse(value.ToString()); + break; + case "mute": + if (value.ToString() == "0") + { + this.Mute = false; + } + else this.Mute = true; + break; + case "dolby": + if (value.ToString() == "0") + { + this.Dolby = false; + } + else this.Dolby = true; + break; + case "crypt": + if (value.ToString() == "0") + { + this.Crypt = false; + } + else this.Crypt = true; + break; + case "format": + if (value.ToString() == "0") + { + this.Format = false; + } + else this.Format = true; + break; + case "recording": + if (value.ToString() == "0") + { + this.Recording = false; + } + else this.Recording = true; + break; + case "vlcparms": + this.VlcParms = value.ToString(); + break; + case "serviceReference": + this.ServiceReference = value.ToString(); + break; + case "videoTime": + this.VideoTime = value.ToString(); + break; + case "videoPosition": + this.VideoPosition = int.Parse(value.ToString()); + break; + case "agc": + this.AGC = int.Parse(value.ToString()); + break; + case "snr": + this.SNR = int.Parse(value.ToString()); + break; + case "ber": + this.BER = int.Parse(value.ToString()); + break; + case "streamingClientStatus": + this.StreamingClientStatus = value.ToString(); + break; + default: + return; + + } + + } + + + } + } + + #region Properties + private int _updateCycleTime; + + public int updateCycleTime + { + get { return _updateCycleTime; } + set { _updateCycleTime = value; } + } + private bool _Standby; + + public bool Standby + { + get { return _Standby; } + set { _Standby = value; } + } + private string _ServiceName; + + public string ServiceName + { + get { return _ServiceName; } + set { _ServiceName = value; } + } + private string _NowT; + + public string NowT + { + get { return _NowT; } + set { _NowT = value; } + } + private string _NowD; + + public string NowD + { + get { return _NowD; } + set { _NowD = value; } + } + private string _NowSt; + + public string NowSt + { + get { return _NowSt; } + set { _NowSt = value; } + } + private string _NextT; + + public string NextT + { + get { return _NextT; } + set { _NextT = value; } + } + private string _NextD; + + public string NextD + { + get { return _NextD; } + set { _NextD = value; } + } + private string _NextSt; + + public string NextSt + { + get { return _NextSt; } + set { _NextSt = value; } + } + private string _DiskGB; + + public string DiskGB + { + get { return _DiskGB; } + set { _DiskGB = value; } + } + private string _DiskH; + + public string DiskH + { + get { return _DiskH; } + set { _DiskH = value; } + } + private string _Apid; + + public string Apid + { + get { return _Apid; } + set { _Apid = value; } + } + private string _Vpid; + + public string Vpid + { + get { return _Vpid; } + set { _Vpid = value; } + } + private string _IP; + + public string IP + { + get { return _IP; } + set { _IP = value; } + } + private string _Lock; + + public string Lock + { + get { return _Lock; } + set { _Lock = value; } + } + private string _UpTime; + + public string UpTime + { + get { return _UpTime; } + set { _UpTime = value; } + } + private int _Volume; + + public int Volume + { + get { return _Volume; } + set { _Volume = value; } + } + private bool _Mute; + + public bool Mute + { + get { return _Mute; } + set { _Mute = value; } + } + private bool _Dolby; + + public bool Dolby + { + get { return _Dolby; } + set { _Dolby = value; } + } + private bool _Crypt; + + public bool Crypt + { + get { return _Crypt; } + set { _Crypt = value; } + } + private bool _format; + + public bool Format + { + get { return _format; } + set { _format = value; } + } + private bool _Recording; + + public bool Recording + { + get { return _Recording; } + set { _Recording = value; } + } + private string _VlcParms; + + public string VlcParms + { + get { return _VlcParms; } + set { _VlcParms = value; } + } + private string _ServiceReference; + + public string ServiceReference + { + get { return _ServiceReference; } + set { _ServiceReference = value; } + } + private string _VideoTime; + + public string VideoTime + { + get { return _VideoTime; } + set { _VideoTime = value; } + } + private int _VideoPosition; + + public int VideoPosition + { + get { return _VideoPosition; } + set { _VideoPosition = value; } + } + private int _AGC; + + public int AGC + { + get { return _AGC; } + set { _AGC = value; } + } + private int _SNR; + + public int SNR + { + get { return _SNR; } + set { _SNR = value; } + } + private int _BER; + + public int BER + { + get { return _BER; } + set { _BER = value; } + } + private string _StreamingClientStatus; + + public string StreamingClientStatus + { + get { return _StreamingClientStatus; } + set { _StreamingClientStatus = value; } + } + + + + #endregion + } +} Added: trunk/plugins/ExternalDreamboxTV/Dreambox/ChannelInfo.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/ChannelInfo.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/ChannelInfo.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,262 @@ +#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.Text.RegularExpressions; + +namespace DreamBox +{ + public class ChannelInfo + { + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + private string _Command = "/cgi-bin/status"; + + + public ChannelInfo(string url, string username, string password) + { + _Url = url; + _UserName = username; + _Password = password; + + Request request = new Request(_Url, _UserName, _Password); + string s = request.PostData(_Command); + InternalParsing(s); + } + + void InternalParsing(string s) + { + Regex objAlphaPattern = new Regex("<tr><td>?.*</td></tr>"); + MatchCollection col = objAlphaPattern.Matches(s); + for (int i = 0; i < col.Count; i++) + { + string val = col[i].ToString().Replace("<tr><td>", "").Replace("</td></tr>", "").Replace("</td></td>", "").Replace("</td><td>", ""); + string[] arr = val.Split(':'); + + switch (arr[0]) + { + case "WebIf-Version": + this.WebIfVersion = arr[1]; + break; + case "Standby": + if (arr[1] == "OFF") + { + this.Standby = false; + } + else + { + this.Standby = true; + } + break; + case "Recording": + if (arr[1] == "OFF") + { + this.Standby = false; + } + else + { + this.Standby = true; + } + break; + case "Mode": + this.Mode = Convert.ToInt32(arr[1]); + break; + case "Current service reference": + this.CurrentServiceReference = arr[1]; + break; + case "name": + this.Name = arr[1]; + break; + case "provider": + this.Provider = arr[1]; + break; + case "vpid": + this.Vpid = arr[1].Replace("<td>", "").Substring(0, arr[1].Replace("<td>", "").IndexOf("(")); + break; + case "apid": + this.Apid = arr[1].Replace("<td>", "").Substring(0, arr[1].Replace("<td>", "").IndexOf("(")); + break; + case "pcrpid": + this.Pcrpid = arr[1].Replace("<td>", "").Substring(0, arr[1].Replace("<td>", "").IndexOf("(")); + break; + case "tpid": + this.Tpid = arr[1].Replace("<td>", "").Substring(0, arr[1].Replace("<td>", "").IndexOf("(")); + break; + case "tsid": + this.Tsid = arr[1]; + break; + case "onid": + this.Onid = arr[1]; + break; + case "sid": + this.Sid = arr[1]; + break; + case "pmt": + this.Pmt = arr[1]; + break; + case "vidformat": + this.VidFormat = arr[1]; + this.VidFormat = this.VidFormat.Replace("<td>", ""); + this.VidFormat = this.VidFormat.Replace("</td>", ""); + break; + default: + return; + + } + + } + } + + #region Properties + private string _CurrentTime; + + public string CurrentTime + { + get { return _CurrentTime; } + set { _CurrentTime = value; } + } + + private string _WebIfVersion; + + public string WebIfVersion + { + get { return _WebIfVersion; } + set { _WebIfVersion = value; } + } + private bool _Standby; + + public bool Standby + { + get { return _Standby; } + set { _Standby = value; } + } + private bool _Recording; + + public bool Recording + { + get { return _Recording; } + set { _Recording = value; } + } + private int _Mode; + + public int Mode + { + get { return _Mode; } + set { _Mode = value; } + } + private string _CurrentServiceReference; + + public string CurrentServiceReference + { + get { return _CurrentServiceReference; } + set { _CurrentServiceReference = value; } + } + + private string _Name; + + public string Name + { + get { return _Name; } + set { _Name = value; } + } + private string _Provider; + + public string Provider + { + get { return _Provider; } + set { _Provider = value; } + } + private string _vpid; + + public string Vpid + { + get { return _vpid; } + set { _vpid = value; } + } + private string _apid; + + public string Apid + { + get { return _apid; } + set { _apid = value; } + } + private string _pcrpid; + + public string Pcrpid + { + get { return _pcrpid; } + set { _pcrpid = value; } + } + private string _tpid; + + public string Tpid + { + get { return _tpid; } + set { _tpid = value; } + } + private string _tsid; + + public string Tsid + { + get { return _tsid; } + set { _tsid = value; } + } + private string _onid; + + public string Onid + { + get { return _onid; } + set { _onid = value; } + } + private string _sid; + + public string Sid + { + get { return _sid; } + set { _sid = value; } + } + private string _pmt; + + public string Pmt + { + get { return _pmt; } + set { _pmt = value; } + } + private string _vidformat; + + public string VidFormat + { + get { return _vidformat; } + set { _vidformat = value; } + } + #endregion + + + + } +} Added: trunk/plugins/ExternalDreamboxTV/Dreambox/Core.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/Core.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/Core.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,125 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + + + +namespace DreamBox +{ + public class Core + { + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + + public DreamBox.Data Data = null; + public DreamBox.Remote Remote = null; + private DreamBox.XML _XML = null; + + public Core(string url, string username, string password) + { + _Url = url; + _UserName = username; + _Password = password; + + this.Data = new Data(url, username, password); + this.Remote = new Remote(url, username, password); + this._XML = new XML(url, username, password); + } + + + + + public XML XML + { + get + { + return _XML; + } + } + + public string Url + { + get { return _Url; } + set { _Url = value; } + } + + public string Password + { + get { return _Password; } + set { _Password = value; } + } + + public string UserName + { + get { return _UserName; } + set { _UserName = value; } + } + + + private string _SelectedBouquet; + public string SelectedBouquet + { + get { return _SelectedBouquet; } + set { _SelectedBouquet = value; } + } + private string _SelectedChannel; + + public string SelectedChannel + { + get { return _SelectedChannel; } + set { _SelectedChannel = value; } + } + + + public ChannelInfo CurrentChannel + { + get + { + return new ChannelInfo(_Url, _UserName, _Password); + } + } + public Remote RemoteControl + { + get + { + return new Remote(_Url, _UserName, _Password); + } + } + + public void Reboot() + { + Request request = new Request(_Url, _UserName, _Password); + string sreturn = request.PostData("/cgi-bin/admin?command=reboot"); + } + + + + + } +} Added: trunk/plugins/ExternalDreamboxTV/Dreambox/Data.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/Data.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/Data.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,364 @@ +#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.Text.RegularExpressions; + +namespace DreamBox +{ + public class Data + { + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + private string _Command = "/cgi-bin/"; + + public Data(string url, string username, string password) + { + _Url = url; + _UserName = username; + _Password = password; + } + + public DataSet AllBouquets + { + get + { + Request request = new Request(_Url, _UserName, _Password); + string sreturn = request.PostData(_Command + "getServices?ref=0"); + string[] allBouquets = sreturn.Split('\n'); + + // convert to dataset + DataSet ds = new DataSet(); + DataTable table = new DataTable("Bouquets"); + DataRow row = null; + + try + { + + table.Columns.Add("Ref", Type.GetType("System.String")); + table.Columns.Add("Name", Type.GetType("System.String")); + + foreach (string bouquets in allBouquets) + { + if (bouquets.IndexOf(';') > -1) + { + string[] bouquet = bouquets.Split(';'); + row = table.NewRow(); + row["Ref"] = bouquet[0].ToString(); + row["Name"] = bouquet[1].ToString(); + table.Rows.Add(row); + } + + } + + ds.Tables.Add(table); + + } + catch (Exception ex) + { + throw ex; + } + + return ds; + } + } + + public DataSet UserTVBouquets + { + get + { + string userbouquests = "Bouquets (TV)".ToLower(); + string temp = ""; + Request request = new Request(_Url, _UserName, _Password); + string sreturn = request.PostData(_Command + "getServices?ref=0"); + string[] allBouquets = sreturn.Split('\n'); + + // convert to dataset + DataSet ds = new DataSet(); + DataTable table = new DataTable("Bouquets"); + DataRow row = null; + + try + { + + table.Columns.Add("Ref", Type.GetType("System.String")); + table.Columns.Add("Name", Type.GetType("System.String")); + + foreach (string s in allBouquets) + { + if (s.ToLower().Contains(userbouquests)) + { + temp = s.Split(';')[0]; + break; + } + } + + sreturn = request.PostData(_Command + "getServices?ref=" + temp); + allBouquets = sreturn.Split('\n'); + + foreach (string bouquets in allBouquets) + { + if (bouquets.IndexOf(';') > -1 && bouquets.Length > 0) // HOTFIX!!!!! 28-10-2006 + { + string[] bouquet = bouquets.Split(';'); + row = table.NewRow(); + row["Ref"] = bouquet[0].ToString(); + row["Name"] = bouquet[1].ToString(); + table.Rows.Add(row); + } + + } + + ds.Tables.Add(table); + + } + catch + { + + } + + return ds; + } + } + + public DataSet UserRadioBouquets + { + get + { + string userbouquests = "bouquets (radio)"; + string temp = ""; + Request request = new Request(_Url, _UserName, _Password); + string sreturn = request.PostData(_Command + "getServices?ref=0"); + string[] allBouquets = sreturn.Split('\n'); + + // convert to dataset + DataSet ds = new DataSet(); + DataTable table = new DataTable("Bouquets"); + DataRow row = null; + + try + { + + table.Columns.Add("Ref", Type.GetType("System.String")); + table.Columns.Add("Name", Type.GetType("System.String")); + + foreach (string s in allBouquets) + { + if (s.ToLower().Contains(userbouquests)) // HOTFIX!!!!! 28-10-2006 + { + temp = s.Split(';')[0]; + break; + } + } + + sreturn = request.PostData(_Command + "getServices?ref=" + temp); + allBouquets = sreturn.Split('\n'); + + foreach (string bouquets in allBouquets) + { + if (bouquets.IndexOf(';') > -1) + { + string[] bouquet = bouquets.Split(';'); + row = table.NewRow(); + row["Ref"] = bouquet[0].ToString(); + row["Name"] = bouquet[1].ToString(); + table.Rows.Add(row); + } + + } + + ds.Tables.Add(table); + + } + catch (Exception ex) + { + throw ex; + } + + return ds; + } + } + + public DataSet Channels(string reference) + { + Request request = new Request(_Url, _UserName, _Password); + string sreturn = request.PostData(_Command + "getServices?ref=" + reference); + string[] allBouquets = sreturn.Split('\n'); + + // convert to dataset + DataSet ds = new DataSet(); + DataTable table = new DataTable("Bouquets"); + DataRow row = null; + + try + { + + table.Columns.Add("Ref", Type.GetType("System.String")); + table.Columns.Add("Name", Type.GetType("System.String")); + + foreach (string bouquets in allBouquets) + { + if (bouquets.IndexOf(';') > -1) + { + string[] bouquet = bouquets.Split(';'); + row = table.NewRow(); + row["Ref"] = bouquet[0].ToString(); + row["Name"] = bouquet[1].ToString(); + table.Rows.Add(row); + } + + } + table.DefaultView.Sort = "Name"; + ds.Tables.Add(table); + + } + catch (Exception ex) + { + throw ex; + } + + return ds; + } + + public DataSet Recordings + { + get + { + Request request = new Request(_Url, _UserName, _Password); + string sreturn = request.PostData("/body?mode=zap&zapmode=3&zapsubmode=1"); + string result = ""; + Regex objAlphaPattern = new Regex(@"channels\[0\].*?;"); + MatchCollection col = objAlphaPattern.Matches(sreturn); + for (int i = 0; i < col.Count; i++) + { + result = col[i].Value.ToString(); + } + result = result.Replace(@"channels[0] = new Array(", ""); + string[] temparr = result.Split('\"'); + int amount = 0; + for (int i = 0; i < temparr.GetUpperBound(0); i++) + { + if (temparr[i].ToString().Trim() != "," && temparr[i].ToString().Trim() != "") + { + amount += 1; + } + } + string[] names = new string[amount]; + amount = 0; + for (int i = 0; i < temparr.GetUpperBound(0); i++) + { + if (temparr[i].ToString().Trim() != "," && temparr[i].ToString().Trim() != "") + { + names[amount] = temparr[i]; + amount += 1; + } + } + // remove ending ',' + for (int i = 0; i < names.GetUpperBound(0); i++) + { + if (names[i].EndsWith(",")) + names[i] = names[i].Substring(0, names[i].Length - 1); + } + + // get refs + objAlphaPattern = new Regex(@"channelRefs\[0\].*?;"); + col = objAlphaPattern.Matches(sreturn); + for (int i = 0; i < col.Count; i++) + { + result = col[i].Value.ToString(); + } + result = result.Replace(@"channelRefs[0] = new Array(", ""); + temparr = result.Split('\"'); + + string[] refs = new string[names.GetUpperBound(0) + 1]; + amount = 0; + for (int i = 0; i < temparr.GetUpperBound(0); i++) + { + if (temparr[i].ToString().Trim() != "," && temparr[i].ToString().Trim() != "") + { + refs[amount] = temparr[i]; + amount += 1; + } + } + + + + // convert to dataset + DataSet ds = new DataSet(); + DataTable table = new DataTable("Recordings"); + DataRow row = null; + + try + { + + table.Columns.Add("Ref", Type.GetType("System.String")); + table.Columns.Add("Name", Type.GetType("System.String")); + + for (int i = 0; i < names.GetUpperBound(0) + 1; i++) + { + { + row = table.NewRow(); + row["Ref"] = refs[i].ToString(); + row["Name"] = names[i].ToString(); + table.Rows.Add(row); + } + } + table.DefaultView.Sort = "Name"; + ds.Tables.Add(table); + + } + catch (Exception ex) + { + throw ex; + } + return ds; + } + } + + #region EPG + public DataSet CurrentEPG + { + get + { + Request request = new Request(_Url, _UserName, _Password); + string sreturn = request.PostData(_Command + "getcurrentepg"); + string result = ""; + Regex objAlphaPattern = new Regex("middle.*?", RegexOptions.IgnoreCase | RegexOptions.Multiline); + MatchCollection col = objAlphaPattern.Matches(sreturn); + for (int i = 0; i < col.Count; i++) + { + result = col[i].Value.ToString(); + } + return null; + } + } + #endregion + } + +} Added: trunk/plugins/ExternalDreamboxTV/Dreambox/NowPlaying799.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/NowPlaying799.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/NowPlaying799.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,62 @@ +#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.Text.RegularExpressions; + + +namespace DreamBox +{ + public class NowPlaying799 + { + + + public NowPlaying799() + { + + } + + public string NowPlaying() + { + string nowPlaying = ""; + Request request = new Request("http://www.club977.com/", null, null); + nowPlaying = request.PostData(""); + return RunningPart(nowPlaying); + } + + string RunningPart(String strToCheck) + { + Regex objAlphaPattern = new Regex("<td height=\"30\" class=\"last\">?.*<br>"); + Match m = objAlphaPattern.Match(strToCheck); + string s = m.ToString().Replace("<td height=\"30\" class=\"last\">", "").Replace("<br>", ""); + + return s; + + } + + } +} Added: trunk/plugins/ExternalDreamboxTV/Dreambox/Remote.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/Remote.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/Remote.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,269 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace DreamBox +{ + public class Remote + { + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + + public Remote(string url, string username, string password) + { + _Url = url; + _UserName = username; + _Password = password; + } + + #region RemoteControl + public void Left() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Left(); + } + public void Right() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Right(); + } + + public void Mute() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Mute(); + } + public void Lame() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Lame(); + } + + public void VolumeUp() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.VolumeUp(); + } + + public void VolumeDown() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.VolumeDown(); + } + public void BouquetUp() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.BouquetUp(); + } + public void BouquetDown() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.BouquetDown(); + } + public void Up() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Up(); + } + public void Down() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Down(); + } + public void Info() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Info(); + } + public void Menu() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Menu(); + } + public void OK() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.OK(); + } + public void Previous() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Previous(); + } + public void Next() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.OK(); + } + public void Audio() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Audio(); + } + public void Video() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Video(); + } + public void Red() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Red(); + } + public void Green() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Green(); + } + public void Yellow() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Yellow(); + } + public void Blue() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Blue(); + } + public void TV() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.TV(); + } + public void Radio() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Radio(); + } + public void Text() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Text(); + } + public void Help() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Help(); + } + public void Zap(string reference) + { + Zap z = new Zap(_Url, _UserName, _Password); + z.ZapTo(reference); + } + + #region Video Keys + public void Rewind() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Rewind(); + } + public void Play() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Play(); + } + public void Pause() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Pause(); + } + public void Forward() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Forward(); + } + public void Stop() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Stop(); + } + public void Record() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Record(); + } + + #endregion + + #region Numbers + public void Zap0() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap0(); + } + public void Zap1() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap1(); + } + public void Zap2() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap2(); + } + public void Zap3() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap3(); + } + public void Zap4() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap4(); + } + public void Zap5() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap5(); + } + public void Zap6() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap6(); + } + public void Zap7() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap7(); + } + public void Zap8() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap8(); + } + public void Zap9() + { + Zap z = new Zap(_Url, _UserName, _Password); + z.Zap9(); + } + + #endregion + #endregion + } +} Added: trunk/plugins/ExternalDreamboxTV/Dreambox/Request.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/Request.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/Request.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,72 @@ +#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.Net; +using System.IO; + +namespace DreamBox +{ + public class Request + { + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + + public Request(string url, string username, string password) + { + _Url = url; + _UserName = username; + _Password = password; + } + + public Stream GetStream(string command) + { + Uri uri = new Uri(_Url + command); + WebRequest request = WebRequest.Create(uri); + request.Credentials = new NetworkCredential(_UserName, _Password); + + WebResponse response = request.GetResponse(); + Stream stream = response.GetResponseStream(); + return stream; + } + + public string PostData(string command) + { + Uri uri = new Uri(_Url + command); + WebRequest request = WebRequest.Create(uri); + request.Credentials = new NetworkCredential(_UserName, _Password); + + WebResponse response = request.GetResponse(); + + StreamReader reader = new StreamReader(response.GetResponseStream()); + + string str = reader.ReadToEnd(); + return str; + } + } +} Added: trunk/plugins/ExternalDreamboxTV/Dreambox/XML.cs =================================================================== --- trunk/plugins/ExternalDreamboxTV/Dreambox/XML.cs (rev 0) +++ trunk/plugins/ExternalDreamboxTV/Dreambox/XML.cs 2008-04-21 23:14:54 UTC (rev 1691) @@ -0,0 +1,931 @@ +#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.Text.RegularExpressions; +using System.Xml; +using System.IO; + +namespace DreamBox +{ + public class XML + { + private string _Url = ""; + private string _UserName = ""; + private string _Password = ""; + private string _Command = "/xml/"; + + public XML(string url, string username, string password) + { + _Url = url; + _UserName = username; + _Password = password; + } + + + #region Accessible Interface + public StreamInfoData StreamInfo + { + get + { + Request request = new Request(_Url, _UserName, _Password); + Stream sreturn = request.GetStream(_Command + "streaminfo"); + XmlDocument xDoc = new XmlDocument(); + xDoc.Load(sreturn); + StreamInfoData streamInfo = new StreamInfoData(); + + + XmlNodeList streaminfo = xDoc.GetElementsByTagName("streaminfo"); + streamInfo.Agc = streaminfo.Item(0)["agc"].InnerText.Trim(); + streamInfo.Apid = streaminfo.Item(0)["apid"].InnerText.Trim(); + streamInfo.Ber = streaminfo.Item(0)["ber"].InnerText.Trim(); + streamInfo.Fec = streaminfo.Item(0)["fec"].InnerText.Trim(); + streamInfo.Frequency = streaminfo.Item(0)["frequency"].InnerText.Trim(); + streamInfo.FrontEnd = streaminfo.Item(0)["frontend"].InnerText.Trim(); + streamInfo.Inversion = streaminfo.Item(0)["inversion"].InnerText.Trim(); + streamInfo.Lock = streaminfo.Item(0)["lock"].InnerText.Trim(); + streamInfo.NameSpace = streaminfo.Item(0)["namespace"].InnerText.Trim(); + streamInfo.OnId = streaminfo.Item(0)["onid"].InnerText.Trim(); + streamInfo.PcrPid = streaminfo.Item(0)["pcrpid"].InnerText.Trim(); + streamInfo.Pmt = streaminfo.Item(0)["pmt"].InnerText.Trim(); + streamInfo.Polarisation = streaminfo.Item(0)["polarisation"].InnerText.Trim(); + streamInfo.Provider = streaminfo.Item(0)["provider"].InnerText.Trim(); + streamInfo.Satellite = streaminfo.Item(0)["satellite"].InnerText.Trim(); + streamInfo.ServiceName = streaminfo.Item(0)["service"].ChildNodes[0].InnerText.Trim(); + streamInfo.ServiceReference = streaminfo.Item(0)["service"].ChildNodes[1].InnerText.Trim(); + streamInfo.Sid = streaminfo.Item(0)["sid"].InnerText.Trim(); + streamInfo.Snr = streaminfo.Item(0)["snr"].InnerText.Trim(); + streamInfo.SupportedCryptSystems = streaminfo.Item(0)["supported_crypt_systems"].InnerText.Trim(); + streamInfo.SymbolRate = streaminfo.Item(0)["symbol_rate"].InnerText.Trim(); + streamInfo.Sync = streaminfo.Item(0)["sync"].InnerText.Trim(); + streamInfo.TPid = streaminfo.Item(0)["tpid"].InnerText.Trim(); + streamInfo.TsId = streaminfo.Item(0)["tsid"].InnerText.Trim(); + streamInfo.UsedCryptSystems = streaminfo.Item(0)["used_crypt_systems"].InnerText.Trim(); + streamInfo.VideoFormat = streaminfo.Item(0)["video_format"].InnerText.Trim(); + streamInfo.Vpid = streaminfo.Item(0)["vpid"].InnerText.Trim(); + return streamInfo; + + } + } + public CurrentServiceData CurrentService + { + get + { + Request request = new Request(_Url, _UserName, _Password); + Stream sreturn = request.GetStream(_Command + "currentservicedata"); + XmlDocument xDoc = new XmlDocument(); + xDoc.Load(sreturn); + XmlNodeList service = xDoc.GetElementsByTagName("service"); + XmlNodeList audiochannels = xDoc.GetElementsByTagName("audio_channels"); + XmlNodeList audiotrack = xDoc.GetElementsByTagName("audio_track"); + XmlNodeList videochannels = xDoc.GetElementsByTagName("video_channels"); + XmlNodeList currentevent = xDoc.GetElementsByTagName("current_event"); + XmlNodeList nextevent = xDoc.GetElementsByTagName("next_event"); + + CurrentServiceData currentServiceData = new CurrentServiceData(); + + // service + currentServiceData.ServiceName = service.Item(0)["name"].InnerText.Trim(); + currentServiceData.ServiceReference = service.Item(0)["reference"].InnerText.Trim(); + currentServiceData.AudioTrack = audiotrack.Item(0).InnerText.Trim(); + + // audiochannel + foreach (System.Xml.XmlElement el in audiochannels.Item(0).ChildNodes) + { + string name = el.GetElementsByTagName("name").Item(0).InnerText.Trim(); + string selected = el.GetElementsByTagName("selected").Item(0).InnerText.Trim(); + string pid = el.GetElementsByTagName("pid").Item(0).InnerText.Trim(); + ServiceDataChannel ac = new ServiceDataChannel(); + ac.Name = name; + if (selected == "1") { ac.Selected = true; } else ac.Selected = false; + ac.Pid = pid; + currentServiceData.AudioChannels.Add(ac); + } + // videochannel + foreach (System.Xml.XmlElement el in videochannels.Item(0).ChildNodes) + { + string name = el.GetElementsByTagName("name").Item(0).InnerText.Trim(); + string selected = el.GetElementsByTagName("selected").Item(0).InnerText.Trim(); + string pid = el.GetElementsByTagName("pid").Item(0).InnerText.Trim(); + ServiceDataChannel ac = new ServiceDataChannel(); + ac.Name = name; + if (selected == "1") { ac.Selected = true; } else ac.Selected = false; + ac.Pid = pid; + currentServiceData.VideoChannels.Add(ac); + } + + // current event + currentServiceData.CurrentEvent.Date = currentevent.Item(0)["date"].InnerText.Trim(); + currentServiceData.CurrentEvent.Time = currentevent.Item(0)["time"].InnerText.Trim(); + currentServiceData.CurrentEvent.Start = currentevent.Item(0)["start"].InnerText.Trim(); + currentServiceData.CurrentEvent.Duration = currentevent.Item(0)["duration"].InnerText.Trim(); + currentServiceData.CurrentEvent.Description = currentevent.Item(0)["description"].InnerText.Trim(); + currentServiceData.CurrentEvent.Details = currentevent.Item(0)["details"].InnerText.Trim(); + +... [truncated message content] |