From: <gre...@us...> - 2007-07-27 18:24:44
|
Revision: 779 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=779&view=rev Author: gregmac45 Date: 2007-07-27 11:24:42 -0700 (Fri, 27 Jul 2007) Log Message: ----------- Added getSiteId Methods Added Configuration screen Added OnlineVideoSettings class Fixed youtube not working when user and password were Added initial support for Stage6 Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GameTrailersUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GrouperUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GubaUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/HttpReader.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Runner.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilFactory.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SoapBoxUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/VideoJugUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/VidiLifeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs Added Paths: ----------- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Stage6Util.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs 2007-07-27 15:26:53 UTC (rev 778) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -19,7 +19,10 @@ { public class BlipTvUtil:SiteUtilBase { - + public override string getSiteId() + { + return "9"; + } public override String getUrl(String fsId) { Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-07-27 15:26:53 UTC (rev 778) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -19,6 +19,10 @@ { public class BreakUtil:SiteUtilBase { + public override string getSiteId() + { + return "break"; + } public override String getUrl(String fsId) { @@ -32,7 +36,7 @@ String lsFileName = loMatch.Groups[1].Value; String lsPathName = loMatch.Groups[2].Value; lsUrl = lsUrl+lsPathName+"/"+lsFileName+".flv"; - Log.Write("break flv url = {0}",lsUrl); + Log.Info("break flv url = {0}",lsUrl); return lsUrl; } public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs 2007-07-27 15:26:53 UTC (rev 778) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -19,8 +19,11 @@ { public class CbsUtil:SiteUtilBase { + public override string getSiteId() + { + return "10"; + } - public override String getUrl(String fsId) { @@ -92,7 +95,7 @@ //loRssItem. //This loops through each node found in the nodeList and adds the //Node data to the DataTable. - XmlAttributeCollection ac; + //XmlAttributeCollection ac; List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); GUIOnlineVideos.VideoInfo loRssItem; //GUIListItem loListItem; Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -0,0 +1,387 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 7/24/2007 + * Time: 9:34 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +namespace OnlineVideos +{ + partial class Configuration + { + /// <summary> + /// Designer variable used to keep track of non-visual components. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Disposes resources used by the form. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + /// <summary> + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// </summary> + private void InitializeComponent() + { + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.General_Tab = new System.Windows.Forms.TabPage(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.btnAdd = new System.Windows.Forms.Button(); + this.CategoryList = new System.Windows.Forms.ListBox(); + this.btnDeleteRss = new System.Windows.Forms.Button(); + this.txtRssUrl = new System.Windows.Forms.TextBox(); + this.btnRssSave = new System.Windows.Forms.Button(); + this.label26 = new System.Windows.Forms.Label(); + this.txtRssName = new System.Windows.Forms.TextBox(); + this.label25 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.txtUserId = new System.Windows.Forms.TextBox(); + this.chkAgeConfirm = new System.Windows.Forms.CheckBox(); + this.label30 = new System.Windows.Forms.Label(); + this.label29 = new System.Windows.Forms.Label(); + this.btnSiteSave = new System.Windows.Forms.Button(); + this.TxtSiteId = new System.Windows.Forms.TextBox(); + this.txtSiteName = new System.Windows.Forms.TextBox(); + this.label28 = new System.Windows.Forms.Label(); + this.label27 = new System.Windows.Forms.Label(); + this.siteList = new System.Windows.Forms.ListBox(); + this.chkEnabled = new System.Windows.Forms.CheckBox(); + this.txtFilters = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.txtThumbLoc = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.tabControl1.SuspendLayout(); + this.General_Tab.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.General_Tab); + this.tabControl1.Location = new System.Drawing.Point(13, 13); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(479, 566); + this.tabControl1.TabIndex = 0; + // + // General_Tab + // + this.General_Tab.Controls.Add(this.groupBox2); + this.General_Tab.Controls.Add(this.groupBox1); + this.General_Tab.Controls.Add(this.txtFilters); + this.General_Tab.Controls.Add(this.label2); + this.General_Tab.Controls.Add(this.txtThumbLoc); + this.General_Tab.Controls.Add(this.label1); + this.General_Tab.Location = new System.Drawing.Point(4, 22); + this.General_Tab.Name = "General_Tab"; + this.General_Tab.Padding = new System.Windows.Forms.Padding(3); + this.General_Tab.Size = new System.Drawing.Size(471, 540); + this.General_Tab.TabIndex = 0; + this.General_Tab.Text = "General"; + this.General_Tab.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.btnAdd); + this.groupBox2.Controls.Add(this.CategoryList); + this.groupBox2.Controls.Add(this.btnDeleteRss); + this.groupBox2.Controls.Add(this.txtRssUrl); + this.groupBox2.Controls.Add(this.btnRssSave); + this.groupBox2.Controls.Add(this.label26); + this.groupBox2.Controls.Add(this.txtRssName); + this.groupBox2.Controls.Add(this.label25); + this.groupBox2.Location = new System.Drawing.Point(15, 295); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(411, 239); + this.groupBox2.TabIndex = 18; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Site Categories"; + // + // btnAdd + // + this.btnAdd.Location = new System.Drawing.Point(87, 200); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(75, 23); + this.btnAdd.TabIndex = 17; + this.btnAdd.Text = "Add"; + this.btnAdd.UseVisualStyleBackColor = true; + this.btnAdd.Click += new System.EventHandler(this.BtnAddClick); + // + // CategoryList + // + this.CategoryList.FormattingEnabled = true; + this.CategoryList.Location = new System.Drawing.Point(22, 19); + this.CategoryList.Name = "CategoryList"; + this.CategoryList.Size = new System.Drawing.Size(120, 173); + this.CategoryList.TabIndex = 6; + this.CategoryList.SelectedIndexChanged += new System.EventHandler(this.CategoryListSelectedIndexChanged); + // + // btnDeleteRss + // + this.btnDeleteRss.Location = new System.Drawing.Point(6, 200); + this.btnDeleteRss.Name = "btnDeleteRss"; + this.btnDeleteRss.Size = new System.Drawing.Size(75, 23); + this.btnDeleteRss.TabIndex = 14; + this.btnDeleteRss.Text = "Delete"; + this.btnDeleteRss.UseVisualStyleBackColor = true; + this.btnDeleteRss.Click += new System.EventHandler(this.BtnDeleteRssClick); + // + // txtRssUrl + // + this.txtRssUrl.Location = new System.Drawing.Point(225, 69); + this.txtRssUrl.Name = "txtRssUrl"; + this.txtRssUrl.Size = new System.Drawing.Size(180, 20); + this.txtRssUrl.TabIndex = 16; + // + // btnRssSave + // + this.btnRssSave.Location = new System.Drawing.Point(225, 95); + this.btnRssSave.Name = "btnRssSave"; + this.btnRssSave.Size = new System.Drawing.Size(75, 23); + this.btnRssSave.TabIndex = 13; + this.btnRssSave.Text = "Save"; + this.btnRssSave.UseVisualStyleBackColor = true; + this.btnRssSave.Click += new System.EventHandler(this.BtnRssSaveClick); + // + // label26 + // + this.label26.Location = new System.Drawing.Point(148, 43); + this.label26.Name = "label26"; + this.label26.Size = new System.Drawing.Size(71, 23); + this.label26.TabIndex = 9; + this.label26.Text = "RSS Name"; + // + // txtRssName + // + this.txtRssName.Location = new System.Drawing.Point(225, 43); + this.txtRssName.Name = "txtRssName"; + this.txtRssName.Size = new System.Drawing.Size(180, 20); + this.txtRssName.TabIndex = 15; + // + // label25 + // + this.label25.Location = new System.Drawing.Point(148, 69); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(71, 17); + this.label25.TabIndex = 10; + this.label25.Text = "RSS URL"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.txtPassword); + this.groupBox1.Controls.Add(this.txtUserId); + this.groupBox1.Controls.Add(this.chkAgeConfirm); + this.groupBox1.Controls.Add(this.label30); + this.groupBox1.Controls.Add(this.label29); + this.groupBox1.Controls.Add(this.btnSiteSave); + this.groupBox1.Controls.Add(this.TxtSiteId); + this.groupBox1.Controls.Add(this.txtSiteName); + this.groupBox1.Controls.Add(this.label28); + this.groupBox1.Controls.Add(this.label27); + this.groupBox1.Controls.Add(this.siteList); + this.groupBox1.Controls.Add(this.chkEnabled); + this.groupBox1.Location = new System.Drawing.Point(15, 86); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(411, 203); + this.groupBox1.TabIndex = 17; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Sites"; + // + // txtPassword + // + this.txtPassword.Location = new System.Drawing.Point(225, 120); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.Size = new System.Drawing.Size(180, 20); + this.txtPassword.TabIndex = 18; + // + // txtUserId + // + this.txtUserId.Location = new System.Drawing.Point(225, 95); + this.txtUserId.Name = "txtUserId"; + this.txtUserId.Size = new System.Drawing.Size(180, 20); + this.txtUserId.TabIndex = 17; + // + // chkAgeConfirm + // + this.chkAgeConfirm.Location = new System.Drawing.Point(132, 146); + this.chkAgeConfirm.Name = "chkAgeConfirm"; + this.chkAgeConfirm.Size = new System.Drawing.Size(104, 24); + this.chkAgeConfirm.TabIndex = 16; + this.chkAgeConfirm.Text = "Confirm Age"; + this.chkAgeConfirm.UseVisualStyleBackColor = true; + // + // label30 + // + this.label30.Location = new System.Drawing.Point(132, 123); + this.label30.Name = "label30"; + this.label30.Size = new System.Drawing.Size(100, 23); + this.label30.TabIndex = 15; + this.label30.Text = "Password"; + // + // label29 + // + this.label29.Location = new System.Drawing.Point(132, 97); + this.label29.Name = "label29"; + this.label29.Size = new System.Drawing.Size(100, 23); + this.label29.TabIndex = 14; + this.label29.Text = "UserId"; + // + // btnSiteSave + // + this.btnSiteSave.Location = new System.Drawing.Point(132, 176); + this.btnSiteSave.Name = "btnSiteSave"; + this.btnSiteSave.Size = new System.Drawing.Size(75, 23); + this.btnSiteSave.TabIndex = 13; + this.btnSiteSave.Text = "Save"; + this.btnSiteSave.UseVisualStyleBackColor = true; + this.btnSiteSave.Click += new System.EventHandler(this.BtnSiteSaveClick); + // + // TxtSiteId + // + this.TxtSiteId.Location = new System.Drawing.Point(225, 68); + this.TxtSiteId.Name = "TxtSiteId"; + this.TxtSiteId.ReadOnly = true; + this.TxtSiteId.Size = new System.Drawing.Size(180, 20); + this.TxtSiteId.TabIndex = 12; + // + // txtSiteName + // + this.txtSiteName.Location = new System.Drawing.Point(225, 43); + this.txtSiteName.Name = "txtSiteName"; + this.txtSiteName.Size = new System.Drawing.Size(180, 20); + this.txtSiteName.TabIndex = 11; + // + // label28 + // + this.label28.Location = new System.Drawing.Point(132, 69); + this.label28.Name = "label28"; + this.label28.Size = new System.Drawing.Size(100, 23); + this.label28.TabIndex = 10; + this.label28.Text = "Site ID:"; + // + // label27 + // + this.label27.Location = new System.Drawing.Point(132, 46); + this.label27.Name = "label27"; + this.label27.Size = new System.Drawing.Size(100, 23); + this.label27.TabIndex = 9; + this.label27.Text = "Site Name:"; + // + // siteList + // + this.siteList.FormattingEnabled = true; + this.siteList.Location = new System.Drawing.Point(6, 19); + this.siteList.Name = "siteList"; + this.siteList.Size = new System.Drawing.Size(120, 160); + this.siteList.TabIndex = 5; + this.siteList.SelectedIndexChanged += new System.EventHandler(this.SiteListSelectedIndexChanged); + // + // chkEnabled + // + this.chkEnabled.Location = new System.Drawing.Point(132, 19); + this.chkEnabled.Name = "chkEnabled"; + this.chkEnabled.Size = new System.Drawing.Size(104, 24); + this.chkEnabled.TabIndex = 8; + this.chkEnabled.Text = "Enabled"; + this.chkEnabled.UseVisualStyleBackColor = true; + // + // txtFilters + // + this.txtFilters.Location = new System.Drawing.Point(220, 35); + this.txtFilters.Name = "txtFilters"; + this.txtFilters.Size = new System.Drawing.Size(171, 20); + this.txtFilters.TabIndex = 4; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(15, 38); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(199, 23); + this.label2.TabIndex = 3; + this.label2.Text = "Filter out videos with these tags"; + // + // txtThumbLoc + // + this.txtThumbLoc.Location = new System.Drawing.Point(220, 9); + this.txtThumbLoc.Name = "txtThumbLoc"; + this.txtThumbLoc.Size = new System.Drawing.Size(171, 20); + this.txtThumbLoc.TabIndex = 2; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(15, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(107, 23); + this.label1.TabIndex = 1; + this.label1.Text = "Thumbnail Location:"; + // + // Configuration + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(511, 582); + this.Controls.Add(this.tabControl1); + this.Name = "Configuration"; + this.Text = "Configuration"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ConfigurationFormClosing); + this.Load += new System.EventHandler(this.Configuration_Load); + this.tabControl1.ResumeLayout(false); + this.General_Tab.ResumeLayout(false); + this.General_Tab.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + } + private System.Windows.Forms.Button btnAdd; + private System.Windows.Forms.TextBox txtRssUrl; + private System.Windows.Forms.TextBox txtRssName; + private System.Windows.Forms.ListBox CategoryList; + private System.Windows.Forms.ListBox siteList; + private System.Windows.Forms.CheckBox chkEnabled; + private System.Windows.Forms.Label label27; + private System.Windows.Forms.Label label28; + private System.Windows.Forms.TextBox txtSiteName; + private System.Windows.Forms.TextBox TxtSiteId; + private System.Windows.Forms.Button btnSiteSave; + private System.Windows.Forms.Label label29; + private System.Windows.Forms.Label label30; + private System.Windows.Forms.CheckBox chkAgeConfirm; + private System.Windows.Forms.TextBox txtUserId; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label25; + private System.Windows.Forms.Label label26; + private System.Windows.Forms.Button btnRssSave; + private System.Windows.Forms.Button btnDeleteRss; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox txtFilters; + private System.Windows.Forms.TextBox txtThumbLoc; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TabPage General_Tab; + private System.Windows.Forms.TabControl tabControl1; + + void CheckBox1CheckedChanged(object sender, System.EventArgs e) + { + + } + } +} Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -0,0 +1,181 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 7/24/2007 + * Time: 9:34 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Collections.Generic; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using MediaPortal.GUI.Library; + +namespace OnlineVideos +{ + /// <summary> + /// Description of Configuration. + /// </summary> + public partial class Configuration : Form + { + //private String msSelectedSiteID; + private String msSelectedCategoryName; + private List<GUIOnlineVideos.Site> moSiteList = new List<GUIOnlineVideos.Site>(); + + public Configuration() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + + // + // TODO: Add constructor code after the InitializeComponent() call. + // + } + public void Configuration_Load(object sender, EventArgs e){ + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + txtThumbLoc.Text = settings.msThumbLocation; + String lsFilterList = ""; + String [] lsFilterArray = settings.msFilterArray; + if(lsFilterArray!=null){ + foreach (String lsFilter in lsFilterArray){ + lsFilterList+=lsFilter+","; + } + txtFilters.Text = lsFilterList; + } + foreach(GUIOnlineVideos.Site site in settings.moSiteList.Values){ + siteList.Items.Add(site.name); + moSiteList.Add(site); + } + + } + + void SiteListSelectedIndexChanged(object sender, EventArgs e) + { + if(siteList.SelectedIndex>-1){ + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + txtSiteName.Text = site.name; + TxtSiteId.Text = site.id; + txtUserId.Text = site.username; + txtPassword.Text = site.password; + chkEnabled.Checked = site.enabled; + chkAgeConfirm.Checked = site.confirmAge; + CategoryList.Items.Clear(); + foreach(String name in site.RssList.Keys){ + CategoryList.Items.Add(name); + } + + } + CategoryList.SelectedIndex = -1; + txtRssUrl.Text = ""; + txtRssName.Text = ""; + } + + void CategoryListSelectedIndexChanged(object sender, EventArgs e) + { + if(CategoryList.SelectedIndex>-1){ + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + msSelectedCategoryName = CategoryList.SelectedItem.ToString(); + Log.Info("Category change site:{0} with selected category of {1}",site.name,msSelectedCategoryName); + + GUIOnlineVideos.RssLink link = site.RssList[msSelectedCategoryName]; + txtRssUrl.Text = link.url; + txtRssName.Text = link.name; + } + + + } + + void BtnSiteSaveClick(object sender, EventArgs e) + { + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + //site.id = TxtSiteId; + site.name = txtSiteName.Text; + site.username = txtUserId.Text; + site.password = txtPassword.Text; + site.confirmAge = chkAgeConfirm.Checked; + site.enabled = chkEnabled.Checked; + siteList.Items[siteList.SelectedIndex] = site.name; +// txtSiteName.Text = ""; +// txtUserId.Text = ""; +// chkAgeConfirm.Checked = false; +// TxtSiteId.Text = ""; +// txtUserId.Text = ""; +// txtPassword.Text = ""; +// siteList.SelectedIndex = -1; + //msSelectedSiteName = String.Empty; + //siteList.SelectedIndex = -1; + //settings.moSiteList.Remove(msSelectedSiteName); + //msSelectedSiteName = txtSiteName.Text; + //settings.moSiteList.Add(msSelectedSiteName,site); + } + + void BtnRssSaveClick(object sender, EventArgs e) + { + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.RssLink link = site.RssList[msSelectedCategoryName]; + link.name = txtRssName.Text; + link.url = txtRssUrl.Text; + CategoryList.Items[CategoryList.SelectedIndex] = txtRssName.Text; + //site.RssList.Remove(msSelectedCategoryName); + //msSelectedCategoryName = txtRssName.Text; + //site.RssList.Add(msSelectedCategoryName,link); + CategoryList.SelectedIndex = -1; + } + + void BtnAddClick(object sender, EventArgs e) + { + GUIOnlineVideos.RssLink link = new GUIOnlineVideos.RssLink(); + link.name = "new"; + link.url = "http://"; + link.isDynamic = false; + GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + site.RssList.Add(link.name,link); + CategoryList.Items.Add(link.name); + CategoryList.SelectedIndex = CategoryList.Items.Count-1; + txtRssName.Focus(); + } + + + void BtnDeleteRssClick(object sender, EventArgs e) + { + if(CategoryList.SelectedIndex>-1){ + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + msSelectedCategoryName = CategoryList.SelectedItem.ToString(); + site.RssList.Remove(msSelectedCategoryName); + CategoryList.Items.RemoveAt(CategoryList.SelectedIndex); + txtRssName.Text = ""; + txtRssUrl.Text = ""; + } + + } + + void ConfigurationFormClosing(object sender, FormClosingEventArgs e) + { + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + String lsFilter = txtFilters.Text; + String [] lsFilterArray = lsFilter.Split(new char[] { ',' }); + settings.msFilterArray = lsFilterArray; + settings.msThumbLocation = txtThumbLoc.Text; + settings.moSiteList.Clear(); + foreach(GUIOnlineVideos.Site site in moSiteList){ + settings.moSiteList.Add(site.id,site); + } + settings.saveSettings(); + + + } + } +} Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-07-27 15:26:53 UTC (rev 778) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -19,7 +19,10 @@ { public class DailyMotionUtil:SiteUtilBase { - + public override string getSiteId() + { + return "6"; + } public override String getUrl(String fsId) { Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs 2007-07-27 15:26:53 UTC (rev 778) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -20,7 +20,10 @@ { public class DownloadedVideoUtil:SiteUtilBase { - + public override string getSiteId() + { + return "99"; + } public override String getUrl(String fsId) { Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-27 15:26:53 UTC (rev 778) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-27 18:24:42 UTC (rev 779) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Text; using System.Xml; using System.Xml.XPath; @@ -16,566 +17,491 @@ namespace OnlineVideos { - public class GUIOnlineVideos : GUIWindow, ISetupForm - { - [SkinControlAttribute(2)] - protected GUIButtonControl btnViewAs = null; - [SkinControlAttribute(50)] - protected GUIFacadeControl facadeView = null; - [SkinControlAttribute(1)] - protected GUIImage logoImage = null; - //private ILog moLog; - protected View currentView = View.Icons; - private Dictionary<String, Site> moSiteList = new Dictionary<String, Site>(); - private String msSelectedSiteId; - private String msSelectedCategoryValue; - private String msSelectedCategoryName; - private State _CurrentState = State.home; - private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; - private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); - private String []msFilterArray; - private String msThumbLocation; - private int miSelectedIndex = 0; - private bool mbPlayFullscreen = true; - public enum State - { - home = 0, - categories = 1, - videos = 2 - } - public enum View - { - List = 0, - Icons = 1, - LargeIcons = 2, - FilmStrip = 3 - } - public class Site - { - public String name; - public String id; - public string username; - public string password; - public bool confirmAge; - public Dictionary<String, RssLink> RssList = new Dictionary<String, RssLink>(); - } - public class RssLink - { - public String name; - public Boolean isDynamic = false; - public String url; - } - public class VideoInfo - { - public String Title; - public String Description; - public String VideoUrl; - public String ImageUrl; - public int Length; - public String Tags; + public class GUIOnlineVideos : GUIWindow, ISetupForm + { + [SkinControlAttribute(2)] + protected GUIButtonControl btnViewAs = null; + [SkinControlAttribute(50)] + protected GUIFacadeControl facadeView = null; + [SkinControlAttribute(1)] + protected GUIImage logoImage = null; + //private ILog moLog; + protected View currentView = View.Icons; + private Dictionary <String, Site> moSiteList = new Dictionary<String, Site>(); + private String msSelectedSiteId; + private String msSelectedCategoryValue; + private String msSelectedCategoryName; + private State _CurrentState = State.home; + private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; + private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); + private String []msFilterArray; + private String msThumbLocation; + private int miSelectedIndex = 0; + private bool mbPlayFullscreen = true; + public enum State + { + home = 0, + categories = 1, + videos = 2 + } + public enum View + { + List = 0, + Icons = 1, + LargeIcons = 2, + FilmStrip = 3 + } + public class Site + { + public String name; + public String id; + public string username; + public string password; + public bool confirmAge; + public bool enabled; + public Dictionary<String, RssLink> RssList = new Dictionary<String, RssLink>(); + } + public class RssLink + { + public String name; + public Boolean isDynamic = false; + public String url; + } + public class VideoInfo + { + public String Title; + public String Description; + public String VideoUrl; + public String ImageUrl; + public int Length; + public String Tags; public Object Other; - public VideoInfo() - { - Length = -1; - } - } - - public GUIOnlineVideos() - { - //ServiceProvider loServices = GlobalServiceProvider.Instance; - //moLog = loServices.Get<ILog>(); - } - public string PluginName() - { + public VideoInfo() + { + Length = -1; + } + } + + public GUIOnlineVideos() + { + //ServiceProvider loServices = GlobalServiceProvider.Instance; + //moLog = loServices.Get<ILog>(); + } + public string PluginName() + { - return "Online Videos"; + return "Online Videos"; - } + } - // Returns the description of the plugin is shown in the plugin menu + // Returns the description of the plugin is shown in the plugin menu - public string Description() - { + public string Description() + { - return "Youtube Plugin"; + return "Youtube Plugin"; - } + } - // Returns the author of the plugin which is shown in the plugin menu + // Returns the author of the plugin which is shown in the plugin menu - public string Author() - { + public string Author() + { - return "GregMac45"; + return "GregMac45"; - } + } - // show the setup dialog + // show the setup dialog - public void ShowPlugin() - { + public void ShowPlugin() + { + System.Windows.Forms.Form setup = new Configuration(); + setup.ShowDialog(); + } - //MessageBox.Show("Nothing to configure, this is just an example"); + // Indicates whether plugin can be enabled/disabled - } + public bool CanEnable() + { - // Indicates whether plugin can be enabled/disabled + return true; - public bool CanEnable() - { + } - return true; + // get ID of windowplugin belonging to this setup - } + public int GetWindowId() + { - // get ID of windowplugin belonging to this setup + return GetID; - public int GetWindowId() - { + } - return GetID; + // Indicates if plugin is enabled by default; - } + public bool DefaultEnabled() + { - // Indicates if plugin is enabled by default; + return true; - public bool DefaultEnabled() - { + } - return true; + // indicates if a plugin has its own setup screen - } + public bool HasSetup() + { - // indicates if a plugin has its own setup screen + return true; - public bool HasSetup() - { + } + public override int GetID + { + get + { + return 4755; + } + set + { + } + } - return false; + public override bool Init() + { + LoadSettings(); + return Load(GUIGraphicsContext.Skin + @"\myonlinevideos.xml"); - } - public override int GetID - { - get - { - return 4755; - } - set - { - } - } + } + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = PluginName(); - public override bool Init() - { - LoadSettings(); - return Load(GUIGraphicsContext.Skin + @"\myonlinevideos.xml"); + strButtonImage = String.Empty; - } - public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) - { - strButtonText = PluginName(); + strButtonImageFocus = String.Empty; - strButtonImage = String.Empty; + strPictureImage = "hover_onlinevideos.png"; - strButtonImageFocus = String.Empty; + return true; + } + public bool ShowDefaultHome() + { + return true; + } + protected override void OnPageLoad() + { + if (_CurrentState == State.home) + { + DisplaySites(); + currentView = View.List; + ChangeFacadeView(); + } + else if (_CurrentState == State.categories) + { + DisplayCategories(); + } + else + { + DisplayVideos(false); + facadeView.SelectedListItemIndex = miSelectedIndex; + } + UpdateViewSate(); + //base.OnPageLoad(); + } + protected override void OnShowContextMenu() + { + int liSelected = facadeView.SelectedListItemIndex-1; + if (liSelected < 0 || msSelectedSiteId=="99" || _CurrentState!=State.videos) + { + return; + } + + GUIListItem loListItem = facadeView.SelectedListItem; + GUIDialogMenu dlgSel = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + dlgSel.Reset(); + if (dlgSel != null) + { + dlgSel.Add("Save"); // Save + if(msSelectedSiteId=="1"){ + dlgSel.Add("Related Videos"); // Related Videos + } + if(isSiteFavoriteEnabled()){ + if(msSelectedCategoryValue.StartsWith("fav:") ==false){ + dlgSel.Add("Add to favorites"); + } + else{ + dlgSel.Add("Remove from favorites"); + } + } + } + dlgSel.DoModal(GetID); + int liSelectedIdx = dlgSel.SelectedId; + Log.Info("Selected id {0}",liSelectedIdx); + switch(liSelectedIdx){ + case 1: + SaveVideo(loListItem); + break; + case 2: + //Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); + SiteUtilBase site = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + //Log.Info("VideoList before:"); + foreach(VideoInfo video in moCurrentVideoList){ + Log.Info(video.Title); + } + moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); + //Log.Info("VideoList after:"); + foreach(VideoInfo video in moCurrentVideoList){ + Log.Info(video.Title); + } + DisplayVideos(false); + break; + case 3: + SiteUtilBase siteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + Site loSite = moSiteList [msSelectedSiteId]; + if(msSelectedCategoryValue.StartsWith("fav:") == false){ + siteUtil.addFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); + }else{ + siteUtil.removeFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); + } + break; + } + base.OnShowContextMenu(); + } + public override void OnAction(Action action) + { + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + if (_CurrentState == State.videos) + { + Log.Info("Set the stopDownload to true 1"); + ImageDownloader._stopDownload = true; + DisplayCategories(); + _CurrentState = State.categories; + return; + } + else if (_CurrentState == State.categories) + { + DisplaySites(); + _CurrentState = State.home; + return; + } + } + base.OnAction(action); + } + protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) + { + //Log.Info("Onclicked action type:{0}",actionType); + if (control == facadeView) + { - strPictureImage = "hover_onlinevideos.png"; + if (_CurrentState == State.home) + { + msSelectedSiteId = facadeView.SelectedListItem.Path; + //GUIPropertyManager.SetProperty("#header.label", "Online Videos"); + DisplayCategories(); + _CurrentState = State.categories; + } + else if (_CurrentState == State.categories) + { + if (facadeView.SelectedListItemIndex == 0) + { + DisplaySites(); + _CurrentState = State.home; + } + else + { + msSelectedCategoryValue = facadeView.SelectedListItem.Path; + msSelectedCategoryName = facadeView.SelectedListItem.Label; + DisplayVideos(true); + _CurrentState = State.videos; + } + } + else if (_CurrentState == State.videos) + { + Log.Info("Set the stopDownload to true 2"); + ImageDownloader._stopDownload = true; + if (facadeView.SelectedListItemIndex == 0) + { + DisplayCategories(); + _CurrentState = State.categories; + } + else + { + miSelectedIndex = facadeView.SelectedListItemIndex; + //play the video + Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); + } + } + UpdateViewSate(); + } + else if (control == btnViewAs) + { + ChangeFacadeView(); + //bool shouldContinue = false; + //do + //{ + //shouldContinue = false; + } + base.OnClicked(controlId, control, actionType); + } + #region new methods + private void LoadSettings() + { + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + msThumbLocation = settings.msThumbLocation; + msFilterArray = settings.msFilterArray; + moSiteList= settings.moSiteList; + msDownloadDir = settings.msDownloadDir; + } + private void DisplaySites() + { + //facadeView.Clear(); + GUIControl.ClearControl(GetID, facadeView.GetID); - return true; - } - public bool ShowDefaultHome() - { - return true; - } - protected override void OnPageLoad() - { - if (_CurrentState == State.home) - { - DisplaySites(); - currentView = View.List; - ChangeFacadeView(); - } - else if (_CurrentState == State.categories) - { - DisplayCategories(); - } - else - { - DisplayVideos(false); - facadeView.SelectedListItemIndex = miSelectedIndex; - } - UpdateViewSate(); - //base.OnPageLoad(); - } - protected override void OnShowContextMenu() - { - int liSelected = facadeView.SelectedListItemIndex-1; - if (liSelected < 0 || msSelectedSiteId=="99" || _CurrentState!=State.videos) - { - return; - } - - GUIListItem loListItem = facadeView.SelectedListItem; - GUIDialogMenu dlgSel = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - dlgSel.Reset(); - if (dlgSel != null) - { - dlgSel.Add("Save"); // Save - if(msSelectedSiteId=="1"){ - dlgSel.Add("Related Videos"); // Related Videos - } - if(isSiteFavoriteEnabled()){ - if(msSelectedCategoryValue.StartsWith("fav:") ==false){ - dlgSel.Add("Add to favorites"); - } - else{ - dlgSel.Add("Remove from favorites"); - } - } - } - dlgSel.DoModal(GetID); - int liSelectedIdx = dlgSel.SelectedId; - Log.Info("Selected id {0}",liSelectedIdx); - switch(liSelectedIdx){ - case 1: - SaveVideo(loListItem); - break; - case 2: - //Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); - SiteUtilBase site = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - //Log.Info("VideoList before:"); - foreach(VideoInfo video in moCurrentVideoList){ - Log.Info(video.Title); - } - moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); - //Log.Info("VideoList after:"); - foreach(VideoInfo video in moCurrentVideoList){ - Log.Info(video.Title); - } - DisplayVideos(false); - break; - case 3: - SiteUtilBase siteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - Site loSite = moSiteList [msSelectedSiteId]; - if(msSelectedCategoryValue.StartsWith("fav:") == false){ - siteUtil.addFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); - }else{ - siteUtil.removeFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); - } - break; - } - base.OnShowContextMenu(); - } - public override void OnAction(Action action) - { - if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) - { - if (_CurrentState == State.videos) - { - DisplayCategories(); - _CurrentState = State.categories; - return; - } - else if (_CurrentState == State.categories) - { - DisplaySites(); - _CurrentState = State.home; - return; - } - } - base.OnAction(action); - } - protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) - { - //Log.Info("Onclicked action type:{0}",actionType); - if (control == facadeView) - { + GUIListItem loListItem; + String image; + foreach (Site loSite in moSiteList.Values) + { + if(loSite.enabled){ + + loListItem = new GUIListItem(loSite.name); + loListItem.Path = loSite.id; + image = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; + if(System.IO.File.Exists(image)){ + loListItem.ThumbnailImage = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; + }else{ + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + } + facadeView.Add(loListItem); + } + } + GUIPropertyManager.SetProperty("#header.image",""); + } + private void DisplayCategories() + { + // facadeView.Clear(); + GUIControl.ClearControl(GetID, facadeView.GetID); + + GUIListItem loListItem; + loListItem = new GUIListItem(".."); + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + Site loSite = moSiteList[msSelectedSiteId]; + SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + foreach (RssLink loCat in loSite.RssList.Values) + { + if (loCat.isDynamic) + { + Log.Info("Looking for dynamic categories for {0}",loCat.name); + List<RssLink> loNewCatList= loSiteUtil.getDynamicCategories(loCat.url); + Log.Info("Found {0} dynamic categoties.", loNewCatList.Count); + foreach (RssLink loNewCat in loNewCatList) + { + loListItem = new GUIListItem(loNewCat.name); + loListItem.Path = loNewCat.url; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + } + } + else + { + loListItem = new GUIListItem(loCat.name); + loListItem.Path = loCat.url; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + } + } + //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); + //SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + if (isSiteFavoriteEnabled()) + { + loListItem = new GUIListItem("Favorites"); + loListItem.Path = "fav:"+loSite.username; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + //loSiteUtil.getSiteFavorites(); + } + } + private bool isSiteFavoriteEnabled(){ + Site loSite = moSiteList[msSelectedSiteId]; + SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + return (loSiteUtil.isSiteFavoritesEnabled() && String.IsNullOrEmpty(loSite.username) == false); + } + + private void DisplayVideos(bool fbRefresh) + { + List<VideoInfo> loListItems; + GUIListItem loListItem; + + GUIControl.ClearControl(GetID, facadeView.GetID); + loListItem = new GUIListItem(".."); + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - if (_CurrentState == State.home) - { - msSelectedSiteId = facadeView.SelectedListItem.Path; - //GUIPropertyManager.SetProperty("#header.label", "Online Videos"); - DisplayCategories(); - _CurrentState = State.categories; - } - else if (_CurrentState == State.categories) - { - if (facadeView.SelectedListItemIndex == 0) - { - DisplaySites(); - _CurrentState = State.home; - } - else - { - msSelectedCategoryValue = facadeView.SelectedListItem.Path; - msSelectedCategoryName = facadeView.SelectedListItem.Label; - DisplayVideos(true); - _CurrentState = State.videos; - } - } - else if (_CurrentState == State.videos) - { - ImageDownloader._stopDownload = true; - if (facadeView.SelectedListItemIndex == 0) - { - DisplayCategories(); - _CurrentState = State.categories; - } - else - { - miSelectedIndex = facadeView.SelectedListItemIndex; - //play the video - Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); - } - } - UpdateViewSate(); - } - else if (control == btnViewAs) - { - ChangeFacadeView(); - //bool shouldContinue = false; - //do - //{ - //shouldContinue = false; - } - base.OnClicked(controlId, control, actionType); - } - #region new methods - private void LoadSettings() - { - XmlDocument doc = new XmlDocument(); - try - { - doc.Load("OnlineVideoSettings.xml"); - XmlNode filter = doc.SelectSingleNode("//settings/filter"); - String lsFilter = filter.InnerText; - msFilterArray = lsFilter.Split(new char[] { ',' }); - if (msFilterArray.Length == 1 && msFilterArray[0] == "") - { - msFilterArray = null; - } - XmlNode thumbNode = doc.SelectSingleNode("//settings/thumbLocation"); - msThumbLocation = thumbNode.InnerText; - if(String.IsNullOrEmpty(msThumbLocation)){ - msThumbLocation = - System.IO.Directory.GetCurrentDirectory()+"/Thumbs/OnlineVideos/"; - } - if(System.IO.Directory.Exists(msThumbLocation)==false){ - System.IO.Directory.CreateDirectory(msThumbLocation); - } - - //lsFilterArray - //Log.Write("filter value {0}",filter.InnerText); - - XmlNode root = doc.SelectSingleNode("//settings/sites/site"); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//settings/sites/site"); - List<Site> loSiteList = new List<Site>(); - Site loSite; - XmlNodeList RssNodeList; - RssLink loRssData; - bool lbDonwloadDirSet = false; - foreach (XmlNode chileNode in nodeList) - { - loSite = new Site(); - - XmlNode node = chileNode.SelectSingleNode("name"); - loSite.name = node.InnerText; - - node = chileNode.SelectSingleNode("id"); - loSite.id = node.InnerText; - - node = chileNode.SelectSingleNode("user"); - if(node!=null) - loSite.username = node.InnerText; - - node = chileNode.SelectSingleNode("password"); - if(node!=null) - loSite.password = node.InnerText; - - node = chileNode.SelectSingleNode("confirmAge"); - if(node!=null) - loSite.confirmAge = node.InnerText == "yes"; - - //Console.WriteLine("site Node:{0}", loSite.ToString()); - RssNodeList = chileNode.SelectNodes("rss"); - foreach (XmlNode RssNode in RssNodeList) - { - loRssData = new RssLink(); - //node = chileNode.SelectSingleNode("d"); - - loRssData.name = RssNode.Attributes["name"].InnerText; - try{ - loRssData.isDynamic = RssNode.Attributes["dynamic"].InnerText.Equals("yes"); - Log.Info("Found a dynamic category for site {0}",loSite.name); - }catch(Exception){} - loRssData.url = RssNode.InnerText; - if (lbDonwloadDirSet==false && loSite.id == "99") - { - msDownloadDir = loRssData.url; - lbDonwloadDirSet = true; - } - //Console.WriteLine("rss Node:{0}", loRssData.ToString()); - loSite.RssList.Add(loRssData.name, loRssData); - } - moSiteList.Add(loSite.id, loSite); - } - } - catch (Exception e) - { - //moLog.Error(e); - Log.Error(e); - } - } - private void DisplaySites() - { - //facadeView.Clear(); - GUIControl.ClearControl(GetID, facadeView.GetID); - - GUIListItem loListItem; - String image; - foreach (Site loSite in moSiteList.Values) - { - - loListItem = new GUIListItem(loSite.name); - loListItem.Path = loSite.id; - image = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; - if(System.IO.File.Exists(image)){ - loListItem.ThumbnailImage = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; - }else{ - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - } - - - facadeView.Add(loListItem); - } - GUIPropertyManager.SetProperty("#header.image",""); - } - private void DisplayCategories() - { - // facadeView.Clear(); - GUIControl.ClearControl(GetID, facadeView.GetID); - - GUIListItem loListItem; - loListItem = new GUIListItem(".."); - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - Site loSite = moSiteList[msSelectedSiteId]; - SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - foreach (RssLink loCat in loSite.RssList.Values) - { - if (loCat.isDynamic) - { - Log.Info("Looking for dynamic categories for {0}",loCat.name); - List<RssLink> loNewCatList= loSiteUtil.getDynamicCategories(loCat.url); - Log.Info("Found {0} dynamic categoties.", loNewCatList.Count); - foreach (RssLink loNewCat in loNewCatList) - { - loListItem = new GUIListItem(loNewCat.name); - loListItem.Path = loNewCat.url; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - } - } - else - { - loListItem = new GUIListItem(loCat.name); - loListItem.Path = loCat.url; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - } - } - //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); - //SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - if (isSiteFavoriteEnabled()) - { - loListItem = new GUIListItem("Favorites"); - loListItem.Path = "fav:"+loSite.username; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - //loSiteUtil.getSiteFavorites(); - } - } - private bool isSiteFavoriteEnabled(){ - Site loSite = moSiteList[msSelectedSiteId]; - SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - return (loSiteUtil.isSiteFavoritesEnabled() && String.IsNullOrEmpty(loSite.username) == false); - } - - private void DisplayVideos(bool fbRefresh) - { - List<VideoInfo> loListItems; - GUIListItem loListItem; - - GUIControl.ClearControl(GetID, facadeView.GetID); - loListItem = new GUIListItem(".."); - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - if (fbRefresh) - { - SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - - if (msSelectedCategoryValue.Contains("{0}")) - { - String lsSearchStr = String.Empty; - GetUserInputString(ref lsSearchStr); - if (FilterOut(lsSearchStr)) - { - return; - } - lsSearchStr = lsSearchStr.Replace(" ", "+"); - msSelectedCategoryValue = String.Format(msSelectedCategoryValue, lsSearchStr); - } - loListItems = loSiteUtil.getVideoList(msSelectedCategoryValue); - moCurrentVideoList.Clear(); - } - else - { - loListItems = moCurrentVideoList; - } - //facadeView.Clear(); - - //GUIListItem loListItem; - List<String> loImageUrlList = new List<string>(); - int liIdx = 0; - foreach (VideoInfo loVideoInfo in loListItems) - { - liIdx++; - loVideoInfo.Description = cleanString(loVideoInfo.Description); - if (FilterOut(loVideoInfo.Title) || FilterOut(loVideoInfo.Description)) - { - continue; - } - loListItem = new GUIListItem(loVideoInfo.Title); - loListItem.Path = loVideoInfo.VideoUrl; - loListItem.ItemId = liIdx; - loListItem.RetrieveArt = false; - loListItem.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - - facadeView.Add(loListItem); - //loListItem.RetrieveArt = true; - loImageUrlList.Add(loVideoInfo.ImageUrl); - if (fbRefresh) - { - moCurrentVideoList.Add(loVideoInfo); - } - } - //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 +""); - - ImageDownloader.getImages(loImageUrlList,msThumbLocation,facadeView); -// Log.Info("Getting images"); -// BackgroundWorker worker = new BackgroundWorker(); + if (fbRefresh) + { + SiteUtilBase loSiteUtil = SiteUtilFacto... [truncated message content] |