From: <gre...@us...> - 2007-05-07 22:22:31
|
Revision: 384 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=384&view=rev Author: gregmac45 Date: 2007-05-07 15:21:32 -0700 (Mon, 07 May 2007) Log Message: ----------- Added support for MyVideo.de and rocketboom.com Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilFactory.cs Added Paths: ----------- trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs 2007-05-07 22:21:32 UTC (rev 384) @@ -0,0 +1,128 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class MyVideodeUtil : SiteUtilBase + { + + public override String getUrl(String fsId) + { + String lsUrl = ""; + HttpWebRequest webrequest = + (HttpWebRequest)WebRequest.Create("http://www.myvideo.de/movie/15714"); + webrequest.KeepAlive = false; + webrequest.Method = "GET"; + webrequest.ContentType = "text/html"; + webrequest.AllowAutoRedirect = false; + HttpWebResponse webresponse; + webresponse = (HttpWebResponse)webrequest.GetResponse(); + WebHeaderCollection headers = webresponse.Headers; + if ((webresponse.StatusCode == HttpStatusCode.Found) || + (webresponse.StatusCode == HttpStatusCode.Redirect) || + (webresponse.StatusCode == HttpStatusCode.Moved) || + (webresponse.StatusCode == HttpStatusCode.MovedPermanently)) + { + // Get redirected uri + string lsUri = headers["Location"]; + lsUrl = Regex.Match(lsUri, "V=([^&]*)").Groups[1].Value; + } + + return lsUrl; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + video.Description = rssItem.description; + video.ImageUrl = rssItem.mediaThumbnail; + video.Title = rssItem.title; + video.VideoUrl = Regex.Match(rssItem.link, "watch/([\\d]*)").Groups[1].Value; + loVideoList.Add(video); + + } + return loVideoList; + } + /* + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) + { + + XmlDocument doc = new XmlDocument(); + //XPathDocument doc = new XPathDocument(fsUrl); + + doc.Load(XmlReader.Create(fsUrl)); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//rss/channel/item"); + //RssItem loRssItem = new RssItem(); + //loRssItem. + //This loops through each node found in the nodeList and adds the + //Node data to the DataTable. + XmlAttributeCollection ac; + //List<RssItem> loRssItems = new List<RssItem>(); + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loRssItem; + //GUIListItem loListItem; + foreach (XmlNode chileNode in nodeList) + { + loRssItem = new GUIOnlineVideos.VideoInfo(); + + XmlNode node = chileNode.SelectSingleNode("title"); + loRssItem.Title = node.InnerText; + + //node = chileNode.SelectSingleNode("link"); + //loRssItem.link = node.InnerText; + + node = chileNode.SelectSingleNode("description"); + loRssItem.Description = node.InnerText; + + node = chileNode.SelectSingleNode("media:thumbnail[@width=\"260\"]", expr); + if (node != null) + { + ac = node.Attributes; + loRssItem.ImageUrl = ac["url"].InnerText; + } + + + node = chileNode.SelectSingleNode("guid"); + if (node != null) + { + //ac = node.Attributes; + loRssItem.VideoUrl = node.InnerText; + } + + //Log.Write(loRssItem.ToString()); + //loListItem = new GUIListItem(loRssItem.title); + //loListItem.Path = loRssItem.videoUrl; + loRssItems.Add(loRssItem); + + + } + return loRssItems; + } + + */ + + } +} Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs 2007-05-07 22:21:32 UTC (rev 384) @@ -0,0 +1,107 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class RocketboomUtil : SiteUtilBase + { + + public override String getUrl(String fsId) + { + return fsId; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + video.Description = rssItem.description; + video.Title = rssItem.title; + video.VideoUrl = rssItem.enclosure; + loVideoList.Add(video); + + } + return loVideoList; + } + /* + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) + { + + XmlDocument doc = new XmlDocument(); + //XPathDocument doc = new XPathDocument(fsUrl); + + doc.Load(XmlReader.Create(fsUrl)); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//rss/channel/item"); + //RssItem loRssItem = new RssItem(); + //loRssItem. + //This loops through each node found in the nodeList and adds the + //Node data to the DataTable. + XmlAttributeCollection ac; + //List<RssItem> loRssItems = new List<RssItem>(); + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loRssItem; + //GUIListItem loListItem; + foreach (XmlNode chileNode in nodeList) + { + loRssItem = new GUIOnlineVideos.VideoInfo(); + + XmlNode node = chileNode.SelectSingleNode("title"); + loRssItem.Title = node.InnerText; + + //node = chileNode.SelectSingleNode("link"); + //loRssItem.link = node.InnerText; + + node = chileNode.SelectSingleNode("description"); + loRssItem.Description = node.InnerText; + + node = chileNode.SelectSingleNode("media:thumbnail[@width=\"260\"]", expr); + if (node != null) + { + ac = node.Attributes; + loRssItem.ImageUrl = ac["url"].InnerText; + } + + + node = chileNode.SelectSingleNode("guid"); + if (node != null) + { + //ac = node.Attributes; + loRssItem.VideoUrl = node.InnerText; + } + + //Log.Write(loRssItem.ToString()); + //loListItem = new GUIListItem(loRssItem.title); + //loListItem.Path = loRssItem.videoUrl; + loRssItems.Add(loRssItem); + + + } + return loRssItems; + } + + */ + + } +} Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilFactory.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilFactory.cs 2007-05-07 02:00:09 UTC (rev 383) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilFactory.cs 2007-05-07 22:21:32 UTC (rev 384) @@ -100,6 +100,16 @@ lbFound = true; moSiteTable.Add("15", new ItunesTrailerUtil()); } + else if (fsSiteId == "16") + { + lbFound = true; + moSiteTable.Add("16", new MyVideodeUtil()); + } + else if (fsSiteId == "17") + { + lbFound = true; + moSiteTable.Add("17", new RocketboomUtil()); + } if(lbFound){ return moSiteTable[fsSiteId]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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] |
From: <gre...@us...> - 2007-08-18 00:46:08
|
Revision: 845 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=845&view=rev Author: gregmac45 Date: 2007-08-17 17:46:02 -0700 (Fri, 17 Aug 2007) Log Message: ----------- many changes Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs 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/Main.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SoapBoxUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Stage6Util.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/FavoriteUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteVideo.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -19,43 +19,37 @@ { public class AbcUtil:SiteUtilBase { + public override string getSiteId() + { + return "8"; + } + public override List<OnlineVideos.GUIOnlineVideos.VideoInfo> getSiteFavorites(string fsUser) + { + return new List<OnlineVideos.GUIOnlineVideos.VideoInfo>(); + } + //private String msXmlLink; - public override List<GUIOnlineVideos.VideoInfo> getSiteFavorites() - { - throw new Exception("The method or operation is not implemented."); - } - public override bool isSiteFavoritesEnabled() - { - return false; - } + + - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { - - return fsId ; + //String [] urlArray = fsId.Split(new char[] { ',' }); + //return urlArray[0] ; + return fsId; } public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) { - List<RssItem> loRssItemList = getRssDataItems(fsUrl); - List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video; - foreach(RssItem rssItem in loRssItemList){ - video = new GUIOnlineVideos.VideoInfo(); - video.Description = rssItem.mediaDescription; - video.ImageUrl = rssItem.mediaThumbnail; - video.Title = rssItem.title; - foreach(MediaContent content in rssItem.contentList){ - if(content.type.Contains("flv")){ - video.VideoUrl = content.url; - break; - } - } - loVideoList.Add(video); - } - return loVideoList; + List<GUIOnlineVideos.VideoInfo> list= new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video = new GUIOnlineVideos.VideoInfo(); + video.Title = "test"; + video.VideoUrl = "RTMP://wdig.fcod.llnwd.net/a339/o2/abc/streaming/episodes/SXD_112_SurstrommingOrASlice_Segment_1_1325482_highband.flv"; + list.Add(video); + return list; + //return getRssData; } - /* + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) { @@ -125,7 +119,7 @@ return loRssItems; } - */ + } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,7 +24,7 @@ return "9"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { String lsUrl = ""; Log.Info("BlipTv getUrl with "+fsId); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,7 +24,7 @@ return "break"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { String lsHtml = getHTMLData(fsId); //Log.Write("html to parse to get url = \n{0}",lsHtml); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -25,7 +25,7 @@ } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { return "http://video.cgi.cbs.com/vplayer3/play.pl?id="+fsId; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,7 +24,7 @@ return "6"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { String lsUrl = ""; Log.Info("DMotion getUrl with "+fsId); @@ -49,7 +49,7 @@ video.Description = rssItem.description; video.ImageUrl = rssItem.mediaThumbnail; video.Title = rssItem.title; - + video.Length = Convert.ToInt32(rssItem.contentList[0].duration); video.VideoUrl = rssItem.guid; loVideoList.Add(video); } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -25,7 +25,7 @@ return "99"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { return fsId; Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -0,0 +1,99 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 8/16/2007 + * Time: 4:04 PM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.IO; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using MediaPortal.Util; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; +using OnlineVideos.Database; + +namespace OnlineVideos +{ + /// <summary> + /// Description of FavoriteUtil. + /// </summary> + public class FavoriteUtil:SiteUtilBase + { + public FavoriteUtil() + { + } + + public override string getSiteId() + { + return "100"; + } + public override string getUrl(OnlineVideos.GUIOnlineVideos.VideoInfo video, OnlineVideos.GUIOnlineVideos.Site foSite) + { + + GUIOnlineVideos.Site loSite = OnlineVideoSettings.getInstance().moSiteList[video.SiteID]; + return SiteUtilFactory.getSiteUtil(video.SiteID).getUrl(video,loSite);; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + + FavoritesDatabase db = FavoritesDatabase.getInstance(); + List<GUIOnlineVideos.VideoInfo> loVideoList; + if(String.IsNullOrEmpty(fsUrl)){ + loVideoList = db.getAllFavoriteVideos(); + }else if(fsUrl.StartsWith("%")){ + fsUrl = fsUrl.Substring(1); + loVideoList = db.searchFavoriteVideos(fsUrl); + }else{ + loVideoList = db.getSiteFavoriteVideos(fsUrl); + } + //GUIOnlineVideos.VideoInfo video; + + + return loVideoList; + } + public override List<OnlineVideos.GUIOnlineVideos.RssLink> getDynamicCategories(string lsUrl) + { + GUIOnlineVideos.RssLink all = new GUIOnlineVideos.RssLink(); + all.name = "All"; + all.url = ""; + List<OnlineVideos.GUIOnlineVideos.RssLink> cats = new List<OnlineVideos.GUIOnlineVideos.RssLink>(); + cats.Add(all); + + FavoritesDatabase db = FavoritesDatabase.getInstance(); + string [] lsSiteIds = db.getSiteIDs(); + Dictionary <String, GUIOnlineVideos.Site> loSiteList = OnlineVideoSettings.getInstance().moSiteList; + GUIOnlineVideos.Site loSite; + GUIOnlineVideos.RssLink cat; + foreach(string lsSiteId in lsSiteIds){ + loSite = loSiteList[lsSiteId]; + cat = new GUIOnlineVideos.RssLink(); + cat.name = loSite.name+"-Favorites"; + cat.url = loSite.id; + cats.Add(cat); + + } + cat = new GUIOnlineVideos.RssLink(); + cat.name = "Search-Favorites"; + cat.url = "%{0}"; + cats.Add(cat); + + //SiteUtilFactory.getSiteUtil( + + return cats; + } + + } + +} Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteVideo.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteVideo.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteVideo.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -0,0 +1,23 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 8/16/2007 + * Time: 4:27 PM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; + +namespace OnlineVideos +{ + /// <summary> + /// Description of FavoriteVideo. + /// </summary> + public class FavoriteVideo + { + public FavoriteVideo() + { + } + } +} Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -0,0 +1,280 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 8/16/2007 + * Time: 9:10 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using MediaPortal.GUI.Library; +using MediaPortal.Database; +using SQLite.NET; +using System.Xml; +using System.IO; +using MediaPortal.MusicVideos; +using MediaPortal.Util; +using MediaPortal.Configuration; + + +namespace OnlineVideos.Database +{ + public class FavoritesDatabase + { + private SQLiteClient m_db; + + private static FavoritesDatabase Instance; + + private FavoritesDatabase() + { + + bool dbExists; + try + { + // Open database + try + { + System.IO.Directory.CreateDirectory("database"); + } + catch (Exception) { } + dbExists = System.IO.File.Exists(Config.GetFile(Config.Dir.Database, "OnlineVideoDatabase.db3")); + m_db = new SQLiteClient(Config.GetFile(Config.Dir.Database, "OnlineVideoDatabase.db3")); + + MediaPortal.Database.DatabaseUtility.SetPragmas(m_db); + + if (!dbExists) + { + CreateTables(); + } + } + catch (SQLiteException ex) + { + Log.Error("database exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + public void Dispose() + { + if (m_db != null) + { + m_db.Close(); + m_db.Dispose(); + m_db = null; + } + } + + public static FavoritesDatabase getInstance() + { + if (Instance == null) + { + Instance = new FavoritesDatabase(); + } + return Instance; + } + private void CreateTables() + { + if (m_db == null) + { + return; + } + try + { + m_db.Execute("CREATE TABLE FAVORITE_VIDEOS(VDO_NM text,VDO_URL text,VDO_DESC text,VDO_TAGS text,VDO_LENGTH text,VDO_OTHER_NFO text,VDO_IMG_URL text,VDO_SITE_ID text)\n"); + //m_db.Execute("CREATE TABLE FAVORITE(FAVORITE_ID integer primary key,FAVORITE_NM text)\n"); + + + + //if (loFavoriteVideos.Count > 0) + //{ + //foreach (YahooVideo loVideo in loFavoriteVideos) + //{ + // addFavoriteVideo("Default", loVideo); + //} + //} + } + catch (Exception e) + { + Log.Info(e.ToString()); + } + } + public bool addFavoriteVideo(OnlineVideos.GUIOnlineVideos.VideoInfo foVideo,String fsSiteId) + { + + //check if the video is already in the favorite list + //lsSQL = string.Format("select SONG_ID from FAVORITE_VIDEOS where SONG_ID='{0}' AND COUNTRY='{1}' and FAVORITE_ID=''", foVideo.songId, foVideo.countryId, lsFavID); + //loResultSet = m_db.Execute(lsSQL); + //if (loResultSet.Rows.Count > 0) + //{ + // return false; + //} + Log.Info("inserting favorite:"); + Log.Info("desc:" +foVideo.Description); + Log.Info("image:"+foVideo.ImageUrl); + Log.Info("tags:"+foVideo.Tags); + Log.Info("title:"+foVideo.Title); + Log.Info("url"+foVideo.VideoUrl); + + DatabaseUtility.RemoveInvalidChars(ref foVideo.Description); + DatabaseUtility.RemoveInvalidChars(ref foVideo.ImageUrl); + DatabaseUtility.RemoveInvalidChars(ref foVideo.Tags); + DatabaseUtility.RemoveInvalidChars(ref foVideo.Title); + DatabaseUtility.RemoveInvalidChars(ref foVideo.VideoUrl); + + string lsSQL = string.Format("insert into FAVORITE_VIDEOS(VDO_NM,VDO_URL,VDO_DESC,VDO_TAGS,VDO_LENGTH,VDO_IMG_URL,VDO_SITE_ID)VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", foVideo.Title,foVideo.VideoUrl, foVideo.Description,foVideo.Tags,foVideo.Length, foVideo.ImageUrl, fsSiteId); + m_db.Execute(lsSQL); + if (m_db.ChangedRows() > 0) + { + Log.Info("Favorite {0} inserted successfully into database",foVideo.Title); + return true; + } + else + { + Log.Info("Favorite {0} failed to insert into database",foVideo.Title); + return false; + } + } + + + public bool removeFavoriteVideo(GUIOnlineVideos.FavoriteVideoInfo foVideo, GUIOnlineVideos.Site foSite) + { + /* + string lsSQL = String.Format("select FAVORITE_ID from FAVORITE where FAVORITE_NM='{0}'", fsFavoriteNm.Replace("'", "''")); + SQLiteResultSet loResultSet = m_db.Execute(lsSQL); + + string lsFavID = (String)loResultSet.GetColumn(0)[0]; + //Log.Info("fav id = {0}",lsFavID); + //Log.Info("song id = {0}", foVideo.songId); + lsSQL = string.Format("delete from FAVORITE_VIDEOS where SONG_ID='{0}' and FAVORITE_ID = {1}", foVideo.songId, lsFavID); + m_db.Execute(lsSQL); + if (m_db.ChangedRows() > 0) + { + return true; + } + else + { + return false; + } + */ + return false; + + } + + + public List<GUIOnlineVideos.VideoInfo> getAllFavoriteVideos() + { + return getFavoriteVideos(false,null); + } + public List<GUIOnlineVideos.VideoInfo> getSiteFavoriteVideos(String fsSiteId){ + return getFavoriteVideos(true,fsSiteId); + } + private List<GUIOnlineVideos.VideoInfo> getFavoriteVideos(bool fbLimitBySite, String fsSiteId){ + + //createFavorite("Default2"); + string lsSQL; + if(!fbLimitBySite){ + lsSQL = string.Format("select * from favorite_videos"); + }else{ + lsSQL = string.Format("select * from favorite_videos where VDO_SITE_ID='{0}'",fsSiteId); + } + SQLiteResultSet loResultSet = m_db.Execute(lsSQL); + List<GUIOnlineVideos.VideoInfo> loFavoriteList = new List<GUIOnlineVideos.VideoInfo>(); + if (loResultSet.Rows.Count == 0) return loFavoriteList ; + + for (int iRow = 0; iRow < loResultSet.Rows.Count; iRow++) + { + GUIOnlineVideos.VideoInfo video = new GUIOnlineVideos.FavoriteVideoInfo(); + video.Description = DatabaseUtility.Get(loResultSet, iRow, "VDO_DESC"); + video.ImageUrl = DatabaseUtility.Get(loResultSet, iRow, "VDO_IMG_URL"); + video.Length = DatabaseUtility.GetAsInt(loResultSet, iRow, "VDO_LENGTH"); + video.Tags = DatabaseUtility.Get(loResultSet, iRow, "VDO_TAGS"); + video.Title = DatabaseUtility.Get(loResultSet, iRow, "VDO_NM"); + video.VideoUrl = DatabaseUtility.Get(loResultSet,iRow,"VDO_URL"); + video.SiteID = DatabaseUtility.Get(loResultSet,iRow,"VDO_SITE_ID"); + + Log.Info("Pulled {0} out of the database",video.Title); + loFavoriteList.Add(video); + + } + return loFavoriteList; + } + public string [] getSiteIDs(){ + string lsSQL = "select distinct VDO_SITE_ID from favorite_videos"; + SQLiteResultSet loResultSet = m_db.Execute(lsSQL); + string [] siteIdList = new string[loResultSet.Rows.Count]; + for (int iRow = 0; iRow < loResultSet.Rows.Count; iRow++) + { + siteIdList[iRow] = DatabaseUtility.Get(loResultSet,iRow,"VDO_SITE_ID"); + + } + return siteIdList; + + } + + public List<GUIOnlineVideos.VideoInfo> searchFavoriteVideos(String fsQuery){ + + //createFavorite("Default2"); + string lsSQL; + //if(!fbLimitBySite){ + lsSQL = string.Format("select * from favorite_videos where VDO_NM like '%{0}%' or VDO_DESC like '%{0}%' or VDO_TAGS like '%{0}%'",fsQuery); + //}else{ + //lsSQL = string.Format("select * from favorite_videos where VDO_SITE_ID='{0}'",fsSiteId); + //} + SQLiteResultSet loResultSet = m_db.Execute(lsSQL); + List<GUIOnlineVideos.VideoInfo> loFavoriteList = new List<GUIOnlineVideos.VideoInfo>(); + if (loResultSet.Rows.Count == 0) return loFavoriteList ; + + for (int iRow = 0; iRow < loResultSet.Rows.Count; iRow++) + { + GUIOnlineVideos.VideoInfo video = new GUIOnlineVideos.FavoriteVideoInfo(); + video.Description = DatabaseUtility.Get(loResultSet, iRow, "VDO_DESC"); + video.ImageUrl = DatabaseUtility.Get(loResultSet, iRow, "VDO_IMG_URL"); + video.Length = DatabaseUtility.GetAsInt(loResultSet, iRow, "VDO_LENGTH"); + video.Tags = DatabaseUtility.Get(loResultSet, iRow, "VDO_TAGS"); + video.Title = DatabaseUtility.Get(loResultSet, iRow, "VDO_NM"); + video.VideoUrl = DatabaseUtility.Get(loResultSet,iRow,"VDO_URL"); + video.SiteID = DatabaseUtility.Get(loResultSet,iRow,"VDO_SITE_ID"); + + Log.Info("Pulled {0} out of the database",video.Title); + loFavoriteList.Add(video); + + } + return loFavoriteList; + } + + /* + public List<GUIOnlineVideos.FavoriteVideos> getSiteFavoriteVideos(GUIOnlineVideos.Site foSite) + { + List<YahooVideo> loFavoriteList = new List<YahooVideo>(); + string lsSQL = String.Format("select FAVORITE_ID from FAVORITE where FAVORITE_NM='{0}'", fsFavoriteNm.Replace("'", "''")); + SQLiteResultSet loResultSet = m_db.Execute(lsSQL); + + string lsFavID = (String)loResultSet.GetColumn(0)[0]; + lsSQL = string.Format("select SONG_NM,SONG_ID,ARTIST_NM,ARTIST_ID,COUNTRY from FAVORITE_VIDEOS where FAVORITE_ID={0}", lsFavID); + loResultSet = m_db.Execute(lsSQL); + + foreach (ArrayList loRow in loResultSet.RowsList) + { + YahooVideo loVideo = new YahooVideo(); + IEnumerator en = loRow.GetEnumerator(); + en.MoveNext(); + loVideo.songName = (String)en.Current; + en.MoveNext(); + loVideo.songId = (String)en.Current; + en.MoveNext(); + loVideo.artistName = (String)en.Current; + en.MoveNext(); + loVideo.artistId = (String)en.Current; + en.MoveNext(); + loVideo.countryId = (String)en.Current; + loFavoriteList.Add(loVideo); + + } + + return loFavoriteList; + } + */ + } +} Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -13,7 +13,9 @@ using MediaPortal.Dialogs; //using MediaPortal.Utils.Services; using MediaPortal.Utils; +using MediaPortal.Configuration; using MediaPortal.Player; +using MediaPortal.GUI; namespace OnlineVideos { @@ -25,6 +27,10 @@ protected GUIFacadeControl facadeView = null; [SkinControlAttribute(1)] protected GUIImage logoImage = null; + + [SkinControlAttribute(4)] + protected GUITextControl txtDesc = null; + //private ILog moLog; protected View currentView = View.Icons; private Dictionary <String, Site> moSiteList = new Dictionary<String, Site>(); @@ -70,17 +76,22 @@ public class VideoInfo { public String Title; - public String Description; - public String VideoUrl; - public String ImageUrl; + public String Description = ""; + public String VideoUrl = ""; + public String ImageUrl = ""; public int Length; - public String Tags; + public String Tags = ""; public Object Other; + public string SiteID = ""; public VideoInfo() { Length = -1; } } + public class FavoriteVideoInfo:VideoInfo + { + public String videoId; + } public GUIOnlineVideos() { @@ -169,7 +180,9 @@ public override bool Init() { LoadSettings(); - return Load(GUIGraphicsContext.Skin + @"\myonlinevideos.xml"); + bool result = Load(GUIGraphicsContext.Skin + @"\myonlinevideos.xml"); + + return result; } public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) @@ -193,8 +206,9 @@ if (_CurrentState == State.home) { DisplaySites(); - currentView = View.List; - ChangeFacadeView(); + //currentView = View.List; + //ChangeFacadeView(); + } else if (_CurrentState == State.categories) { @@ -222,26 +236,39 @@ if (dlgSel != null) { dlgSel.Add("Save"); // Save + if(msSelectedCategoryValue.StartsWith("fav:") ==false){ + dlgSel.Add("Add to favorites"); + } + else{ + dlgSel.Add("Remove from favorites"); + } 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"); - } - } + //if(isSiteFavoriteEnabled()){ + + //} } dlgSel.DoModal(GetID); int liSelectedIdx = dlgSel.SelectedId; Log.Info("Selected id {0}",liSelectedIdx); switch(liSelectedIdx){ case 1: - SaveVideo(loListItem); + SaveVideo(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); break; case 2: + SiteUtilBase siteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + Site loSite = moSiteList [msSelectedSiteId]; + if(msSelectedCategoryValue.StartsWith("fav:") == false){ + //siteUtil.addFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); + Log.Info("Received request to add video to favorites."); + siteUtil.AddFavorite(moCurrentVideoList[liSelected],msSelectedSiteId); + + }else{ + siteUtil.removeFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); + } + break; + case 3: //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:"); @@ -255,15 +282,7 @@ } 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(); } @@ -285,6 +304,8 @@ _CurrentState = State.home; return; } + }else{ + Log.Info("Action:"+action.wID); } base.OnAction(action); } @@ -344,13 +365,84 @@ } base.OnClicked(controlId, control, actionType); } + public override bool OnMessage(GUIMessage message) + { + /* + if(message.Message == GUIMessage.MessageType.GUI_MSG_SETFOCUS || message.Message == GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED){ + Log.Info("Message:"+message.Message); + //if(message.Message == GUIMessage.MessageType.GUI_MSG_SETFOCUS){ + Log.Info(message.Label); + Log.Info(message.Label2); + Log.Info(message.Label3); + Log.Info(message.Label4); + Log.Info(message.Object+""); + Log.Info(message.Object2+""); + Log.Info(message.Param1+""); + Log.Info(message.Param2+""); + Log.Info(message.Param3+"" ); + Log.Info(message.Param4+""); + Log.Info(message.SenderControlId+""); + Log.Info(message.SendToTargetWindow+""); + Log.Info(message.TargetWindowId+""); + Log.Info(message.TargetControlId+""); + + + + int liIndex = facadeView.SelectedListItemIndex; + if(liIndex>0){ + if(message.Message == GUIMessage.MessageType.GUI_MSG_SETFOCUS && _CurrentState == State.videos && message.TargetWindowId==GetID && message.TargetControlId == facadeView.GetID){ + DisplayVideoInfo(moCurrentVideoList[liIndex -1]); + + }else if(message.Message == GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED && _CurrentState == State.videos && message.SenderControlId == facadeView.GetID && message.TargetWindowId == GetID){ + DisplayVideoInfo(moCurrentVideoList[liIndex -1]); + + }else{ + DisplayVideoInfo(null); + } + }else{ + DisplayVideoInfo(null); + } + } + + */ + /* + if(message.Message == GUIMessage.MessageType.GUI_MSG_SETFOCUS && _CurrentState == State.videos && message.TargetControlId!=facadeView.GetID && message.TargetWindowId == GetID){ + DisplayVideoInfo(null); + } + */ + return base.OnMessage(message); + } + protected override void OnPageDestroy(int newWindowId) + { + // Save view + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValue("onlinevideos", "view", (int)currentView); + } + base.OnPageDestroy(newWindowId); + } #region new methods private void LoadSettings() { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + currentView = (View)xmlreader.GetValueAsInt("onlinevideos", "view", (int)View.Icons); + SwitchView(); + } OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); msThumbLocation = settings.msThumbLocation; msFilterArray = settings.msFilterArray; moSiteList= settings.moSiteList; + Site FavSite = new Site(); + FavSite.id = "100"; + FavSite.name = "Favorites"; + FavSite.enabled = true; + RssLink cat = new RssLink(); + cat.isDynamic = true; + cat.name = "dynamic"; + cat.url = "favorites"; + FavSite.RssList.Add("dynamic",cat); + moSiteList.Add("100",FavSite); msDownloadDir = settings.msDownloadDir; } private void DisplaySites() @@ -376,6 +468,8 @@ facadeView.Add(loListItem); } } + + GUIPropertyManager.SetProperty("#header.image",""); } private void DisplayCategories() @@ -417,6 +511,7 @@ } //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); //SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + /* if (isSiteFavoriteEnabled()) { loListItem = new GUIListItem("Favorites"); @@ -426,13 +521,15 @@ 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; @@ -441,6 +538,8 @@ GUIControl.ClearControl(GetID, facadeView.GetID); loListItem = new GUIListItem(".."); loListItem.IsFolder = true; + loListItem.ItemId = 0; + loListItem.OnItemSelected+= new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnVideoItemSelected); MediaPortal.Util.Utils.SetDefaultIcons(loListItem); facadeView.Add(loListItem); @@ -484,7 +583,7 @@ loListItem.ItemId = liIdx; loListItem.RetrieveArt = false; loListItem.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - + loListItem.OnItemSelected+=new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler( OnVideoItemSelected); facadeView.Add(loListItem); //loListItem.RetrieveArt = true; loImageUrlList.Add(loVideoInfo.ImageUrl); @@ -550,6 +649,14 @@ item.ThumbnailImage = ImageDownloader._imageLocationList[item.ItemId-1]; } } + void OnVideoItemSelected(GUIListItem item,GUIControl parent){ + if(item.ItemId ==0 ){ + DisplayVideoInfo(null); + } + else{ + DisplayVideoInfo(moCurrentVideoList[item.ItemId-1]); + } + } private bool GetUserInputString(ref string sString) { VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); @@ -588,14 +695,16 @@ GUIWindowManager.SendThreadMessage(msg); } } - private void SaveVideo(GUIListItem foListItem) + private void SaveVideo(VideoInfo foListItem) { - String lsUrl = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getUrl(foListItem.Path); + Site loSite = moSiteList[msSelectedSiteId]; + //String lsUrl = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getUrl(foListItem.Path); + String lsUrl = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getUrl(foListItem,loSite); WebClient loClient = new WebClient(); loClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); loClient.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted); - String lsFileName = msDownloadDir+foListItem.Label; - loClient.DownloadFileAsync(new Uri(lsUrl), lsFileName + ".flv", foListItem.Label); + String lsFileName = msDownloadDir+foListItem.Title; + loClient.DownloadFileAsync(new Uri(lsUrl), lsFileName + ".flv", foListItem.Title); } private void DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) @@ -652,15 +761,17 @@ case State.home: GUIPropertyManager.SetProperty("#header.label","OnlineVideos"); GUIPropertyManager.SetProperty("#header.image",""); + DisplayVideoInfo(null); break; case State.categories: GUIPropertyManager.SetProperty("#header.label","Categories"); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); + DisplayVideoInfo(null); break; case State.videos: GUIPropertyManager.SetProperty("#header.label",msSelectedCategoryName); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); - + DisplayVideoInfo(null); break; } } @@ -672,14 +783,14 @@ //if (!AllowView(CurrentView) || facadeView.ThumbnailView == null) // shouldContinue = true; //else - facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + //facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; break; case View.Icons: currentView = View.LargeIcons; //if (!AllowView(CurrentView) || facadeView.ThumbnailView == null) // shouldContinue = true; //else - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + //facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; //facadeView. break; case View.LargeIcons: @@ -687,18 +798,20 @@ //if (!AllowView(CurrentView) || facadeView.FilmstripView == null) // shouldContinue = true; //else - facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; + //facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; break; case View.FilmStrip: currentView = View.List; //if (!AllowView(CurrentView) || facadeView.ListView == null) // shouldContinue = true; //else - facadeView.View = GUIFacadeControl.ViewMode.List; + //facadeView.View = GUIFacadeControl.ViewMode.List; break; } + SwitchView(); //} while (shouldContinue); //SelectCurrentItem(); + /* GUIControl.FocusControl(GetID, facadeView.GetID); string strLine = String.Empty; @@ -720,9 +833,63 @@ } GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); + */ + } + protected void SwitchView() + { + if (facadeView == null) + return; + string strLine = String.Empty; + switch (currentView) + { + case View.List: + facadeView.View = GUIFacadeControl.ViewMode.List; + strLine = GUILocalizeStrings.Get(101); + break; + case View.Icons: + facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + strLine = GUILocalizeStrings.Get(100); + break; + case View.LargeIcons: + facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + strLine = GUILocalizeStrings.Get(417); + break; + case View.FilmStrip: + facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; + strLine = GUILocalizeStrings.Get(733); + break; + } + GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); + } + + private void DisplayVideoInfo(VideoInfo foVideo){ + if(foVideo==null){ + GUIPropertyManager.SetProperty("#videotitle", String.Empty); + GUIPropertyManager.SetProperty("#tags", String.Empty); + GUIPropertyManager.SetProperty("#length", String.Empty); + GUIPropertyManager.SetProperty("#desc", String.Empty); + GUIControl.HideControl(GetID,11); + GUIControl.HideControl(GetID,12); + GUIControl.HideControl(GetID,13); + GUIControl.HideControl(GetID,14); + + }else{ + GUIPropertyManager.SetProperty("#videotitle", foVideo.Title); + GUIPropertyManager.SetProperty("#tags", foVideo.Tags); + TimeSpan t = TimeSpan.FromSeconds(foVideo.Length); + GUIPropertyManager.SetProperty("#length", t.ToString()); + GUIPropertyManager.SetProperty("#desc", foVideo.Description); + GUIControl.ShowControl(GetID,11); + GUIControl.ShowControl(GetID,12); + GUIControl.ShowControl(GetID,13); + GUIControl.ShowControl(GetID,14); + //Log.Info(foVideo.Description); + } + } + #endregion } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GameTrailersUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GameTrailersUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GameTrailersUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -25,7 +25,7 @@ } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { return "http://trailers.gametrailers.com/gt_vault/"+fsId + ".wmv"; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,7 +24,7 @@ return "2"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { return fsId + "&txe=.flv"; @@ -51,6 +51,7 @@ }else if(content.type.Contains("flv")){ flvUrl = content.url; Log.Info("flv url:{0}", content.url); + video.Length = Convert.ToInt32(content.duration); } else if (content.type.Contains("mp4")) { Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GrouperUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GrouperUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GrouperUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,7 +24,7 @@ return "3"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { Log.Info("doc id={0}", fsId); String lsHtml = getHTMLData("http://grouper.com/rss/flv.ashx?id=" + fsId); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GubaUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GubaUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GubaUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -25,7 +25,7 @@ return "guba"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { String lsHtml = getHTMLData("http://www.guba.com/watch/" + fsId); Regex loRegex = new Regex("(http://free.guba.com/download/flash/[^?]+)"); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -184,7 +184,7 @@ name = System.IO.Path.GetFileNameWithoutExtension(name); imageLocation = lsThumbLocation + name + "L.jpg"; thumbnailLocation = lsThumbLocation + name + ".jpg"; - if (System.IO.File.Exists(imageLocation) == false) + if (System.IO.File.Exists(thumbnailLocation) == false) { client.DownloadFile(url, imageLocation); if (System.IO.File.Exists(thumbnailLocation) == false) Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -17,47 +17,88 @@ namespace OnlineVideos { - public class ItunesTrailerUtil : SiteUtilBase - { - public override string getSiteId() + public class ItunesTrailerUtil : SiteUtilBase + { + public override string getSiteId() { return "15"; } - public override List<GUIOnlineVideos.VideoInfo> getVideoList(String fsUrl) - { - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += new DoWorkEventHandler(HDTrailerPlugin.AppleTrailers.GetAppleTrailersRSS); - AppleTrailers._workerCompleted = false; - worker.RunWorkerAsync(fsUrl); - using (WaitCursor cursor = new WaitCursor()) - { - while (HDTrailerPlugin.AppleTrailers._workerCompleted == false) - GUIWindowManager.Process(); - } - List<GUIOnlineVideos.VideoInfo> loListItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loItem; - foreach (ITMSClient.TrailerInfo trailer in HDTrailerPlugin.AppleTrailers.trailers) - { - loItem = new GUIOnlineVideos.VideoInfo(); - loItem.Title = trailer.Title; - if(trailer.PosterUrl!=null) - loItem.ImageUrl = trailer.PosterUrl.ToString(); - //loItem.Description = trailer.Overview; - loItem.VideoUrl = trailer.Url.ToString(); - loItem.Other = trailer; - loListItems.Add(loItem); - } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(String fsUrl) + { + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += new DoWorkEventHandler(HDTrailerPlugin.AppleTrailers.GetAppleTrailersRSS); + AppleTrailers._workerCompleted = false; + worker.RunWorkerAsync(fsUrl); + using (WaitCursor cursor = new WaitCursor()) + { + while (HDTrailerPlugin.AppleTrailers._workerCompleted == false) + GUIWindowManager.Process(); + } + List<GUIOnlineVideos.VideoInfo> loListItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loItem; + foreach (ITMSClient.TrailerInfo trailer in HDTrailerPlugin.AppleTrailers.trailers) + { + loItem = new GUIOnlineVideos.VideoInfo(); + loItem.Title = trailer.Title; + if(trailer.PosterUrl!=null) + loItem.ImageUrl = trailer.PosterUrl.ToString(); + loItem.Description = trailer.Overview; + loItem.VideoUrl = trailer.Url.ToString(); + loItem.Other = trailer; + //loItem.Length = trailer.. + loListItems.Add(loItem); + } - return loListItems; + return loListItems; - } + } - public override String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.Site foSite) - { - TrailerInfo trailer = (TrailerInfo)video.Other; - trailer = AppleTrailers.ProcessTrailer(trailer); - return trailer.TrailerStreamCollection[0].Uri.ToString(); - } + public override String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.Site foSite) + { + TrailerInfo trailer = (TrailerInfo)video.Other; + trailer = AppleTrailers.ProcessTrailer(trailer); + return trailer.TrailerStreamCollection[0].Uri.ToString(); + } + private List<GUIOnlineVideos.VideoInfo> search(String fsQuery){ + Dictionary<string, GUIOnlineVideos.RssLink> loRssList= OnlineVideoSettings.getInstance().moSiteList[getSiteId()].RssList; + List<GUIOnlineVideos.VideoInfo> loListItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loItem; + foreach(GUIOnlineVideos.RssLink link in loRssList.Values){ + + + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += new DoWorkEventHandler(HDTrailerPlugin.AppleTrailers.GetAppleTrailersRSS); + AppleTrailers._workerCompleted = false; + worker.RunWorkerAsync(link.url); + Dictionary<string, string> loTrailersFound = new Dictionary<string,string>(); + using (WaitCursor cursor = new WaitCursor()) + { + while (HDTrailerPlugin.AppleTrailers._workerCompleted == false) + GUIWindowManager.Process(); + } + foreach (ITMSClient.TrailerInfo trailer in HDTrailerPlugin.AppleTrailers.trailers) + { + if(trailer.Title.Contains(fsQuery)){ + if(loTrailersFound.ContainsKey(trailer.Title) == false){ + loTrailersFound.Add(trailer.Title, ""); + loItem = new GUIOnlineVideos.VideoInfo(); + loItem.Title = trailer.Title; + if(trailer.PosterUrl!=null){ + loItem.ImageUrl = trailer.PosterUrl.ToString(); + } + loItem.Description = trailer.Overview; + loItem.VideoUrl = trailer.Url.ToString(); + loItem.Other = trailer; + //loItem.Length = trailer.. + loListItems.Add(loItem); + } + } + } + + + } + return loListItems; - } + } + } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,40 +24,17 @@ public static void Main(string[] args) { - XmlDocument doc = new XmlDocument(); - XmlReaderSettings settings = new XmlReaderSettings(); - WebClient client =new WebClient(); - String xml = client.DownloadString("http://stage6.divx.com/rss/videos/order%3Arating"); - settings.ProhibitDtd = false; - settings.CheckCharacters =false; - //settings. - try{ - //XmlParserContext context = new XmlParserContext(); - //context.Encoding = System.Text.Encoding.UTF8; - doc.LoadXml(xml); - }catch(Exception e){ - Console.WriteLine(e); - } - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - expr.AddNamespace("exInfo","http://www.gametrailers.com/rssexplained.php"); - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//rss/channel/item"); - //XmlAttributeCollection ac; -// List<RssItem> loRssItems = new List<RssItem>(); -// RssItem loRssItem; -// //GUIListItem loListItem; -// MediaContent loMediaContent; + - //SiteUtilBase loUtil = new YouTubeUtil(); + SiteUtilBase loUtil = new YouTubeUtil(); //List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("http://youtube.com/rss/global/top_rated.rss"); + + /* SiteUtilBase loUtil = new BlipTvUtil(); List<GUIOnlineVideos.VideoInfo> loList = loUtil.getRssData("http://blip.tv/?1=1&search=soccer;page=1;s=posts&skin=rss"); @@ -75,9 +52,9 @@ List<GUIOnlineVideos.VideoInfo> loList = loUtil.getRssData("http://www.gametrailers.com/rss/newest.xml"); */ /* - SiteUtilBase loUtil = new AbcUtil(); + AbcUtil loUtil = new AbcUtil(); List<GUIOnlineVideos.VideoInfo> loList = loUtil.getRssData("http://ll.static.abc.com/streaming/s/catalog?aff=&isIE=true"); - */ + */ /* SiteUtilBase loUtil = new VideoJugUtil(); List<GUIOnlineVideos.VideoInfo> loList = loUtil.getRssData("http://www.videojug.com/rss"); @@ -102,10 +79,14 @@ SiteUtilBase loUtil = new DailyMotionUtil(); List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("http://www.dailymotion.com/rss"); */ + /* + SiteUtilBase loUtil = new Stage6Util(); + List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("http://stage6.divx.com/rss/videos/order:rating"); + */ //Console.WriteLine(loUtil.getUrl(loList[0].VideoUrl)); //foreach(GUIOnlineVideos.VideoInfo loVideoInfo in loList){ - // Console.WriteLine("title:{0} \nurl:{1} \nimage:{2}",loVideoInfo.Title,loVideoInfo.VideoUrl, loVideoInfo.ImageUrl); - //} +// Console.WriteLine("title:{0} \nurl:{1} \nimage:{2}",loVideoInfo.Title,loVideoInfo.VideoUrl, loVideoInfo.ImageUrl); +// } //YouTubeUtil youtube = new YouTubeUtil(); //youtube.username = "MepoPlugin"; //youtube.password = "mepo"; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -25,7 +25,7 @@ return "5"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { WebClient client = new WebClient(); String lsHtml = client.DownloadString(String.Format("http://www.metacafe.com/fplayer.php?itemID={0}&fs=n&t=embedded", fsId)); @@ -46,7 +46,8 @@ video = new GUIOnlineVideos.VideoInfo(); video.Description = rssItem.description; video.ImageUrl = rssItem.mediaThumbnail; - video.Title = rssItem.title; + video.Title = rssItem.title; + video.Length = Convert.ToInt32(rssItem.contentList[0].duration); video.VideoUrl = Regex.Match(rssItem.link,@"watch/([\d]*)").Groups[1].Value; loVideoList.Add(video); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/MyVideodeUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,7 +24,7 @@ return "myvideo.de"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { String lsUrl = ""; HttpWebRequest webrequest = Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -64,7 +64,7 @@ msThumbLocation = thumbNode.InnerText; if(String.IsNullOrEmpty(msThumbLocation)){ msThumbLocation = - System.IO.Directory.GetCurrentDirectory()+"/Thumbs/OnlineVideos/"; + System.IO.Directory.GetCurrentDirectory()+@"\Thumbs\OnlineVideos\"; } if(System.IO.Directory.Exists(msThumbLocation)==false){ System.IO.Directory.CreateDirectory(msThumbLocation); @@ -130,6 +130,13 @@ if (lbDonwloadDirSet==false && loSite.id == "99") { msDownloadDir = loRssData.url; + if(String.IsNullOrEmpty(msDownloadDir)){ + msDownloadDir = + System.IO.Directory.GetCurrentDirectory()+@"\Downloads\OnlineVideos\"; + } + if(System.IO.Directory.Exists(msDownloadDir)==false){ + System.IO.Directory.CreateDirectory(msDownloadDir); + } lbDonwloadDirSet = true; } //Console.WriteLine("rss Node:{0}", loRssData.ToString()); @@ -188,7 +195,7 @@ filterNode.InnerText = lsFilterList; }else{ msFilterArray = null; - + } root.AppendChild(filterNode); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-18 00:46:02 UTC (rev 845) @@ -42,6 +42,11 @@ <HintPath>..\..\..\..\Mediaportal\Core\bin\Release\Core.DLL</HintPath> <Private>False</Private> </Reference> + <Reference Include="Databases"> + <HintPath>..\..\..\..\Mediaportal\Databases\bin\Debug\Databases.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + <Private>False</Private> + </Reference> <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Mediaportal\Dialogs\bin\Release\Dialogs.DLL</HintPath> @@ -74,6 +79,9 @@ <Compile Include="Configuration.Designer.cs"> <DependentUpon>Configuration.cs</DependentUpon> </Compile> + <Compile Include="Favorites.cs" /> + <Compile Include="FavoriteUtil.cs" /> + <Compile Include="FavoriteVideo.cs" /> <Compile Include="OnlineVideoSettings.cs" /> <Compile Include="RocketboomUtil.cs" /> <Compile Include="MyVideodeUtil.cs" /> @@ -110,7 +118,7 @@ <Compile Include="VidiLifeUtil.cs" /> <Compile Include="SoapBoxUtil.cs" /> <Compile Include="GameTrailersUtil.cs" /> - <None Include="AbcUtil.cs" /> + <Compile Include="AbcUtil.cs" /> <Compile Include="CbsUtil.cs" /> <Compile Include="BreakUtil.cs" /> <EmbeddedResource Include="Configuration.resx"> Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/RocketboomUtil.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -24,7 +24,7 @@ return "17"; } - public override String getUrl(String fsId) + protected override String getUrl(String fsId) { return fsId; } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-18 00:46:02 UTC (rev 845) @@ -9,6 +9,7 @@ using System.Xml; using System.Xml.XPath; using System.Threading; +using OnlineVideos.Database; namespace OnlineVideos { @@ -29,6 +30,7 @@ public String exInfoImage; public List<MediaContent> contentList; public String enclosure; + public String enclosureDuration; public RssItem(){ contentList = new List<MediaContent>(); } @@ -52,11 +54,8 @@ { //ServiceProvider loServices = GlobalServiceProvider.Instance; //moLog = loServices.Get<ILog>(); - } + } - public virtual Boolean isSiteFavoritesEnabled(){ - return false; - } public virtual List<GUIOnlineVideos.VideoInfo> getSiteFavorites(String fsUser){ return new List<GUIOnlineVideos.VideoInfo>(); } @@ -65,25 +64,30 @@ return new List<GUIOnlineVideos.VideoInfo>(); } public virtual List<GUIOnlineVideos.RssLink> getDynamicCategories(String lsUrl) - { - return new List<GUIOnlineVideos.RssLink>(); + { + return new List<GUIOnlineVideos.RssLink>(); - } - public virtual String getUrl(String fsId) - { - return ""; - } - public virtual bool addFavorite(String fsId,String fsUserName,String fsPassword){ - return false; - } - public virtual bool removeFavorite(String fsId,String fsUserName,String fsPassword){ - return false; - } - - public virtual String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.Site foSite) - { - return getUrl(video.VideoUrl); - } + } + protected virtual String getUrl(String fsId) + { + return ""; + } + //public virtual bool addFavorite(String fsId,String fsUserName,String fsPassword){ + public virtual void AddFavorite(GUIOnlineVideos.VideoInfo foVideo,String fsSiteId){ + //return false; + Log.Info("SiteUtilBase AddFavorites."); + FavoritesDatabase db = FavoritesDatabase.getInstance(); + db.addFavoriteVideo(foVideo,fsSiteId); + + } + public virtual bool removeFavorite(String fsId,String fsUserName,String fsPassword){ + return false; + } + + public virtual String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.Site foSite) + { + return getUrl(video.VideoUrl); + } public List<RssItem> getRssDataItems(String fsUrl){ @@ -143,33 +147,32 @@ for (int j = 0; j < n.ChildNodes.Count; j++) { - XmlNode nin = n.ChildNodes[j]; - + XmlNode nin = n.ChildNodes[j]; switch (nin.Name) { case "media:content": loMediaContent = new MediaContent(); try{ - loMediaContent.url = nin.Attributes["url"].Value; - loMediaContent.type = nin.Attributes["type"].Value; - loMediaContent.medium = nin.Attributes["medium"].Value; - loMediaContent.duration = nin.Attributes["duration"].Value; - loMediaContent.height = nin.Attributes["height"].Value; - loMediaContent.width = nin.Attributes["width"].Value; + loMediaContent.url = nin.Attributes["url"].Value; + loMediaContent.type = nin.Attributes["type"].Value; + loMediaContent.medium = nin.Attributes["medium"].Value; + loMediaContent.duration = nin.Attributes["duration"].Value; + loMediaContent.height = nin.Attributes["height"].Value; + loMediaContent.width = nin.Attributes["width"].Value; }catch(Exception){}; loRssItem.contentList.Add(loMediaContent); break; case "media:description": loRssItem.mediaDescription = n.InnerText; break; - case "media:thumbnail": + case "media:thumbnail": loRssItem.mediaThumbnail = nin.Attributes["url"].Value; break; case "media:title": loRssItem.mediaTitle = nin.InnerText; break; - + } } break; @@ -182,6 +185,24 @@ loMediaContent.height = n.Attributes["height"].Value; loMediaContent.width = n.Attributes["width"].Value; loRssItem.contentList.Add(loMediaContent); + for (int j = 0; j < n.ChildNodes.Count; j++) + { + XmlNode nin = n.ChildNodes[j]; + + switch (nin.Name) + { + case "media:description": + loRssItem.mediaDescription = n.InnerText; + break; + case "media:thumbnail": + loRssItem.mediaThumbnail = nin.Attributes["url"].Value; + break; + case "media:title": + loRssItem.mediaTitle = nin.InnerText; + break; + + } + } break; case "media:description": loRssItem.mediaDescription = n.InnerText; @@ -194,6 +215,9 @@ break; case "enclosure": loRssItem.enclosure = n.Attributes["url"].Value; + if(n.Attributes["duration"]!=null){ + loRssItem.enclosureDuration = n.Attributes["duration"].Value; + } break; case "media:category": loRssItem.mediaCategory = n.InnerText; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SoapBoxUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SoapBoxUtil.cs 2007-08-17 15:52:32 UTC (rev 844) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SoapBoxUtil.cs 2007-08-18 00... [truncated message content] |
From: <gre...@us...> - 2007-08-22 23:07:37
|
Revision: 857 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=857&view=rev Author: gregmac45 Date: 2007-08-22 16:07:31 -0700 (Wed, 22 Aug 2007) Log Message: ----------- Added search for AppleTrailers Added Remove Favorites from local db Fixed thumbnails always downloaded bug Using JW Media Player swf to play FLVs Added ability to seek when in fullscreen using the arrows Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsContent.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs Added Paths: ----------- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx 2007-08-22 23:07:31 UTC (rev 857) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -47,7 +47,7 @@ } public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) { - + fsUrl = fsUrl.Substring(4); FavoritesDatabase db = FavoritesDatabase.getInstance(); List<GUIOnlineVideos.VideoInfo> loVideoList; if(String.IsNullOrEmpty(fsUrl)){ @@ -67,7 +67,7 @@ { GUIOnlineVideos.RssLink all = new GUIOnlineVideos.RssLink(); all.name = "All"; - all.url = ""; + all.url = "fav:"; List<OnlineVideos.GUIOnlineVideos.RssLink> cats = new List<OnlineVideos.GUIOnlineVideos.RssLink>(); cats.Add(all); @@ -80,13 +80,13 @@ loSite = loSiteList[lsSiteId]; cat = new GUIOnlineVideos.RssLink(); cat.name = loSite.name+"-Favorites"; - cat.url = loSite.id; + cat.url = "fav:"+loSite.id; cats.Add(cat); } cat = new GUIOnlineVideos.RssLink(); cat.name = "Search-Favorites"; - cat.url = "%{0}"; + cat.url = "fav:%{0}"; cats.Add(cat); //SiteUtilFactory.getSiteUtil( Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -82,7 +82,7 @@ } try { - m_db.Execute("CREATE TABLE FAVORITE_VIDEOS(VDO_NM text,VDO_URL text,VDO_DESC text,VDO_TAGS text,VDO_LENGTH text,VDO_OTHER_NFO text,VDO_IMG_URL text,VDO_SITE_ID text)\n"); + m_db.Execute("CREATE TABLE FAVORITE_VIDEOS(VDO_ID integer primary key autoincrement,VDO_NM text,VDO_URL text,VDO_DESC text,VDO_TAGS text,VDO_LENGTH text,VDO_OTHER_NFO text,VDO_IMG_URL text,VDO_SITE_ID text)\n"); //m_db.Execute("CREATE TABLE FAVORITE(FAVORITE_ID integer primary key,FAVORITE_NM text)\n"); @@ -138,16 +138,11 @@ } - public bool removeFavoriteVideo(GUIOnlineVideos.FavoriteVideoInfo foVideo, GUIOnlineVideos.Site foSite) + public bool removeFavoriteVideo(GUIOnlineVideos.VideoInfo foVideo) { - /* - string lsSQL = String.Format("select FAVORITE_ID from FAVORITE where FAVORITE_NM='{0}'", fsFavoriteNm.Replace("'", "''")); - SQLiteResultSet loResultSet = m_db.Execute(lsSQL); - - string lsFavID = (String)loResultSet.GetColumn(0)[0]; - //Log.Info("fav id = {0}",lsFavID); - //Log.Info("song id = {0}", foVideo.songId); - lsSQL = string.Format("delete from FAVORITE_VIDEOS where SONG_ID='{0}' and FAVORITE_ID = {1}", foVideo.songId, lsFavID); + + + String lsSQL = string.Format("delete from FAVORITE_VIDEOS where VDO_ID='{0}' ", foVideo.VideoID); m_db.Execute(lsSQL); if (m_db.ChangedRows() > 0) { @@ -157,8 +152,8 @@ { return false; } - */ - return false; + + } @@ -193,7 +188,7 @@ video.Title = DatabaseUtility.Get(loResultSet, iRow, "VDO_NM"); video.VideoUrl = DatabaseUtility.Get(loResultSet,iRow,"VDO_URL"); video.SiteID = DatabaseUtility.Get(loResultSet,iRow,"VDO_SITE_ID"); - + video.VideoID = DatabaseUtility.GetAsInt(loResultSet,iRow,"VDO_ID"); Log.Info("Pulled {0} out of the database",video.Title); loFavoriteList.Add(video); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -83,9 +83,11 @@ public String Tags = ""; public Object Other; public string SiteID = ""; + public int VideoID; public VideoInfo() { Length = -1; + VideoID = -1; } } public class FavoriteVideoInfo:VideoInfo @@ -236,6 +238,7 @@ if (dlgSel != null) { dlgSel.Add("Save"); // Save + Log.Info("msSelectedCategoryValue = "+msSelectedCategoryValue); if(msSelectedCategoryValue.StartsWith("fav:") ==false){ dlgSel.Add("Add to favorites"); } @@ -265,9 +268,10 @@ siteUtil.AddFavorite(moCurrentVideoList[liSelected],msSelectedSiteId); }else{ - siteUtil.removeFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); + siteUtil.RemoveFavorite(moCurrentVideoList[liSelected]); + DisplayVideos(true); } - break; + break; case 3: //Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); SiteUtilBase site = SiteUtilFactory.getSiteUtil(msSelectedSiteId); @@ -282,7 +286,7 @@ } DisplayVideos(false); break; - + } base.OnShowContextMenu(); } @@ -304,8 +308,6 @@ _CurrentState = State.home; return; } - }else{ - Log.Info("Action:"+action.wID); } base.OnAction(action); } @@ -521,7 +523,7 @@ facadeView.Add(loListItem); //loSiteUtil.getSiteFavorites(); } - */ + */ } /* private bool isSiteFavoriteEnabled(){ @@ -529,7 +531,7 @@ SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); return (loSiteUtil.isSiteFavoritesEnabled() && String.IsNullOrEmpty(loSite.username) == false); } - */ + */ private void DisplayVideos(bool fbRefresh) { List<VideoInfo> loListItems; @@ -657,6 +659,10 @@ DisplayVideoInfo(moCurrentVideoList[item.ItemId-1]); } } + public void OnAction2(Action foAction){ + Log.Info("MyFlashPlayer received action:"+foAction.wID); + } + private bool GetUserInputString(ref string sString) { VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); @@ -875,17 +881,34 @@ GUIControl.HideControl(GetID,12); GUIControl.HideControl(GetID,13); GUIControl.HideControl(GetID,14); + GUIControl.HideControl(GetID,111); + GUIControl.HideControl(GetID,121); + GUIControl.HideControl(GetID,131); + GUIControl.HideControl(GetID,141); }else{ GUIPropertyManager.SetProperty("#videotitle", foVideo.Title); - GUIPropertyManager.SetProperty("#tags", foVideo.Tags); + if(String.IsNullOrEmpty(foVideo.Tags)){ + GUIPropertyManager.SetProperty("#tags", "None"); + //GUIPropertyManager. + }else{ + GUIPropertyManager.SetProperty("#tags", foVideo.Tags); + } TimeSpan t = TimeSpan.FromSeconds(foVideo.Length); GUIPropertyManager.SetProperty("#length", t.ToString()); - GUIPropertyManager.SetProperty("#desc", foVideo.Description); + if(String.IsNullOrEmpty(foVideo.Description)){ + GUIPropertyManager.SetProperty("#desc", "None"); + }else{ + GUIPropertyManager.SetProperty("#desc", foVideo.Description); + } GUIControl.ShowControl(GetID,11); GUIControl.ShowControl(GetID,12); GUIControl.ShowControl(GetID,13); GUIControl.ShowControl(GetID,14); + GUIControl.ShowControl(GetID,111); + GUIControl.ShowControl(GetID,121); + GUIControl.ShowControl(GetID,131); + GUIControl.ShowControl(GetID,141); //Log.Info(foVideo.Description); } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -9,80 +9,80 @@ using System.Net; namespace OnlineVideos { - public static class ImageDownloader - { - #region OldCode - public static bool _imagesDone = false; - public static bool _stopDownload = false; - public static List<String> _imageLocationList = new List<String>(); - - public static void DownloadImages(object sender, DoWorkEventArgs e) - { - _stopDownload = false; - _imagesDone = false; - _imageLocationList = new List<String>(); - Object [] loArguments = (Object [])e.Argument; - GUIFacadeControl facadeView = (GUIFacadeControl)loArguments[0]; - List<String> loImageUrlList = (List<String>) loArguments[1]; - String lsThumbLocation = (String)loArguments[2]; - - - Log.Info("OnlineVideos thumbnails will be saved in {0}",lsThumbLocation); - //int liSelectedIndex = Convert.ToInt32(loArguments[2]); - int liIdx = 0; - List<String> loImageFileList = new List<String>(loImageUrlList.Count); - foreach(String lsUrl in loImageUrlList){ - Log.Info("Getting image :"+lsUrl); - liIdx++; - if (lsUrl == String.Empty) - { - continue; - } - if (_stopDownload) - { - break; - } - string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl); - //Log.Info("1)lsThumb = "+lsThumb); - lsThumb = System.IO.Path.GetFileName(lsThumb); - //Log.Info("2)lsThumb = "+lsThumb); - string lsThumbsDir = lsThumbLocation; - if (System.IO.Directory.Exists(lsThumbsDir) ==false) - { - System.IO.Directory.CreateDirectory(lsThumbsDir); - } - lsThumb =lsThumbsDir + lsThumb; - //Log.Info("3)lsThumb = "+lsThumb); - //Log.Info(lsThumb); - if (System.IO.File.Exists(lsThumb) == false) - { - //Log.Info("lsThumb doesn't exist"); - String lsFilename = System.IO.Path.GetFileName(lsThumb); - //moLog.Info("Filename will be {0}", lsFilename); - MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb); - System.Threading.Thread.Sleep(25); - } - if (System.IO.File.Exists(lsThumb)) - { - //Log.Info("lsThumb exist now"); - //facadeView[liIdx].IconImageBig = lsThumb; - loImageFileList.Add(lsThumb); - } - else - { - //Log.Info("lsThumb couldn't be created"); - loImageFileList.Add(""); - //facadeView[liIdx].IconImageBig = ""; - } + public static class ImageDownloader + { + #region OldCode + public static bool _imagesDone = false; + public static bool _stopDownload = false; + public static List<String> _imageLocationList = new List<String>(); + + public static void DownloadImages(object sender, DoWorkEventArgs e) + { + _stopDownload = false; + _imagesDone = false; + _imageLocationList = new List<String>(); + Object [] loArguments = (Object [])e.Argument; + GUIFacadeControl facadeView = (GUIFacadeControl)loArguments[0]; + List<String> loImageUrlList = (List<String>) loArguments[1]; + String lsThumbLocation = (String)loArguments[2]; + + + Log.Info("OnlineVideos thumbnails will be saved in {0}",lsThumbLocation); + //int liSelectedIndex = Convert.ToInt32(loArguments[2]); + int liIdx = 0; + List<String> loImageFileList = new List<String>(loImageUrlList.Count); + foreach(String lsUrl in loImageUrlList){ + Log.Info("Getting image :"+lsUrl); + liIdx++; + if (lsUrl == String.Empty) + { + continue; + } + if (_stopDownload) + { + break; + } + string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl); + //Log.Info("1)lsThumb = "+lsThumb); + lsThumb = System.IO.Path.GetFileName(lsThumb); + //Log.Info("2)lsThumb = "+lsThumb); + string lsThumbsDir = lsThumbLocation; + if (System.IO.Directory.Exists(lsThumbsDir) ==false) + { + System.IO.Directory.CreateDirectory(lsThumbsDir); + } + lsThumb =lsThumbsDir + lsThumb; + //Log.Info("3)lsThumb = "+lsThumb); + //Log.Info(lsThumb); + if (System.IO.File.Exists(lsThumb) == false) + { + //Log.Info("lsThumb doesn't exist"); + String lsFilename = System.IO.Path.GetFileName(lsThumb); + //moLog.Info("Filename will be {0}", lsFilename); + MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb); + System.Threading.Thread.Sleep(25); + } + if (System.IO.File.Exists(lsThumb)) + { + //Log.Info("lsThumb exist now"); + //facadeView[liIdx].IconImageBig = lsThumb; + loImageFileList.Add(lsThumb); + } + else + { + //Log.Info("lsThumb couldn't be created"); + loImageFileList.Add(""); + //facadeView[liIdx].IconImageBig = ""; + } //facadeView[liIdx].ThumbnailImage = lsThumb; _imageLocationList.Add(lsThumb); facadeView[liIdx].ItemId = liIdx; //Log.Info("Set item {0} with image {1}", facadeView[liIdx].ItemId,facadeView[liIdx].ThumbnailImage); facadeView[liIdx].RetrieveArt = true; - facadeView[liIdx].RefreshCoverArt(); - - } - /* + facadeView[liIdx].RefreshCoverArt(); + + } + /* foreach (String lsFileName in loImageFileList) { liIdx++; @@ -90,14 +90,14 @@ facadeView[liIdx]. } - */ - _imagesDone = true; - //facadeView.SelectedListItemIndex = liSelectedIndex; - - //GUIControl.SelectItemControl(4755, facadeView.GetID, liSelectedIndex); + */ + _imagesDone = true; + //facadeView.SelectedListItemIndex = liSelectedIndex; + + //GUIControl.SelectItemControl(4755, facadeView.GetID, liSelectedIndex); - } - /* + } + /* public static String DownloadImage(String fsUrl,String fsThumbLocation){ string lsThumb = MediaPortal.Util.Utils.GetThumb(fsUrl); lsThumb = System.IO.Path.GetFileName(lsThumb); @@ -125,87 +125,88 @@ //facadeView[liIdx].IconImageBig = ""; } } - */ - #endregion - public static void getImages(List<String> imageUrlList,String ThumbLocation,GUIFacadeControl facadeView){ - Log.Info("Getting images"); - BackgroundWorker worker = new BackgroundWorker(); + */ + #endregion + public static void getImages(List<String> imageUrlList,String ThumbLocation,GUIFacadeControl facadeView){ + Log.Info("Getting images"); + BackgroundWorker worker = new BackgroundWorker(); Object[] loParms = new Object[4]; - loParms[0] = facadeView; - loParms[1] = imageUrlList; - loParms[2] = ThumbLocation; - worker.DoWork += new DoWorkEventHandler(DownloadImages2); - //_imagesDone = false; - worker.RunWorkerAsync(loParms); + loParms[0] = facadeView; + loParms[1] = imageUrlList; + loParms[2] = ThumbLocation; + worker.DoWork += new DoWorkEventHandler(DownloadImages2); + //_imagesDone = false; + worker.RunWorkerAsync(loParms); - // using (WaitCursor cursor = new WaitCursor()) - // { - // while (_imagesDone == false) - // { - // GUIWindowManager.Process(); - // } - //} - } - - public static void DownloadImages2(object sender, DoWorkEventArgs e) - { - //Log.Info("Using thumb directory:{0}", _imageDirectory); - Log.Info("Downloading images"); - _imageLocationList.Clear(); - _imagesDone = false; - _stopDownload = false; - //List<String> imageList = (List<String>)e.Argument; - //NameValueCollection imgNameUrlList = (NameValueCollection)e.Argument; - Object [] loArguments = (Object [])e.Argument; - GUIFacadeControl facadeView = (GUIFacadeControl)loArguments[0]; - List<String> loImageUrlList = (List<String>) loArguments[1]; - String lsThumbLocation = (String)loArguments[2]; - - - Log.Info("OnlineVideos thumbnails will be saved in {0}",lsThumbLocation); - //int liSelectedIndex = Convert.ToInt32(loArguments[2]); - int liIdx = 0; - //List<String> loImageFileList = new List<String>(loImageUrlList.Count); - WebClient client = new WebClient(); + // using (WaitCursor cursor = new WaitCursor()) + // { + // while (_imagesDone == false) + // { + // GUIWindowManager.Process(); + // } + //} + } + + public static void DownloadImages2(object sender, DoWorkEventArgs e) + { + //Log.Info("Using thumb directory:{0}", _imageDirectory); + Log.Info("Downloading images"); + _imageLocationList.Clear(); + _imagesDone = false; + _stopDownload = false; + //List<String> imageList = (List<String>)e.Argument; + //NameValueCollection imgNameUrlList = (NameValueCollection)e.Argument; + Object [] loArguments = (Object [])e.Argument; + GUIFacadeControl facadeView = (GUIFacadeControl)loArguments[0]; + List<String> loImageUrlList = (List<String>) loArguments[1]; + String lsThumbLocation = (String)loArguments[2]; + + + Log.Info("OnlineVideos thumbnails will be saved in {0}",lsThumbLocation); + //int liSelectedIndex = Convert.ToInt32(loArguments[2]); + int liIdx = 0; + //List<String> loImageFileList = new List<String>(loImageUrlList.Count); + WebClient client = new WebClient(); - string imageLocation; - string thumbnailLocation; - string name; - foreach(String url in loImageUrlList){ - liIdx++; - if (_stopDownload) - { - Log.Info("Received Request to stop Download"); - break; - } - Log.Info("downloading image :" + url); - name = MediaPortal.Util.Utils.GetThumb(url); - //Log.Info("1)lsThumb = "+lsThumb); - name = System.IO.Path.GetFileNameWithoutExtension(name); - imageLocation = lsThumbLocation + name + "L.jpg"; - thumbnailLocation = lsThumbLocation + name + ".jpg"; - if (System.IO.File.Exists(thumbnailLocation) == false) - { - client.DownloadFile(url, imageLocation); - if (System.IO.File.Exists(thumbnailLocation) == false) - { - //int iRotate = dbs.GetRotation(imageLocation); - MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0); - System.Threading.Thread.Sleep(25); - System.IO.File.Delete(imageLocation); - } - - } - _imageLocationList.Add(thumbnailLocation); - facadeView[liIdx].RetrieveArt = true; - facadeView[liIdx].RefreshCoverArt(); - //i++; + string imageLocation; + string thumbnailLocation; + string name; + foreach(String url in loImageUrlList){ + liIdx++; + if (_stopDownload) + { + Log.Info("Received Request to stop Download"); + break; + } + + name = MediaPortal.Util.Utils.GetThumb(url); + //Log.Info("1)lsThumb = "+lsThumb); + name = System.IO.Path.GetFileNameWithoutExtension(name); + imageLocation = lsThumbLocation + name + "L.jpg"; + thumbnailLocation = lsThumbLocation + name + ".jpg"; + if (System.IO.File.Exists(thumbnailLocation) == false) + { + Log.Info("downloading image :" + url); + client.DownloadFile(url, imageLocation); + if (System.IO.File.Exists(thumbnailLocation) == false) + { + //int iRotate = dbs.GetRotation(imageLocation); + MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0); + System.Threading.Thread.Sleep(25); + System.IO.File.Delete(imageLocation); + } + + } + _imageLocationList.Add(thumbnailLocation); + facadeView[liIdx].RetrieveArt = true; + facadeView[liIdx].RefreshCoverArt(); + //i++; - } - Log.Info("Setting imagesDone to true"); - _imagesDone = true; - } - - } + } + Log.Info("Setting imagesDone to true"); + _imagesDone = true; + } + + } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -25,30 +25,59 @@ } public override List<GUIOnlineVideos.VideoInfo> getVideoList(String fsUrl) { - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += new DoWorkEventHandler(HDTrailerPlugin.AppleTrailers.GetAppleTrailersRSS); - AppleTrailers._workerCompleted = false; - worker.RunWorkerAsync(fsUrl); - using (WaitCursor cursor = new WaitCursor()) - { - while (HDTrailerPlugin.AppleTrailers._workerCompleted == false) - GUIWindowManager.Process(); - } List<GUIOnlineVideos.VideoInfo> loListItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loItem; - foreach (ITMSClient.TrailerInfo trailer in HDTrailerPlugin.AppleTrailers.trailers) - { - loItem = new GUIOnlineVideos.VideoInfo(); - loItem.Title = trailer.Title; - if(trailer.PosterUrl!=null) - loItem.ImageUrl = trailer.PosterUrl.ToString(); - loItem.Description = trailer.Overview; - loItem.VideoUrl = trailer.Url.ToString(); - loItem.Other = trailer; - //loItem.Length = trailer.. - loListItems.Add(loItem); + if(fsUrl.StartsWith("%")){ + if(fsUrl.Length == 1){ + loListItems = getAllTrailers(); + loListItems.Sort(delegate(GUIOnlineVideos.VideoInfo v1, GUIOnlineVideos.VideoInfo v2) { return v1.Title.CompareTo(v2.Title); }); + }else{ + fsUrl = fsUrl.Substring(1); + loListItems = search(fsUrl); + } + }else{ + /* + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += new DoWorkEventHandler(HDTrailerPlugin.AppleTrailers.GetAppleTrailersRSS); + AppleTrailers._workerCompleted = false; + worker.RunWorkerAsync(fsUrl); + using (WaitCursor cursor = new WaitCursor()) + { + while (HDTrailerPlugin.AppleTrailers._workerCompleted == false) + GUIWindowManager.Process(); + } + */ + DownloadTrailers(fsUrl); + GUIOnlineVideos.VideoInfo loItem; + foreach (ITMSClient.TrailerInfo trailer in HDTrailerPlugin.AppleTrailers.trailers) + { + + loItem = new GUIOnlineVideos.VideoInfo(); + loItem.Title = trailer.Title; + if(trailer.PosterUrl!=null) + loItem.ImageUrl = trailer.PosterUrl.ToString(); + + loItem.Tags = trailer.Genre; + /* + try{ + ITMSClient.TrailerInfo trailerMore = AppleTrailers.ProcessTrailer(trailer); + loItem.Description = trailerMore.Overview; + Log.Info("trailer desc set="+(String.IsNullOrEmpty(loItem.Description)==false)); + + loItem.VideoUrl = trailerMore.TrailerStreamCollection[0].Uri.ToString(); + //foreach(TrailerStream stream in trailerMore.TrailerStreamCollection){ + //Log.Info("Trailer stream type:{0} url:{1} size:{2}",stream.Type,stream.Uri,stream.Size); + //} + //loItem.Other = trailer; + //loItem.Length = trailer.. + */ + loListItems.Add(loItem); + /* + }catch(Exception e){ + Log.Debug("skipped {0}. Unable to parse video url out of {1}",trailer.Title, trailer.Url); + } + */ + } } - return loListItems; } @@ -59,40 +88,36 @@ trailer = AppleTrailers.ProcessTrailer(trailer); return trailer.TrailerStreamCollection[0].Uri.ToString(); } - private List<GUIOnlineVideos.VideoInfo> search(String fsQuery){ + public List<GUIOnlineVideos.VideoInfo> getAllTrailers(){ + GUIOnlineVideos.VideoInfo loItem; Dictionary<string, GUIOnlineVideos.RssLink> loRssList= OnlineVideoSettings.getInstance().moSiteList[getSiteId()].RssList; List<GUIOnlineVideos.VideoInfo> loListItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loItem; foreach(GUIOnlineVideos.RssLink link in loRssList.Values){ + if(link.url.StartsWith("%")){ + continue; + } + //Log.Info("searching link:{0}",link.name); - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += new DoWorkEventHandler(HDTrailerPlugin.AppleTrailers.GetAppleTrailersRSS); - AppleTrailers._workerCompleted = false; - worker.RunWorkerAsync(link.url); + DownloadTrailers(link.url); Dictionary<string, string> loTrailersFound = new Dictionary<string,string>(); - using (WaitCursor cursor = new WaitCursor()) - { - while (HDTrailerPlugin.AppleTrailers._workerCompleted == false) - GUIWindowManager.Process(); - } foreach (ITMSClient.TrailerInfo trailer in HDTrailerPlugin.AppleTrailers.trailers) { - if(trailer.Title.Contains(fsQuery)){ - if(loTrailersFound.ContainsKey(trailer.Title) == false){ - loTrailersFound.Add(trailer.Title, ""); - loItem = new GUIOnlineVideos.VideoInfo(); - loItem.Title = trailer.Title; - if(trailer.PosterUrl!=null){ - loItem.ImageUrl = trailer.PosterUrl.ToString(); - } - loItem.Description = trailer.Overview; - loItem.VideoUrl = trailer.Url.ToString(); - loItem.Other = trailer; - //loItem.Length = trailer.. - loListItems.Add(loItem); + + if(loTrailersFound.ContainsKey(trailer.Title) == false){ + loTrailersFound.Add(trailer.Title.ToUpper(), ""); + loItem = new GUIOnlineVideos.VideoInfo(); + loItem.Title = trailer.Title; + if(trailer.PosterUrl!=null){ + loItem.ImageUrl = trailer.PosterUrl.ToString(); } + loItem.Description = trailer.Overview; + loItem.VideoUrl = trailer.Url.ToString(); + loItem.Other = trailer; + //loItem.Length = trailer.. + loListItems.Add(loItem); } + } @@ -100,5 +125,36 @@ return loListItems; } + private List<GUIOnlineVideos.VideoInfo> search(String fsQuery){ + fsQuery = fsQuery.ToUpper(); + + List<GUIOnlineVideos.VideoInfo>loAllTrailers = getAllTrailers(); + List<GUIOnlineVideos.VideoInfo>loSearchResult = loAllTrailers.FindAll(delegate(GUIOnlineVideos.VideoInfo v1) { return v1.Title.ToUpper().Contains(fsQuery);}); + + return loSearchResult; + } + private void DownloadTrailers(String fsLink){ + + //Log.Info("getting trailers from url:"+fsLink.url); + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += new DoWorkEventHandler(HDTrailerPlugin.AppleTrailers.GetAppleTrailersRSS); + AppleTrailers._workerCompleted = false; + + worker.RunWorkerAsync(fsLink); + DateTime startTime = DateTime.Now; + TimeSpan duration = new TimeSpan(); + using (WaitCursor cursor = new WaitCursor()) + { + + while (HDTrailerPlugin.AppleTrailers._workerCompleted == false && duration.TotalSeconds < 10){ + //Log.Info("donwload trailer duration = {0} seconds",duration.TotalSeconds); + GUIWindowManager.Process(); + duration = DateTime.Now - startTime;; + + } + } + + //Log.Info("finished getting trailers from url:"+fsLink.url); + } } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -61,22 +61,27 @@ // mediaportal.xml public static string server = string.Empty; - + public void HandleHttpError(object sender, ITMSClient.HTTPErrorEventArgs e){ + + } public static void GetAppleTrailersRSS(object sender, DoWorkEventArgs e) { _workerCompleted = false; + //.+=new ITMSClient.HTTPErrorEventHandler(HandleHttpError); + //loListItem.OnItemSelected+= new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnVideoItemSelected); string xmlurl = e.Argument.ToString(); trailers.Clear(); Uri pageUri = new Uri(xmlurl); ITMSClient.ITMSContent xmlContent = ITMSClient.ITMSHelper.GetITMSPage(pageUri); - //Console.WriteLine(xmlContent.Xml); + Log.Info(xmlContent.Xml); if (xmlContent.IsValid) { + Log.Info("xml is valid"); ITMSClient.TrailerIndex indexPage = new ITMSClient.TrailerIndex("test", xmlContent); RSSTitle = "Apple HD Trailers"; //trailers.Add(indexPage.TrailerInfoCollection.); - Log.Info("FOund {0} trailers.", indexPage.TrailerInfoCollection.Count); + //Log.Info("FOund {0} trailers.", indexPage.TrailerInfoCollection.Count); foreach (ITMSClient.TrailerInfo trailerInfo in indexPage.TrailerInfoCollection) { /* @@ -115,7 +120,7 @@ { ITMSClient.TrailerInfo trailerInfo = (ITMSClient.TrailerInfo)obj; - Log.Info("Processing Trailer {0}",trailerInfo.Title); + //Log.Info("Processing Trailer {0}",trailerInfo.Title); // Lookup the trailer in the media library string key = trailerInfo.Title.GetHashCode().ToString(); // Populate the rest of the meta data Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsContent.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsContent.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsContent.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -21,10 +21,10 @@ /// <param name="Xml">Xml.</param> public ITMSContent(HttpWebResponse response, string Xml) { - MediaPortal.GUI.Library.Log.Info("creating ITMSContent"); + //MediaPortal.GUI.Library.Log.Info("creating ITMSContent"); _webResponse = response; _xml = Xml; - MediaPortal.GUI.Library.Log.Info("Finished creating ITMSContent"); + //MediaPortal.GUI.Library.Log.Info("Finished creating ITMSContent"); } /// <summary> Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -47,7 +47,7 @@ /// <returns></returns> static public TrailerInfo PopulateTrailerDetails(TrailerInfo trailerInfo, ITMSClient.TrailerSize desiredSize) { - Log.Info("Populating Trailer details for {0}", trailerInfo.Title); + //Log.Info("Populating Trailer details for {0}", trailerInfo.Title); string[] MONTHS = new string[]{"January","February","March","April","May","June","July","August","September","October","November","December"}; //const string DIRECTOR = "(dir.)"; Match fields; @@ -62,7 +62,7 @@ fields = RegexParsers.moviedetailsRegex1.Match(infoPage.Xml); if (fields.Success) { - Log.Info("got the movie details for {0}",trailerInfo.Title); + //Log.Info("got the movie details for {0}",trailerInfo.Title); trailerInfo.Title = fields.Groups["title"].Value.Replace('\u0092', '\'').Replace('\u0093', '"').Replace('\u0094', '"'); trailerInfo.PosterUrl = new Uri(fields.Groups["poster"].Value); trailerInfo.Copyright = fields.Groups["copyright"].Value; @@ -139,7 +139,7 @@ { foreach (Capture url in fields.Groups["urls"].Captures) { - Log.Info("Found stream url:{0}", url); + //Log.Info("Found stream url:{0}", url); TrailerStreamCollection tsc = GetTrailerStreamCollection(new Uri(infoPage.WebResponse.ResponseUri, url.Value)); TrailerStream myStream = GetDesiredTrailerStream(tsc, desiredSize); trailerInfo.TrailerStreamCollection.Add(myStream); @@ -198,8 +198,8 @@ HttpWebResponse response = null; ITMSContent content = null; - Debug.WriteLine("GetITMSPage: " + uri.AbsoluteUri); - Log.Info("GetITMSPage: " + uri.AbsoluteUri); + Log.Debug("GetITMSPage: " + uri.AbsoluteUri); + //Log.Info("GetITMSPage: " + uri.AbsoluteUri); try { request = (HttpWebRequest) HttpWebRequest.Create(uri); @@ -211,33 +211,35 @@ if (ifModifiedSince != DateTime.MinValue) request.IfModifiedSince = ifModifiedSince; - Log.Info("getiing request response"); + //Log.Info("getiing request response"); response = (HttpWebResponse) request.GetResponse(); - Log.Info("got response"); + //Log.Info("got response"); sReader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8, false, (int) Math.Abs(response.ContentLength)); - Log.Info("Got Response Stream"); + //Log.Info("Got Response Stream"); - Log.Info("Download xml"); + //Log.Info("Download xml"); content = new ITMSContent(response, HttpUtility.HtmlDecode( sReader.ReadToEnd())); Log.Info("created ITMSContent"); - //Debug.WriteLine(response.LastModified); + //Log.Debug(response.LastModified); } catch (WebException ex) { - Debug.WriteLine(ex.GetBaseException().Message); + Log.Debug(ex.GetBaseException().Message); content = new ITMSContent(ex); if (ex.Response is HttpWebResponse) { HttpWebResponse httpResponse = ex.Response as HttpWebResponse; if (httpResponse.StatusCode == HttpStatusCode.NotModified) { - Debug.WriteLine(uri.AbsoluteUri + " not modified since " + ifModifiedSince); + Log.Debug(uri.AbsoluteUri + " not modified since " + ifModifiedSince); content = new ITMSContent(response, String.Empty); } } + }catch(Exception e){ + Log.Error(e); } finally { @@ -258,7 +260,7 @@ /// <returns></returns> private static TrailerStream GetDesiredTrailerStream(TrailerStreamCollection trailerStreams, TrailerSize desiredSize) { - Log.Info("getting desired Trailer size of {0}", desiredSize); + //Log.Info("getting desired Trailer size of {0}", desiredSize); // Find the largest desired size supported by the available streams while (trailerStreams.ContainsKey(desiredSize) == false && desiredSize > 0) desiredSize = desiredSize - 1; @@ -281,7 +283,7 @@ } } */ - Log.Info("Finished getting desired trailer"); + //Log.Info("Finished getting desired trailer"); return stream; } @@ -317,9 +319,9 @@ { TrailerSize size = (TrailerSize) Enum.Parse(typeof(TrailerSize), m.Groups["size"].Value, true); - Log.Info("found size {0}",size); + //Log.Info("found size {0}",size); Uri uri = new Uri(trailerPage.WebResponse.ResponseUri, m.Groups["url"].Value); - Log.Info("found url {0}", uri.ToString()); + //Log.Info("found url {0}", uri.ToString()); TrailerStream ts = new TrailerStream(size, uri); ts.Length = length; ts.Type = type; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -21,6 +21,7 @@ using System.Text.RegularExpressions; using System.Net; using System.Diagnostics; +using MediaPortal.GUI.Library; namespace ITMSClient { @@ -110,6 +111,7 @@ /// </summary> protected void ParseIndexPage() { + Log.Info("Parsing index page"); MatchCollection movieItemCollection = RegexParsers.indexDetailsRegex.Matches(Content.Xml); _trailers = new TrailerInfoCollection(movieItemCollection.Count); Debug.Assert(movieItemCollection.Count > 0, "No movies found in index page xml"); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -30,9 +30,11 @@ - SiteUtilBase loUtil = new YouTubeUtil(); + //SiteUtilBase loUtil = new YouTubeUtil(); //List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("http://youtube.com/rss/global/top_rated.rss"); + SiteUtilBase loUtil = new ItunesTrailerUtil(); + List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("%transformers"); /* @@ -84,9 +86,9 @@ List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("http://stage6.divx.com/rss/videos/order:rating"); */ //Console.WriteLine(loUtil.getUrl(loList[0].VideoUrl)); - //foreach(GUIOnlineVideos.VideoInfo loVideoInfo in loList){ -// Console.WriteLine("title:{0} \nurl:{1} \nimage:{2}",loVideoInfo.Title,loVideoInfo.VideoUrl, loVideoInfo.ImageUrl); -// } + foreach(GUIOnlineVideos.VideoInfo loVideoInfo in loList){ + Console.WriteLine("title:{0} \nurl:{1} \nimage:{2}",loVideoInfo.Title,loVideoInfo.VideoUrl, loVideoInfo.ImageUrl); + } //YouTubeUtil youtube = new YouTubeUtil(); //youtube.username = "MepoPlugin"; //youtube.password = "mepo"; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -80,8 +80,10 @@ db.addFavoriteVideo(foVideo,fsSiteId); } - public virtual bool removeFavorite(String fsId,String fsUserName,String fsPassword){ - return false; + public virtual bool RemoveFavorite(GUIOnlineVideos.VideoInfo foVideo){ + Log.Info("SiteUtilBase removeFavorites."); + FavoritesDatabase db = FavoritesDatabase.getInstance(); + return db.removeFavoriteVideo(foVideo); } public virtual String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.Site foSite) @@ -111,8 +113,13 @@ RssItem loRssItem; //GUIListItem loListItem; MediaContent loMediaContent; + int itemCount = 0; foreach (XmlNode chileNode in nodeList) { + if(itemCount>=100){ + break; + } + itemCount++; loRssItem = new RssItem(); for (int i = 0; i < chileNode.ChildNodes.Count; i++) Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs 2007-08-22 15:01:30 UTC (rev 856) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs 2007-08-22 23:07:31 UTC (rev 857) @@ -392,6 +392,7 @@ return token; } + /* public override bool removeFavorite(string fsVideoId, string fsUserName, string fsPassword) { if (isLoggedIn()==false){ @@ -421,13 +422,16 @@ RequestStream.Write(PostData, 0, PostData.Length); RequestStream.Close(); */ + /* HttpWebResponse response = (HttpWebResponse)Request.GetResponse(); StreamReader Reader = new StreamReader(response.GetResponseStream()); String lsResponse = Reader.ReadToEnd(); Console.WriteLine(lsResponse); response.Close(); return true; + } + */ public override string getSiteId() { return "1"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-08-23 00:58:49
|
Revision: 858 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=858&view=rev Author: gregmac45 Date: 2007-08-22 17:58:47 -0700 (Wed, 22 Aug 2007) Log Message: ----------- change the length to string in VideoInfo Added GenericSiteUtil to handle rss with video links Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs Added Paths: ----------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -49,7 +49,7 @@ video.Description = rssItem.description; video.ImageUrl = rssItem.mediaThumbnail; video.Title = rssItem.title; - video.Length = Convert.ToInt32(rssItem.contentList[0].duration); + video.Length = rssItem.contentList[0].duration; video.VideoUrl = rssItem.guid; loVideoList.Add(video); } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Favorites.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -183,7 +183,7 @@ GUIOnlineVideos.VideoInfo video = new GUIOnlineVideos.FavoriteVideoInfo(); video.Description = DatabaseUtility.Get(loResultSet, iRow, "VDO_DESC"); video.ImageUrl = DatabaseUtility.Get(loResultSet, iRow, "VDO_IMG_URL"); - video.Length = DatabaseUtility.GetAsInt(loResultSet, iRow, "VDO_LENGTH"); + video.Length = DatabaseUtility.Get(loResultSet, iRow, "VDO_LENGTH"); video.Tags = DatabaseUtility.Get(loResultSet, iRow, "VDO_TAGS"); video.Title = DatabaseUtility.Get(loResultSet, iRow, "VDO_NM"); video.VideoUrl = DatabaseUtility.Get(loResultSet,iRow,"VDO_URL"); @@ -226,7 +226,7 @@ GUIOnlineVideos.VideoInfo video = new GUIOnlineVideos.FavoriteVideoInfo(); video.Description = DatabaseUtility.Get(loResultSet, iRow, "VDO_DESC"); video.ImageUrl = DatabaseUtility.Get(loResultSet, iRow, "VDO_IMG_URL"); - video.Length = DatabaseUtility.GetAsInt(loResultSet, iRow, "VDO_LENGTH"); + video.Length = DatabaseUtility.Get(loResultSet, iRow, "VDO_LENGTH"); video.Tags = DatabaseUtility.Get(loResultSet, iRow, "VDO_TAGS"); video.Title = DatabaseUtility.Get(loResultSet, iRow, "VDO_NM"); video.VideoUrl = DatabaseUtility.Get(loResultSet,iRow,"VDO_URL"); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -79,14 +79,14 @@ public String Description = ""; public String VideoUrl = ""; public String ImageUrl = ""; - public int Length; + public String Length; public String Tags = ""; public Object Other; public string SiteID = ""; public int VideoID; public VideoInfo() { - Length = -1; + //Length = -1; VideoID = -1; } } @@ -894,7 +894,7 @@ }else{ GUIPropertyManager.SetProperty("#tags", foVideo.Tags); } - TimeSpan t = TimeSpan.FromSeconds(foVideo.Length); + TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(foVideo.Length)); GUIPropertyManager.SetProperty("#length", t.ToString()); if(String.IsNullOrEmpty(foVideo.Description)){ GUIPropertyManager.SetProperty("#desc", "None"); Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -0,0 +1,111 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 8/22/2007 + * Time: 4:13 PM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Collections.Generic; +using System.Collections; +using System.Xml; +using System.Text; + +using MediaPortal.GUI.Library; +using MediaPortal.Configuration; + +namespace OnlineVideos +{ + /// <summary> + /// Description of GenericSiteUtil. + /// </summary> + public class GenericSiteUtil:SiteUtilBase + { + ArrayList m_VideoExtensions = new ArrayList(); + public GenericSiteUtil(){ + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + String strTmp = xmlreader.GetValueAsString("movies", "extensions", ".avi,.mpg,.ogm,.mpeg,.mkv,.wmv,.ifo,.qt,.rm,.mov,.sbe,.dvr-ms,.ts"); + String [] tok = strTmp.Split( ','); + foreach (string extension in tok) + { + m_VideoExtensions.Add(extension.ToLower()); + } + } + + } + public override string getSiteId() + { + return "50"; + } + + protected override String getUrl(String fsId) + { + return fsId; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + if(!String.IsNullOrEmpty(rssItem.description)){ + video.Description = rssItem.description; + }else{ + video.Description = rssItem.mediaDescription; + } + if(!String.IsNullOrEmpty(rssItem.mediaThumbnail)){ + video.ImageUrl = rssItem.mediaThumbnail; + } + else if(!String.IsNullOrEmpty(rssItem.exInfoImage)){ + video.ImageUrl = rssItem.exInfoImage; + } + //get the video + if(!String.IsNullOrEmpty(rssItem.enclosure)&& isPossibleVideo(rssItem.enclosure)){ + video.VideoUrl = rssItem.enclosure; + video.Length = rssItem.enclosureDuration; + } + else if(rssItem.contentList.Count>0){ + foreach(MediaContent content in rssItem.contentList){ + if(isPossibleVideo(content.url)){ + video.VideoUrl = content.url; + video.Length = content.duration; + break; + } + + } + + + } + //if(!String.IsNullOrEmpty()){ + + //} + //if(!String.IsNullOrEmpty()){ + + //} + + + video.Title = rssItem.title; + + if(String.IsNullOrEmpty(video.VideoUrl)==false){ + + loVideoList.Add(video); + } + } + return loVideoList; + } + private bool isPossibleVideo(string fsUrl){ + string extensionFile = System.IO.Path.GetExtension(fsUrl).ToLower(); + if(String.IsNullOrEmpty(extensionFile))return true; + foreach (string extension in m_VideoExtensions) + { + if (extension == extensionFile) return true; + } + return false; + + } + } +} Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -51,7 +51,7 @@ }else if(content.type.Contains("flv")){ flvUrl = content.url; Log.Info("flv url:{0}", content.url); - video.Length = Convert.ToInt32(content.duration); + video.Length = content.duration; } else if (content.type.Contains("mp4")) { Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -47,7 +47,7 @@ video.Description = rssItem.description; video.ImageUrl = rssItem.mediaThumbnail; video.Title = rssItem.title; - video.Length = Convert.ToInt32(rssItem.contentList[0].duration); + video.Length = rssItem.contentList[0].duration; video.VideoUrl = Regex.Match(rssItem.link,@"watch/([\d]*)").Groups[1].Value; loVideoList.Add(video); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-23 00:58:47 UTC (rev 858) @@ -82,6 +82,7 @@ <Compile Include="Favorites.cs" /> <Compile Include="FavoriteUtil.cs" /> <Compile Include="FavoriteVideo.cs" /> + <Compile Include="GenericSiteUtil.cs" /> <Compile Include="OnlineVideoSettings.cs" /> <Compile Include="RocketboomUtil.cs" /> <Compile Include="MyVideodeUtil.cs" /> Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -225,6 +225,7 @@ if(n.Attributes["duration"]!=null){ loRssItem.enclosureDuration = n.Attributes["duration"].Value; } + break; case "media:category": loRssItem.mediaCategory = n.InnerText; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs 2007-08-22 23:07:31 UTC (rev 857) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs 2007-08-23 00:58:47 UTC (rev 858) @@ -127,7 +127,7 @@ Regex loRegex2 = new Regex("http://youtube.com/[?]v=([^<]*)"); video.VideoUrl = loRegex2.Match(rssItem.link).Groups[1].Value; video.Tags = rssItem.mediaCategory; - video.Length = Convert.ToInt32(rssItem.enclosureDuration); + video.Length = rssItem.enclosureDuration; loVideoList.Add(video); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-08-24 16:22:12
|
Revision: 864 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=864&view=rev Author: gregmac45 Date: 2007-08-24 09:22:01 -0700 (Fri, 24 Aug 2007) Log Message: ----------- Fixed AppleTrailers Removed some debug log message Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-24 05:58:51 UTC (rev 863) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-24 16:22:01 UTC (rev 864) @@ -57,6 +57,7 @@ loItem.ImageUrl = trailer.PosterUrl.ToString(); loItem.Tags = trailer.Genre; + loItem.Other = trailer; /* try{ ITMSClient.TrailerInfo trailerMore = AppleTrailers.ProcessTrailer(trailer); @@ -67,7 +68,7 @@ //foreach(TrailerStream stream in trailerMore.TrailerStreamCollection){ //Log.Info("Trailer stream type:{0} url:{1} size:{2}",stream.Type,stream.Uri,stream.Size); //} - //loItem.Other = trailer; + // //loItem.Length = trailer.. */ loListItems.Add(loItem); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-24 05:58:51 UTC (rev 863) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-24 16:22:01 UTC (rev 864) @@ -73,11 +73,11 @@ trailers.Clear(); Uri pageUri = new Uri(xmlurl); ITMSClient.ITMSContent xmlContent = ITMSClient.ITMSHelper.GetITMSPage(pageUri); - Log.Info(xmlContent.Xml); + //Log.Info(xmlContent.Xml); if (xmlContent.IsValid) { - Log.Info("xml is valid"); + //Log.Info("xml is valid"); ITMSClient.TrailerIndex indexPage = new ITMSClient.TrailerIndex("test", xmlContent); RSSTitle = "Apple HD Trailers"; //trailers.Add(indexPage.TrailerInfoCollection.); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-24 05:58:51 UTC (rev 863) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-24 16:22:01 UTC (rev 864) @@ -198,7 +198,7 @@ HttpWebResponse response = null; ITMSContent content = null; - Log.Debug("GetITMSPage: " + uri.AbsoluteUri); + //Log.Debug("GetITMSPage: " + uri.AbsoluteUri); //Log.Info("GetITMSPage: " + uri.AbsoluteUri); try { @@ -222,7 +222,7 @@ content = new ITMSContent(response, HttpUtility.HtmlDecode( sReader.ReadToEnd())); - Log.Info("created ITMSContent"); + //Log.Info("created ITMSContent"); //Log.Debug(response.LastModified); } catch (WebException ex) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2008-01-28 22:27:58
|
Revision: 1321 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1321&view=rev Author: gregmac45 Date: 2008-01-28 14:27:53 -0800 (Mon, 28 Jan 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs 2008-01-28 22:25:52 UTC (rev 1320) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs 2008-01-28 22:27:53 UTC (rev 1321) @@ -37,393 +37,380 @@ /// </summary> private void InitializeComponent() { - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.General_Tab = new System.Windows.Forms.TabPage(); - this.label4 = new System.Windows.Forms.Label(); - this.cmbTrailerSize = new System.Windows.Forms.ComboBox(); - this.txtDownloadDir = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - 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.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); - 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(17, 16); - this.tabControl1.Margin = new System.Windows.Forms.Padding(4); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(639, 715); - this.tabControl1.TabIndex = 0; - // - // General_Tab - // - this.General_Tab.Controls.Add(this.label4); - this.General_Tab.Controls.Add(this.cmbTrailerSize); - this.General_Tab.Controls.Add(this.txtDownloadDir); - this.General_Tab.Controls.Add(this.label3); - 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, 25); - this.General_Tab.Margin = new System.Windows.Forms.Padding(4); - this.General_Tab.Name = "General_Tab"; - this.General_Tab.Padding = new System.Windows.Forms.Padding(4); - this.General_Tab.Size = new System.Drawing.Size(631, 686); - this.General_Tab.TabIndex = 0; - this.General_Tab.Text = "General"; - this.General_Tab.UseVisualStyleBackColor = true; - // - // label4 - // - this.label4.Location = new System.Drawing.Point(20, 103); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(188, 23); - this.label4.TabIndex = 22; - this.label4.Text = "Apple Trailers Max Quality"; - // - // cmbTrailerSize - // - this.cmbTrailerSize.FormattingEnabled = true; - this.cmbTrailerSize.Location = new System.Drawing.Point(293, 100); - this.cmbTrailerSize.Name = "cmbTrailerSize"; - this.cmbTrailerSize.Size = new System.Drawing.Size(121, 24); - this.cmbTrailerSize.TabIndex = 21; - // - // txtDownloadDir - // - this.txtDownloadDir.Location = new System.Drawing.Point(293, 70); - this.txtDownloadDir.Margin = new System.Windows.Forms.Padding(4); - this.txtDownloadDir.Name = "txtDownloadDir"; - this.txtDownloadDir.Size = new System.Drawing.Size(227, 22); - this.txtDownloadDir.TabIndex = 20; - // - // label3 - // - this.label3.Location = new System.Drawing.Point(20, 74); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(143, 28); - this.label3.TabIndex = 19; - this.label3.Text = "Download Folder:"; - // - // 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(20, 391); - this.groupBox2.Margin = new System.Windows.Forms.Padding(4); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(4); - this.groupBox2.Size = new System.Drawing.Size(548, 281); - this.groupBox2.TabIndex = 18; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Site Categories"; - // - // btnAdd - // - this.btnAdd.Location = new System.Drawing.Point(116, 248); - this.btnAdd.Margin = new System.Windows.Forms.Padding(4); - this.btnAdd.Name = "btnAdd"; - this.btnAdd.Size = new System.Drawing.Size(100, 28); - 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.ItemHeight = 16; - this.CategoryList.Location = new System.Drawing.Point(8, 23); - this.CategoryList.Margin = new System.Windows.Forms.Padding(4); - this.CategoryList.Name = "CategoryList"; - this.CategoryList.Size = new System.Drawing.Size(159, 212); - this.CategoryList.TabIndex = 6; - this.CategoryList.SelectedIndexChanged += new System.EventHandler(this.CategoryListSelectedIndexChanged); - // - // btnDeleteRss - // - this.btnDeleteRss.Location = new System.Drawing.Point(8, 248); - this.btnDeleteRss.Margin = new System.Windows.Forms.Padding(4); - this.btnDeleteRss.Name = "btnDeleteRss"; - this.btnDeleteRss.Size = new System.Drawing.Size(100, 28); - 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(300, 85); - this.txtRssUrl.Margin = new System.Windows.Forms.Padding(4); - this.txtRssUrl.Name = "txtRssUrl"; - this.txtRssUrl.Size = new System.Drawing.Size(239, 22); - this.txtRssUrl.TabIndex = 16; - // - // btnRssSave - // - this.btnRssSave.Location = new System.Drawing.Point(300, 117); - this.btnRssSave.Margin = new System.Windows.Forms.Padding(4); - this.btnRssSave.Name = "btnRssSave"; - this.btnRssSave.Size = new System.Drawing.Size(100, 28); - 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(197, 53); - this.label26.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label26.Name = "label26"; - this.label26.Size = new System.Drawing.Size(95, 28); - this.label26.TabIndex = 9; - this.label26.Text = "RSS Name"; - // - // txtRssName - // - this.txtRssName.Location = new System.Drawing.Point(300, 53); - this.txtRssName.Margin = new System.Windows.Forms.Padding(4); - this.txtRssName.Name = "txtRssName"; - this.txtRssName.Size = new System.Drawing.Size(239, 22); - this.txtRssName.TabIndex = 15; - // - // label25 - // - this.label25.Location = new System.Drawing.Point(197, 85); - this.label25.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label25.Name = "label25"; - this.label25.Size = new System.Drawing.Size(95, 21); - 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(20, 129); - this.groupBox1.Margin = new System.Windows.Forms.Padding(4); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(4); - this.groupBox1.Size = new System.Drawing.Size(548, 250); - this.groupBox1.TabIndex = 17; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Sites"; - // - // txtPassword - // - this.txtPassword.Location = new System.Drawing.Point(300, 148); - this.txtPassword.Margin = new System.Windows.Forms.Padding(4); - this.txtPassword.Name = "txtPassword"; - this.txtPassword.Size = new System.Drawing.Size(239, 22); - this.txtPassword.TabIndex = 18; - // - // txtUserId - // - this.txtUserId.Location = new System.Drawing.Point(300, 117); - this.txtUserId.Margin = new System.Windows.Forms.Padding(4); - this.txtUserId.Name = "txtUserId"; - this.txtUserId.Size = new System.Drawing.Size(239, 22); - this.txtUserId.TabIndex = 17; - // - // chkAgeConfirm - // - this.chkAgeConfirm.Location = new System.Drawing.Point(176, 180); - this.chkAgeConfirm.Margin = new System.Windows.Forms.Padding(4); - this.chkAgeConfirm.Name = "chkAgeConfirm"; - this.chkAgeConfirm.Size = new System.Drawing.Size(139, 30); - this.chkAgeConfirm.TabIndex = 16; - this.chkAgeConfirm.Text = "Confirm Age"; - this.chkAgeConfirm.UseVisualStyleBackColor = true; - // - // label30 - // - this.label30.Location = new System.Drawing.Point(176, 151); - this.label30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label30.Name = "label30"; - this.label30.Size = new System.Drawing.Size(133, 28); - this.label30.TabIndex = 15; - this.label30.Text = "Password"; - // - // label29 - // - this.label29.Location = new System.Drawing.Point(176, 119); - this.label29.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label29.Name = "label29"; - this.label29.Size = new System.Drawing.Size(133, 28); - this.label29.TabIndex = 14; - this.label29.Text = "UserId"; - // - // btnSiteSave - // - this.btnSiteSave.Location = new System.Drawing.Point(176, 217); - this.btnSiteSave.Margin = new System.Windows.Forms.Padding(4); - this.btnSiteSave.Name = "btnSiteSave"; - this.btnSiteSave.Size = new System.Drawing.Size(100, 28); - 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(300, 84); - this.TxtSiteId.Margin = new System.Windows.Forms.Padding(4); - this.TxtSiteId.Name = "TxtSiteId"; - this.TxtSiteId.ReadOnly = true; - this.TxtSiteId.Size = new System.Drawing.Size(239, 22); - this.TxtSiteId.TabIndex = 12; - // - // txtSiteName - // - this.txtSiteName.Location = new System.Drawing.Point(300, 53); - this.txtSiteName.Margin = new System.Windows.Forms.Padding(4); - this.txtSiteName.Name = "txtSiteName"; - this.txtSiteName.Size = new System.Drawing.Size(239, 22); - this.txtSiteName.TabIndex = 11; - // - // label28 - // - this.label28.Location = new System.Drawing.Point(176, 85); - this.label28.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label28.Name = "label28"; - this.label28.Size = new System.Drawing.Size(133, 28); - this.label28.TabIndex = 10; - this.label28.Text = "Site ID:"; - // - // label27 - // - this.label27.Location = new System.Drawing.Point(176, 57); - this.label27.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label27.Name = "label27"; - this.label27.Size = new System.Drawing.Size(133, 28); - this.label27.TabIndex = 9; - this.label27.Text = "Site Name:"; - // - // siteList - // - this.siteList.FormattingEnabled = true; - this.siteList.ItemHeight = 16; - this.siteList.Location = new System.Drawing.Point(8, 23); - this.siteList.Margin = new System.Windows.Forms.Padding(4); - this.siteList.Name = "siteList"; - this.siteList.Size = new System.Drawing.Size(159, 196); - this.siteList.TabIndex = 5; - this.siteList.SelectedIndexChanged += new System.EventHandler(this.SiteListSelectedIndexChanged); - // - // chkEnabled - // - this.chkEnabled.Location = new System.Drawing.Point(176, 23); - this.chkEnabled.Margin = new System.Windows.Forms.Padding(4); - this.chkEnabled.Name = "chkEnabled"; - this.chkEnabled.Size = new System.Drawing.Size(139, 30); - this.chkEnabled.TabIndex = 8; - this.chkEnabled.Text = "Enabled"; - this.chkEnabled.UseVisualStyleBackColor = true; - // - // txtFilters - // - this.txtFilters.Location = new System.Drawing.Point(293, 43); - this.txtFilters.Margin = new System.Windows.Forms.Padding(4); - this.txtFilters.Name = "txtFilters"; - this.txtFilters.Size = new System.Drawing.Size(227, 22); - this.txtFilters.TabIndex = 4; - // - // label2 - // - this.label2.Location = new System.Drawing.Point(20, 47); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(265, 28); - this.label2.TabIndex = 3; - this.label2.Text = "Filter out videos with these tags"; - // - // txtThumbLoc - // - this.txtThumbLoc.Location = new System.Drawing.Point(293, 11); - this.txtThumbLoc.Margin = new System.Windows.Forms.Padding(4); - this.txtThumbLoc.Name = "txtThumbLoc"; - this.txtThumbLoc.Size = new System.Drawing.Size(227, 22); - this.txtThumbLoc.TabIndex = 2; - // - // label1 - // - this.label1.Location = new System.Drawing.Point(20, 15); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(143, 28); - this.label1.TabIndex = 1; - this.label1.Text = "Thumbnail Location:"; - // - // Configuration - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(681, 744); - this.Controls.Add(this.tabControl1); - this.Margin = new System.Windows.Forms.Padding(4); - 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); + this.label4 = new System.Windows.Forms.Label(); + this.cmbTrailerSize = new System.Windows.Forms.ComboBox(); + this.txtDownloadDir = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + 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.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); + this.label5 = new System.Windows.Forms.Label(); + this.mplayerUse = new System.Windows.Forms.CheckBox(); + this.button1 = new System.Windows.Forms.Button(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // label4 + // + this.label4.Location = new System.Drawing.Point(18, 88); + this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(141, 19); + this.label4.TabIndex = 22; + this.label4.Text = "Apple Trailers Max Quality"; + // + // cmbTrailerSize + // + this.cmbTrailerSize.FormattingEnabled = true; + this.cmbTrailerSize.Location = new System.Drawing.Point(220, 86); + this.cmbTrailerSize.Margin = new System.Windows.Forms.Padding(2); + this.cmbTrailerSize.Name = "cmbTrailerSize"; + this.cmbTrailerSize.Size = new System.Drawing.Size(92, 21); + this.cmbTrailerSize.TabIndex = 21; + // + // txtDownloadDir + // + this.txtDownloadDir.Location = new System.Drawing.Point(220, 61); + this.txtDownloadDir.Name = "txtDownloadDir"; + this.txtDownloadDir.Size = new System.Drawing.Size(171, 20); + this.txtDownloadDir.TabIndex = 20; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(18, 64); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(107, 23); + this.label3.TabIndex = 19; + this.label3.Text = "Download Folder:"; + // + // 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(12, 374); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(411, 228); + this.groupBox2.TabIndex = 18; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Site Categories"; + // + // btnAdd + // + this.btnAdd.Enabled = false; + this.btnAdd.Location = new System.Drawing.Point(135, 202); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(112, 23); + this.btnAdd.TabIndex = 17; + this.btnAdd.Text = "Add Category"; + this.btnAdd.UseVisualStyleBackColor = true; + this.btnAdd.Click += new System.EventHandler(this.BtnAddClick); + // + // CategoryList + // + this.CategoryList.FormattingEnabled = true; + this.CategoryList.Location = new System.Drawing.Point(6, 23); + 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.Enabled = false; + this.btnDeleteRss.Location = new System.Drawing.Point(6, 202); + this.btnDeleteRss.Name = "btnDeleteRss"; + this.btnDeleteRss.Size = new System.Drawing.Size(112, 23); + this.btnDeleteRss.TabIndex = 14; + this.btnDeleteRss.Text = "Delete Category"; + this.btnDeleteRss.UseVisualStyleBackColor = true; + this.btnDeleteRss.Click += new System.EventHandler(this.BtnDeleteRssClick); + // + // txtRssUrl + // + this.txtRssUrl.Enabled = false; + 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.Enabled = false; + this.btnRssSave.Location = new System.Drawing.Point(225, 95); + this.btnRssSave.Name = "btnRssSave"; + this.btnRssSave.Size = new System.Drawing.Size(95, 23); + this.btnRssSave.TabIndex = 13; + this.btnRssSave.Text = "Save Category"; + 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.Enabled = false; + 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(12, 165); + 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.Enabled = false; + 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.Enabled = false; + 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.Enabled = false; + 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.Enabled = false; + 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 Site"; + 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.Enabled = false; + 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.Enabled = false; + 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(18, 41); + 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(18, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(107, 23); + this.label1.TabIndex = 1; + this.label1.Text = "Thumbnail Location:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(18, 114); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(129, 13); + this.label5.TabIndex = 23; + this.label5.Text = "Use Mplayer for all Videos"; + // + // mplayerUse + // + this.mplayerUse.AutoSize = true; + this.mplayerUse.Location = new System.Drawing.Point(220, 113); + this.mplayerUse.Name = "mplayerUse"; + this.mplayerUse.Size = new System.Drawing.Size(15, 14); + this.mplayerUse.TabIndex = 24; + this.mplayerUse.UseVisualStyleBackColor = true; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(348, 136); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 25; + this.button1.Text = "Finish"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Configuration + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(511, 604); + this.Controls.Add(this.button1); + this.Controls.Add(this.mplayerUse); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.cmbTrailerSize); + this.Controls.Add(this.txtDownloadDir); + this.Controls.Add(this.label3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.txtFilters); + this.Controls.Add(this.label2); + this.Controls.Add(this.txtThumbLoc); + this.Controls.Add(this.label1); + this.Name = "Configuration"; + this.Text = "Configuration"; + this.Load += new System.EventHandler(this.Configuration_Load); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ConfigurationFormClosing); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } private System.Windows.Forms.ComboBox cmbTrailerSize; private System.Windows.Forms.Label label4; @@ -456,12 +443,16 @@ 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; + //private System.Windows.Forms.TabPage General_Tab; + //private System.Windows.Forms.TabControl tabControl1; void CheckBox1CheckedChanged(object sender, System.EventArgs e) { } + + private System.Windows.Forms.Label label5; + private System.Windows.Forms.CheckBox mplayerUse; + private System.Windows.Forms.Button button1; } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2008-01-28 22:25:52 UTC (rev 1320) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2008-01-28 22:27:53 UTC (rev 1321) @@ -26,8 +26,10 @@ { //private String msSelectedSiteID; private String msSelectedCategoryName; + private int miSelectedCategoryIndex = -1; + private List<GUIOnlineVideos.SiteSettings> moSiteList = new List<GUIOnlineVideos.SiteSettings>(); - + public Configuration() { // @@ -44,12 +46,13 @@ 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.SiteSettings site in settings.moSiteList.Values){ siteList.Items.Add(site.name); moSiteList.Add(site); @@ -61,7 +64,7 @@ cmbTrailerSize.SelectedIndex = cmbTrailerSize.Items.Count-1; } } - + this.mplayerUse.Checked = settings.mbForceMPlayer; } void SiteListSelectedIndexChanged(object sender, EventArgs e) @@ -75,6 +78,28 @@ txtPassword.Text = site.password; chkEnabled.Checked = site.enabled; chkAgeConfirm.Checked = site.confirmAge; + SiteUtilBase siteUtil= SiteUtilFactory.getSiteUtil(site.id); + if (siteUtil.hasConfirmAge()) + { + chkAgeConfirm.Enabled = true; + } + else + { + chkAgeConfirm.Enabled = false; + } + if(siteUtil.hasLoginSupport()){ + txtUserId.Enabled = true; + txtPassword.Enabled = true; + }else{ + txtUserId.Enabled = false; + txtPassword.Enabled = false; + } + txtSiteName.Enabled = true; + btnSiteSave.Enabled = true; + btnDeleteRss.Enabled = true; + btnRssSave.Enabled = true; + btnAdd.Enabled = true; + CategoryList.Items.Clear(); foreach(String name in site.RssList.Keys){ CategoryList.Items.Add(name); @@ -84,22 +109,37 @@ CategoryList.SelectedIndex = -1; txtRssUrl.Text = ""; txtRssName.Text = ""; + txtRssUrl.Enabled = false; + txtRssName.Enabled = false; + btnRssSave.Enabled = false; } void CategoryListSelectedIndexChanged(object sender, EventArgs e) { - if(CategoryList.SelectedIndex>-1){ - OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - GUIOnlineVideos.SiteSettings 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; - } - - + if (CategoryList.SelectedIndex !=miSelectedCategoryIndex && CategoryList.SelectedIndex > -1) + { + + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; + msSelectedCategoryName = CategoryList.SelectedItem.ToString(); + miSelectedCategoryIndex = CategoryList.SelectedIndex; + Log.Info("Category change site:{0} with selected category of {1}", site.name, msSelectedCategoryName); + GUIOnlineVideos.RssLink link = null; + link = site.RssList[msSelectedCategoryName]; + txtRssUrl.Text = link.url; + txtRssName.Text = link.name; + txtRssUrl.Enabled = true; + txtRssName.Enabled = true; + btnRssSave.Enabled = true; + + } + if (CategoryList.SelectedIndex == -1) + { + txtRssUrl.Enabled = false; + txtRssName.Enabled = false; + btnRssSave.Enabled = false; + + } } void BtnSiteSaveClick(object sender, EventArgs e) @@ -129,20 +169,26 @@ void BtnRssSaveClick(object sender, EventArgs e) { - OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - GUIOnlineVideos.SiteSettings 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; + if (CategoryList.SelectedIndex > -1) + { + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.RssLink link = null; + link = site.RssList[msSelectedCategoryName]; + site.RssList.Remove(msSelectedCategoryName); + link.name = txtRssName.Text; + link.url = txtRssUrl.Text; + CategoryList.Items[CategoryList.SelectedIndex] = txtRssName.Text; + site.RssList.Add(link.name, link); + //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://"; @@ -152,6 +198,7 @@ CategoryList.Items.Add(link.name); CategoryList.SelectedIndex = CategoryList.Items.Count-1; txtRssName.Focus(); + msSelectedCategoryName = "new"; } @@ -165,6 +212,7 @@ CategoryList.Items.RemoveAt(CategoryList.SelectedIndex); txtRssName.Text = ""; txtRssUrl.Text = ""; + miSelectedCategoryIndex = -1; } } @@ -178,6 +226,8 @@ settings.msThumbLocation = txtThumbLoc.Text; settings.msDownloadDir = txtDownloadDir.Text; settings.AppleTrailerSize = (ITMSClient.TrailerSize) cmbTrailerSize.SelectedItem; + settings.mbForceMPlayer = mplayerUse.Checked; + Log.Write("force mplayer={0}",settings.mbForceMPlayer); settings.moSiteList.Clear(); foreach(GUIOnlineVideos.SiteSettings site in moSiteList){ settings.moSiteList.Add(site.id,site); @@ -186,5 +236,10 @@ } + + private void button1_Click(object sender, EventArgs e) + { + Close(); + } } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2008-01-28 22:25:52 UTC (rev 1320) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2008-01-28 22:27:53 UTC (rev 1321) @@ -15,6 +15,7 @@ using MediaPortal.Utils; using MediaPortal.Configuration; using MediaPortal.Player; +using MediaPortal.Playlists; using MediaPortal.GUI; namespace OnlineVideos @@ -74,6 +75,10 @@ public bool confirmAge; public bool enabled; public Dictionary<String, RssLink> RssList = new Dictionary<String, RssLink>(); + public String toString() + { + return "name"; + } } public class RssLink { @@ -98,6 +103,10 @@ //Length = -1; VideoID = -1; } + public override string ToString() + { + return String.Format("Title:{0}\nDesc:{1}\nVidUrl:{2}\nImgUrl:{3}\nLength:{4}\nTags:{5}",Title,Description,VideoUrl,ImageUrl,Length,Tags); + } } public class FavoriteVideoInfo:VideoInfo { @@ -308,7 +317,7 @@ //foreach(VideoInfo video in moCurrentVideoList){ //Log.Info(video.Title); //} - moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); + moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].VideoUrl); //Log.Info("VideoList after:"); //foreach(VideoInfo video in moCurrentVideoList){ // Log.Info(video.Title); @@ -846,14 +855,57 @@ private void Play(VideoInfo foListItem) { //foListItem. - SiteSettings loSite = moSiteList[msSelectedSiteId]; - String lsUrl = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getUrl(foListItem,loSite); + SiteSettings loSiteSettings = moSiteList[msSelectedSiteId]; + SiteUtilBase loSite = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + if (mbPlayFullscreen) { - g_Player.Play(lsUrl); - GUIGraphicsContext.IsFullScreenVideo = true; - GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); + bool playing = false; + OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); + if(loSite.MultipleFilePlay()){ + PlayList videoList = PlayListPlayer.SingletonPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO_TEMP); + PlayListItem item; + + List<String> loUrlList = loSite.getMultipleVideoUrls(foListItem,loSiteSettings); + foreach(String url in loUrlList){ + if (settings.mbForceMPlayer) + { + + + item = new PlayListItem("", url + OnlineVideoSettings.MPLAYER_EXT); + } + else + { + item = new PlayListItem("", url); + } + //item.Type = PlayListType.PLAYLIST_VIDEO_TEMP; + videoList.Add(item); + + } + PlayListPlayer.SingletonPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO_TEMP; + if(PlayListPlayer.SingletonPlayer.Play(0)){ + playing = true; + } + }else{ + String lsUrl = loSite.getUrl(foListItem, loSiteSettings); + if (settings.mbForceMPlayer) + { + lsUrl = lsUrl + OnlineVideoSettings.MPLAYER_EXT; + } + if(lsUrl.EndsWith(".wmv")){ + if(g_Player.PlayAudioStream(lsUrl)) + playing = true; + }else{ + if(g_Player.Play(lsUrl)) + playing =true; + } + } + if(playing){ + GUIGraphicsContext.IsFullScreenVideo = true; + GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); + } } + /* else { GUIWindowManager.ActivateWindow(4760); @@ -870,6 +922,7 @@ GUIWindowManager.SendThreadMessage(msg); } + */ } private void SaveVideo(VideoInfo foListItem) { @@ -1164,8 +1217,14 @@ GUIPropertyManager.SetProperty("#length", "None"); } else{ - TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(foVideo.Length)); - GUIPropertyManager.SetProperty("#length", t.ToString()); + double ldLength; + if(Double.TryParse(foVideo.Length,out ldLength)){ + TimeSpan t = TimeSpan.FromSeconds(ldLength); + GUIPropertyManager.SetProperty("#length", t.ToString()); + } + else{ + GUIPropertyManager.SetProperty("#length", foVideo.Length); + } } if(String.IsNullOrEmpty(foVideo.Description)){ GUIPropertyManager.SetProperty("#desc", "None"); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2008-01-28 22:25:52 UTC (rev 1320) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2008-01-28 22:27:53 UTC (rev 1321) @@ -205,7 +205,7 @@ if (System.IO.File.Exists(thumbnailLocation) == false) { //int iRotate = dbs.GetRotation(imageLocation); - MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0); + MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0, Thumbs.SpeedThumbsSmall); System.Threading.Thread.Sleep(25); System.IO.File.Delete(imageLocation); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-08-25 00:37:31
|
Revision: 865 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=865&view=rev Author: gregmac45 Date: 2007-08-24 17:37:22 -0700 (Fri, 24 Aug 2007) Log Message: ----------- Fixed all videos downloaded with flv extension bug Fixed only flv videos displayed when browsing in downloaded video folder Writing user settings to mediaportal.xml instead of onlinevideosettings.xml site config now in onlinevideosites.xml Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs 2007-08-25 00:37:22 UTC (rev 865) @@ -39,6 +39,8 @@ { this.tabControl1 = new System.Windows.Forms.TabControl(); this.General_Tab = new System.Windows.Forms.TabPage(); + this.txtDownloadDir = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.btnAdd = new System.Windows.Forms.Button(); this.CategoryList = new System.Windows.Forms.ListBox(); @@ -65,6 +67,7 @@ this.label2 = new System.Windows.Forms.Label(); this.txtThumbLoc = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); + this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.tabControl1.SuspendLayout(); this.General_Tab.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -74,28 +77,49 @@ // tabControl1 // this.tabControl1.Controls.Add(this.General_Tab); - this.tabControl1.Location = new System.Drawing.Point(13, 13); + this.tabControl1.Location = new System.Drawing.Point(17, 16); + this.tabControl1.Margin = new System.Windows.Forms.Padding(4); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(479, 566); + this.tabControl1.Size = new System.Drawing.Size(639, 697); this.tabControl1.TabIndex = 0; // // General_Tab // + this.General_Tab.Controls.Add(this.txtDownloadDir); + this.General_Tab.Controls.Add(this.label3); 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.Location = new System.Drawing.Point(4, 25); + this.General_Tab.Margin = new System.Windows.Forms.Padding(4); 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.Padding = new System.Windows.Forms.Padding(4); + this.General_Tab.Size = new System.Drawing.Size(631, 668); this.General_Tab.TabIndex = 0; this.General_Tab.Text = "General"; this.General_Tab.UseVisualStyleBackColor = true; // + // txtDownloadDir + // + this.txtDownloadDir.Location = new System.Drawing.Point(293, 70); + this.txtDownloadDir.Margin = new System.Windows.Forms.Padding(4); + this.txtDownloadDir.Name = "txtDownloadDir"; + this.txtDownloadDir.Size = new System.Drawing.Size(227, 22); + this.txtDownloadDir.TabIndex = 20; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(20, 74); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(143, 28); + this.label3.TabIndex = 19; + this.label3.Text = "Download Folder:"; + // // groupBox2 // this.groupBox2.Controls.Add(this.btnAdd); @@ -106,18 +130,21 @@ 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.Location = new System.Drawing.Point(20, 363); + this.groupBox2.Margin = new System.Windows.Forms.Padding(4); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(411, 239); + this.groupBox2.Padding = new System.Windows.Forms.Padding(4); + this.groupBox2.Size = new System.Drawing.Size(548, 294); 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.Location = new System.Drawing.Point(116, 246); + this.btnAdd.Margin = new System.Windows.Forms.Padding(4); this.btnAdd.Name = "btnAdd"; - this.btnAdd.Size = new System.Drawing.Size(75, 23); + this.btnAdd.Size = new System.Drawing.Size(100, 28); this.btnAdd.TabIndex = 17; this.btnAdd.Text = "Add"; this.btnAdd.UseVisualStyleBackColor = true; @@ -126,17 +153,20 @@ // CategoryList // this.CategoryList.FormattingEnabled = true; - this.CategoryList.Location = new System.Drawing.Point(22, 19); + this.CategoryList.ItemHeight = 16; + this.CategoryList.Location = new System.Drawing.Point(29, 23); + this.CategoryList.Margin = new System.Windows.Forms.Padding(4); this.CategoryList.Name = "CategoryList"; - this.CategoryList.Size = new System.Drawing.Size(120, 173); + this.CategoryList.Size = new System.Drawing.Size(159, 212); this.CategoryList.TabIndex = 6; this.CategoryList.SelectedIndexChanged += new System.EventHandler(this.CategoryListSelectedIndexChanged); // // btnDeleteRss // - this.btnDeleteRss.Location = new System.Drawing.Point(6, 200); + this.btnDeleteRss.Location = new System.Drawing.Point(8, 246); + this.btnDeleteRss.Margin = new System.Windows.Forms.Padding(4); this.btnDeleteRss.Name = "btnDeleteRss"; - this.btnDeleteRss.Size = new System.Drawing.Size(75, 23); + this.btnDeleteRss.Size = new System.Drawing.Size(100, 28); this.btnDeleteRss.TabIndex = 14; this.btnDeleteRss.Text = "Delete"; this.btnDeleteRss.UseVisualStyleBackColor = true; @@ -144,16 +174,18 @@ // // txtRssUrl // - this.txtRssUrl.Location = new System.Drawing.Point(225, 69); + this.txtRssUrl.Location = new System.Drawing.Point(300, 85); + this.txtRssUrl.Margin = new System.Windows.Forms.Padding(4); this.txtRssUrl.Name = "txtRssUrl"; - this.txtRssUrl.Size = new System.Drawing.Size(180, 20); + this.txtRssUrl.Size = new System.Drawing.Size(239, 22); this.txtRssUrl.TabIndex = 16; // // btnRssSave // - this.btnRssSave.Location = new System.Drawing.Point(225, 95); + this.btnRssSave.Location = new System.Drawing.Point(300, 117); + this.btnRssSave.Margin = new System.Windows.Forms.Padding(4); this.btnRssSave.Name = "btnRssSave"; - this.btnRssSave.Size = new System.Drawing.Size(75, 23); + this.btnRssSave.Size = new System.Drawing.Size(100, 28); this.btnRssSave.TabIndex = 13; this.btnRssSave.Text = "Save"; this.btnRssSave.UseVisualStyleBackColor = true; @@ -161,24 +193,27 @@ // // label26 // - this.label26.Location = new System.Drawing.Point(148, 43); + this.label26.Location = new System.Drawing.Point(197, 53); + this.label26.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label26.Name = "label26"; - this.label26.Size = new System.Drawing.Size(71, 23); + this.label26.Size = new System.Drawing.Size(95, 28); this.label26.TabIndex = 9; this.label26.Text = "RSS Name"; // // txtRssName // - this.txtRssName.Location = new System.Drawing.Point(225, 43); + this.txtRssName.Location = new System.Drawing.Point(300, 53); + this.txtRssName.Margin = new System.Windows.Forms.Padding(4); this.txtRssName.Name = "txtRssName"; - this.txtRssName.Size = new System.Drawing.Size(180, 20); + this.txtRssName.Size = new System.Drawing.Size(239, 22); this.txtRssName.TabIndex = 15; // // label25 // - this.label25.Location = new System.Drawing.Point(148, 69); + this.label25.Location = new System.Drawing.Point(197, 85); + this.label25.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label25.Name = "label25"; - this.label25.Size = new System.Drawing.Size(71, 17); + this.label25.Size = new System.Drawing.Size(95, 21); this.label25.TabIndex = 10; this.label25.Text = "RSS URL"; // @@ -196,57 +231,65 @@ 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.Location = new System.Drawing.Point(20, 106); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(411, 203); + this.groupBox1.Padding = new System.Windows.Forms.Padding(4); + this.groupBox1.Size = new System.Drawing.Size(548, 250); this.groupBox1.TabIndex = 17; this.groupBox1.TabStop = false; this.groupBox1.Text = "Sites"; // // txtPassword // - this.txtPassword.Location = new System.Drawing.Point(225, 120); + this.txtPassword.Location = new System.Drawing.Point(300, 148); + this.txtPassword.Margin = new System.Windows.Forms.Padding(4); this.txtPassword.Name = "txtPassword"; - this.txtPassword.Size = new System.Drawing.Size(180, 20); + this.txtPassword.Size = new System.Drawing.Size(239, 22); this.txtPassword.TabIndex = 18; // // txtUserId // - this.txtUserId.Location = new System.Drawing.Point(225, 95); + this.txtUserId.Location = new System.Drawing.Point(300, 117); + this.txtUserId.Margin = new System.Windows.Forms.Padding(4); this.txtUserId.Name = "txtUserId"; - this.txtUserId.Size = new System.Drawing.Size(180, 20); + this.txtUserId.Size = new System.Drawing.Size(239, 22); this.txtUserId.TabIndex = 17; // // chkAgeConfirm // - this.chkAgeConfirm.Location = new System.Drawing.Point(132, 146); + this.chkAgeConfirm.Location = new System.Drawing.Point(176, 180); + this.chkAgeConfirm.Margin = new System.Windows.Forms.Padding(4); this.chkAgeConfirm.Name = "chkAgeConfirm"; - this.chkAgeConfirm.Size = new System.Drawing.Size(104, 24); + this.chkAgeConfirm.Size = new System.Drawing.Size(139, 30); 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.Location = new System.Drawing.Point(176, 151); + this.label30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label30.Name = "label30"; - this.label30.Size = new System.Drawing.Size(100, 23); + this.label30.Size = new System.Drawing.Size(133, 28); this.label30.TabIndex = 15; this.label30.Text = "Password"; // // label29 // - this.label29.Location = new System.Drawing.Point(132, 97); + this.label29.Location = new System.Drawing.Point(176, 119); + this.label29.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label29.Name = "label29"; - this.label29.Size = new System.Drawing.Size(100, 23); + this.label29.Size = new System.Drawing.Size(133, 28); this.label29.TabIndex = 14; this.label29.Text = "UserId"; // // btnSiteSave // - this.btnSiteSave.Location = new System.Drawing.Point(132, 176); + this.btnSiteSave.Location = new System.Drawing.Point(176, 217); + this.btnSiteSave.Margin = new System.Windows.Forms.Padding(4); this.btnSiteSave.Name = "btnSiteSave"; - this.btnSiteSave.Size = new System.Drawing.Size(75, 23); + this.btnSiteSave.Size = new System.Drawing.Size(100, 28); this.btnSiteSave.TabIndex = 13; this.btnSiteSave.Text = "Save"; this.btnSiteSave.UseVisualStyleBackColor = true; @@ -254,89 +297,101 @@ // // TxtSiteId // - this.TxtSiteId.Location = new System.Drawing.Point(225, 68); + this.TxtSiteId.Location = new System.Drawing.Point(300, 84); + this.TxtSiteId.Margin = new System.Windows.Forms.Padding(4); this.TxtSiteId.Name = "TxtSiteId"; this.TxtSiteId.ReadOnly = true; - this.TxtSiteId.Size = new System.Drawing.Size(180, 20); + this.TxtSiteId.Size = new System.Drawing.Size(239, 22); this.TxtSiteId.TabIndex = 12; // // txtSiteName // - this.txtSiteName.Location = new System.Drawing.Point(225, 43); + this.txtSiteName.Location = new System.Drawing.Point(300, 53); + this.txtSiteName.Margin = new System.Windows.Forms.Padding(4); this.txtSiteName.Name = "txtSiteName"; - this.txtSiteName.Size = new System.Drawing.Size(180, 20); + this.txtSiteName.Size = new System.Drawing.Size(239, 22); this.txtSiteName.TabIndex = 11; // // label28 // - this.label28.Location = new System.Drawing.Point(132, 69); + this.label28.Location = new System.Drawing.Point(176, 85); + this.label28.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label28.Name = "label28"; - this.label28.Size = new System.Drawing.Size(100, 23); + this.label28.Size = new System.Drawing.Size(133, 28); this.label28.TabIndex = 10; this.label28.Text = "Site ID:"; // // label27 // - this.label27.Location = new System.Drawing.Point(132, 46); + this.label27.Location = new System.Drawing.Point(176, 57); + this.label27.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label27.Name = "label27"; - this.label27.Size = new System.Drawing.Size(100, 23); + this.label27.Size = new System.Drawing.Size(133, 28); 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.ItemHeight = 16; + this.siteList.Location = new System.Drawing.Point(8, 23); + this.siteList.Margin = new System.Windows.Forms.Padding(4); this.siteList.Name = "siteList"; - this.siteList.Size = new System.Drawing.Size(120, 160); + this.siteList.Size = new System.Drawing.Size(159, 196); this.siteList.TabIndex = 5; this.siteList.SelectedIndexChanged += new System.EventHandler(this.SiteListSelectedIndexChanged); // // chkEnabled // - this.chkEnabled.Location = new System.Drawing.Point(132, 19); + this.chkEnabled.Location = new System.Drawing.Point(176, 23); + this.chkEnabled.Margin = new System.Windows.Forms.Padding(4); this.chkEnabled.Name = "chkEnabled"; - this.chkEnabled.Size = new System.Drawing.Size(104, 24); + this.chkEnabled.Size = new System.Drawing.Size(139, 30); this.chkEnabled.TabIndex = 8; this.chkEnabled.Text = "Enabled"; this.chkEnabled.UseVisualStyleBackColor = true; // // txtFilters // - this.txtFilters.Location = new System.Drawing.Point(220, 35); + this.txtFilters.Location = new System.Drawing.Point(293, 43); + this.txtFilters.Margin = new System.Windows.Forms.Padding(4); this.txtFilters.Name = "txtFilters"; - this.txtFilters.Size = new System.Drawing.Size(171, 20); + this.txtFilters.Size = new System.Drawing.Size(227, 22); this.txtFilters.TabIndex = 4; // // label2 // - this.label2.Location = new System.Drawing.Point(15, 38); + this.label2.Location = new System.Drawing.Point(20, 47); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(199, 23); + this.label2.Size = new System.Drawing.Size(265, 28); 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.Location = new System.Drawing.Point(293, 11); + this.txtThumbLoc.Margin = new System.Windows.Forms.Padding(4); this.txtThumbLoc.Name = "txtThumbLoc"; - this.txtThumbLoc.Size = new System.Drawing.Size(171, 20); + this.txtThumbLoc.Size = new System.Drawing.Size(227, 22); this.txtThumbLoc.TabIndex = 2; // // label1 // - this.label1.Location = new System.Drawing.Point(15, 12); + this.label1.Location = new System.Drawing.Point(20, 15); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(107, 23); + this.label1.Size = new System.Drawing.Size(143, 28); this.label1.TabIndex = 1; this.label1.Text = "Thumbnail Location:"; // // Configuration // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(511, 582); + this.ClientSize = new System.Drawing.Size(681, 716); this.Controls.Add(this.tabControl1); + this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Configuration"; this.Text = "Configuration"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ConfigurationFormClosing); @@ -350,6 +405,9 @@ this.groupBox1.PerformLayout(); this.ResumeLayout(false); } + private System.Windows.Forms.TextBox txtDownloadDir; + private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + private System.Windows.Forms.Label label3; private System.Windows.Forms.Button btnAdd; private System.Windows.Forms.TextBox txtRssUrl; private System.Windows.Forms.TextBox txtRssName; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2007-08-25 00:37:22 UTC (rev 865) @@ -169,6 +169,7 @@ String [] lsFilterArray = lsFilter.Split(new char[] { ',' }); settings.msFilterArray = lsFilterArray; settings.msThumbLocation = txtThumbLoc.Text; + settings.msDownloadDir = txtDownloadDir.Text; settings.moSiteList.Clear(); foreach(GUIOnlineVideos.Site site in moSiteList){ settings.moSiteList.Add(site.id,site); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.resx 2007-08-25 00:37:22 UTC (rev 865) @@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root> \ No newline at end of file Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/DownloadedVideoUtil.cs 2007-08-25 00:37:22 UTC (rev 865) @@ -33,16 +33,19 @@ public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) { List<GUIOnlineVideos.VideoInfo>loVideoInfoList = new List<GUIOnlineVideos.VideoInfo>(); - string[]loVideoList = Directory.GetFiles(fsUrl,"*.flv"); + string[]loVideoList = Directory.GetFiles(fsUrl); + GUIOnlineVideos.VideoInfo loVideoInfo; foreach (String lsVideo in loVideoList) { - loVideoInfo = new GUIOnlineVideos.VideoInfo(); - loVideoInfo.VideoUrl = lsVideo; + if(isPossibleVideo(lsVideo)){ + loVideoInfo = new GUIOnlineVideos.VideoInfo(); + loVideoInfo.VideoUrl = lsVideo; - loVideoInfo.Title = Utils.GetFilename(lsVideo); - loVideoInfoList.Add(loVideoInfo); + loVideoInfo.Title = Utils.GetFilename(lsVideo); + loVideoInfoList.Add(loVideoInfo); + } } return loVideoInfoList; } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-25 00:37:22 UTC (rev 865) @@ -181,9 +181,9 @@ public override bool Init() { + + bool result = Load(GUIGraphicsContext.Skin + @"\myonlinevideos.xml"); LoadSettings(); - bool result = Load(GUIGraphicsContext.Skin + @"\myonlinevideos.xml"); - return result; } @@ -435,17 +435,29 @@ msThumbLocation = settings.msThumbLocation; msFilterArray = settings.msFilterArray; moSiteList= settings.moSiteList; - Site FavSite = new Site(); - FavSite.id = "100"; - FavSite.name = "Favorites"; - FavSite.enabled = true; + //create a favorites site + Site loSite = new Site(); + loSite.id = "100"; + loSite.name = "Favorites"; + loSite.enabled = true; RssLink cat = new RssLink(); cat.isDynamic = true; cat.name = "dynamic"; cat.url = "favorites"; - FavSite.RssList.Add("dynamic",cat); - moSiteList.Add("100",FavSite); - msDownloadDir = settings.msDownloadDir; + loSite.RssList.Add("dynamic",cat); + moSiteList.Add("100",loSite); + + //add a downloaded videos site + loSite = new Site(); + loSite.id = "99"; + loSite.name = "Downloaded Videos"; + loSite.enabled = true; + cat = new RssLink(); + cat.name = "All"; + cat.url = settings.msDownloadDir; + loSite.RssList.Add(cat.name,cat); + moSiteList.Add("99",loSite); + } private void DisplaySites() { @@ -707,8 +719,10 @@ WebClient loClient = new WebClient(); loClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); loClient.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted); - String lsFileName = msDownloadDir+foListItem.Title; - loClient.DownloadFileAsync(new Uri(lsUrl), lsFileName + ".flv", foListItem.Title); + String lsExtension = System.IO.Path.GetExtension(lsUrl); + String lsFileName = msDownloadDir+foListItem.Title+lsExtension; + + loClient.DownloadFileAsync(new Uri(lsUrl), lsFileName, foListItem.Title); } private void DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs 2007-08-25 00:37:22 UTC (rev 865) @@ -23,19 +23,9 @@ /// </summary> public class GenericSiteUtil:SiteUtilBase { - ArrayList m_VideoExtensions = new ArrayList(); - public GenericSiteUtil(){ - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - String strTmp = xmlreader.GetValueAsString("movies", "extensions", ".avi,.mpg,.ogm,.mpeg,.mkv,.wmv,.ifo,.qt,.rm,.mov,.sbe,.dvr-ms,.ts"); - String [] tok = strTmp.Split( ','); - foreach (string extension in tok) - { - m_VideoExtensions.Add(extension.ToLower()); - } - } + - } + public override string getSiteId() { return "50"; @@ -97,15 +87,6 @@ } return loVideoList; } - private bool isPossibleVideo(string fsUrl){ - string extensionFile = System.IO.Path.GetExtension(fsUrl).ToLower(); - if(String.IsNullOrEmpty(extensionFile))return true; - foreach (string extension in m_VideoExtensions) - { - if (extension == extensionFile) return true; - } - return false; - - } + } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-25 00:37:22 UTC (rev 865) @@ -21,11 +21,16 @@ { private static OnlineVideoSettings instance = new OnlineVideoSettings(); public String msThumbLocation; + public String msDownloadDir; public String[] msFilterArray; public Dictionary<String,GUIOnlineVideos.Site> moSiteList = new Dictionary<String, GUIOnlineVideos.Site>(); - public String msDownloadDir; - private String SETTINGS_FILE = "OnlineVideoSettings.xml"; + private const String SETTINGS_FILE = "OnlineVideoSites.xml"; + private const String THUMBNAIL_DIR = "thumbDir"; + private const String DOWNLOAD_DIR = "downloadDir"; + private const String SECTION = "onlinevideos"; + private const String FILTER = "filter"; + public static OnlineVideoSettings getInstance(){ if(instance ==null){ instance = new OnlineVideoSettings(); @@ -37,49 +42,30 @@ loadSettings(); } private void loadSettings(){ - /* + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { - msThumbLocation = xmlreader.GetValueAsString("onlinevideos", "thumblocation", ""); - String lsFilter = xmlreader.GetValueAsString("onlinevideos", "filter", ""); + msThumbLocation = xmlreader.GetValueAsString(SECTION, THUMBNAIL_DIR, ""); + + msDownloadDir = xmlreader.GetValueAsString(SECTION, DOWNLOAD_DIR, ""); + String lsFilter = xmlreader.GetValueAsString(SECTION, FILTER, ""); + msFilterArray = lsFilter.Split(new char[] { ',' }); if (msFilterArray.Length == 1 && msFilterArray[0] == "") { msFilterArray = null; } } - */ + + if(String.IsNullOrEmpty(msThumbLocation)){ + msThumbLocation = Config.GetFolder(Config.Dir.Thumbs) +@"\OnlineVideos\"; + + } XmlDocument doc = new XmlDocument(); try { doc.Load(SETTINGS_FILE); - 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); - } - /* - if(String.IsNullOrEmpty(msThumbLocation)){ - msThumbLocation = - System.IO.Directory.GetCurrentDirectory()+"/Thumbs/OnlineVideos/"; - } - if(System.IO.Directory.Exists(msThumbLocation)==false){ - System.IO.Directory.CreateDirectory(msThumbLocation); - } - */ - XmlNode root = doc.SelectSingleNode("//settings/sites/site"); XmlNodeList nodeList; nodeList = root.SelectNodes("//settings/sites/site"); @@ -155,6 +141,24 @@ { try { + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + String lsFilterList = ""; + String [] lsFilterArray = msFilterArray; + if(lsFilterArray!=null){ + foreach (String lsFilter in lsFilterArray){ + lsFilterList+=lsFilter+","; + } + } + if((lsFilterList == ",")==false){ + xmlwriter.SetValue(SECTION, FILTER, lsFilterList); + }else{ + msFilterArray = null; + } + xmlwriter.SetValue(SECTION,THUMBNAIL_DIR,msThumbLocation); + xmlwriter.SetValue(SECTION, DOWNLOAD_DIR,msDownloadDir ); + + } Console.WriteLine(System.IO.Directory.GetCurrentDirectory()); //pick whatever filename with .xml extension string filename = SETTINGS_FILE; @@ -183,26 +187,8 @@ xmlDoc.Load(filename); } XmlNode root = xmlDoc.DocumentElement; - XmlElement filterNode = xmlDoc.CreateElement("filter"); - String lsFilterList = ""; - String [] lsFilterArray = msFilterArray; - if(lsFilterArray!=null){ - foreach (String lsFilter in lsFilterArray){ - lsFilterList+=lsFilter+","; - } - } - if((lsFilterList == ",")==false){ - filterNode.InnerText = lsFilterList; - }else{ - msFilterArray = null; - - } - root.AppendChild(filterNode); - XmlElement thumbNode = xmlDoc.CreateElement("thumbLocation"); - thumbNode.InnerText = msThumbLocation; - root.AppendChild(thumbNode); XmlElement sitesNode = xmlDoc.CreateElement("sites"); @@ -269,7 +255,7 @@ } catch(Exception ex) { - Console.WriteLine(ex.ToString()); + Log.Error(ex); } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-24 16:22:01 UTC (rev 864) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-25 00:37:22 UTC (rev 865) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections; using System.Text; using MediaPortal.GUI.Library; //using MediaPortal.Utils.Services; @@ -10,6 +11,7 @@ using System.Xml.XPath; using System.Threading; using OnlineVideos.Database; +using MediaPortal.Configuration; namespace OnlineVideos { @@ -50,10 +52,21 @@ private static bool _workerCompleted = true; private string HTMLdownload; //protected static SiteUtilBase _Instance; + ArrayList m_VideoExtensions = new ArrayList(); + + public SiteUtilBase() { - //ServiceProvider loServices = GlobalServiceProvider.Instance; - //moLog = loServices.Get<ILog>(); + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + String strTmp = xmlreader.GetValueAsString("movies", "extensions", ".avi,.mpg,.ogm,.mpeg,.mkv,.wmv,.ifo,.qt,.rm,.mov,.sbe,.dvr-ms,.ts"); + String [] tok = strTmp.Split( ','); + foreach (string extension in tok) + { + m_VideoExtensions.Add(extension.ToLower()); + } + } + m_VideoExtensions.Add(".flv"); } public virtual List<GUIOnlineVideos.VideoInfo> getSiteFavorites(String fsUser){ @@ -282,6 +295,17 @@ } public abstract String getSiteId(); + protected bool isPossibleVideo(string fsUrl){ + string extensionFile = System.IO.Path.GetExtension(fsUrl).ToLower(); + if(String.IsNullOrEmpty(extensionFile))return true; + foreach (string extension in m_VideoExtensions) + { + if (extension == extensionFile) return true; + } + return false; + + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-08-27 14:36:34
|
Revision: 869 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=869&view=rev Author: gregmac45 Date: 2007-08-26 22:44:33 -0700 (Sun, 26 Aug 2007) Log Message: ----------- start of "add video detail screen for apple trailers" Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-26 18:25:08 UTC (rev 868) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-27 05:44:33 UTC (rev 869) @@ -48,7 +48,8 @@ { home = 0, categories = 1, - videos = 2 + videos = 2, + info = 3 } public enum View { @@ -216,18 +217,21 @@ { DisplayCategories(); } - else + else if (_CurrentState == State.videos) { DisplayVideos(false); facadeView.SelectedListItemIndex = miSelectedIndex; } + else{ + DisplayVideoDetails(); + } UpdateViewSate(); //base.OnPageLoad(); } protected override void OnShowContextMenu() { int liSelected = facadeView.SelectedListItemIndex-1; - if (liSelected < 0 || msSelectedSiteId=="99" || _CurrentState!=State.videos) + if (liSelected < 0 || msSelectedSiteId=="99" || _CurrentState!=State.videos || _CurrentState!=State.info) { return; } @@ -294,6 +298,14 @@ { if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) { + if (_CurrentState == State.info) + { + Log.Info("Set the stopDownload to true 1"); + ImageDownloader._stopDownload = true; + DisplayVideos(false); + _CurrentState = State.videos; + return; + } if (_CurrentState == State.videos) { Log.Info("Set the stopDownload to true 1"); @@ -307,7 +319,8 @@ DisplaySites(); _CurrentState = State.home; return; - } + } + } base.OnAction(action); } @@ -350,11 +363,32 @@ } else { - miSelectedIndex = facadeView.SelectedListItemIndex; + miSelectedIndex = facadeView.SelectedListItemIndex; + if(msSelectedCategory == "20"){ + DiplayVideoDetails(moCurrentVideoList[facadeView.SelectedListItemIndex - 1]); + }else{ + //play the video Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); + } } } + else if (_CurrentState == State.info) + { + //Log.Info("Set the stopDownload to true 2"); + ImageDownloader._stopDownload = true; + if (facadeView.SelectedListItemIndex == 0) + { + DisplayVideos(false); + _CurrentState = State.videos; + } + else + { + miSelectedIndex = facadeView.SelectedListItemIndex; + //play the video + Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); + } + } UpdateViewSate(); } else if (control == btnViewAs) @@ -367,6 +401,11 @@ } base.OnClicked(controlId, control, actionType); } + + private void DiplayVideoDetails(VideoInfo videoInfo) + { + throw new Exception("The method or operation is not implemented."); + } public override bool OnMessage(GUIMessage message) { /* @@ -791,6 +830,11 @@ GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); DisplayVideoInfo(null); break; + case State.info: + GUIPropertyManager.SetProperty("#header.label",String.Empty); + GUIPropertyManager.SetProperty("#header.image",String.Empty); + DisplayVideoInfo(null); + break; } } private void ChangeFacadeView(){ Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-26 18:25:08 UTC (rev 868) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-27 05:44:33 UTC (rev 869) @@ -37,15 +37,13 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Core, Version=0.2.2.0, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Core, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Mediaportal\Core\bin\Release\Core.DLL</HintPath> - <Private>False</Private> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Core.DLL</HintPath> </Reference> - <Reference Include="Databases"> - <HintPath>..\..\..\..\Mediaportal\Databases\bin\Debug\Databases.dll</HintPath> + <Reference Include="Databases, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <Private>False</Private> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Databases.DLL</HintPath> </Reference> <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> @@ -68,14 +66,15 @@ <Reference Include="System.Xml"> <Private>False</Private> </Reference> - <Reference Include="Utils, Version=2.1.2.0, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Utils, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Mediaportal\Utils\bin\Release\Utils.DLL</HintPath> - <Private>False</Private> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Utils.DLL</HintPath> </Reference> </ItemGroup> <ItemGroup> - <Compile Include="Configuration.cs" /> + <Compile Include="Configuration.cs"> + <SubType>Form</SubType> + </Compile> <Compile Include="Configuration.Designer.cs"> <DependentUpon>Configuration.cs</DependentUpon> </Compile> @@ -124,6 +123,7 @@ <Compile Include="BreakUtil.cs" /> <EmbeddedResource Include="Configuration.resx"> <DependentUpon>Configuration.Designer.cs</DependentUpon> + <SubType>Designer</SubType> </EmbeddedResource> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-26 18:25:08 UTC (rev 868) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-27 05:44:33 UTC (rev 869) @@ -293,7 +293,7 @@ _workerCompleted = true; //return HTMLdownload; } - public abstract String getSiteId(); + public static abstract String getSiteId(); protected bool isPossibleVideo(string fsUrl){ string extensionFile = System.IO.Path.GetExtension(fsUrl).ToLower(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-08-29 23:30:16
|
Revision: 876 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=876&view=rev Author: gregmac45 Date: 2007-08-29 16:30:10 -0700 (Wed, 29 Aug 2007) Log Message: ----------- Added code to get all trailers for a movie Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerInfo.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/Runner.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs Added Paths: ----------- trunk/plugins/OnlineVideos/Source/OnlineVideos/LiveVideoUtil.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -21,7 +21,7 @@ { public override string getSiteId() { - return "break"; + return "22"; } protected override String getUrl(String fsId) Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -26,7 +26,7 @@ { //private String msSelectedSiteID; private String msSelectedCategoryName; - private List<GUIOnlineVideos.Site> moSiteList = new List<GUIOnlineVideos.Site>(); + private List<GUIOnlineVideos.SiteSettings> moSiteList = new List<GUIOnlineVideos.SiteSettings>(); public Configuration() { @@ -50,7 +50,7 @@ } txtFilters.Text = lsFilterList; } - foreach(GUIOnlineVideos.Site site in settings.moSiteList.Values){ + foreach(GUIOnlineVideos.SiteSettings site in settings.moSiteList.Values){ siteList.Items.Add(site.name); moSiteList.Add(site); } @@ -61,7 +61,7 @@ { if(siteList.SelectedIndex>-1){ OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; txtSiteName.Text = site.name; TxtSiteId.Text = site.id; txtUserId.Text = site.username; @@ -83,7 +83,7 @@ { if(CategoryList.SelectedIndex>-1){ OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; msSelectedCategoryName = CategoryList.SelectedItem.ToString(); Log.Info("Category change site:{0} with selected category of {1}",site.name,msSelectedCategoryName); @@ -98,7 +98,7 @@ void BtnSiteSaveClick(object sender, EventArgs e) { OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; //site.id = TxtSiteId; site.name = txtSiteName.Text; site.username = txtUserId.Text; @@ -123,7 +123,7 @@ void BtnRssSaveClick(object sender, EventArgs e) { OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; GUIOnlineVideos.RssLink link = site.RssList[msSelectedCategoryName]; link.name = txtRssName.Text; link.url = txtRssUrl.Text; @@ -140,7 +140,7 @@ link.name = "new"; link.url = "http://"; link.isDynamic = false; - GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; site.RssList.Add(link.name,link); CategoryList.Items.Add(link.name); CategoryList.SelectedIndex = CategoryList.Items.Count-1; @@ -152,7 +152,7 @@ { if(CategoryList.SelectedIndex>-1){ OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - GUIOnlineVideos.Site site = moSiteList[siteList.SelectedIndex]; + GUIOnlineVideos.SiteSettings site = moSiteList[siteList.SelectedIndex]; msSelectedCategoryName = CategoryList.SelectedItem.ToString(); site.RssList.Remove(msSelectedCategoryName); CategoryList.Items.RemoveAt(CategoryList.SelectedIndex); @@ -171,7 +171,7 @@ settings.msThumbLocation = txtThumbLoc.Text; settings.msDownloadDir = txtDownloadDir.Text; settings.moSiteList.Clear(); - foreach(GUIOnlineVideos.Site site in moSiteList){ + foreach(GUIOnlineVideos.SiteSettings site in moSiteList){ settings.moSiteList.Add(site.id,site); } settings.saveSettings(); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/FavoriteUtil.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -39,10 +39,10 @@ { return "100"; } - public override string getUrl(OnlineVideos.GUIOnlineVideos.VideoInfo video, OnlineVideos.GUIOnlineVideos.Site foSite) + public override string getUrl(OnlineVideos.GUIOnlineVideos.VideoInfo video, OnlineVideos.GUIOnlineVideos.SiteSettings foSite) { - GUIOnlineVideos.Site loSite = OnlineVideoSettings.getInstance().moSiteList[video.SiteID]; + GUIOnlineVideos.SiteSettings loSite = OnlineVideoSettings.getInstance().moSiteList[video.SiteID]; return SiteUtilFactory.getSiteUtil(video.SiteID).getUrl(video,loSite);; } public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) @@ -73,8 +73,8 @@ FavoritesDatabase db = FavoritesDatabase.getInstance(); string [] lsSiteIds = db.getSiteIDs(); - Dictionary <String, GUIOnlineVideos.Site> loSiteList = OnlineVideoSettings.getInstance().moSiteList; - GUIOnlineVideos.Site loSite; + Dictionary <String, GUIOnlineVideos.SiteSettings> loSiteList = OnlineVideoSettings.getInstance().moSiteList; + GUIOnlineVideos.SiteSettings loSite; GUIOnlineVideos.RssLink cat; foreach(string lsSiteId in lsSiteIds){ loSite = loSiteList[lsSiteId]; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -33,10 +33,11 @@ //private ILog moLog; protected View currentView = View.Icons; - private Dictionary <String, Site> moSiteList = new Dictionary<String, Site>(); + private Dictionary <String, SiteSettings> moSiteList = new Dictionary<String, SiteSettings>(); private String msSelectedSiteId; private String msSelectedCategoryValue; private String msSelectedCategoryName; + private String msSelectedVideo; private State _CurrentState = State.home; private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); @@ -58,7 +59,7 @@ LargeIcons = 2, FilmStrip = 3 } - public class Site + public class SiteSettings { public String name; public String id; @@ -223,7 +224,7 @@ facadeView.SelectedListItemIndex = miSelectedIndex; } else{ - DisplayVideoDetails(); + DisplayVideoDetails(moCurrentVideoList[facadeView.SelectedListItemIndex - 1]); } UpdateViewSate(); //base.OnPageLoad(); @@ -265,7 +266,7 @@ break; case 2: SiteUtilBase siteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - Site loSite = moSiteList [msSelectedSiteId]; + SiteSettings loSite = moSiteList [msSelectedSiteId]; if(msSelectedCategoryValue.StartsWith("fav:") == false){ //siteUtil.addFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); Log.Info("Received request to add video to favorites."); @@ -281,7 +282,7 @@ SiteUtilBase site = SiteUtilFactory.getSiteUtil(msSelectedSiteId); //Log.Info("VideoList before:"); //foreach(VideoInfo video in moCurrentVideoList){ - //Log.Info(video.Title); + //Log.Info(video.Title); //} moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); //Log.Info("VideoList after:"); @@ -298,30 +299,10 @@ { if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) { - if (_CurrentState == State.info) - { - Log.Info("Set the stopDownload to true 1"); - ImageDownloader._stopDownload = true; - DisplayVideos(false); - _CurrentState = State.videos; - return; + OnShowPreviousMenu2(); + return; + } - 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) @@ -341,8 +322,7 @@ { if (facadeView.SelectedListItemIndex == 0) { - DisplaySites(); - _CurrentState = State.home; + OnShowPreviousMenu2(); } else { @@ -358,18 +338,17 @@ ImageDownloader._stopDownload = true; if (facadeView.SelectedListItemIndex == 0) { - DisplayCategories(); - _CurrentState = State.categories; + OnShowPreviousMenu2(); } else { - miSelectedIndex = facadeView.SelectedListItemIndex; - if(msSelectedCategory == "20"){ - DiplayVideoDetails(moCurrentVideoList[facadeView.SelectedListItemIndex - 1]); - }else{ - - //play the video - Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); + miSelectedIndex = facadeView.SelectedListItemIndex; + if(msSelectedSiteId == "15"){ + DisplayVideoDetails(moCurrentVideoList[facadeView.SelectedListItemIndex - 1]); + _CurrentState = State.info; + }else{ + //play the video + Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); } } } @@ -379,14 +358,13 @@ ImageDownloader._stopDownload = true; if (facadeView.SelectedListItemIndex == 0) { - DisplayVideos(false); - _CurrentState = State.videos; + OnShowPreviousMenu2(); } else { miSelectedIndex = facadeView.SelectedListItemIndex; //play the video - Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); + Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); } } UpdateViewSate(); @@ -402,10 +380,38 @@ base.OnClicked(controlId, control, actionType); } - private void DiplayVideoDetails(VideoInfo videoInfo) - { - throw new Exception("The method or operation is not implemented."); - } + private void OnShowPreviousMenu2(){ + if (_CurrentState == State.categories) + { + + DisplaySites(); + _CurrentState = State.home; + + + } + else if (_CurrentState == State.videos) + { + Log.Info("Set the stopDownload to true 2"); + ImageDownloader._stopDownload = true; + + DisplayCategories(); + _CurrentState = State.categories; + + + } + else if (_CurrentState == State.info) + { + //Log.Info("Set the stopDownload to true 2"); + ImageDownloader._stopDownload = true; + + DisplayVideos(true); + SwitchView(); + btnViewAs.Visible = true; + _CurrentState = State.videos; + + + } + } public override bool OnMessage(GUIMessage message) { /* @@ -475,7 +481,7 @@ msFilterArray = settings.msFilterArray; moSiteList= settings.moSiteList; //create a favorites site - Site loSite = new Site(); + SiteSettings loSite = new SiteSettings(); loSite.id = "100"; loSite.name = "Favorites"; loSite.enabled = true; @@ -487,7 +493,7 @@ moSiteList.Add("100",loSite); //add a downloaded videos site - loSite = new Site(); + loSite = new SiteSettings(); loSite.id = "99"; loSite.name = "Downloaded Videos"; loSite.enabled = true; @@ -505,7 +511,7 @@ GUIListItem loListItem; String image; - foreach (Site loSite in moSiteList.Values) + foreach (SiteSettings loSite in moSiteList.Values) { if(loSite.enabled){ @@ -535,7 +541,7 @@ loListItem.IsFolder = true; MediaPortal.Util.Utils.SetDefaultIcons(loListItem); facadeView.Add(loListItem); - Site loSite = moSiteList[msSelectedSiteId]; + SiteSettings loSite = moSiteList[msSelectedSiteId]; SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); foreach (RssLink loCat in loSite.RssList.Values) { @@ -685,6 +691,42 @@ } + private void DisplayVideoDetails(VideoInfo foVideo) + { + msSelectedVideo = foVideo.Title; + SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + List<VideoInfo> loVideoList= loSiteUtil.getOtherVideoList(foVideo); + moCurrentVideoList.Clear(); + GUIControl.ClearControl(GetID, facadeView.GetID); + GUIListItem loListItem = new GUIListItem(".."); + loListItem.IsFolder = true; + loListItem.ItemId = 0; + //loListItem.OnItemSelected+= new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnVideoItemSelected); + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + int liIdx = 0; + foreach (VideoInfo loVideoInfo in loVideoList) + { + liIdx++; + loVideoInfo.Description = cleanString(loVideoInfo.Description); + + loListItem = new GUIListItem(loVideoInfo.Title); + loListItem.Path = loVideoInfo.VideoUrl; + loListItem.ItemId = liIdx; + //loListItem.RetrieveArt = false; + //loListItem.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + //loListItem.OnItemSelected+=new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler( OnVideoItemSelected); + facadeView.Add(loListItem); + //loListItem.RetrieveArt = true; + //loImageUrlList.Add(loVideoInfo.ImageUrl); + moCurrentVideoList.Add(loVideoInfo); + } + facadeView.View = GUIFacadeControl.ViewMode.List; + btnViewAs.Visible = false; + DisplayVideoInfo(loVideoList[0]); + //strLine = GUILocalizeStrings.Get(101); + + } /* public void downloadImages(object sender, DoWorkEventArgs e) { @@ -711,7 +753,7 @@ } } - + private bool GetUserInputString(ref string sString) { VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); @@ -725,7 +767,7 @@ private void Play(VideoInfo foListItem) { //foListItem. - Site loSite = moSiteList[msSelectedSiteId]; + SiteSettings loSite = moSiteList[msSelectedSiteId]; String lsUrl = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getUrl(foListItem,loSite); if (mbPlayFullscreen) { @@ -752,7 +794,7 @@ } private void SaveVideo(VideoInfo foListItem) { - Site loSite = moSiteList[msSelectedSiteId]; + SiteSettings loSite = moSiteList[msSelectedSiteId]; //String lsUrl = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getUrl(foListItem.Path); String lsUrl = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getUrl(foListItem,loSite); WebClient loClient = new WebClient(); @@ -831,9 +873,10 @@ DisplayVideoInfo(null); break; case State.info: - GUIPropertyManager.SetProperty("#header.label",String.Empty); - GUIPropertyManager.SetProperty("#header.image",String.Empty); - DisplayVideoInfo(null); + + GUIPropertyManager.SetProperty("#header.label",msSelectedVideo); + GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); + //DisplayVideoInfo(); break; } } @@ -965,6 +1008,7 @@ GUIControl.ShowControl(GetID,121); GUIControl.ShowControl(GetID,131); GUIControl.ShowControl(GetID,141); + //if() //Log.Info(foVideo.Description); } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -23,6 +23,10 @@ { return "15"; } + public override bool hasMultipleVideos() + { + return true; + } public override List<GUIOnlineVideos.VideoInfo> getVideoList(String fsUrl) { List<GUIOnlineVideos.VideoInfo> loListItems = new List<GUIOnlineVideos.VideoInfo>(); @@ -82,11 +86,29 @@ return loListItems; } - - public override String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.Site foSite) + public override List<OnlineVideos.GUIOnlineVideos.VideoInfo> getOtherVideoList(OnlineVideos.GUIOnlineVideos.VideoInfo video) { + List<OnlineVideos.GUIOnlineVideos.VideoInfo> videoList = new List<OnlineVideos.GUIOnlineVideos.VideoInfo>(); TrailerInfo trailer = (TrailerInfo)video.Other; + trailer = AppleTrailers.GetTrailerUrls(trailer); + Console.WriteLine("Found {0} trailer urls",trailer.trailers.Count); + GUIOnlineVideos.VideoInfo newVideo; + foreach (String name in trailer.trailers.Keys){ + newVideo = new GUIOnlineVideos.VideoInfo(); + newVideo.Title = name; + newVideo.VideoUrl = trailer.trailers[name]; + newVideo.Description = trailer.Overview; + Console.WriteLine(newVideo.Description); + newVideo.Other = trailer; + videoList.Add(newVideo); + } + return videoList; + } + public override String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.SiteSettings foSite) + { + TrailerInfo trailer = (TrailerInfo)video.Other; trailer = AppleTrailers.ProcessTrailer(trailer); + Console.WriteLine("Found {0} trailer urls",trailer.TrailerStreamCollection.Count); return trailer.TrailerStreamCollection[0].Uri.ToString(); } public List<GUIOnlineVideos.VideoInfo> getAllTrailers(){ @@ -144,12 +166,12 @@ worker.RunWorkerAsync(fsLink); DateTime startTime = DateTime.Now; TimeSpan duration = new TimeSpan(); - using (WaitCursor cursor = new WaitCursor()) + //using (WaitCursor cursor = new WaitCursor()) { while (HDTrailerPlugin.AppleTrailers._workerCompleted == false && duration.TotalSeconds < 10){ //Log.Info("donwload trailer duration = {0} seconds",duration.TotalSeconds); - GUIWindowManager.Process(); + //GUIWindowManager.Process(); duration = DateTime.Now - startTime;; } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -134,6 +134,14 @@ return trailerInfo; } #endregion + public static ITMSClient.TrailerInfo GetTrailerUrls(object obj) + { + + ITMSClient.TrailerInfo trailerInfo = (ITMSClient.TrailerInfo)obj; + // Populate the rest of the meta data + trailerInfo = ITMSClient.ITMSHelper.PopulateTrailerUrls(trailerInfo); + return trailerInfo; + } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -2,22 +2,23 @@ * iTunes Movie Trailer Import * Copyright (c) 2005 Jonathan Bradshaw * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions + * The above copyright notice and this permission notice shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED - * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ using System; using System.Collections; +using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Text.RegularExpressions; @@ -38,7 +39,41 @@ private const string USER_AGENT = "User-Agent: iTunes/6.0 (Windows)"; private static Hashtable HighDef = HDHelper.GetAvailableMovies(); #endregion - + + + static public TrailerInfo PopulateTrailerUrls(TrailerInfo trailerInfo) + { + MatchCollection matches; + //Console.WriteLine(""); + ITMSContent infoPage = GetITMSPage(trailerInfo.Url); + if (infoPage.IsValid) + { + Match field = RegexParsers.moviedetailsRegex1.Match(infoPage.Xml); + //String desc; + if (field.Success) + { + //Log.Info("got the movie details for {0}",trailerInfo.Title); + trailerInfo.Overview = field.Groups["overview"].Value.Replace("\r\n", " ").Replace('\u0092', '\'').Replace('\u0093', '"').Replace('\u0094', '"'); + } + String name; + String url; + + Dictionary<string, string> trailers = new Dictionary<string, string>(); + // First regular expression parser + matches = RegexParsers.trailerLinkRegex.Matches(infoPage.Xml); + if (matches.Count>0) + { + foreach(Match fields in matches){ + name = fields.Groups["name"].Value; + url=fields.Groups["url"].Value; + trailers.Add(name,url); + + } + trailerInfo.trailers = trailers; + } + } + return trailerInfo; + } #region Public Methods /// <summary> /// Populates the full meta data for a particular trailer @@ -47,7 +82,7 @@ /// <returns></returns> static public TrailerInfo PopulateTrailerDetails(TrailerInfo trailerInfo, ITMSClient.TrailerSize desiredSize) { - //Log.Info("Populating Trailer details for {0}", trailerInfo.Title); + //Log.Info("Populating Trailer details for {0}", trailerInfo.Title); string[] MONTHS = new string[]{"January","February","March","April","May","June","July","August","September","October","November","December"}; //const string DIRECTOR = "(dir.)"; Match fields; @@ -55,26 +90,26 @@ StringBuilder actors = new StringBuilder("|"); ITMSContent infoPage = GetITMSPage(trailerInfo.Url); - //Log.Info(infoPage.Xml); - if (infoPage.IsValid) - { - // First regular expression parser - fields = RegexParsers.moviedetailsRegex1.Match(infoPage.Xml); - if (fields.Success) - { - //Log.Info("got the movie details for {0}",trailerInfo.Title); - trailerInfo.Title = fields.Groups["title"].Value.Replace('\u0092', '\'').Replace('\u0093', '"').Replace('\u0094', '"'); - trailerInfo.PosterUrl = new Uri(fields.Groups["poster"].Value); - trailerInfo.Copyright = fields.Groups["copyright"].Value; - trailerInfo.Overview = fields.Groups["overview"].Value.Replace("\r\n", " ").Replace('\u0092', '\'').Replace('\u0093', '"').Replace('\u0094', '"'); + //Log.Info(infoPage.Xml); + if (infoPage.IsValid) + { + // First regular expression parser + fields = RegexParsers.moviedetailsRegex1.Match(infoPage.Xml); + if (fields.Success) + { + //Log.Info("got the movie details for {0}",trailerInfo.Title); + trailerInfo.Title = fields.Groups["title"].Value.Replace('\u0092', '\'').Replace('\u0093', '"').Replace('\u0094', '"'); + trailerInfo.PosterUrl = new Uri(fields.Groups["poster"].Value); + trailerInfo.Copyright = fields.Groups["copyright"].Value; + trailerInfo.Overview = fields.Groups["overview"].Value.Replace("\r\n", " ").Replace('\u0092', '\'').Replace('\u0093', '"').Replace('\u0094', '"'); - // Second regular expression parser (split due to issues with .NET regex spinning out of control) + // Second regular expression parser (split due to issues with .NET regex spinning out of control) - fields = RegexParsers.moviedetailsRegex2.Match(infoPage.Xml); - /* + fields = RegexParsers.moviedetailsRegex2.Match(infoPage.Xml); + /* if (fields.Success) { - trailerInfo.Rating = fields.Groups["rating"].Value; + trailerInfo.Rating = fields.Groups["rating"].Value; // Release details (either a date or Coming Soon) and year (assume this year if we don't find one) trailerInfo.Release = fields.Groups["release"].Value; @@ -83,7 +118,7 @@ { trailerInfo.Year = Convert.ToInt32(date.Groups["year"].Value); trailerInfo.SortDate = new DateTime( - trailerInfo.Year, + trailerInfo.Year, Array.IndexOf(MONTHS, date.Groups["month"].Value)+1, Convert.ToInt32(date.Groups["day"].Value)); } @@ -114,47 +149,48 @@ actors.Append(cast.Value.Trim()).Append("|"); } trailerInfo.Actors = actors.ToString(); - */ - trailerInfo.TrailerStreamCollection = new TrailerStreamCollection(); + */ + trailerInfo.TrailerStreamCollection = new TrailerStreamCollection(); - // WARNING: HACK CODE FOR HIGHDEF TRAILERS - if (desiredSize >= TrailerSize.HD480p) - { - if (HighDef.Contains(trailerInfo.Title)) - { - Console.WriteLine("Found HD movie for " + trailerInfo.Title); - Uri page = HighDef[trailerInfo.Title] as Uri; - Uri mov = HDHelper.GetHDMovie(page, desiredSize); - TrailerStream myStream = new TrailerStream(desiredSize, page); - myStream.Type = "HD"; - trailerInfo.Type = "HD"; - myStream.Movie = mov; - trailerInfo.TrailerStreamCollection.Add(myStream); - } - } - // END HACK CODE + // WARNING: HACK CODE FOR HIGHDEF TRAILERS + if (desiredSize >= TrailerSize.HD480p) + { + if (HighDef.Contains(trailerInfo.Title)) + { + Console.WriteLine("Found HD movie for " + trailerInfo.Title); + Uri page = HighDef[trailerInfo.Title] as Uri; + Uri mov = HDHelper.GetHDMovie(page, desiredSize); + TrailerStream myStream = new TrailerStream(desiredSize, page); + myStream.Type = "HD"; + trailerInfo.Type = "HD"; + myStream.Movie = mov; + trailerInfo.TrailerStreamCollection.Add(myStream); + } + } + // END HACK CODE - // Get movie trailer streams - if (desiredSize != TrailerSize.None && trailerInfo.TrailerStreamCollection.Count == 0) - { - foreach (Capture url in fields.Groups["urls"].Captures) - { - //Log.Info("Found stream url:{0}", url); - TrailerStreamCollection tsc = GetTrailerStreamCollection(new Uri(infoPage.WebResponse.ResponseUri, url.Value)); - TrailerStream myStream = GetDesiredTrailerStream(tsc, desiredSize); - trailerInfo.TrailerStreamCollection.Add(myStream); - } - } - trailerInfo.TrailerStreamCollection.TrimToSize(); - //} - } - } - else - { - Log.Debug("Invalid page {0} for trailer {1}", trailerInfo.Url, trailerInfo.Title); - } + // Get movie trailer streams + if (desiredSize != TrailerSize.None && trailerInfo.TrailerStreamCollection.Count == 0) + { + foreach (Capture url in fields.Groups["urls"].Captures) + { + //Log.Info("Found stream url:{0}", url); + TrailerStreamCollection tsc = GetTrailerStreamCollection(new Uri(infoPage.WebResponse.ResponseUri, url.Value)); + + TrailerStream myStream = GetDesiredTrailerStream(tsc, desiredSize); + trailerInfo.TrailerStreamCollection.Add(myStream); + } + } + trailerInfo.TrailerStreamCollection.TrimToSize(); + //} + } + } + else + { + Log.Debug("Invalid page {0} for trailer {1}", trailerInfo.Url, trailerInfo.Title); + } return trailerInfo; - } + } /// <summary> /// Downloads the cover image to the specified destination directory if @@ -169,14 +205,14 @@ Uri uri = TrailerInfo.PosterUrl; string filename = Path.Combine(destinationDirectory, uri.AbsolutePath.Remove(0, uri.AbsolutePath.LastIndexOf('/')+1)); if (File.Exists(filename) == false) - try - { - webClient.DownloadFile(uri.AbsoluteUri, filename); - } - catch (WebException) - { - return String.Empty; - } + try + { + webClient.DownloadFile(uri.AbsoluteUri, filename); + } + catch (WebException) + { + return String.Empty; + } return filename; } @@ -199,8 +235,8 @@ ITMSContent content = null; //Log.Debug("GetITMSPage: " + uri.AbsoluteUri); - //Log.Info("GetITMSPage: " + uri.AbsoluteUri); - try + //Log.Info("GetITMSPage: " + uri.AbsoluteUri); + try { request = (HttpWebRequest) HttpWebRequest.Create(uri); request.KeepAlive = false; @@ -211,18 +247,18 @@ if (ifModifiedSince != DateTime.MinValue) request.IfModifiedSince = ifModifiedSince; - //Log.Info("getiing request response"); + //Log.Info("getiing request response"); response = (HttpWebResponse) request.GetResponse(); - //Log.Info("got response"); - sReader = new StreamReader(response.GetResponseStream(), - System.Text.Encoding.UTF8, false, (int) Math.Abs(response.ContentLength)); - //Log.Info("Got Response Stream"); - - //Log.Info("Download xml"); - content = new ITMSContent(response, - HttpUtility.HtmlDecode( - sReader.ReadToEnd())); - //Log.Info("created ITMSContent"); + //Log.Info("got response"); + sReader = new StreamReader(response.GetResponseStream(), + System.Text.Encoding.UTF8, false, (int) Math.Abs(response.ContentLength)); + //Log.Info("Got Response Stream"); + + //Log.Info("Download xml"); + content = new ITMSContent(response, + HttpUtility.HtmlDecode( + sReader.ReadToEnd())); + //Log.Info("created ITMSContent"); //Log.Debug(response.LastModified); } catch (WebException ex) @@ -241,14 +277,14 @@ }catch(Exception e){ Log.Error(e); } - finally + finally { - if(sReader != null) + if(sReader != null) sReader.Close(); - if(response != null) + if(response != null) response.Close(); } - return content; + return content; } #endregion @@ -259,8 +295,8 @@ /// <param name="uri">URI.</param> /// <returns></returns> private static TrailerStream GetDesiredTrailerStream(TrailerStreamCollection trailerStreams, TrailerSize desiredSize) - { - //Log.Info("getting desired Trailer size of {0}", desiredSize); + { + //Log.Info("getting desired Trailer size of {0}", desiredSize); // Find the largest desired size supported by the available streams while (trailerStreams.ContainsKey(desiredSize) == false && desiredSize > 0) desiredSize = desiredSize - 1; @@ -282,8 +318,8 @@ stream.Date = content.WebResponse.LastModified; } } - */ - //Log.Info("Finished getting desired trailer"); + */ + //Log.Info("Finished getting desired trailer"); return stream; } @@ -307,21 +343,21 @@ // Details not available for older trailers if (streamDetails.Groups["type"].Success) type = streamDetails.Groups["type"].Value; - if (streamDetails.Groups["minutes"].Success) - { - string minutes = streamDetails.Groups["minutes"].Value; - if (String.IsNullOrEmpty(minutes)) - minutes = "0"; - length = new TimeSpan(0, Convert.ToInt32(minutes), Convert.ToInt32(streamDetails.Groups["seconds"].Value)); - } + if (streamDetails.Groups["minutes"].Success) + { + string minutes = streamDetails.Groups["minutes"].Value; + if (String.IsNullOrEmpty(minutes)) + minutes = "0"; + length = new TimeSpan(0, Convert.ToInt32(minutes), Convert.ToInt32(streamDetails.Groups["seconds"].Value)); + } MatchCollection streamMatches = RegexParsers.streamRegex.Matches(trailerPage.Xml); foreach (Match m in streamMatches) { TrailerSize size = (TrailerSize) Enum.Parse(typeof(TrailerSize), m.Groups["size"].Value, true); - //Log.Info("found size {0}",size); - Uri uri = new Uri(trailerPage.WebResponse.ResponseUri, m.Groups["url"].Value); - //Log.Info("found url {0}", uri.ToString()); + //Log.Info("found size {0}",size); + Uri uri = new Uri(trailerPage.WebResponse.ResponseUri, m.Groups["url"].Value); + //Log.Info("found url {0}", uri.ToString()); TrailerStream ts = new TrailerStream(size, uri); ts.Length = length; ts.Type = type; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -75,6 +75,15 @@ RegexOptions.ExplicitCapture | RegexOptions.Compiled ); + + //Used to find the multiple trailer urls + internal static Regex trailerLinkRegex = new Regex( + "<HBoxView[^>]*>\\s*<GotoURL\\starget=\"main\"\\surl=\"(?<url>[^\"]*)[^=]*=[^=]*=\"(?<name>[^\"]*)", + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); + /// <summary> /// Used to pull the type and length of the Quicktime trailer movies available from Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerInfo.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerInfo.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerInfo.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -18,6 +18,8 @@ */ using System; using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; using System.IO; namespace ITMSClient @@ -45,6 +47,7 @@ private Uri _posterUrl; private DateTime _sortDate; private TrailerStreamCollection _trailerStreamCollection; + private Dictionary<String, String> _trailers; #endregion #region Properties @@ -214,6 +217,11 @@ get { return _sortDate; } set { _sortDate = value; } } + public Dictionary<String, String> trailers + { + get{return _trailers;} + set{_trailers = value;} + } #endregion } } Added: trunk/plugins/OnlineVideos/Source/OnlineVideos/LiveVideoUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/LiveVideoUtil.cs (rev 0) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/LiveVideoUtil.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -0,0 +1,74 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 8/28/2007 + * Time: 3:09 PM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using System.Xml; +using System.IO; +using System.ComponentModel; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.Dialogs; +//using Rss; +using MediaPortal.GUI.View ; + +namespace OnlineVideos +{ + /// <summary> + /// Description of LiveVideoUtil. + /// </summary> + public class LiveVideoUtil : SiteUtilBase + { + public override string getSiteId() + { + return "21"; + } + + protected override String getUrl(String fsId) + { + + String lsHtml = getHTMLData(fsId); + Match loMatch = Regex.Match(lsHtml,@"GetFlashPlayer\('([^']*)"); + String lsUrl = ""; + if(loMatch.Success){ + lsUrl = System.Web.HttpUtility.UrlDecode(loMatch.Groups[1].Value); + lsUrl = Regex.Match(lsUrl,"video=([^&]*)").Groups[1].Value; + lsHtml = getHTMLData(lsUrl); + lsHtml = System.Web.HttpUtility.UrlDecode(getHTMLData(lsUrl)); + + //loMatch = Regex.Match(lsHtml,) + //lsUrl = System.Web.HttpUtility.UrlDecode(lsHtml); + lsUrl = Regex.Match(lsHtml,"video_id=([^&]*)").Groups[1].Value; + }else{ + Log.Info("LiveVideo video not found. Site could have changed layout."); + } + return lsUrl; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + video.Description = rssItem.mediaDescription; + video.ImageUrl = rssItem.mediaThumbnail; + video.Title = rssItem.title; + video.Length = rssItem.contentList[0].duration; + video.VideoUrl = rssItem.link; + loVideoList.Add(video); + } + return loVideoList; + } + } +} Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -33,9 +33,13 @@ //SiteUtilBase loUtil = new YouTubeUtil(); //List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("http://youtube.com/rss/global/top_rated.rss"); - SiteUtilBase loUtil = new ItunesTrailerUtil(); - List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("%transformers"); + ItunesTrailerUtil loUtil = new ItunesTrailerUtil(); + List<GUIOnlineVideos.VideoInfo> loList = loUtil.getVideoList("http://movies.apple.com/moviesxml/s/dreamworks/index_1.xml"); + //loUtil.getUrl(loList[0],null); + loList =loUtil.getOtherVideoList(loList[9]); + //loUtil.getUrl(loList[8],null); + //loUtil.getUrl(loList[loList.Count-1],null); /* SiteUtilBase loUtil = new BlipTvUtil(); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -23,7 +23,7 @@ public String msThumbLocation; public String msDownloadDir; public String[] msFilterArray; - public Dictionary<String,GUIOnlineVideos.Site> moSiteList = new Dictionary<String, GUIOnlineVideos.Site>(); + public Dictionary<String,GUIOnlineVideos.SiteSettings> moSiteList = new Dictionary<String, GUIOnlineVideos.SiteSettings>(); private const String SETTINGS_FILE = "OnlineVideoSites.xml"; private const String THUMBNAIL_DIR = "thumbDir"; @@ -69,14 +69,14 @@ XmlNode root = doc.SelectSingleNode("//settings/sites/site"); XmlNodeList nodeList; nodeList = root.SelectNodes("//settings/sites/site"); - List<GUIOnlineVideos.Site> loSiteList = new List<GUIOnlineVideos.Site>(); - GUIOnlineVideos.Site loSite; + List<GUIOnlineVideos.SiteSettings> loSiteList = new List<GUIOnlineVideos.SiteSettings>(); + GUIOnlineVideos.SiteSettings loSite; XmlNodeList RssNodeList; GUIOnlineVideos.RssLink loRssData; bool lbDonwloadDirSet = false; foreach (XmlNode chileNode in nodeList) { - loSite = new GUIOnlineVideos.Site(); + loSite = new GUIOnlineVideos.SiteSettings(); XmlNode node = chileNode.SelectSingleNode("name"); loSite.name = node.InnerText; @@ -202,7 +202,7 @@ XmlElement siteRssNode; XmlElement siteEnabledNode; String lsConfirm; - foreach(GUIOnlineVideos.Site site in moSiteList.Values){ + foreach(GUIOnlineVideos.SiteSettings site in moSiteList.Values){ siteNode = xmlDoc.CreateElement("site"); siteNameNode = xmlDoc.CreateElement("name"); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj 2007-08-29 23:30:10 UTC (rev 876) @@ -40,10 +40,12 @@ <Reference Include="Core, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Core.DLL</HintPath> + <Private>False</Private> </Reference> <Reference Include="Databases, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Databases.DLL</HintPath> + <Private>False</Private> </Reference> <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> @@ -69,6 +71,7 @@ <Reference Include="Utils, Version=0.2.2.9991, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Utils.DLL</HintPath> + <Private>False</Private> </Reference> </ItemGroup> <ItemGroup> @@ -82,6 +85,7 @@ <Compile Include="FavoriteUtil.cs" /> <Compile Include="FavoriteVideo.cs" /> <Compile Include="GenericSiteUtil.cs" /> + <Compile Include="LiveVideoUtil.cs" /> <Compile Include="OnlineVideoSettings.cs" /> <Compile Include="RocketboomUtil.cs" /> <Compile Include="MyVideodeUtil.cs" /> Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Runner.csproj =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Runner.csproj 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Runner.csproj 2007-08-29 23:30:10 UTC (rev 876) @@ -24,14 +24,18 @@ <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> </PropertyGroup> <ItemGroup> - <Reference Include="Core, Version=0.2.2.0, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Core"> + <HintPath>..\..\..\..\Mediaportal\Databases\bin\Debug\Core.dll</HintPath> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Mediaportal\Core\bin\Release\Core.DLL</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> + <Reference Include="Utils"> + <HintPath>..\..\..\..\Mediaportal\Databases\bin\Debug\Utils.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="Main.cs" /> Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -99,12 +99,17 @@ return db.removeFavoriteVideo(foVideo); } - public virtual String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.Site foSite) + public virtual String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.SiteSettings foSite) { return getUrl(video.VideoUrl); } + public virtual bool hasMultipleVideos(){ + return false; + } + public virtual List<GUIOnlineVideos.VideoInfo> getOtherVideoList(GUIOnlineVideos.VideoInfo foVideo){ + return new List<GUIOnlineVideos.VideoInfo>(); + } - public List<RssItem> getRssDataItems(String fsUrl){ List<RssItem> loRssItems = new List<RssItem>(); try{ @@ -293,7 +298,7 @@ _workerCompleted = true; //return HTMLdownload; } - public static abstract String getSiteId(); + public abstract String getSiteId(); protected bool isPossibleVideo(string fsUrl){ string extensionFile = System.IO.Path.GetExtension(fsUrl).ToLower(); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs 2007-08-29 13:29:29 UTC (rev 875) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs 2007-08-29 23:30:10 UTC (rev 876) @@ -186,14 +186,14 @@ return loListItems; } */ - public override String getUrl(GUIOnlineVideos.VideoInfo foVideo,GUIOnlineVideos.Site foSite) + public override String getUrl(GUIOnlineVideos.VideoInfo foVideo,GUIOnlineVideos.SiteSettings foSite) { String lsSessionId = getSessionId(foVideo.VideoUrl,foSite); String lsUrl = "http://youtube.com/get_video?video_id=" +foVideo.VideoUrl + "&t=" + lsSessionId; Log.Info("youtube video url={0}", lsUrl); return lsUrl+"&txe=.flv"; } - public String getSessionId(String fsId,GUIOnlineVideos.Site foSite) + public String getSessionId(String fsId,GUIOnlineVideos.SiteSettings foSite) { //Log.Info("getting youtube session id"); String lsUrl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-08-30 21:28:58
|
Revision: 878 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=878&view=rev Author: gregmac45 Date: 2007-08-30 14:28:51 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Added ability to set trailer quality Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.Designer.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -39,6 +39,8 @@ { this.tabControl1 = new System.Windows.Forms.TabControl(); this.General_Tab = new System.Windows.Forms.TabPage(); + this.label4 = new System.Windows.Forms.Label(); + this.cmbTrailerSize = new System.Windows.Forms.ComboBox(); this.txtDownloadDir = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); @@ -81,11 +83,13 @@ this.tabControl1.Margin = new System.Windows.Forms.Padding(4); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(639, 697); + this.tabControl1.Size = new System.Drawing.Size(639, 715); this.tabControl1.TabIndex = 0; // // General_Tab // + this.General_Tab.Controls.Add(this.label4); + this.General_Tab.Controls.Add(this.cmbTrailerSize); this.General_Tab.Controls.Add(this.txtDownloadDir); this.General_Tab.Controls.Add(this.label3); this.General_Tab.Controls.Add(this.groupBox2); @@ -98,11 +102,27 @@ this.General_Tab.Margin = new System.Windows.Forms.Padding(4); this.General_Tab.Name = "General_Tab"; this.General_Tab.Padding = new System.Windows.Forms.Padding(4); - this.General_Tab.Size = new System.Drawing.Size(631, 668); + this.General_Tab.Size = new System.Drawing.Size(631, 686); this.General_Tab.TabIndex = 0; this.General_Tab.Text = "General"; this.General_Tab.UseVisualStyleBackColor = true; // + // label4 + // + this.label4.Location = new System.Drawing.Point(20, 103); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(188, 23); + this.label4.TabIndex = 22; + this.label4.Text = "Apple Trailers Max Quality"; + // + // cmbTrailerSize + // + this.cmbTrailerSize.FormattingEnabled = true; + this.cmbTrailerSize.Location = new System.Drawing.Point(293, 100); + this.cmbTrailerSize.Name = "cmbTrailerSize"; + this.cmbTrailerSize.Size = new System.Drawing.Size(121, 24); + this.cmbTrailerSize.TabIndex = 21; + // // txtDownloadDir // this.txtDownloadDir.Location = new System.Drawing.Point(293, 70); @@ -130,18 +150,18 @@ 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(20, 363); + this.groupBox2.Location = new System.Drawing.Point(20, 391); this.groupBox2.Margin = new System.Windows.Forms.Padding(4); this.groupBox2.Name = "groupBox2"; this.groupBox2.Padding = new System.Windows.Forms.Padding(4); - this.groupBox2.Size = new System.Drawing.Size(548, 294); + this.groupBox2.Size = new System.Drawing.Size(548, 281); this.groupBox2.TabIndex = 18; this.groupBox2.TabStop = false; this.groupBox2.Text = "Site Categories"; // // btnAdd // - this.btnAdd.Location = new System.Drawing.Point(116, 246); + this.btnAdd.Location = new System.Drawing.Point(116, 248); this.btnAdd.Margin = new System.Windows.Forms.Padding(4); this.btnAdd.Name = "btnAdd"; this.btnAdd.Size = new System.Drawing.Size(100, 28); @@ -154,7 +174,7 @@ // this.CategoryList.FormattingEnabled = true; this.CategoryList.ItemHeight = 16; - this.CategoryList.Location = new System.Drawing.Point(29, 23); + this.CategoryList.Location = new System.Drawing.Point(8, 23); this.CategoryList.Margin = new System.Windows.Forms.Padding(4); this.CategoryList.Name = "CategoryList"; this.CategoryList.Size = new System.Drawing.Size(159, 212); @@ -163,7 +183,7 @@ // // btnDeleteRss // - this.btnDeleteRss.Location = new System.Drawing.Point(8, 246); + this.btnDeleteRss.Location = new System.Drawing.Point(8, 248); this.btnDeleteRss.Margin = new System.Windows.Forms.Padding(4); this.btnDeleteRss.Name = "btnDeleteRss"; this.btnDeleteRss.Size = new System.Drawing.Size(100, 28); @@ -231,7 +251,7 @@ 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(20, 106); + this.groupBox1.Location = new System.Drawing.Point(20, 129); this.groupBox1.Margin = new System.Windows.Forms.Padding(4); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(4); @@ -389,7 +409,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(681, 716); + this.ClientSize = new System.Drawing.Size(681, 744); this.Controls.Add(this.tabControl1); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Configuration"; @@ -405,6 +425,8 @@ this.groupBox1.PerformLayout(); this.ResumeLayout(false); } + private System.Windows.Forms.ComboBox cmbTrailerSize; + private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox txtDownloadDir; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private System.Windows.Forms.Label label3; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/Configuration.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -54,6 +54,13 @@ siteList.Items.Add(site.name); moSiteList.Add(site); } + foreach(ITMSClient.TrailerSize size in Enum.GetValues(typeof(ITMSClient.TrailerSize))){ + + cmbTrailerSize.Items.Add(size); + if(size==OnlineVideoSettings.getInstance().AppleTrailerSize){ + cmbTrailerSize.SelectedIndex = cmbTrailerSize.Items.Count-1; + } + } } @@ -170,6 +177,7 @@ settings.msFilterArray = lsFilterArray; settings.msThumbLocation = txtThumbLoc.Text; settings.msDownloadDir = txtDownloadDir.Text; + settings.AppleTrailerSize = (ITMSClient.TrailerSize) cmbTrailerSize.SelectedItem; settings.moSiteList.Clear(); foreach(GUIOnlineVideos.SiteSettings site in moSiteList){ settings.moSiteList.Add(site.id,site); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -37,7 +37,8 @@ private String msSelectedSiteId; private String msSelectedCategoryValue; private String msSelectedCategoryName; - private String msSelectedVideo; + private VideoInfo moSelectedVideo; + private State _CurrentState = State.home; private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); @@ -78,6 +79,7 @@ public class VideoInfo { public String Title; + public String Title2; public String Description = ""; public String VideoUrl = ""; public String ImageUrl = ""; @@ -224,7 +226,7 @@ facadeView.SelectedListItemIndex = miSelectedIndex; } else{ - DisplayVideoDetails(moCurrentVideoList[facadeView.SelectedListItemIndex - 1]); + DisplayVideoDetails(moSelectedVideo); } UpdateViewSate(); //base.OnPageLoad(); @@ -693,7 +695,7 @@ } private void DisplayVideoDetails(VideoInfo foVideo) { - msSelectedVideo = foVideo.Title; + moSelectedVideo = foVideo; SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); List<VideoInfo> loVideoList= loSiteUtil.getOtherVideoList(foVideo); moCurrentVideoList.Clear(); @@ -711,6 +713,7 @@ loVideoInfo.Description = cleanString(loVideoInfo.Description); loListItem = new GUIListItem(loVideoInfo.Title); + loListItem.Label2 = loVideoInfo.Title2; loListItem.Path = loVideoInfo.VideoUrl; loListItem.ItemId = liIdx; //loListItem.RetrieveArt = false; @@ -874,7 +877,7 @@ break; case State.info: - GUIPropertyManager.SetProperty("#header.label",msSelectedVideo); + GUIPropertyManager.SetProperty("#header.label",moSelectedVideo.Title); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); //DisplayVideoInfo(); break; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -51,17 +51,11 @@ } */ DownloadTrailers(fsUrl); - GUIOnlineVideos.VideoInfo loItem; + //GUIOnlineVideos.VideoInfo loItem; foreach (ITMSClient.TrailerInfo trailer in HDTrailerPlugin.AppleTrailers.trailers) { - loItem = new GUIOnlineVideos.VideoInfo(); - loItem.Title = trailer.Title; - if(trailer.PosterUrl!=null) - loItem.ImageUrl = trailer.PosterUrl.ToString(); - loItem.Tags = trailer.Genre; - loItem.Other = trailer; /* try{ ITMSClient.TrailerInfo trailerMore = AppleTrailers.ProcessTrailer(trailer); @@ -75,7 +69,7 @@ // //loItem.Length = trailer.. */ - loListItems.Add(loItem); + loListItems.Add(loadVideoInfo(trailer)); /* }catch(Exception e){ Log.Debug("skipped {0}. Unable to parse video url out of {1}",trailer.Title, trailer.Url); @@ -93,13 +87,10 @@ trailer = AppleTrailers.GetTrailerUrls(trailer); Console.WriteLine("Found {0} trailer urls",trailer.trailers.Count); GUIOnlineVideos.VideoInfo newVideo; - foreach (String name in trailer.trailers.Keys){ - newVideo = new GUIOnlineVideos.VideoInfo(); + foreach (String name in trailer.trailers.Keys){ + newVideo = loadVideoInfo(trailer); newVideo.Title = name; - newVideo.VideoUrl = trailer.trailers[name]; - newVideo.Description = trailer.Overview; - Console.WriteLine(newVideo.Description); - newVideo.Other = trailer; + newVideo.VideoUrl = trailer.trailers[name]; videoList.Add(newVideo); } return videoList; @@ -107,12 +98,13 @@ public override String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.SiteSettings foSite) { TrailerInfo trailer = (TrailerInfo)video.Other; - trailer = AppleTrailers.ProcessTrailer(trailer); + trailer = AppleTrailers.ProcessTrailer(trailer,OnlineVideoSettings.getInstance().AppleTrailerSize); + Log.Info("Trailer quality set to {0}",OnlineVideoSettings.getInstance().AppleTrailerSize); Console.WriteLine("Found {0} trailer urls",trailer.TrailerStreamCollection.Count); return trailer.TrailerStreamCollection[0].Uri.ToString(); } public List<GUIOnlineVideos.VideoInfo> getAllTrailers(){ - GUIOnlineVideos.VideoInfo loItem; + //GUIOnlineVideos.VideoInfo loItem; Dictionary<string, GUIOnlineVideos.RssLink> loRssList= OnlineVideoSettings.getInstance().moSiteList[getSiteId()].RssList; List<GUIOnlineVideos.VideoInfo> loListItems = new List<GUIOnlineVideos.VideoInfo>(); foreach(GUIOnlineVideos.RssLink link in loRssList.Values){ @@ -129,16 +121,9 @@ if(loTrailersFound.ContainsKey(trailer.Title) == false){ loTrailersFound.Add(trailer.Title.ToUpper(), ""); - loItem = new GUIOnlineVideos.VideoInfo(); - loItem.Title = trailer.Title; - if(trailer.PosterUrl!=null){ - loItem.ImageUrl = trailer.PosterUrl.ToString(); - } - loItem.Description = trailer.Overview; - loItem.VideoUrl = trailer.Url.ToString(); - loItem.Other = trailer; + //loItem.Length = trailer.. - loListItems.Add(loItem); + loListItems.Add(loadVideoInfo(trailer)); } } @@ -179,5 +164,17 @@ //Log.Info("finished getting trailers from url:"+fsLink.url); } + private GUIOnlineVideos.VideoInfo loadVideoInfo(TrailerInfo trailer){ + GUIOnlineVideos.VideoInfo newVideo = new GUIOnlineVideos.VideoInfo(); + newVideo.Title = trailer.Title; + newVideo.VideoUrl = trailer.Title; + newVideo.Description = trailer.Overview; + if(trailer.PosterUrl!=null){ + newVideo.ImageUrl = trailer.PosterUrl.ToString(); + } + newVideo.Other = trailer; + return newVideo; + + } } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -116,7 +116,7 @@ /// </summary> /// <param name="obj">Obj.</param> /// <returns></returns> - public static ITMSClient.TrailerInfo ProcessTrailer(object obj) + public static ITMSClient.TrailerInfo ProcessTrailer(object obj ,ITMSClient.TrailerSize size) { ITMSClient.TrailerInfo trailerInfo = (ITMSClient.TrailerInfo)obj; @@ -124,7 +124,7 @@ // Lookup the trailer in the media library string key = trailerInfo.Title.GetHashCode().ToString(); // Populate the rest of the meta data - trailerInfo = ITMSClient.ITMSHelper.PopulateTrailerDetails(trailerInfo, ITMSClient.TrailerSize.h640); + trailerInfo = ITMSClient.ITMSHelper.PopulateTrailerDetails(trailerInfo, size); // Get the poster image if it doesn't already exist //if (trailerInfo.PosterUrl != null) Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -179,6 +179,7 @@ TrailerStream myStream = GetDesiredTrailerStream(tsc, desiredSize); trailerInfo.TrailerStreamCollection.Add(myStream); + //trailerInfo.TrailerStreamCollection = tsc; } } trailerInfo.TrailerStreamCollection.TrimToSize(); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -71,7 +71,7 @@ /// </summary> internal static Regex streamRegex = new Regex( //@"<GotoURL.+?url=""(?<url>.*?(?<size>(small|medium|large|fullscreen))\.xml)""", - @"<key>episodeURL</key><string>(?<url>[^<]*(?<size>h[\d]*)[w]*\.mov)", + @"<key>episodeURL</key><string>(?<url>[^<]*(?<size>h[\d]*p*)[w]*\.mov)", RegexOptions.ExplicitCapture | RegexOptions.Compiled ); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -103,4 +103,4 @@ } } -} \ No newline at end of file +} Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-30 13:10:21 UTC (rev 877) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideoSettings.cs 2007-08-30 21:28:51 UTC (rev 878) @@ -24,9 +24,10 @@ public String msDownloadDir; public String[] msFilterArray; public Dictionary<String,GUIOnlineVideos.SiteSettings> moSiteList = new Dictionary<String, GUIOnlineVideos.SiteSettings>(); - + public ITMSClient.TrailerSize AppleTrailerSize = ITMSClient.TrailerSize.h640; private const String SETTINGS_FILE = "OnlineVideoSites.xml"; private const String THUMBNAIL_DIR = "thumbDir"; + private const String TRAILER_SIZE = "trailerSize"; private const String DOWNLOAD_DIR = "downloadDir"; private const String SECTION = "onlinevideos"; private const String FILTER = "filter"; @@ -42,20 +43,24 @@ loadSettings(); } private void loadSettings(){ - + String lsTrailerSize; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { msThumbLocation = xmlreader.GetValueAsString(SECTION, THUMBNAIL_DIR, ""); msDownloadDir = xmlreader.GetValueAsString(SECTION, DOWNLOAD_DIR, ""); String lsFilter = xmlreader.GetValueAsString(SECTION, FILTER, ""); - + lsTrailerSize = xmlreader.GetValueAsString(SECTION,TRAILER_SIZE,"h640"); msFilterArray = lsFilter.Split(new char[] { ',' }); if (msFilterArray.Length == 1 && msFilterArray[0] == "") { msFilterArray = null; } } + if(Enum.IsDefined(typeof(ITMSClient.TrailerSize),lsTrailerSize)){ + AppleTrailerSize = (ITMSClient.TrailerSize)Enum.Parse(typeof(ITMSClient.TrailerSize),lsTrailerSize,true); + } + if(String.IsNullOrEmpty(msThumbLocation)){ msThumbLocation = Config.GetFolder(Config.Dir.Thumbs) +@"\OnlineVideos\"; @@ -157,6 +162,7 @@ } xmlwriter.SetValue(SECTION,THUMBNAIL_DIR,msThumbLocation); xmlwriter.SetValue(SECTION, DOWNLOAD_DIR,msDownloadDir ); + xmlwriter.SetValue(SECTION,TRAILER_SIZE,AppleTrailerSize.ToString()); } Console.WriteLine(System.IO.Directory.GetCurrentDirectory()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-09-04 07:32:34
|
Revision: 891 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=891&view=rev Author: gregmac45 Date: 2007-09-04 00:32:31 -0700 (Tue, 04 Sep 2007) Log Message: ----------- Added page with all available trailers for movie Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/HDHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -23,13 +23,17 @@ { [SkinControlAttribute(2)] protected GUIButtonControl btnViewAs = null; + [SkinControlAttribute(3)] + protected GUIButtonControl btnNext = null; + [SkinControlAttribute(4)] + protected GUIButtonControl btnPrevious = null; [SkinControlAttribute(50)] protected GUIFacadeControl facadeView = null; [SkinControlAttribute(1)] protected GUIImage logoImage = null; - [SkinControlAttribute(4)] - protected GUITextControl txtDesc = null; + //[SkinControlAttribute(4)] + //protected GUITextControl txtDesc = null; //private ILog moLog; protected View currentView = View.Icons; @@ -42,6 +46,7 @@ private State _CurrentState = State.home; private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); + private List<VideoInfo> moCurrentTrailerList = new List<VideoInfo>(); private String []msFilterArray; private String msThumbLocation; private int miSelectedIndex = 0; @@ -212,6 +217,7 @@ if (_CurrentState == State.home) { DisplaySites(); + SwitchView(); //currentView = View.List; //ChangeFacadeView(); @@ -228,7 +234,7 @@ else{ DisplayVideoDetails(moSelectedVideo); } - UpdateViewSate(); + UpdateViewState(); //base.OnPageLoad(); } protected override void OnShowContextMenu() @@ -299,7 +305,7 @@ } public override void OnAction(Action action) { - if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU && _CurrentState!= State.home ) { OnShowPreviousMenu2(); return; @@ -366,10 +372,10 @@ { miSelectedIndex = facadeView.SelectedListItemIndex; //play the video - Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); + Play(moCurrentTrailerList[facadeView.SelectedListItemIndex -1]); } } - UpdateViewSate(); + UpdateViewState(); } else if (control == btnViewAs) { @@ -378,7 +384,19 @@ //do //{ //shouldContinue = false; - } + } + else if (control == btnNext) + { + moCurrentVideoList = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getNextPageVideos(); + DisplayVideos(false); + UpdateViewState(); + } + else if (control == btnPrevious) + { + moCurrentVideoList = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getPreviousPageVideos(); + DisplayVideos(false); + UpdateViewState(); + } base.OnClicked(controlId, control, actionType); } @@ -393,7 +411,7 @@ } else if (_CurrentState == State.videos) { - Log.Info("Set the stopDownload to true 2"); + Log.Info("Set the stopDownload to true 3"); ImageDownloader._stopDownload = true; DisplayCategories(); @@ -406,13 +424,15 @@ //Log.Info("Set the stopDownload to true 2"); ImageDownloader._stopDownload = true; - DisplayVideos(true); + DisplayVideos(false); SwitchView(); btnViewAs.Visible = true; _CurrentState = State.videos; } + DisplayVideoInfo(null); + UpdateViewState(); } public override bool OnMessage(GUIMessage message) { @@ -493,18 +513,50 @@ cat.url = "favorites"; loSite.RssList.Add("dynamic",cat); moSiteList.Add("100",loSite); + + if (!String.IsNullOrEmpty(settings.msDownloadDir)) + { + try{ + if (System.IO.Directory.Exists(settings.msDownloadDir)==false) + { + + System.IO.Directory.CreateDirectory(msDownloadDir); + + } + } + catch (Exception e) + { + Log.Error("Failed to create download dir"); + Log.Error(e); + } + //add a downloaded videos site + loSite = new SiteSettings(); + loSite.id = "99"; + loSite.name = "Downloaded Videos"; + loSite.enabled = true; + cat = new RssLink(); + cat.name = "All"; + cat.url = settings.msDownloadDir; + loSite.RssList.Add(cat.name, cat); + moSiteList.Add("99", loSite); + } + try + { + Log.Info("checking existance of thumb dir:" + settings.msThumbLocation); + if (System.IO.Directory.Exists(settings.msThumbLocation)==false) + { + Log.Info("Thumb dir does not exist."); + System.IO.Directory.CreateDirectory(settings.msThumbLocation); + Log.Info("thumb dir created"); + } + } + catch (Exception e) + { + Log.Error("Failed to create thumb dir"); + Log.Error(e); + } + - //add a downloaded videos site - loSite = new SiteSettings(); - loSite.id = "99"; - loSite.name = "Downloaded Videos"; - loSite.enabled = true; - cat = new RssLink(); - cat.name = "All"; - cat.url = settings.msDownloadDir; - loSite.RssList.Add(cat.name,cat); - moSiteList.Add("99",loSite); - } private void DisplaySites() { @@ -655,7 +707,7 @@ } //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 +""); - ImageDownloader.getImages(loImageUrlList,msThumbLocation,facadeView); + ImageDownloader.getImages(loImageUrlList,OnlineVideoSettings.getInstance().msThumbLocation,facadeView); // Log.Info("Getting images"); // BackgroundWorker worker = new BackgroundWorker(); // @@ -698,7 +750,7 @@ moSelectedVideo = foVideo; SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); List<VideoInfo> loVideoList= loSiteUtil.getOtherVideoList(foVideo); - moCurrentVideoList.Clear(); + moCurrentTrailerList.Clear(); GUIControl.ClearControl(GetID, facadeView.GetID); GUIListItem loListItem = new GUIListItem(".."); loListItem.IsFolder = true; @@ -711,7 +763,7 @@ { liIdx++; loVideoInfo.Description = cleanString(loVideoInfo.Description); - + moSelectedVideo.Description = loVideoInfo.Description; loListItem = new GUIListItem(loVideoInfo.Title); loListItem.Label2 = loVideoInfo.Title2; loListItem.Path = loVideoInfo.VideoUrl; @@ -722,11 +774,11 @@ facadeView.Add(loListItem); //loListItem.RetrieveArt = true; //loImageUrlList.Add(loVideoInfo.ImageUrl); - moCurrentVideoList.Add(loVideoInfo); + moCurrentTrailerList.Add(loVideoInfo); } facadeView.View = GUIFacadeControl.ViewMode.List; btnViewAs.Visible = false; - DisplayVideoInfo(loVideoList[0]); + //DisplayVideoInfo(loVideoList[0]); //strLine = GUILocalizeStrings.Get(101); } @@ -858,28 +910,81 @@ } return fsStr; } - private void UpdateViewSate(){ + private void UpdateViewState(){ switch(_CurrentState){ case State.home: GUIPropertyManager.SetProperty("#header.label","OnlineVideos"); GUIPropertyManager.SetProperty("#header.image",""); - DisplayVideoInfo(null); + GUIControl.HideControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID,btnPrevious.GetID); + GUIControl.HideControl(GetID, 23); + GUIControl.HideControl(GetID, 24); + GUIControl.HideControl(GetID, 25); + GUIControl.HideControl(GetID, 58); + GUIControl.HideControl(GetID, 59); + DisplayVideoInfo(null); break; case State.categories: GUIPropertyManager.SetProperty("#header.label","Categories"); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); + GUIControl.HideControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID,btnPrevious.GetID); + GUIControl.HideControl(GetID, 23); + GUIControl.HideControl(GetID, 24); + GUIControl.HideControl(GetID, 25); + GUIControl.HideControl(GetID, 58); + GUIControl.HideControl(GetID, 59); DisplayVideoInfo(null); break; case State.videos: GUIPropertyManager.SetProperty("#header.label",msSelectedCategoryName); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); - DisplayVideoInfo(null); + GUIControl.ShowControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID, 23); + GUIControl.HideControl(GetID, 24); + GUIControl.HideControl(GetID, 25); + GUIControl.HideControl(GetID, 58); + GUIControl.HideControl(GetID, 59); + + SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + if (loSiteUtil.hasNextPage()) + { + GUIControl.EnableControl(GetID,btnNext.GetID); + } + else + { + GUIControl.DisableControl(GetID,btnNext.GetID); + } + GUIControl.ShowControl(GetID,btnPrevious.GetID); + if (loSiteUtil.hasPreviousPage()) + { + GUIControl.EnableControl(GetID, btnPrevious.GetID); + } + else + { + GUIControl.DisableControl(GetID,btnPrevious.GetID); + } + DisplayVideoInfo(null); break; case State.info: GUIPropertyManager.SetProperty("#header.label",moSelectedVideo.Title); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); - //DisplayVideoInfo(); + GUIControl.HideControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID,btnPrevious.GetID); + + GUIControl.ShowControl(GetID, 23); + GUIPropertyManager.SetProperty("#movieposter", ImageDownloader.downloadPoster(moSelectedVideo.ImageUrl.Replace("_m", "_l"),moSelectedVideo.Title,OnlineVideoSettings.getInstance().msThumbLocation)); + GUIPropertyManager.SetProperty("#movietitle", moSelectedVideo.Title); + GUIPropertyManager.SetProperty("#trailerdesc", moSelectedVideo.Description); + //Log.Info("trailer desc:{0}", moSelectedVideo.Description); + GUIControl.ShowControl(GetID, 24); + GUIControl.ShowControl(GetID, 25); + GUIControl.ShowControl(GetID, 58); + GUIControl.ShowControl(GetID, 59); + + + DisplayVideoInfo(null); break; } } @@ -946,8 +1051,11 @@ } protected void SwitchView() { - if (facadeView == null) - return; + if (facadeView == null) + { + //Log.Info("SwitchView - facadeview is null"); + return; + } string strLine = String.Empty; switch (currentView) Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ImageDowloader.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -127,6 +127,20 @@ } */ #endregion + public static string downloadPoster(String fsUrl, String fsMovieName,string fsLocation) + { + + String lsPosterLocation = fsLocation + fsMovieName + "_p.jpg"; + if (System.IO.File.Exists(lsPosterLocation) == false) + { + WebClient client = new WebClient(); + Log.Info("downloading Poster image :" + fsUrl); + client.DownloadFile(fsUrl, lsPosterLocation); + } + return lsPosterLocation; + } + + public static void getImages(List<String> imageUrlList,String ThumbLocation,GUIFacadeControl facadeView){ Log.Info("Getting images"); BackgroundWorker worker = new BackgroundWorker(); Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -85,12 +85,14 @@ List<OnlineVideos.GUIOnlineVideos.VideoInfo> videoList = new List<OnlineVideos.GUIOnlineVideos.VideoInfo>(); TrailerInfo trailer = (TrailerInfo)video.Other; trailer = AppleTrailers.GetTrailerUrls(trailer); - Console.WriteLine("Found {0} trailer urls",trailer.trailers.Count); + //Log.Info("getOtherVideoList overview:" + trailer.Overview); + //Console.WriteLine("Found {0} trailer urls",trailer.trailers.Count); GUIOnlineVideos.VideoInfo newVideo; foreach (String name in trailer.trailers.Keys){ newVideo = loadVideoInfo(trailer); newVideo.Title = name; - newVideo.VideoUrl = trailer.trailers[name]; + newVideo.VideoUrl = trailer.trailers[name]; + Log.Info("added video url={0}", newVideo.VideoUrl); videoList.Add(newVideo); } return videoList; @@ -98,9 +100,12 @@ public override String getUrl(GUIOnlineVideos.VideoInfo video,GUIOnlineVideos.SiteSettings foSite) { TrailerInfo trailer = (TrailerInfo)video.Other; - trailer = AppleTrailers.ProcessTrailer(trailer,OnlineVideoSettings.getInstance().AppleTrailerSize); - Log.Info("Trailer quality set to {0}",OnlineVideoSettings.getInstance().AppleTrailerSize); - Console.WriteLine("Found {0} trailer urls",trailer.TrailerStreamCollection.Count); + Log.Info("requesting to get url for " + video.VideoUrl); + trailer.Url = new Uri("http://movies.apple.com" + video.VideoUrl); + Log.Info("Trailer quality set to {0}", OnlineVideoSettings.getInstance().AppleTrailerSize); + trailer = AppleTrailers.ProcessTrailer(trailer,OnlineVideoSettings.getInstance().AppleTrailerSize); + + //Console.WriteLine("Found {0} trailer urls",trailer.TrailerStreamCollection.Count); return trailer.TrailerStreamCollection[0].Uri.ToString(); } public List<GUIOnlineVideos.VideoInfo> getAllTrailers(){ @@ -176,5 +181,44 @@ return newVideo; } + public override bool hasNextPage() + { + if (AppleTrailers.currentPage == null || AppleTrailers.currentPage.NextPageUri == null) + { + //Log.Info("current page is null or next page uri is null"); + return false; + } + //Log.Info("{0}",AppleTrailers.currentPage.NextPageUri); + Log.Info(AppleTrailers.currentPage.NextPageUri.ToString()); + return String.IsNullOrEmpty(AppleTrailers.currentPage.NextPageUri.ToString()) == false; + } + public override List<GUIOnlineVideos.VideoInfo> getNextPageVideos() + { + List<GUIOnlineVideos.VideoInfo> trailerList = new List<GUIOnlineVideos.VideoInfo>(); + if (hasNextPage()) + { + trailerList = getVideoList(AppleTrailers.currentPage.NextPageUri.ToString()); + } + return trailerList; + } + public override List<GUIOnlineVideos.VideoInfo> getPreviousPageVideos() + { + List<GUIOnlineVideos.VideoInfo> trailerList = new List<GUIOnlineVideos.VideoInfo>(); + if (hasPreviousPage()) + { + trailerList = getVideoList(AppleTrailers.currentPage.BackPageUri.ToString()); + } + return trailerList; + + } + public override bool hasPreviousPage() + { + if (AppleTrailers.currentPage == null || AppleTrailers.currentPage.BackPageUri == null) + { + return false; + } + return String.IsNullOrEmpty(AppleTrailers.currentPage.BackPageUri.ToString()) == false; + } + } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -18,7 +18,9 @@ public class AppleTrailers { public static List<ITMSClient.TrailerInfo> trailers = new List<ITMSClient.TrailerInfo>(); + public static ITMSClient.TrailerIndex currentPage; + /* public static string casturl; public static string TempXML = string.Empty; @@ -54,18 +56,20 @@ public static bool tview = false; public static bool cview = false; public static bool mview = false; - + */ public static bool _workerCompleted = false; - public static string PosterUrl = string.Empty; + //public static string PosterUrl = string.Empty; // mediaportal.xml - public static string server = string.Empty; + //public static string server = string.Empty; public void HandleHttpError(object sender, ITMSClient.HTTPErrorEventArgs e){ } public static void GetAppleTrailersRSS(object sender, DoWorkEventArgs e) { + currentPage = null; + _workerCompleted = false; //.+=new ITMSClient.HTTPErrorEventHandler(HandleHttpError); //loListItem.OnItemSelected+= new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnVideoItemSelected); @@ -77,12 +81,12 @@ if (xmlContent.IsValid) { - //Log.Info("xml is valid"); - ITMSClient.TrailerIndex indexPage = new ITMSClient.TrailerIndex("test", xmlContent); - RSSTitle = "Apple HD Trailers"; + Log.Info("xml is valid"); + currentPage = new ITMSClient.TrailerIndex("test", xmlContent); + //RSSTitle = "Apple HD Trailers"; //trailers.Add(indexPage.TrailerInfoCollection.); //Log.Info("FOund {0} trailers.", indexPage.TrailerInfoCollection.Count); - foreach (ITMSClient.TrailerInfo trailerInfo in indexPage.TrailerInfoCollection) + foreach (ITMSClient.TrailerInfo trailerInfo in currentPage.TrailerInfoCollection) { /* ITMSClient.TrailerInfo trailer = ProcessTrailer(trailerInfo); @@ -96,15 +100,15 @@ } - pageUri = indexPage.NextPageUri; + //pageUri = indexPage.NextPageUri; } - else - { - pageUri = null; - } + //else + //{ + // pageUri = null; + //} _workerCompleted = true; - foundt = true; - tview = true; + //foundt = true; + //tview = true; } @@ -120,7 +124,7 @@ { ITMSClient.TrailerInfo trailerInfo = (ITMSClient.TrailerInfo)obj; - //Log.Info("Processing Trailer {0}",trailerInfo.Title); + Log.Info("Processing Trailer {0}",trailerInfo.Title); // Lookup the trailer in the media library string key = trailerInfo.Title.GetHashCode().ToString(); // Populate the rest of the meta data Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/HDHelper.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/HDHelper.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/HDHelper.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -32,6 +32,7 @@ /// </summary> public sealed class HDHelper { + /* private const string URI = "http://www.apple.com/trailers/"; static public Hashtable GetAvailableMovies() @@ -51,13 +52,13 @@ ITMSContent content = ITMSHelper.GetITMSPage(trailerPage); switch (size) { - case TrailerSize.HD480p: + case TrailerSize.h480p: regex = new Regex("HREF=\"(?<url>.+?_480p.mov)\""); break; - case TrailerSize.HD720p: + case TrailerSize.h720p: regex = new Regex("HREF=\"(?<url>.+?_720p.mov)\""); break; - case TrailerSize.HD1080p: + case TrailerSize.h1080p: regex = new Regex("HREF=\"(?<url>.+?_1080p.mov)\""); break; } @@ -65,6 +66,7 @@ string url = regex.Match(content.Xml).Groups["url"].Value; return new Uri(content.WebResponse.ResponseUri, url); } + */ } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -37,7 +37,7 @@ #region Constants // The iTunes server won't talk to us unless we pretend to be a bona-fide iTunes client private const string USER_AGENT = "User-Agent: iTunes/6.0 (Windows)"; - private static Hashtable HighDef = HDHelper.GetAvailableMovies(); + //private static Hashtable HighDef = HDHelper.GetAvailableMovies(); #endregion @@ -52,8 +52,9 @@ //String desc; if (field.Success) { - //Log.Info("got the movie details for {0}",trailerInfo.Title); + //Log.Info("got the movie overview {0}",trailerInfo.Title); trailerInfo.Overview = field.Groups["overview"].Value.Replace("\r\n", " ").Replace('\u0092', '\'').Replace('\u0093', '"').Replace('\u0094', '"'); + //Log.Info("got the movie overview {0}", trailerInfo.Overview); } String name; String url; @@ -82,6 +83,7 @@ /// <returns></returns> static public TrailerInfo PopulateTrailerDetails(TrailerInfo trailerInfo, ITMSClient.TrailerSize desiredSize) { + Log.Info("pop details for " + trailerInfo.Url); //Log.Info("Populating Trailer details for {0}", trailerInfo.Title); string[] MONTHS = new string[]{"January","February","March","April","May","June","July","August","September","October","November","December"}; //const string DIRECTOR = "(dir.)"; @@ -90,6 +92,7 @@ StringBuilder actors = new StringBuilder("|"); ITMSContent infoPage = GetITMSPage(trailerInfo.Url); + Log.Info("got itms page for " + trailerInfo.Url); //Log.Info(infoPage.Xml); if (infoPage.IsValid) { @@ -151,9 +154,9 @@ trailerInfo.Actors = actors.ToString(); */ trailerInfo.TrailerStreamCollection = new TrailerStreamCollection(); - + /* // WARNING: HACK CODE FOR HIGHDEF TRAILERS - if (desiredSize >= TrailerSize.HD480p) + if (desiredSize >= TrailerSize.h480p) { if (HighDef.Contains(trailerInfo.Title)) { @@ -168,16 +171,18 @@ } } // END HACK CODE - + */ // Get movie trailer streams if (desiredSize != TrailerSize.None && trailerInfo.TrailerStreamCollection.Count == 0) { foreach (Capture url in fields.Groups["urls"].Captures) { //Log.Info("Found stream url:{0}", url); - TrailerStreamCollection tsc = GetTrailerStreamCollection(new Uri(infoPage.WebResponse.ResponseUri, url.Value)); + //TrailerStreamCollection tsc = GetTrailerStreamCollection(new Uri(infoPage.WebResponse.ResponseUri, url.Value)); + TrailerStreamCollection tsc = GetTrailerStreamCollection(infoPage); TrailerStream myStream = GetDesiredTrailerStream(tsc, desiredSize); + Log.Info("Addinf stream to collection:" + myStream.Uri); trailerInfo.TrailerStreamCollection.Add(myStream); //trailerInfo.TrailerStreamCollection = tsc; } @@ -229,6 +234,7 @@ static public ITMSContent GetITMSPage(Uri uri, DateTime ifModifiedSince) { + //Log.Info("GetItmsPage witrh uri:" + uri); const int TIMEOUT = 30000; // 30 seconds StreamReader sReader = null; HttpWebRequest request = null; @@ -236,7 +242,7 @@ ITMSContent content = null; //Log.Debug("GetITMSPage: " + uri.AbsoluteUri); - //Log.Info("GetITMSPage: " + uri.AbsoluteUri); + Log.Info("GetITMSPage: " + uri.AbsoluteUri); try { request = (HttpWebRequest) HttpWebRequest.Create(uri); @@ -297,6 +303,11 @@ /// <returns></returns> private static TrailerStream GetDesiredTrailerStream(TrailerStreamCollection trailerStreams, TrailerSize desiredSize) { + Log.Info("GetDesiredTrailerStream - desiredSize=" + desiredSize); + foreach (TrailerStream stream1 in trailerStreams) + { + Log.Info("GetDesiredTrailerStream - size available:" + stream1.Size); + } //Log.Info("getting desired Trailer size of {0}", desiredSize); // Find the largest desired size supported by the available streams while (trailerStreams.ContainsKey(desiredSize) == false && desiredSize > 0) @@ -329,11 +340,13 @@ /// </summary> /// <param name="trailerInfo">Trailer info.</param> /// <returns></returns> - private static TrailerStreamCollection GetTrailerStreamCollection(Uri url) + //private static TrailerStreamCollection GetTrailerStreamCollection(Uri url) + private static TrailerStreamCollection GetTrailerStreamCollection(ITMSContent trailerPage) { + //Log.Info("GetTrailerStreamCollection url:" + url); TrailerStreamCollection streamCollection = new TrailerStreamCollection(3); - ITMSContent trailerPage = GetITMSPage(url); + //ITMSContent trailerPage = GetITMSPage(url); if (trailerPage.IsValid) { string type = String.Empty; Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -3,107 +3,131 @@ namespace ITMSClient { - /// <summary> - /// Regular expression parsers for iTunes movie XML pages - /// </summary> - internal sealed class RegexParsers - { - /// <summary> - /// Used to find the link to the next index page from the current index page - /// Returns the url and page number - /// </summary> - internal static Regex indexNextPageRegex = new Regex( - @"\<GotoURL url=""(?<url>index_(?<pagenum>\d{1,3})\.xml)""\>\s*\<TextView[^/]*?\<B\>More", - RegexOptions.Singleline - | RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); + /// <summary> + /// Regular expression parsers for iTunes movie XML pages + /// </summary> + internal sealed class RegexParsers + { + /// <summary> + /// Used to find the link to the next index page from the current index page + /// Returns the url and page number + /// </summary> + internal static Regex indexNextPageRegex = new Regex( + @"\<GotoURL url=""(?<url>\w*_(?<pagenum>\d{1,3})\.xml)""\>\s*\<TextView[^/]*?\<B\>More", + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); + internal static Regex indexBackPageRegex = new Regex( + @"\<GotoURL url=""(?<url>\w*_(?<pagenum>\d{1,3})\.xml)""\>\s*\<TextView[^/]*?\<B\>Back", + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); - /// <summary> - /// Used to pull the title, studio and url link for each movie trailer on the index page - /// </summary> - internal static Regex indexDetailsRegex = new Regex( - //"<GotoURL[^>]+url=\"(?<url>/moviesxml/[^\"]+?/index.xml)\">\\s*<B>(?<title>[^<]+)</B>.+?" - //+ "<GotoURL[^>]+>\\s*(?<studio>.+?)\\s*</GotoURL>", + /// <summary> + /// Used to pull the title, studio and url link for each movie trailer on the index page + /// </summary> + internal static Regex indexDetailsRegex = new Regex( + //"<GotoURL[^>]+url=\"(?<url>/moviesxml/[^\"]+?/index.xml)\">\\s*<B>(?<title>[^<]+)</B>.+?" + //+ "<GotoURL[^>]+>\\s*(?<studio>.+?)\\s*</GotoURL>", //"<GotoURL[^>]+url=\"(?<url>/moviesxml/[^\"]+?/index.xml)\">\\s*<[^>]+><B>(?<title>[^<]+)</B>[^>]+>(?>\\s+[^>]+>)+\\s+<GotoURL[^>]+>\\s*<[^>]+>(?<studio>.+?)\\s*</SetFontStyle>", //"<GotoURL[^>]+url=\"(?<url>/moviesxml/[^\"]+?/index.xml)\">\\s*<[^>]+><B>(?<title>[^<]+)</B>[^>]+>.+?<GotoURL[^>]+>\\s*<[^>]+>(?<studio>.+?)\\s*</GotoURL>", @"<PictureView[^.]+ url=""(?<poster>[^""]*.jpg)"".+?<GotoURL[^>]+url=""(?<url>/moviesxml/[^""]+?/index.xml)"">\s*<[^>]+><B>(?<title>[^<]+)</B>[^>]+>.+?<GotoURL[^>]+>\s*<[^>]+>(?<studio>.+?)\s*</GotoURL>", - RegexOptions.Singleline - | RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); - /// <summary> - /// Used to capture all the movie details from the movie details index.xml page - /// </summary> - internal static Regex moviedetailsRegex1 = new Regex( - @"<PictureView.+?url=""(?<poster>[^""]+)"".+?" + internal static Regex indexDetailsRegex2 = new Regex( + "<GotoURL url=\"(?<url>[^\"]*)\".+?\\s*<PictureView.+?url=\"(" + + "?<poster>[^\"]+)\".+?[^>]+>.+?[^>]+>.+?[^>]+>.+?[^>]+>.+?[^>" + + "]+>.+?\\s*<b>(?<title>[^<]+)</b>.+?[^>]+>.+?[^>]+>.+?[^>]+>." + + "+?[^>]+>.+?\\s*(?<studio>.+?)\\s*</", + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); + internal static Regex indexBoxOfficeRegex = new Regex( + "<GotoURL target=\"[^\"]*\" url=\"(?<url>[^\"]*)\".+?\\s*[^>]" + + "+>.+?[^>]+>.+?[^>]+>.+?[^>]+>.+?[^>]+>.+?[^>]+>.+?[^>]+>\\s*" + + "<b>(?<title>[^<]+)</b>(?<poster>)(?<studio>)", +RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); + + /// <summary> + /// Used to capture all the movie details from the movie details index.xml page + /// </summary> + internal static Regex moviedetailsRegex1 = new Regex( + @"<PictureView.+?url=""(?<poster>[^""]+)"".+?" + @"<TextView[^>]*>\s*[^>]+>\s*<b>(?<title>[^<]+?)</b>.+?" + @"<TextView[^>]*>\s*[^>]+>\s*(?<copyright>[^<]+?)\s*<.+?" + @"<TextView[^>]*>\s*[^>]+>\s*(?<overview>[^<]*?)\s*<", - RegexOptions.Singleline - | RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); - internal static Regex moviedetailsRegex2 = new Regex( - //@"Release:\s*(?<release>[^<]+?)\s*<.+?" - //+ @"<TextView[^>]*>(\s*<GotoURL[^>]*>(?<genres>[^<]+)</GotoURL>,?){0,}\s*</TextView>.+?" - //+ @"Rating:\s*(?<rating>.+?)\s*<.+?" - //+ @"(<TextView[^>]*>\s*(?<cast>[^<]*?)\s*</TextView>.+?){0,}</VBoxView>.+?" - // @"(<GotoURL[^>]+url=""(?<urls>/moviesxml/[^>]+?/index.xml)"">\s*<TextView.+?){0,}</Document>", + internal static Regex moviedetailsRegex2 = new Regex( + //@"Release:\s*(?<release>[^<]+?)\s*<.+?" + //+ @"<TextView[^>]*>(\s*<GotoURL[^>]*>(?<genres>[^<]+)</GotoURL>,?){0,}\s*</TextView>.+?" + //+ @"Rating:\s*(?<rating>.+?)\s*<.+?" + //+ @"(<TextView[^>]*>\s*(?<cast>[^<]*?)\s*</TextView>.+?){0,}</VBoxView>.+?" + // @"(<GotoURL[^>]+url=""(?<urls>/moviesxml/[^>]+?/index.xml)"">\s*<TextView.+?){0,}</Document>", "<GotoURL[^>]+url=\"(?<urls>/moviesxml/[^\"]+)[^>]*>\\s*<TextView", - RegexOptions.Singleline - | RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); - internal static Regex dateRegex = new Regex( - @"(?<month>\w+) (?<day>\d+).+?(?<year>(19|20)\d\d)", - RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); + internal static Regex dateRegex = new Regex( + @"(?<month>\w+) (?<day>\d+).+?(?<year>(19|20)\d\d)", + RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); - /// <summary> - /// Used to find the different sizes of Quicktime trailer movies available from - /// the trailer size selection page - /// Returns the url and the size of the movie - /// </summary> - internal static Regex streamRegex = new Regex( - //@"<GotoURL.+?url=""(?<url>.*?(?<size>(small|medium|large|fullscreen))\.xml)""", + /// <summary> + /// Used to find the different sizes of Quicktime trailer movies available from + /// the trailer size selection page + /// Returns the url and the size of the movie + /// </summary> + internal static Regex streamRegex = new Regex( + //@"<GotoURL.+?url=""(?<url>.*?(?<size>(small|medium|large|fullscreen))\.xml)""", @"<key>episodeURL</key><string>(?<url>[^<]*(?<size>h[\d]*p*)[w]*\.mov)", - RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); - - //Used to find the multiple trailer urls - internal static Regex trailerLinkRegex = new Regex( - "<HBoxView[^>]*>\\s*<GotoURL\\starget=\"main\"\\surl=\"(?<url>[^\"]*)[^=]*=[^=]*=\"(?<name>[^\"]*)", - RegexOptions.Singleline - | RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); - + RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); - /// <summary> - /// Used to pull the type and length of the Quicktime trailer movies available from - /// the trailer size selection page - /// </summary> - internal static Regex streamDetailsRegex = new Regex( - @"<b>(?<type>.+?)\s\((?<minutes>\d{0,2}):(?<seconds>\d{2})\)?</b>", - RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); + //Used to find the multiple trailer urls + internal static Regex trailerLinkRegex = new Regex( + "<HBoxView[^>]*>\\s*<GotoURL\\starget=\"main\"\\surl=\"(?<url>[^\"]*)[^=]*=[^=]*=\"(?<name>[^\"]*)", + RegexOptions.Singleline + | RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); - /// <summary> - /// Used to find the actual Quicktime movie on the final movie playback page - /// Returns the url of the .mov file - /// </summary> - internal static Regex movRegex = new Regex( - @"\<MovieView.+?url=""(?<url>.+?\.mov)""", - RegexOptions.ExplicitCapture - | RegexOptions.Compiled - ); - } + /// <summary> + /// Used to pull the type and length of the Quicktime trailer movies available from + /// the trailer size selection page + /// </summary> + internal static Regex streamDetailsRegex = new Regex( + @"<b>(?<type>.+?)\s\((?<minutes>\d{0,2}):(?<seconds>\d{2})\)?</b>", + RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); + + /// <summary> + /// Used to find the actual Quicktime movie on the final movie playback page + /// Returns the url of the .mov file + /// </summary> + internal static Regex movRegex = new Regex( + @"\<MovieView.+?url=""(?<url>.+?\.mov)""", + RegexOptions.ExplicitCapture + | RegexOptions.Compiled + ); + + } } Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -33,6 +33,7 @@ protected ITMSContent _content = null; protected TrailerInfoCollection _trailers = null; protected Uri _nextPageUri = null; + protected Uri _backPageUri = null; protected string _sectionName; #region Constructor @@ -78,17 +79,45 @@ { get { + if (_nextPageUri == null) { + Match nextPage = RegexParsers.indexNextPageRegex.Match(Content.Xml); - if (nextPage.Success) - this._nextPageUri = new Uri(Content.WebResponse.ResponseUri, nextPage.Groups["url"].Value); - else - this._nextPageUri = null; + + if (nextPage.Success) + { + this._nextPageUri = new Uri(Content.WebResponse.ResponseUri, nextPage.Groups["url"].Value); + Log.Info("Found next page"); + } + else + this._nextPageUri = null; } return _nextPageUri; } } + public Uri BackPageUri + { + get + { + Log.Info("backPage uri requested"); + if (_backPageUri == null) + { + Log.Info("backPage currently null"); + Match backPage = RegexParsers.indexBackPageRegex.Match(Content.Xml); + Log.Info("backPage regex performed"); + if (backPage.Success) + { + Log.Info("backPage regex successful"); + this._backPageUri = new Uri(Content.WebResponse.ResponseUri, backPage.Groups["url"].Value); + Log.Info("TrailerIndex.BackPageUri - Found previous page"); + } + else + this._backPageUri = null; + } + return _backPageUri; + } + } /// <summary> /// Gets the count of trailers on the page @@ -112,21 +141,48 @@ protected void ParseIndexPage() { Log.Info("Parsing index page"); - MatchCollection movieItemCollection = RegexParsers.indexDetailsRegex.Matches(Content.Xml); - _trailers = new TrailerInfoCollection(movieItemCollection.Count); - Debug.Assert(movieItemCollection.Count > 0, "No movies found in index page xml"); + MatchCollection movieItemCollection = RegexParsers.indexDetailsRegex.Matches(Content.Xml); + if (movieItemCollection.Count == 0) + { + movieItemCollection = RegexParsers.indexDetailsRegex2.Matches(Content.Xml); + + if (movieItemCollection.Count == 0) + { + movieItemCollection = RegexParsers.indexBoxOfficeRegex.Matches(Content.Xml); + if (movieItemCollection.Count == 0) + { + Log.Info("No movies found in index page xml"); + return; + } + } + + } + _trailers = new TrailerInfoCollection(movieItemCollection.Count); + Log.Info("ParseIndexPage - Found {0} trailers.", movieItemCollection.Count); foreach (Match movieItem in movieItemCollection) { + Log.Info("ParseIndexPage - success ={0}", movieItem.Success); Debug.Assert(movieItem.Success); TrailerInfo trailerInfo = new TrailerInfo(); trailerInfo.Url = new Uri(Content.WebResponse.ResponseUri, movieItem.Groups["url"].Value); + Log.Info("ParseIndexPage - url set"); trailerInfo.Title = movieItem.Groups["title"].Value; - trailerInfo.Studio = movieItem.Groups["studio"].Value; - trailerInfo.PosterUrl = new Uri(movieItem.Groups["poster"].Value); + Log.Info("ParseIndexPage - title set"); + if (movieItem.Groups["studio"] != null) + { + trailerInfo.Studio = movieItem.Groups["studio"].Value; + Log.Info("ParseIndexPage - studio set"); + } + if (movieItem.Groups["poster"] != null && !String.IsNullOrEmpty(movieItem.Groups["poster"].Value)) + { + trailerInfo.PosterUrl = new Uri(movieItem.Groups["poster"].Value); + Log.Info("ParseIndexPage - poster set"); + } trailerInfo.Section = this._sectionName; //Console.WriteLine("Adding trailer {0}", trailerInfo.Title); _trailers.Add(trailerInfo); + Log.Info("ParseIndexPage - trailer added to list"); } } #endregion Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerStream.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -12,9 +12,9 @@ //Medium, //Large, //Fullscreen, - HD480p, - HD720p, - HD1080p + h480p, + h720p, + h1080p } /// <summary> Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-09-03 19:59:11 UTC (rev 890) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs 2007-09-04 07:32:31 UTC (rev 891) @@ -85,6 +85,24 @@ { return ""; } + + public virtual bool hasNextPage() + { + return false; + } + public virtual List<GUIOnlineVideos.VideoInfo> getNextPageVideos() + { + return new List<GUIOnlineVideos.VideoInfo>(); + } + public virtual bool hasPreviousPage() + { + return false; + } + public virtual List<GUIOnlineVideos.VideoInfo> getPreviousPageVideos() + { + return new List<GUIOnlineVideos.VideoInfo>(); + } + //public virtual bool addFavorite(String fsId,String fsUserName,String fsPassword){ public virtual void AddFavorite(GUIOnlineVideos.VideoInfo foVideo,String fsSiteId){ //return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-09-11 18:30:14
|
Revision: 914 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=914&view=rev Author: gregmac45 Date: 2007-09-11 11:30:11 -0700 (Tue, 11 Sep 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesTrailerUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/AppleTrailers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/ItmsHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/RegexParsers.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/ItunesUtils/TrailerIndex.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Main.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/OnlineVideos.csproj trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilBase.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SoapBoxUtil.cs Added Paths: ----------- trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/ trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/AbcUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/BlipTvUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/BreakUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/CbsUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/CnnUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/DailyMotionUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/GameTrailersUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/GenericSiteUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/GoogleVideoUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/GrouperUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/GubaUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/LiveVideoUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/MetaCafeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/SiteUtilFactory.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/Stage6Util.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/VideoJugUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/VidiLifeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Sites/YouTubeUtil.cs Removed Paths: ------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs 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/GameTrailersUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.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/ItunesUtils/HDHelper.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/LiveVideoUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/MetaCafeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/SiteUtilFactory.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/Stage6Util.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/VideoJugUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/VidiLifeUtil.cs trunk/plugins/OnlineVideos/Source/OnlineVideos/YouTubeUtil.cs Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/AbcUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,125 +0,0 @@ -using System; -using MediaPortal.GUI.Library; -using System.Text.RegularExpressions; -using System.Net; -using System.Text; -using MediaPortal.Player; -using System.Collections.Generic; -//using MediaPortal.Utils.Services; -using MediaPortal.GUI.View ; -using MediaPortal.Dialogs; -using System.Xml; -using System.Xml.XPath; -using System.ComponentModel; -using System.Threading; - - - -namespace OnlineVideos -{ - public class AbcUtil:SiteUtilBase - { - public override string getSiteId() - { - return "8"; - } - public override List<OnlineVideos.GUIOnlineVideos.VideoInfo> getSiteFavorites(string fsUser) - { - return new List<OnlineVideos.GUIOnlineVideos.VideoInfo>(); - } - - //private String msXmlLink; - - - - protected override String getUrl(String fsId) - { - //String [] urlArray = fsId.Split(new char[] { ',' }); - //return urlArray[0] ; - return fsId; - } - - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - List<GUIOnlineVideos.VideoInfo> list= new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video = new GUIOnlineVideos.VideoInfo(); - video.Title = "test"; - video.VideoUrl = "RTMP://wdig.fcod.llnwd.net/a339/o2/abc/streaming/episodes/SXD_112_SurstrommingOrASlice_Segment_1_1325482_highband.flv"; - list.Add(video); - return list; - //return getRssData; - } - - public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) - { - - - XmlDocument doc = new XmlDocument(); - //XPathDocument doc = new XPathDocument(fsUrl); - - doc.Load(XmlReader.Create("http://ll.static.abc.com/streaming/s/catalog?aff=&isIE=true")); - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - XmlNode StreamServerNode = doc.SelectSingleNode("//config/streamServer"); - String lsStreamServer = "RTMP://"+StreamServerNode.InnerText; - Console.WriteLine("Stream Server ={0} ",lsStreamServer); - - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//streaming/catalog/channel", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//streaming/catalog/channel[title='Six Degrees']/episode"); - //Console.WriteLine(nodeList.Count); - - - //RssItem loRssItem = new RssItem(); - //loRssItem. - //This loops through each node found in the nodeList and adds the - //Node data to the DataTable. - //XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loRssItem; - //GUIListItem loListItem; - foreach (XmlNode chileNode in nodeList) - { - loRssItem = new GUIOnlineVideos.VideoInfo(); - - XmlNode node = chileNode.SelectSingleNode("title"); - loRssItem.Title = node.InnerText; - - //node = chileNode.SelectSingleNode("link"); - //loRssItem.link = node.InnerText; - - node = chileNode.SelectSingleNode("description"); - loRssItem.Description = node.InnerText; - - node = chileNode.SelectSingleNode("screenShot", expr); - if (node != null) - { - //ac = node.Attributes; - loRssItem.ImageUrl = node.InnerText; - } - - - XmlNodeList SegNodeList = chileNode.SelectNodes("segment/HighStreamURL", expr); - loRssItem.VideoUrl = ""; - foreach(XmlNode SegNode in SegNodeList ) - { - //ac = node.Attributes; - loRssItem.VideoUrl = loRssItem.VideoUrl+lsStreamServer+SegNode.InnerText+","; - } - //Console.WriteLine(loRssItem.VideoUrl.ToString()); - - //Log.Write(loRssItem.ToString()); - //loListItem = new GUIListItem(loRssItem.title); - //loListItem.Path = loRssItem.videoUrl; - loRssItems.Add(loRssItem); - - - } - return loRssItems; - } - - - - } -} Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/BlipTvUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,123 +0,0 @@ -using System; -using MediaPortal.GUI.Library; -using System.Text.RegularExpressions; -using System.Net; -using System.Text; -using MediaPortal.Player; -using System.Collections.Generic; -//using MediaPortal.Utils.Services; -using MediaPortal.GUI.View ; -using MediaPortal.Dialogs; -using System.Xml; -using System.Xml.XPath; -using System.ComponentModel; -using System.Threading; - - - -namespace OnlineVideos -{ - public class BlipTvUtil:SiteUtilBase - { - public override string getSiteId() - { - return "9"; - } - - protected override String getUrl(String fsId) - { - String lsUrl = ""; - Log.Info("BlipTv getUrl with "+fsId); - String lsHtml = getHTMLData(fsId); - Match loMatch = Regex.Match(lsHtml,"class=\"permalink_input\" value=\"([^\"]*.flv)"); - if(loMatch.Success){ - lsUrl = loMatch.Groups[1].Value; - //lsUrl = System.Web.HttpUtility.UrlDecode(lsUrl); - //lsUrl = "http://blip.tv"+lsUrl; - }else{ - Log.Info("BlipTv video not found. Site may have changed layout."); - } - return lsUrl; - } - - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - List<RssItem> loRssItemList = getRssDataItems(fsUrl); - List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video; - foreach(RssItem rssItem in loRssItemList){ - video = new GUIOnlineVideos.VideoInfo(); - video.Description = rssItem.mediaDescription; - video.ImageUrl = rssItem.mediaThumbnail; - video.Title = rssItem.title; - video.VideoUrl = rssItem.link; - loVideoList.Add(video); - } - return loVideoList; - } - public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) - { - - XmlDocument doc = new XmlDocument(); - //XPathDocument doc = new XPathDocument(fsUrl); - - doc.Load(XmlReader.Create(fsUrl)); - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//rss/channel/item"); - //RssItem loRssItem = new RssItem(); - //loRssItem. - //This loops through each node found in the nodeList and adds the - //Node data to the DataTable. - XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loRssItem; - //GUIListItem loListItem; - foreach (XmlNode chileNode in nodeList) - { - loRssItem = new GUIOnlineVideos.VideoInfo(); - - XmlNode node = chileNode.SelectSingleNode("title"); - loRssItem.Title = node.InnerText; - - //node = chileNode.SelectSingleNode("link"); - //loRssItem.link = node.InnerText; - - node = chileNode.SelectSingleNode("description"); - loRssItem.Description = node.InnerText; - - node = chileNode.SelectSingleNode("media:thumbnail", expr); - if (node != null) - { - ac = node.Attributes; - loRssItem.ImageUrl = ac["url"].InnerText; - } - - - node = chileNode.SelectSingleNode("media:group/media:content[@type=\"video/x-flv\"]", expr); - if (node != null) - { - ac = node.Attributes; - loRssItem.VideoUrl = ac["url"].InnerText; - } - - //Log.Write(loRssItem.ToString()); - //loListItem = new GUIListItem(loRssItem.title); - //loListItem.Path = loRssItem.videoUrl; - loRssItems.Add(loRssItem); - - - } - return loRssItems; - } - - - - - - } -} Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/BreakUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,123 +0,0 @@ -using System; -using MediaPortal.GUI.Library; -using System.Text.RegularExpressions; -using System.Net; -using System.Text; -using MediaPortal.Player; -using System.Collections.Generic; -//using MediaPortal.Utils.Services; -using MediaPortal.GUI.View ; -using MediaPortal.Dialogs; -using System.Xml; -using System.Xml.XPath; -using System.ComponentModel; -using System.Threading; - - - -namespace OnlineVideos -{ - public class BreakUtil:SiteUtilBase - { - public override string getSiteId() - { - return "22"; - } - - protected override String getUrl(String fsId) - { String lsUrl = ""; - String lsHtml = getHTMLData(fsId); - //Log.Write("html to parse to get url = \n{0}",lsHtml); - Regex loPathRegex = new Regex("sGlobalFileName='([^']*)';[^;]*;.+sGlobalContentFilePath='([^']*)'"); - Regex loUrlRegex = new Regex(@"so.addVariable\('videoPath',\s'([^']*)"); - Match urlField = loUrlRegex.Match(lsHtml); - if(urlField.Success){ - lsUrl = urlField.Groups[1].Value; - Match loMatch = loPathRegex.Match(lsHtml); - if(loMatch.Success){ - String lsFileName = loMatch.Groups[1].Value; - String lsPathName = loMatch.Groups[2].Value; - lsUrl = lsUrl+lsPathName+"/"+lsFileName+".flv"; - Log.Info("break flv url = {0}",lsUrl); - } - } - return lsUrl; - } - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - List<RssItem> loRssItemList = getRssDataItems(fsUrl); - List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video; - foreach(RssItem rssItem in loRssItemList){ - video = new GUIOnlineVideos.VideoInfo(); - video.Description = rssItem.description; - video.ImageUrl = rssItem.enclosure; - video.Title = rssItem.title; - //foreach(MediaContent content in rssItem.contentList){ - // if(content.type.Contains("flv")){ - video.VideoUrl = rssItem.link; - // break; - // } - loVideoList.Add(video); - } - return loVideoList; - } - /* - public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) - { - - XmlDocument doc = new XmlDocument(); - //XPathDocument doc = new XPathDocument(fsUrl); - - doc.Load(XmlReader.Create(fsUrl)); - //XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - //expr.AddNamespace("", "http://search.yahoo.com/mrss"); - //Console.WriteLine(doc.InnerXml); - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//rss/channel/item"); - if(root==null){ - Console.WriteLine(root); - - } - XmlNodeList nodeList; - nodeList = root.SelectNodes("//rss/channel/item"); - //RssItem loRssItem = new RssItem(); - //loRssItem. - //This loops through each node found in the nodeList and adds the - //Node data to the DataTable. - XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loRssItem; - //GUIListItem loListItem; - foreach (XmlNode chileNode in nodeList) - { - loRssItem = new GUIOnlineVideos.VideoInfo(); - - XmlNode node = chileNode.SelectSingleNode("title"); - loRssItem.Title = node.InnerText; - - node = chileNode.SelectSingleNode("link"); - loRssItem.VideoUrl = node.InnerText; - - node = chileNode.SelectSingleNode("description"); - loRssItem.Description = node.InnerText; - - node = chileNode.SelectSingleNode("enclosure"); - if (node != null) - { - ac = node.Attributes; - loRssItem.ImageUrl = ac["url"].InnerText; - } - loRssItems.Add(loRssItem); - - - } - - return loRssItems; - } - */ - - - - } -} Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/CbsUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,128 +0,0 @@ -using System; -using MediaPortal.GUI.Library; -using System.Text.RegularExpressions; -using System.Net; -using System.Text; -using MediaPortal.Player; -using System.Collections.Generic; -//using MediaPortal.Utils.Services; -using MediaPortal.GUI.View ; -using MediaPortal.Dialogs; -using System.Xml; -using System.Xml.XPath; -using System.ComponentModel; -using System.Threading; - - - -namespace OnlineVideos -{ - public class CbsUtil:SiteUtilBase - { - public override string getSiteId() - { - return "10"; - } - - - protected override String getUrl(String fsId) - { - return "http://video.cgi.cbs.com/vplayer3/play.pl?id="+fsId; - - } - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - return getRssData(fsUrl); - } - public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) - { - - XmlDocument doc = new XmlDocument(); - //XPathDocument doc = new XPathDocument(fsUrl); - - doc.Load(XmlReader.Create("http://www.cbs.com/innertube/xmlProxy.php?type=videoList&id="+fsUrl)); - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//videoList/list/video", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//videoList/list/video"); - //RssItem loRssItem = new RssItem(); - //loRssItem. - //This loops through each node found in the nodeList and adds the - //Node data to the DataTable. - XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loRssItem; - //GUIListItem loListItem; - foreach (XmlNode childNode in nodeList) - { - loRssItem = new GUIOnlineVideos.VideoInfo(); - ac = childNode.Attributes; - - //XmlNode node = chileNode.SelectSingleNode("title"); - loRssItem.Title = ac["show"].InnerText; - loRssItem.Description = ac["summary"].InnerText; - loRssItem.ImageUrl = "http://www.cbs.com"+ac["image"].InnerText; - loRssItem.VideoUrl = ac["videoID"].InnerText; - - - //Log.Write(loRssItem.ToString()); - //loListItem = new GUIListItem(loRssItem.title); - //loListItem.Path = loRssItem.videoUrl; - loRssItems.Add(loRssItem); - - - } - return loRssItems; - } - public List<GUIOnlineVideos.VideoInfo> getCategories(String fsUrl) - { - - XmlDocument doc = new XmlDocument(); - //XPathDocument doc = new XPathDocument(fsUrl); - - doc.Load(XmlReader.Create(fsUrl)); - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//browseMenu/primary/secondary", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//browseMenu/primary/secondary"); - //RssItem loRssItem = new RssItem(); - //loRssItem. - //This loops through each node found in the nodeList and adds the - //Node data to the DataTable. - //XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loRssItem; - //GUIListItem loListItem; - foreach (XmlNode chileNode in nodeList) - { - loRssItem = new GUIOnlineVideos.VideoInfo(); - - XmlNode node = chileNode.SelectSingleNode("name"); - loRssItem.Title = node.InnerText; - - //node = chileNode.SelectSingleNode("link"); - //loRssItem.link = node.InnerText; - - node = chileNode.SelectSingleNode("id"); - loRssItem.VideoUrl = node.InnerText; - - //node = chileNode.SelectSingleNode("media:group/media:thumbnail", expr); - //get the description and images for the categories - - - loRssItems.Add(loRssItem); - - - } - return loRssItems; - } - - - } -} Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/DailyMotionUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,120 +0,0 @@ -using System; -using MediaPortal.GUI.Library; -using System.Text.RegularExpressions; -using System.Net; -using System.Text; -using MediaPortal.Player; -using System.Collections.Generic; -//using MediaPortal.Utils.Services; -using MediaPortal.GUI.View ; -using MediaPortal.Dialogs; -using System.Xml; -using System.Xml.XPath; -using System.ComponentModel; -using System.Threading; - - - -namespace OnlineVideos -{ - public class DailyMotionUtil:SiteUtilBase - { - public override string getSiteId() - { - return "6"; - } - - protected override String getUrl(String fsId) - { - String lsUrl = ""; - Log.Info("DMotion getUrl with "+fsId); - String lsHtml = getHTMLData(fsId); - Match loMatch = Regex.Match(lsHtml,"addVariable\\(\"url\", \"([^\"]*)"); - if(loMatch.Success){ - lsUrl = loMatch.Groups[1].Value; - lsUrl = System.Web.HttpUtility.UrlDecode(lsUrl); - lsUrl = lsUrl+"&txe=.flv"; - }else{ - Log.Info("Dailymotion video not found. Site could have changed layout."); - } - return lsUrl; - } - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - List<RssItem> loRssItemList = getRssDataItems(fsUrl); - List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video; - foreach(RssItem rssItem in loRssItemList){ - video = new GUIOnlineVideos.VideoInfo(); - video.Description = rssItem.description; - video.ImageUrl = rssItem.mediaThumbnail; - video.Title = rssItem.title; - video.Length = rssItem.contentList[0].duration; - video.VideoUrl = rssItem.guid; - loVideoList.Add(video); - } - return loVideoList; - } - public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) - { - - XmlDocument doc = new XmlDocument(); - - doc.Load(XmlReader.Create(fsUrl)); - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//rss/channel/item"); - - XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - //RssItem loRssItem; - //GUIListItem loListItem; - GUIOnlineVideos.VideoInfo loVideoInfo; - foreach (XmlNode chileNode in nodeList) - { - //loRssItem = new RssItem(); - loVideoInfo = new GUIOnlineVideos.VideoInfo(); - XmlNode node = chileNode.SelectSingleNode("title"); - //loRssItem.title = node.InnerText; - loVideoInfo.Title = node.InnerText; - - //node = chileNode.SelectSingleNode("link"); - //loRssItem.link = node.InnerText; - - - node = chileNode.SelectSingleNode("description"); - //loRssItem.description = node.InnerText; - loVideoInfo.Description = node.InnerText; - - node = chileNode.SelectSingleNode("media:thumbnail", expr); - if (node != null) - { - ac = node.Attributes; - //loRssItem.imageUrl = ac["url"].InnerText; - loVideoInfo.ImageUrl = ac["url"].InnerText; - } - - - node = chileNode.SelectSingleNode("guid", expr); - if (node != null) - { - //loRssItem.videoUrl = ac["url"].InnerText; - loVideoInfo.VideoUrl = node.InnerText; - - } - - //Log.Write(loRssItem.ToString()); - //loListItem = new GUIListItem(loRssItem.title); - //loListItem.Path = loRssItem.videoUrl; - loRssItems.Add(loVideoInfo); - - - } - return loRssItems; - } - } -} Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -23,10 +23,10 @@ { [SkinControlAttribute(2)] protected GUIButtonControl btnViewAs = null; - [SkinControlAttribute(3)] - protected GUIButtonControl btnNext = null; - [SkinControlAttribute(4)] - protected GUIButtonControl btnPrevious = null; + [SkinControlAttribute(3)] + protected GUIButtonControl btnNext = null; + [SkinControlAttribute(4)] + protected GUIButtonControl btnPrevious = null; [SkinControlAttribute(50)] protected GUIFacadeControl facadeView = null; [SkinControlAttribute(1)] @@ -44,11 +44,11 @@ private VideoInfo moSelectedVideo; private State _CurrentState = State.home; - private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; + //private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); - private List<VideoInfo> moCurrentTrailerList = new List<VideoInfo>(); + private List<VideoInfo> moCurrentTrailerList = new List<VideoInfo>(); private String []msFilterArray; - private String msThumbLocation; + //private String msThumbLocation; private int miSelectedIndex = 0; private bool mbPlayFullscreen = true; public enum State @@ -217,7 +217,7 @@ if (_CurrentState == State.home) { DisplaySites(); - SwitchView(); + SwitchView(); //currentView = View.List; //ChangeFacadeView(); @@ -240,7 +240,7 @@ protected override void OnShowContextMenu() { int liSelected = facadeView.SelectedListItemIndex-1; - if (liSelected < 0 || msSelectedSiteId=="99" || _CurrentState!=State.videos || _CurrentState!=State.info) + if (liSelected < 0 || msSelectedSiteId=="99" || _CurrentState==State.home || _CurrentState==State.categories || (msSelectedSiteId=="15" && _CurrentState == State.videos)) { return; } @@ -250,7 +250,9 @@ dlgSel.Reset(); if (dlgSel != null) { - dlgSel.Add("Save"); // Save + if(String.IsNullOrEmpty(OnlineVideoSettings.getInstance().msDownloadDir)==false){ + dlgSel.Add("Save"); // Save + } //Log.Info("msSelectedCategoryValue = "+msSelectedCategoryValue); if(msSelectedCategoryValue.StartsWith("fav:") ==false){ dlgSel.Add("Add to favorites"); @@ -267,21 +269,35 @@ } dlgSel.DoModal(GetID); int liSelectedIdx = dlgSel.SelectedId; + VideoInfo loSelectedVideo; + if(_CurrentState == State.videos){ + loSelectedVideo = moCurrentVideoList[liSelected]; + } + else{ + loSelectedVideo = moCurrentTrailerList[liSelected]; + } //Log.Info("Selected id {0}",liSelectedIdx); switch(liSelectedIdx){ case 1: - SaveVideo(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); - break; + if(String.IsNullOrEmpty(OnlineVideoSettings.getInstance().msDownloadDir)==false){ + SaveVideo(loSelectedVideo); + + break; + }else{ + goto case 2; + } case 2: SiteUtilBase siteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); SiteSettings loSite = moSiteList [msSelectedSiteId]; if(msSelectedCategoryValue.StartsWith("fav:") == false){ //siteUtil.addFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); Log.Info("Received request to add video to favorites."); - siteUtil.AddFavorite(moCurrentVideoList[liSelected],msSelectedSiteId); + siteUtil.AddFavorite(loSelectedVideo,msSelectedSiteId); + + }else{ - siteUtil.RemoveFavorite(moCurrentVideoList[liSelected]); + siteUtil.RemoveFavorite(loSelectedVideo); DisplayVideos(true); } break; @@ -354,7 +370,7 @@ if(msSelectedSiteId == "15"){ DisplayVideoDetails(moCurrentVideoList[facadeView.SelectedListItemIndex - 1]); _CurrentState = State.info; - }else{ + }else{ //play the video Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); } @@ -384,55 +400,55 @@ //do //{ //shouldContinue = false; - } - else if (control == btnNext) - { - moCurrentVideoList = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getNextPageVideos(); - DisplayVideos(false); - UpdateViewState(); - } - else if (control == btnPrevious) - { - moCurrentVideoList = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getPreviousPageVideos(); - DisplayVideos(false); - UpdateViewState(); - } + } + else if (control == btnNext) + { + moCurrentVideoList = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getNextPageVideos(); + DisplayVideos(false); + UpdateViewState(); + } + else if (control == btnPrevious) + { + moCurrentVideoList = SiteUtilFactory.getSiteUtil(msSelectedSiteId).getPreviousPageVideos(); + DisplayVideos(false); + UpdateViewState(); + } base.OnClicked(controlId, control, actionType); } private void OnShowPreviousMenu2(){ if (_CurrentState == State.categories) - { - - DisplaySites(); - _CurrentState = State.home; - - - } - else if (_CurrentState == State.videos) - { - Log.Info("Set the stopDownload to true 3"); - ImageDownloader._stopDownload = true; - - DisplayCategories(); - _CurrentState = State.categories; - - - } - else if (_CurrentState == State.info) - { - //Log.Info("Set the stopDownload to true 2"); - ImageDownloader._stopDownload = true; - - DisplayVideos(false); - SwitchView(); - btnViewAs.Visible = true; - _CurrentState = State.videos; - - - } - DisplayVideoInfo(null); - UpdateViewState(); + { + + DisplaySites(); + _CurrentState = State.home; + + + } + else if (_CurrentState == State.videos) + { + Log.Info("Set the stopDownload to true 3"); + ImageDownloader._stopDownload = true; + + DisplayCategories(); + _CurrentState = State.categories; + + + } + else if (_CurrentState == State.info) + { + //Log.Info("Set the stopDownload to true 2"); + ImageDownloader._stopDownload = true; + + DisplayVideos(false); + SwitchView(); + btnViewAs.Visible = true; + _CurrentState = State.videos; + + + } + DisplayVideoInfo(null); + UpdateViewState(); } public override bool OnMessage(GUIMessage message) { @@ -499,7 +515,7 @@ SwitchView(); } OnlineVideoSettings settings = OnlineVideoSettings.getInstance(); - msThumbLocation = settings.msThumbLocation; + //msThumbLocation = settings.msThumbLocation; msFilterArray = settings.msFilterArray; moSiteList= settings.moSiteList; //create a favorites site @@ -514,47 +530,47 @@ loSite.RssList.Add("dynamic",cat); moSiteList.Add("100",loSite); - if (!String.IsNullOrEmpty(settings.msDownloadDir)) - { - try{ - if (System.IO.Directory.Exists(settings.msDownloadDir)==false) - { - - System.IO.Directory.CreateDirectory(msDownloadDir); - - } - } - catch (Exception e) - { - Log.Error("Failed to create download dir"); - Log.Error(e); - } - //add a downloaded videos site - loSite = new SiteSettings(); - loSite.id = "99"; - loSite.name = "Downloaded Videos"; - loSite.enabled = true; - cat = new RssLink(); - cat.name = "All"; - cat.url = settings.msDownloadDir; - loSite.RssList.Add(cat.name, cat); - moSiteList.Add("99", loSite); - } - try - { - Log.Info("checking existance of thumb dir:" + settings.msThumbLocation); - if (System.IO.Directory.Exists(settings.msThumbLocation)==false) - { - Log.Info("Thumb dir does not exist."); - System.IO.Directory.CreateDirectory(settings.msThumbLocation); - Log.Info("thumb dir created"); - } - } - catch (Exception e) - { - Log.Error("Failed to create thumb dir"); - Log.Error(e); - } + if (!String.IsNullOrEmpty(settings.msDownloadDir)) + { + try{ + if (System.IO.Directory.Exists(settings.msDownloadDir)==false) + { + + System.IO.Directory.CreateDirectory(settings.msDownloadDir); + + } + } + catch (Exception e) + { + Log.Error("Failed to create download dir"); + Log.Error(e); + } + //add a downloaded videos site + loSite = new SiteSettings(); + loSite.id = "99"; + loSite.name = "Downloaded Videos"; + loSite.enabled = true; + cat = new RssLink(); + cat.name = "All"; + cat.url = settings.msDownloadDir; + loSite.RssList.Add(cat.name, cat); + moSiteList.Add("99", loSite); + } + try + { + //Log.Info("checking existance of thumb dir:" + settings.msThumbLocation); + if (System.IO.Directory.Exists(settings.msThumbLocation)==false) + { + Log.Info("Thumb dir does not exist."); + System.IO.Directory.CreateDirectory(settings.msThumbLocation); + Log.Info("thumb dir created"); + } + } + catch (Exception e) + { + Log.Error("Failed to create thumb dir"); + Log.Error(e); + } } @@ -763,8 +779,8 @@ { liIdx++; loVideoInfo.Description = cleanString(loVideoInfo.Description); - moSelectedVideo.Description = loVideoInfo.Description; - moSelectedVideo.Other = loVideoInfo.Other; + moSelectedVideo.Description = loVideoInfo.Description; + moSelectedVideo.Other = loVideoInfo.Other; loListItem = new GUIListItem(loVideoInfo.Title); loListItem.Label2 = loVideoInfo.Title2; loListItem.Path = loVideoInfo.VideoUrl; @@ -809,9 +825,9 @@ } if(currentView == View.FilmStrip){ GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; - if (filmstrip == null) - return; - filmstrip.InfoImageFileName = item.ThumbnailImage; + if (filmstrip == null) + return; + filmstrip.InfoImageFileName = item.ThumbnailImage; } } @@ -864,7 +880,7 @@ loClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); loClient.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted); String lsExtension = System.IO.Path.GetExtension(lsUrl); - String lsFileName = msDownloadDir+foListItem.Title+lsExtension; + String lsFileName = OnlineVideoSettings.getInstance().msDownloadDir+foListItem.Title+"_"+foListItem.Title2+lsExtension; loClient.DownloadFileAsync(new Uri(lsUrl), lsFileName, foListItem.Title); } @@ -923,103 +939,107 @@ case State.home: GUIPropertyManager.SetProperty("#header.label","OnlineVideos"); GUIPropertyManager.SetProperty("#header.image",""); - GUIControl.HideControl(GetID,btnNext.GetID); - GUIControl.HideControl(GetID,btnPrevious.GetID); - GUIControl.HideControl(GetID, 23); - GUIControl.HideControl(GetID, 24); - GUIControl.HideControl(GetID, 25); -// GUIControl.HideControl(GetID, 52); -// GUIControl.HideControl(GetID, 53); - GUIControl.HideControl(GetID, 54); - GUIControl.HideControl(GetID, 55); - GUIControl.HideControl(GetID, 56); - GUIControl.HideControl(GetID, 57); - GUIControl.HideControl(GetID, 58); - GUIControl.HideControl(GetID, 59); - DisplayVideoInfo(null); + GUIControl.HideControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID,btnPrevious.GetID); + GUIControl.HideControl(GetID, 23); + GUIControl.HideControl(GetID, 24); + GUIControl.HideControl(GetID, 25); + // GUIControl.HideControl(GetID, 52); + // GUIControl.HideControl(GetID, 53); + GUIControl.HideControl(GetID, 54); + GUIControl.HideControl(GetID, 55); + GUIControl.HideControl(GetID, 56); + GUIControl.HideControl(GetID, 57); + GUIControl.HideControl(GetID, 58); + GUIControl.HideControl(GetID, 59); + DisplayVideoInfo(null); + //GUIControl.FocusControl(GetID,facadeView.GetID); break; case State.categories: GUIPropertyManager.SetProperty("#header.label","Categories"); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); - GUIControl.HideControl(GetID,btnNext.GetID); - GUIControl.HideControl(GetID,btnPrevious.GetID); - GUIControl.HideControl(GetID, 23); - GUIControl.HideControl(GetID, 24); - GUIControl.HideControl(GetID, 25); -// GUIControl.HideControl(GetID, 52); -// GUIControl.HideControl(GetID, 53); - GUIControl.HideControl(GetID, 54); - GUIControl.HideControl(GetID, 55); - GUIControl.HideControl(GetID, 56); - GUIControl.HideControl(GetID, 57); - GUIControl.HideControl(GetID, 58); - GUIControl.HideControl(GetID, 59); + GUIControl.HideControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID,btnPrevious.GetID); + GUIControl.HideControl(GetID, 23); + GUIControl.HideControl(GetID, 24); + GUIControl.HideControl(GetID, 25); + // GUIControl.HideControl(GetID, 52); + // GUIControl.HideControl(GetID, 53); + GUIControl.HideControl(GetID, 54); + GUIControl.HideControl(GetID, 55); + GUIControl.HideControl(GetID, 56); + GUIControl.HideControl(GetID, 57); + GUIControl.HideControl(GetID, 58); + GUIControl.HideControl(GetID, 59); DisplayVideoInfo(null); break; case State.videos: GUIPropertyManager.SetProperty("#header.label",msSelectedCategoryName); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); - GUIControl.ShowControl(GetID,btnNext.GetID); - GUIControl.HideControl(GetID, 23); - GUIControl.HideControl(GetID, 24); - GUIControl.HideControl(GetID, 25); -// GUIControl.HideControl(GetID, 52); -// GUIControl.HideControl(GetID, 53); - GUIControl.HideControl(GetID, 54); - GUIControl.HideControl(GetID, 55); - GUIControl.HideControl(GetID, 56); - GUIControl.HideControl(GetID, 57); - GUIControl.HideControl(GetID, 58); - GUIControl.HideControl(GetID, 59); - - SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - if (loSiteUtil.hasNextPage()) - { - GUIControl.EnableControl(GetID,btnNext.GetID); - } - else - { - GUIControl.DisableControl(GetID,btnNext.GetID); - } - GUIControl.ShowControl(GetID,btnPrevious.GetID); - if (loSiteUtil.hasPreviousPage()) - { - GUIControl.EnableControl(GetID, btnPrevious.GetID); - } - else - { - GUIControl.DisableControl(GetID,btnPrevious.GetID); - } - DisplayVideoInfo(null); + GUIControl.ShowControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID, 23); + GUIControl.HideControl(GetID, 24); + GUIControl.HideControl(GetID, 25); + // GUIControl.HideControl(GetID, 52); + // GUIControl.HideControl(GetID, 53); + GUIControl.HideControl(GetID, 54); + GUIControl.HideControl(GetID, 55); + GUIControl.HideControl(GetID, 56); + GUIControl.HideControl(GetID, 57); + GUIControl.HideControl(GetID, 58); + GUIControl.HideControl(GetID, 59); + + SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + if (loSiteUtil.hasNextPage()) + { + GUIControl.EnableControl(GetID,btnNext.GetID); + } + else + { + GUIControl.DisableControl(GetID,btnNext.GetID); + } + GUIControl.ShowControl(GetID,btnPrevious.GetID); + if (loSiteUtil.hasPreviousPage()) + { + GUIControl.EnableControl(GetID, btnPrevious.GetID); + } + else + { + GUIControl.DisableControl(GetID,btnPrevious.GetID); + } + DisplayVideoInfo(null); break; case State.info: GUIPropertyManager.SetProperty("#header.label",moSelectedVideo.Title); GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); - GUIControl.HideControl(GetID,btnNext.GetID); - GUIControl.HideControl(GetID,btnPrevious.GetID); + GUIControl.HideControl(GetID,btnNext.GetID); + GUIControl.HideControl(GetID,btnPrevious.GetID); - GUIControl.ShowControl(GetID, 23); - GUIPropertyManager.SetProperty("#movieposter", ImageDownloader.downloadPoster(moSelectedVideo.ImageUrl.Replace("_m", "_l"),moSelectedVideo.Title,OnlineVideoSettings.getInstance().msThumbLocation)); - GUIPropertyManager.SetProperty("#movietitle", moSelectedVideo.Title); - GUIPropertyManager.SetProperty("#trailerdesc", moSelectedVideo.Description); - ITMSClient.TrailerInfo info= (ITMSClient.TrailerInfo)moSelectedVideo.Other; - GUIPropertyManager.SetProperty("#genre", info.Genre); - GUIPropertyManager.SetProperty("#releasedate", info.Release); - - //Log.Info("trailer desc:{0}", moSelectedVideo.Description); - GUIControl.ShowControl(GetID, 24); - GUIControl.ShowControl(GetID, 25); -// GUIControl.ShowControl(GetID, 52); -// GUIControl.ShowControl(GetID, 53); - GUIControl.ShowControl(GetID, 54); - GUIControl.ShowControl(GetID, 55); - GUIControl.ShowControl(GetID, 56); - GUIControl.ShowControl(GetID, 57); - GUIControl.ShowControl(GetID, 58); - GUIControl.ShowControl(GetID, 59); + GUIControl.ShowControl(GetID, 23); + GUIPropertyManager.SetProperty("#movieposter", ImageDownloader.downloadPoster(moSelectedVideo.ImageUrl.Replace("_m", "_l"),moSelectedVideo.Title,OnlineVideoSettings.getInstance().msThumbLocation)); + GUIPropertyManager.SetProperty("#movietitle", moSelectedVideo.Title); + GUIPropertyManager.SetProperty("#trailerdesc", moSelectedVideo.Description); + ITMSClient.TrailerInfo info= (ITMSClient.TrailerInfo)moSelectedVideo.Other; + GUIPropertyManager.SetProperty("#genre", info.Genre); + GUIPropertyManager.SetProperty("#releasedate", info.Release); + //Log.Info("selected "+moSelectedVideo.Description); + //Log.Info("info:"+info.Overview); + + + //Log.Info("trailer desc:{0}", moSelectedVideo.Description); + GUIControl.ShowControl(GetID, 24); + GUIControl.ShowControl(GetID, 25); + // GUIControl.ShowControl(GetID, 52); + // GUIControl.ShowControl(GetID, 53); + GUIControl.ShowControl(GetID, 54); + GUIControl.ShowControl(GetID, 55); + GUIControl.ShowControl(GetID, 56); + GUIControl.ShowControl(GetID, 57); + GUIControl.ShowControl(GetID, 58); + GUIControl.ShowControl(GetID, 59); - + DisplayVideoInfo(null); break; } @@ -1087,11 +1107,11 @@ } protected void SwitchView() { - if (facadeView == null) - { - //Log.Info("SwitchView - facadeview is null"); - return; - } + if (facadeView == null) + { + //Log.Info("SwitchView - facadeview is null"); + return; + } string strLine = String.Empty; switch (currentView) @@ -1140,8 +1160,13 @@ }else{ GUIPropertyManager.SetProperty("#tags", foVideo.Tags); } - TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(foVideo.Length)); - GUIPropertyManager.SetProperty("#length", t.ToString()); + if(String.IsNullOrEmpty(foVideo.Length)){ + GUIPropertyManager.SetProperty("#length", "None"); + } + else{ + TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(foVideo.Length)); + GUIPropertyManager.SetProperty("#length", t.ToString()); + } if(String.IsNullOrEmpty(foVideo.Description)){ GUIPropertyManager.SetProperty("#desc", "None"); }else{ Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/GameTrailersUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GameTrailersUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GameTrailersUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,118 +0,0 @@ -using System; -using MediaPortal.GUI.Library; -using System.Text.RegularExpressions; -using System.Net; -using System.Text; -using MediaPortal.Player; -using System.Collections.Generic; -//using MediaPortal.Utils.Services; -using MediaPortal.GUI.View ; -using MediaPortal.Dialogs; -using System.Xml; -using System.Xml.XPath; -using System.ComponentModel; -using System.Threading; - - - -namespace OnlineVideos -{ - public class GameTrailersUtil:SiteUtilBase - { - public override string getSiteId() - { - return "11"; - } - - - protected override String getUrl(String fsId) - { - - return "http://trailers.gametrailers.com/gt_vault/"+fsId + ".wmv"; - } - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - List<RssItem> loRssItemList = getRssDataItems(fsUrl); - List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video; - foreach(RssItem rssItem in loRssItemList){ - video = new GUIOnlineVideos.VideoInfo(); - video.Description = rssItem.description; - video.ImageUrl = rssItem.exInfoImage; - video.Title = rssItem.title; - Match loMatch = Regex.Match(rssItem.exInfoImage,"[\\d]-([^\\.]*)"); - video.VideoUrl = loMatch.Groups[1].Value; - loVideoList.Add(video); - } - return loVideoList; - } - /* - public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) - { - - XmlDocument doc = new XmlDocument(); - //XPathDocument doc = new XPathDocument(fsUrl); - - doc.Load(XmlReader.Create(fsUrl)); - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - expr.AddNamespace("exInfo","http://www.gametrailers.com/rssexplained.php"); - - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//rss/channel/item"); - //RssItem loRssItem = new RssItem(); - //loRssItem. - //This loops through each node found in the nodeList and adds the - //Node data to the DataTable. - XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loRssItem; - //GUIListItem loListItem; - foreach (XmlNode chileNode in nodeList) - { - loRssItem = new GUIOnlineVideos.VideoInfo(); - - XmlNode node = chileNode.SelectSingleNode("title"); - loRssItem.Title = node.InnerText; - - //node = chileNode.SelectSingleNode("link"); - //loRssItem.link = node.InnerText; - - node = chileNode.SelectSingleNode("description"); - loRssItem.Description = node.InnerText; - - node = chileNode.SelectSingleNode("exInfo:image", expr); - if (node != null) - { - //ac = node.Attributes; - loRssItem.ImageUrl = node.InnerText; - - //Regex loRegex = new Regex(; - Match loMatch = Regex.Match(loRssItem.ImageUrl,"[\\d]-([^\\.]*)"); - loRssItem.VideoUrl = loMatch.Groups[1].Value; - } - - - //node = chileNode.SelectSingleNode("link", expr); - //if (node != null) - //{ - //ac = node.Attributes; - // loRssItem.VideoUrl = node.InnerText; - //} - - //Log.Write(loRssItem.ToString()); - //loListItem = new GUIListItem(loRssItem.title); - //loListItem.Path = loRssItem.videoUrl; - loRssItems.Add(loRssItem); - - - } - return loRssItems; - } - - */ - - } -} Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GenericSiteUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,92 +0,0 @@ -/* - * Created by SharpDevelop. - * User: GZamor1 - * Date: 8/22/2007 - * Time: 4:13 PM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Collections.Generic; -using System.Collections; -using System.Xml; -using System.Text; - -using MediaPortal.GUI.Library; -using MediaPortal.Configuration; - -namespace OnlineVideos -{ - /// <summary> - /// Description of GenericSiteUtil. - /// </summary> - public class GenericSiteUtil:SiteUtilBase - { - - - - public override string getSiteId() - { - return "50"; - } - - protected override String getUrl(String fsId) - { - return fsId; - } - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - List<RssItem> loRssItemList = getRssDataItems(fsUrl); - List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video; - foreach(RssItem rssItem in loRssItemList){ - video = new GUIOnlineVideos.VideoInfo(); - if(!String.IsNullOrEmpty(rssItem.description)){ - video.Description = rssItem.description; - }else{ - video.Description = rssItem.mediaDescription; - } - if(!String.IsNullOrEmpty(rssItem.mediaThumbnail)){ - video.ImageUrl = rssItem.mediaThumbnail; - } - else if(!String.IsNullOrEmpty(rssItem.exInfoImage)){ - video.ImageUrl = rssItem.exInfoImage; - } - //get the video - if(!String.IsNullOrEmpty(rssItem.enclosure)&& isPossibleVideo(rssItem.enclosure)){ - video.VideoUrl = rssItem.enclosure; - video.Length = rssItem.enclosureDuration; - } - else if(rssItem.contentList.Count>0){ - foreach(MediaContent content in rssItem.contentList){ - if(isPossibleVideo(content.url)){ - video.VideoUrl = content.url; - video.Length = content.duration; - break; - } - - } - - - } - //if(!String.IsNullOrEmpty()){ - - //} - //if(!String.IsNullOrEmpty()){ - - //} - - - video.Title = rssItem.title; - - if(String.IsNullOrEmpty(video.VideoUrl)==false){ - - loVideoList.Add(video); - } - } - return loVideoList; - } - - } -} Deleted: trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs 2007-09-11 13:33:16 UTC (rev 913) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GoogleVideoUtil.cs 2007-09-11 18:30:11 UTC (rev 914) @@ -1,162 +0,0 @@ -using System; -using MediaPortal.GUI.Library; -using System.Text.RegularExpressions; -using System.Net; -using System.Text; -using MediaPortal.Player; -using System.Collections.Generic; -//using MediaPortal.Utils.Services; -using MediaPortal.GUI.View ; -using MediaPortal.Dialogs; -using System.Xml; -using System.Xml.XPath; -using System.ComponentModel; -using System.Threading; - - - -namespace OnlineVideos -{ - public class GoogleVideoUtil:SiteUtilBase - { - public override string getSiteId() - { - return "2"; - } - - protected override String getUrl(String fsId) - { - - return fsId + "&txe=.flv"; - } - public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) - { - List<RssItem> loRssItemList = getRssDataItems(fsUrl); - List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo video; - foreach(RssItem rssItem in loRssItemList){ - video = new GUIOnlineVideos.VideoInfo(); - video.Description = rssItem.mediaDescription; - video.ImageUrl = rssItem.mediaThumbnail; - video.Title = rssItem.title; - String flvUrl = String.Empty; - String aviUrl = String.Empty; - String mp4Url = String.Empty; - String youtubeUrl = String.Empty; - foreach(MediaContent content in rssItem.contentList){ - if(content.type.Contains("msvideo")){ - aviUrl = content.url; - Log.Info("avi url:{0}",content.url); - //break; - }else if(content.type.Contains("flv")){ - flvUrl = content.url; - Log.Info("flv url:{0}", content.url); - video.Length = content.duration; - } - else if (content.type.Contains("mp4")) - { - - mp4Url = content.url; - Log.Info("mp4 url:{0}", content.url); - } - else - { - - Log.Info("unknown url:{0}", content.url); - } - video.VideoUrl = flvUrl; - } - if(String.IsNullOrEmpty(video.VideoUrl)==false){ - - loVideoList.Add(video); - } - } - return loVideoList; - } - /* - public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) - { - - XmlDocument doc = new XmlDocument(); - - - doc.Load(XmlReader.Create(fsUrl)); - - XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); - expr.AddNamespace("media", "http://search.yahoo.com/mrss"); - - - //Create the root XmlNode and generate an XmlNodeList from it. - XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//rss/channel/item"); - //RssItem loRssItem = new RssItem(); - //loRssItem. - //This loops through each node found in the nodeList and adds the - //Node data to the DataTable. - XmlAttributeCollection ac; - List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); - GUIOnlineVideos.VideoInfo loRssItem; - //GUIListItem loListItem; - foreach (XmlNode chileNode in nodeList) - { - - - loRssItem = new GUIOnlineVideos.VideoInfo(); - - for (int i = 0; i < chileNode.ChildNodes.Count; i++) - { - XmlNode n = chileNode.ChildNodes[i]; - - switch (n.Name) - { - - case "title": - loRssItem.Title = n.InnerText; - break; - case "media:group": - - for (int j = 0; j < n.ChildNodes.Count; j++) - { - XmlNode nin = n.ChildNodes[j]; - - switch (nin.Name) - { - case "media:content": - if(nin.Attributes["type"].Value == "video/x-flv"){ - loRssItem.VideoUrl = nin.Attributes["url"].Value; - } - break; - case "media:description": - loRssItem.Description = n.InnerText; - break; - case "media:thumbnail": - loRssItem.ImageUrl = nin.Attributes["url"].Value; - break; - } - } - break; - default: - break; - } - } - - XmlNode node = chileNode.SelectSingleNode("title"); - - - - - loRssItems.Add(loRssItem); - - - } - ... [truncated message content] |