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. |