|
From: <Sil...@us...> - 2011-06-11 21:40:24
|
Revision: 4243
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4243&view=rev
Author: SilentException
Date: 2011-06-11 21:40:16 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
MyDailyComics:
- version 0.2.6.0
- added support for incremental (not date base comics)
- fixed some bugs & improved some things
Modified Paths:
--------------
trunk/plugins/MyDailyComics/ComicStrip.cs
trunk/plugins/MyDailyComics/HTML/MyHtmlParser.cs
trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics.xmp2
trunk/plugins/MyDailyComics/MpeRelease/update.xml
trunk/plugins/MyDailyComics/MyDailyComics.cs
trunk/plugins/MyDailyComics/MyDailyComics.csproj
trunk/plugins/MyDailyComics/MyDailyComics.csproj.user
trunk/plugins/MyDailyComics/MyDailyComics.suo
trunk/plugins/MyDailyComics/MyXmlReader.cs
trunk/plugins/MyDailyComics/Properties/AssemblyInfo.cs
trunk/plugins/MyDailyComics/example/MyDailyComics.xml
trunk/plugins/MyDailyComics/gui/Setup.Designer.cs
trunk/plugins/MyDailyComics/gui/Setup.cs
trunk/plugins/MyDailyComics/skin/Blue3/MyDailyComics.xml
trunk/plugins/MyDailyComics/skin/Blue3wide/MyDailyComics.xml
trunk/plugins/MyDailyComics/util/ComicHelper.cs
Added Paths:
-----------
trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics_0260.mpe1
Modified: trunk/plugins/MyDailyComics/ComicStrip.cs
===================================================================
--- trunk/plugins/MyDailyComics/ComicStrip.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/ComicStrip.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -140,6 +140,24 @@
// set { _lastRelease = value; }
//}
+ public string LastUrl { get; set; }
+ public string PreviousPage { get; set; }
+ public string NextPage { get; set; }
+ public string DateTitle { get; set; }
+ public bool HasNext {
+ get {
+ return !string.IsNullOrEmpty(NextPage) && LastUrl != Url;
+ }
+ }
+ public bool HasPrevious {
+ get {
+ return !string.IsNullOrEmpty(PreviousPage);
+ }
+ }
+ public string PreviousRegex { get; set; }
+ public string NextRegex { get; set; }
+ public string DateTitleRegex { get; set; }
+
#endregion
#region Overrides
@@ -203,6 +221,37 @@
elemEndsWith.InnerText = EndsWith;
root.AppendChild(elemEndsWith);
}
+
+ if (!string.IsNullOrEmpty(PreviousRegex))
+ {
+ XmlCDataSection cd = doc.CreateCDataSection(PreviousRegex);
+
+ XmlElement elemPrevRegex = doc.CreateElement("previousregex");
+ elemPrevRegex.AppendChild(cd);
+ //elemPrevRegex.InnerText = string.Format("<!CDATA[{0}]]>", PreviousRegex);
+ root.AppendChild(elemPrevRegex);
+ }
+
+ if (!string.IsNullOrEmpty(NextRegex))
+ {
+ XmlCDataSection cd = doc.CreateCDataSection(NextRegex);
+
+ XmlElement elemNextRegex = doc.CreateElement("nextregex");
+ elemNextRegex.AppendChild(cd);
+ //elemNextRegex.InnerText = string.Format("<!CDATA[{0}]]>", NextRegex);
+ root.AppendChild(elemNextRegex);
+ }
+
+ if (!string.IsNullOrEmpty(DateTitleRegex))
+ {
+ XmlCDataSection cd = doc.CreateCDataSection(DateTitleRegex);
+
+ XmlElement elemDateTitleRegex = doc.CreateElement("datetitleregex");
+ elemDateTitleRegex.AppendChild(cd);
+ //elemDateTitleRegex.InnerText = string.Format("<!CDATA[{0}]]>", DateTitleRegex);
+ root.AppendChild(elemDateTitleRegex);
+ }
+
doc.AppendChild(root);
xmlWriter.Formatting = Formatting.Indented;
Modified: trunk/plugins/MyDailyComics/HTML/MyHtmlParser.cs
===================================================================
--- trunk/plugins/MyDailyComics/HTML/MyHtmlParser.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/HTML/MyHtmlParser.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -25,6 +25,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.Text.RegularExpressions;
using System.Net;
using System.IO;
using MediaPortal.GUI.Library;
@@ -33,6 +34,59 @@
{
class MyHtmlParser
{
+ public string parse(String html_url, ComicStrip comic, out string previous, out string next, out string datetitle)
+ {
+ previous = string.Empty;
+ next = string.Empty;
+ datetitle = string.Empty;
+
+ string result = string.Empty;
+ Uri uri = new Uri(html_url);
+
+ string page = sendRequest(html_url);
+ if (string.IsNullOrEmpty(page))
+ return result;
+
+ //string previouscomic_reg = @"<a href="(?<prev>[^"]*)" id="dyn-prev" title="Prethodni overkloking">Prethodni overkloking</a>";
+ //string nextcomic_reg = @"<a href="(?<next>[^"]*)" id="dyn-next" title="Sljede\xE6i overkloking">Sljede\xE6i overkloking</a>";
+ //string datetitle_reg = @"<h2 class="title">\s<span>(?<title>.*?)</h2>";
+ string previouscomic_reg = comic.PreviousRegex;
+ string nextcomic_reg = comic.NextRegex;
+ string datetitle_reg = comic.DateTitleRegex;
+
+ if (!string.IsNullOrEmpty(previouscomic_reg))
+ {
+ Match matchPrev = Regex.Match(page, previouscomic_reg);
+ if (matchPrev.Success && matchPrev.Groups["prev"].Success)
+ previous = matchPrev.Groups["prev"].Value;
+ }
+
+ if (!string.IsNullOrEmpty(nextcomic_reg))
+ {
+ Match matchNext = Regex.Match(page, nextcomic_reg);
+ if (matchNext.Success && matchNext.Groups["next"].Success)
+ next = matchNext.Groups["next"].Value;
+ }
+
+ if (!string.IsNullOrEmpty(datetitle_reg))
+ {
+ Match matchDateTitle = Regex.Match(page, datetitle_reg);
+ if (matchDateTitle.Success && matchDateTitle.Groups["title"].Success)
+ datetitle = StripHTML(matchDateTitle.Groups["title"].Value);
+ }
+
+ Uri uriprev = new Uri(uri, previous);
+ if (!string.IsNullOrEmpty(previous))
+ previous = uriprev.AbsoluteUri;
+ Uri urinext = new Uri(uri, next);
+ if (!string.IsNullOrEmpty(next))
+ next = urinext.AbsoluteUri;
+
+ result = html_url;
+
+ return result;
+ }
+
public String parse(String html_url, string startsWith, string endsWith)
{
string result = String.Empty;
@@ -89,6 +143,8 @@
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+ request.Timeout = 5000;
+ request.ReadWriteTimeout = 20000;
response = request.GetResponse();
stream = response.GetResponseStream();
@@ -129,5 +185,22 @@
response.Close();
}
}
+
+ public void save(string url, string file)
+ {
+ WebClient client = new WebClient();
+ client.DownloadFile(url, file);
+ }
+
+ private string StripHTML(string HTMLText)
+ {
+ var reg = new Regex("<[^>]+>", RegexOptions.IgnoreCase);
+ string result = reg.Replace(HTMLText, "");
+ result = result.Replace("<", "<");
+ result = result.Replace(">", ">");
+ result = result.Replace("&", "&");
+ result = result.Trim();
+ return result;
+ }
}
}
Modified: trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics.xmp2
===================================================================
--- trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics.xmp2 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics.xmp2 2011-06-11 21:40:16 UTC (rev 4243)
@@ -2124,7 +2124,27 @@
</Items>
</Sections>
<Dependencies>
- <Items />
+ <Items>
+ <DependencyItem>
+ <Type>MediaPortal</Type>
+ <Id />
+ <MinVersion>
+ <Major>1</Major>
+ <Minor>1</Minor>
+ <Build>0</Build>
+ <Revision>6</Revision>
+ </MinVersion>
+ <MaxVersion>
+ <Major>999999</Major>
+ <Minor>999999</Minor>
+ <Build>999999</Build>
+ <Revision>999999</Revision>
+ </MaxVersion>
+ <WarnOnly>false</WarnOnly>
+ <Message>This version of MyDailyComics requires MediaPortal 1.2 Beta or newer!</Message>
+ <Name>MediaPortal</Name>
+ </DependencyItem>
+ </Items>
</Dependencies>
<GeneralInfo>
<Name>MyDailyComics</Name>
@@ -2136,16 +2156,16 @@
<Version>
<Major>0</Major>
<Minor>2</Minor>
- <Build>5</Build>
+ <Build>6</Build>
<Revision>0</Revision>
</Version>
<ExtensionDescription>Plugin to display a daily comic strip like Garfield</ExtensionDescription>
- <VersionDescription>Initial MPE release.</VersionDescription>
- <DevelopmentStatus>Rc</DevelopmentStatus>
- <OnlineLocation>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics.mpe1</OnlineLocation>
- <ReleaseDate>2010-04-28T10:05:22.4972176+02:00</ReleaseDate>
+ <VersionDescription>0.2.6.0 release</VersionDescription>
+ <DevelopmentStatus>Stable</DevelopmentStatus>
+ <OnlineLocation>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics_0260.mpe1</OnlineLocation>
+ <ReleaseDate>2011-06-11T00:00:00</ReleaseDate>
<Tags>comic strip, garfield, dilbert</Tags>
- <Location>D:\developing\#maintained\MyDailyComics\MpeRelease\MyDailyComics.mpe1</Location>
+ <Location>D:\developing\#maintained\MyDailyComics\MpeRelease\MyDailyComics_0260.mpe1</Location>
<Params>
<Items>
<SectionParam Name="Icon">
Added: trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics_0260.mpe1
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics_0260.mpe1
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/plugins/MyDailyComics/MpeRelease/update.xml
===================================================================
--- trunk/plugins/MyDailyComics/MpeRelease/update.xml 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/MpeRelease/update.xml 2011-06-11 21:40:16 UTC (rev 4243)
@@ -104,5 +104,128 @@
<FolderGroups />
</ProjectSettings>
</PackageClass>
+ <PackageClass>
+ <Version>2.0</Version>
+ <Groups>
+ <Items>
+ <GroupItem Name="Plugin DLL">
+ <DisplayName>Plugin DLL</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>Plugin DLL</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ <GroupItem Name="Plugin Configuration">
+ <DisplayName>Plugin Configuration</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>Plugin Configuration</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ <GroupItem Name="Plugin Thumbs">
+ <DisplayName>Plugin Thumbs</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>Plugin Thumbs</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ <GroupItem Name="Plugin Skin">
+ <DisplayName>Plugin Skin</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>Plugin Skin</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ </Items>
+ </Groups>
+ <Sections>
+ <Items />
+ </Sections>
+ <Dependencies>
+ <Items>
+ <DependencyItem>
+ <Type>MediaPortal</Type>
+ <Id />
+ <MinVersion>
+ <Major>1</Major>
+ <Minor>1</Minor>
+ <Build>0</Build>
+ <Revision>6</Revision>
+ </MinVersion>
+ <MaxVersion>
+ <Major>999999</Major>
+ <Minor>999999</Minor>
+ <Build>999999</Build>
+ <Revision>999999</Revision>
+ </MaxVersion>
+ <WarnOnly>false</WarnOnly>
+ <Message>This version of MyDailyComics requires MediaPortal 1.2 Beta or newer!</Message>
+ <Name>MediaPortal</Name>
+ </DependencyItem>
+ </Items>
+ </Dependencies>
+ <GeneralInfo>
+ <Name>MyDailyComics</Name>
+ <Id>bdfea2a7-2206-4fae-8165-02342031848c</Id>
+ <Author>TimmyT, SilentException</Author>
+ <HomePage />
+ <ForumPage>http://forum.team-mediaportal.com/mediaportal-plugins-47/my-daily-comics-plugin-20389/</ForumPage>
+ <UpdateUrl>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MyDailyComics/MpeRelease/update.xml</UpdateUrl>
+ <Version>
+ <Major>0</Major>
+ <Minor>2</Minor>
+ <Build>6</Build>
+ <Revision>0</Revision>
+ </Version>
+ <ExtensionDescription>Plugin to display a daily comic strip like Garfield</ExtensionDescription>
+ <VersionDescription>0.2.6.0 release</VersionDescription>
+ <DevelopmentStatus>Stable</DevelopmentStatus>
+ <OnlineLocation>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MyDailyComics/MpeRelease/MyDailyComics_0260.mpe1</OnlineLocation>
+ <ReleaseDate>2011-06-11T00:00:00</ReleaseDate>
+ <Tags>comic strip, garfield, dilbert</Tags>
+ <Location>D:\developing\#maintained\MyDailyComics\MpeRelease\MyDailyComics_0260.mpe1</Location>
+ <Params>
+ <Items>
+ <SectionParam Name="Icon">
+ <Value />
+ <ValueType>File</ValueType>
+ <Description>The icon file of the package (jpg,png,bmp)</Description>
+ </SectionParam>
+ <SectionParam Name="Online Icon">
+ <Value />
+ <ValueType>String</ValueType>
+ <Description>The icon file of the package stored online (jpg,png,bmp)</Description>
+ </SectionParam>
+ <SectionParam Name="Configuration file">
+ <Value />
+ <ValueType>Template</ValueType>
+ <Description>The file used to configure the extension.
+ If have .exe extension the will be executed
+ If have .dll extension used like MP plugin configuration</Description>
+ </SectionParam>
+ <SectionParam Name="Online Screenshots">
+ <Value />
+ <ValueType>String</ValueType>
+ <Description>Online stored screenshot urls separated by ; </Description>
+ </SectionParam>
+ <SectionParam Name="Force to uninstall on update">
+ <Value>yes</Value>
+ <ValueType>Bool</ValueType>
+ <Description>Show dialog and force to uninstall previous version when updating an extension. Should only be disabled if you are using an NSIS/MSI installer.</Description>
+ </SectionParam>
+ </Items>
+ </Params>
+ </GeneralInfo>
+ <UniqueFileList>
+ <Items />
+ </UniqueFileList>
+ <ProjectSettings>
+ <FolderGroups />
+ </ProjectSettings>
+ </PackageClass>
</Items>
</ExtensionCollection>
\ No newline at end of file
Modified: trunk/plugins/MyDailyComics/MyDailyComics.cs
===================================================================
--- trunk/plugins/MyDailyComics/MyDailyComics.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/MyDailyComics.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -45,6 +45,11 @@
protected GUISelectButtonControl btnComic = null; // change comic button
[SkinControlAttribute(3)]
protected GUISelectButtonControl btnDate = null; // change date button
+ [SkinControlAttribute(4)]
+ protected GUIButtonControl btnPrevious = null; //
+ [SkinControlAttribute(5)]
+ protected GUIButtonControl btnNext = null; //
+
[SkinControlAttribute(100)]
protected GUIImage imgComic = null; // comic image
[SkinControlAttribute(101)]
@@ -59,6 +64,7 @@
private ComicStrip[] _comics;
private ComicStrip _currentComic;
private string _title = String.Empty;
+ private string imageFile = "";
private int _selectedComicIndex = -1;
private int _selectedDateIndex = -1;
@@ -159,6 +165,11 @@
return Load(GUIGraphicsContext.Skin + @"\MyDailyComics.xml");
}
+ public override void DeInit() {
+ base.DeInit();
+ DeleteFile();
+ }
+
protected override void OnPageLoad()
{
base.OnPageLoad();
@@ -193,8 +204,29 @@
SelectedComic = comic;
}
ShowComic(SelectedComic, SelectedDate);
+ SelectedComic = SelectedComic;
GUIControl.FocusControl(GetID, btnComic.GetID);
}
+ if (control == btnPrevious)
+ {
+ SelectedComic.LastUrl = SelectedComic.PreviousPage;
+ SelectedComic.DateTitle = string.Empty;
+ SelectedComic = SelectedComic;
+ ShowComic(SelectedComic, SelectedDate);
+ SelectedComic = SelectedComic;
+ if (!btnPrevious.IsEnabled)
+ GUIControl.FocusControl(GetID, btnComic.GetID);
+ }
+ if (control == btnNext)
+ {
+ SelectedComic.LastUrl = SelectedComic.NextPage;
+ SelectedComic.DateTitle = string.Empty;
+ SelectedComic = SelectedComic;
+ ShowComic(SelectedComic, SelectedDate);
+ SelectedComic = SelectedComic;
+ if (!btnNext.IsEnabled)
+ GUIControl.FocusControl(GetID, btnComic.GetID);
+ }
RestoreButtons();
}
@@ -215,16 +247,28 @@
{
get { return _currentComic; }
set
- {
+ {
+ if (_currentComic != value && _currentComic != null) {
+ _currentComic.LastUrl = string.Empty;
+ _currentComic.DateTitle = string.Empty;
+ }
_currentComic = value;
GUIPropertyManager.SetProperty("#MyDailyComics.Selected.Title", _currentComic.Name);
GUIPropertyManager.SetProperty("#MyDailyComics.Selected.LanguageName", _currentComic.Language);
string languageIcon = Config.GetFolder(Config.Dir.Thumbs) + @"\MyDailyComics\Flags\" + _currentComic.Language + @".png";
GUIPropertyManager.SetProperty("#MyDailyComics.Selected.LanguageIcon", File.Exists(languageIcon) ? languageIcon : " ");
+ if (_currentComic.Type.Equals(ComicStrip.TYPE_NUMERIC, StringComparison.OrdinalIgnoreCase))
+ {
+ GUIPropertyManager.SetProperty("#MyDailyComics.Selected.Date", _currentComic.DateTitle);
+ }
+ else
+ {
+ SelectedDate = SelectedDate;
+ }
}
}
- new public string Title
+ public string Title
{
get { return _title; }
set { _title = value; }
@@ -305,24 +349,64 @@
private void ShowComic(ComicStrip comic, DateTime dt)
{
+ imgComic.IsVisible = false;
+ imgBanner.IsVisible = false;
+ imgLanguage.IsVisible = false;
+
GUIWaitCursor.Show();
+ GUIWindowManager.Process();
try
{
lock (this)
{
- imgComic.Visible = false;
string tmp_url = ComicHelper.Instance.getComicUrl(comic, dt);
+ if (comic.Type.Equals(ComicStrip.TYPE_NUMERIC, StringComparison.OrdinalIgnoreCase) && btnNext != null && btnPrevious != null)
+ {
+ btnNext.IsEnabled = comic.HasNext;
+ //btnNext.Visible = true;
+ btnPrevious.IsEnabled = comic.HasPrevious;
+ //btnPrevious.Visible = true;
+ btnDate.IsEnabled = false;
+ //btnDate.Visible = false;
+ }
+ else
+ {
+ if (btnNext != null && btnPrevious != null)
+ {
+ btnNext.IsEnabled = false;
+ //btnNext.Visible = false;
+ btnPrevious.IsEnabled = false;
+ //btnPrevious.Visible = false;
+ }
+ btnDate.IsEnabled = true;
+ //btnDate.Visible = true;
+ }
+
Log.Debug("trying to show url: " + tmp_url);
- if (!ComicHelper.Instance.TryDisplayComic(tmp_url))
+
+ DeleteFile();
+ if (!string.IsNullOrEmpty(tmp_url))
{
- tmp_url = string.Empty;
+ //imageFile = Config.GetFolder(Config.Dir.Thumbs) + @"\" + Path.GetRandomFileName() + "." + new FileInfo(new Uri(tmp_url).AbsolutePath).Extension;
+
+ imageFile = ComicHelper.Instance.Download(tmp_url);
+
+ //MyHtmlParser parser = new MyHtmlParser();
+ //parser.save(tmp_url, imageFile);
+
+ //if (!ComicHelper.Instance.TryDisplayComic(tmp_url))
+ //{
+ // tmp_url = string.Empty;
+ //}
}
- imgComic.SetFileName(tmp_url);
+ imgComic.SetFileName(imageFile);
+ //imgComic.AllocResources();
imgComic.KeepAspectRatio = true;
imgComic.Refresh();
- imgComic.Visible = true;
+ imgComic.IsVisible = true;
+ DeleteFile();
ShowBanner(comic);
ShowLanguageIcon(comic);
}
@@ -335,24 +419,24 @@
private void ShowBanner(ComicStrip comic)
{
- imgBanner.Visible = false;
+ imgBanner.IsVisible = false;
string localName = string.Empty;
if (comic.Banner.Length > 0)
{
- localName = ComicHelper.Instance.DownloadBanner(comic.Banner);
+ localName = ComicHelper.Instance.Download(comic.Banner);
}
imgBanner.SetFileName(localName);
imgBanner.KeepAspectRatio = true;
imgBanner.Refresh();
- imgBanner.Visible = true;
+ imgBanner.IsVisible = true;
}
private void ShowLanguageIcon(ComicStrip comic)
{
if (imgLanguage == null) return;
- imgLanguage.Visible = false;
+ imgLanguage.IsVisible = false;
string languageIcon = Config.GetFolder(Config.Dir.Thumbs) + @"\MyDailyComics\Flags\" + comic.Language + @".png";
if (!File.Exists(languageIcon))
@@ -360,9 +444,27 @@
imgLanguage.SetFileName(languageIcon);
imgLanguage.KeepAspectRatio = true;
imgLanguage.Refresh();
- imgLanguage.Visible = true;
+ imgLanguage.IsVisible = true;
}
+ private void DeleteFile()
+ {
+ if (string.IsNullOrEmpty(imageFile)) return;
+
+ FileInfo fi = new FileInfo(imageFile);
+ try
+ {
+ fi.Delete();
+ }
+ catch
+ {
+ }
+ }
+
+ private void NewFile()
+ {
+ imageFile = Path.GetTempFileName();
+ }
#endregion
}
}
Modified: trunk/plugins/MyDailyComics/MyDailyComics.csproj
===================================================================
--- trunk/plugins/MyDailyComics/MyDailyComics.csproj 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/MyDailyComics.csproj 2011-06-11 21:40:16 UTC (rev 4243)
@@ -2,7 +2,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
+ <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{10EA3ECE-BE4B-40DE-BF30-EF73503DF630}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -48,15 +48,20 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Common.Utils">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="Core, Version=1.0.5.23365, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath>
- <Private>False</Private>
+ <Private>True</Private>
</Reference>
<Reference Include="Dialogs, Version=1.0.5.23368, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath>
- <Private>False</Private>
+ <Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -66,7 +71,7 @@
<Reference Include="Utils, Version=2.2.7.23364, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath>
- <Private>False</Private>
+ <Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -142,4 +147,8 @@
<Target Name="AfterBuild">
</Target>
-->
+ <PropertyGroup>
+ <PostBuildEvent>rem copy $(TargetDir)MyDailyComics.dll "c:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\"
+rem copy $(TargetDir)MyDailyComics.pdb "c:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\"</PostBuildEvent>
+ </PropertyGroup>
</Project>
\ No newline at end of file
Modified: trunk/plugins/MyDailyComics/MyDailyComics.csproj.user
===================================================================
--- trunk/plugins/MyDailyComics/MyDailyComics.csproj.user 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/MyDailyComics.csproj.user 2011-06-11 21:40:16 UTC (rev 4243)
@@ -14,4 +14,8 @@
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>C:\Program Files\Team MediaPortal\MediaPortal\MediaPortal.exe</StartProgram>
+ </PropertyGroup>
</Project>
\ No newline at end of file
Modified: trunk/plugins/MyDailyComics/MyDailyComics.suo
===================================================================
(Binary files differ)
Modified: trunk/plugins/MyDailyComics/MyXmlReader.cs
===================================================================
--- trunk/plugins/MyDailyComics/MyXmlReader.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/MyXmlReader.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -45,6 +45,7 @@
try
{
XmlTextReader reader = new XmlTextReader(pathToXml);
+ string read = string.Empty;
ComicStrip comic = new ComicStrip();
while (reader.Read())
{
@@ -53,10 +54,12 @@
switch (nodeType)
{
case XmlNodeType.Element:
+ read = string.Empty;
switch (reader.Name)
{
case "comic":
comic = new ComicStrip();
+ read = string.Empty;
break;
case "name":
@@ -100,7 +103,23 @@
comic.UrlType = reader.ReadInnerXml();
break;
- //TODO for future versions, use this approach for numeric types
+ case "previousregex":
+ read = "previousregex";
+ break;
+
+ case "nextregex":
+ read = "nextregex";
+ break;
+
+ case "datetitleregex":
+ read = "datetitleregex";
+ break;
+
+ default:
+ read = string.Empty;
+ break;
+
+ //TODO for future versions, use this approach for numeric types
//case "firstrelease":
// comic.FirstRelease = reader.ReadInnerXml();
// break;
@@ -112,7 +131,23 @@
}
break;
+ case XmlNodeType.CDATA:
+ switch (read)
+ {
+ case "previousregex":
+ comic.PreviousRegex = reader.Value;
+ break;
+ case "nextregex":
+ comic.NextRegex = reader.Value;
+ break;
+
+ case "datetitleregex":
+ comic.DateTitleRegex = reader.Value;
+ break;
+ }
+ break;
+
case XmlNodeType.EndElement:
if (reader.Name.Equals("comic"))
{
Modified: trunk/plugins/MyDailyComics/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/MyDailyComics/Properties/AssemblyInfo.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/Properties/AssemblyInfo.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -27,6 +27,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using MediaPortal.Common.Utils;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@@ -59,8 +60,13 @@
// by using the '*' as shown below:
#endregion
-[assembly: AssemblyVersion("0.2.5.0")]
+[assembly: AssemblyVersion("0.2.6.0")]
+// MediaPortal plugin version compatibility
+[assembly: CompatibleVersion("1.1.7.0")]
+[assembly: UsesSubsystem("MP.SkinEngine")]
+[assembly: UsesSubsystem("MP.Config")]
+
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
Modified: trunk/plugins/MyDailyComics/example/MyDailyComics.xml
===================================================================
--- trunk/plugins/MyDailyComics/example/MyDailyComics.xml 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/example/MyDailyComics.xml 2011-06-11 21:40:16 UTC (rev 4243)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<MyDailyComics><comic>
<name>Garfield</name>
<url>http://images.ucomics.com/comics/ga/[yyyy]/ga[yy][MM][dd].gif</url>
@@ -101,12 +101,15 @@
<urltype>image</urltype>
</comic><comic>
<name>Matakovic</name>
- <url>http://www.net.hr/webcafe/matakovic/</url>
+ <url>http://webcafe.net.hr/forwarduse/overkloking/inner.html</url>
<enabled>true</enabled>
<banner>http://www.net.hr/2009/01/28/0065007.19.gif</banner>
<language>hr</language>
- <type>date</type>
+ <type>numeric</type>
<urltype>webpage</urltype>
<startswith>/20</startswith>
<endswith>.jpg</endswith>
+ <previousregex><![CDATA[<a href="(?<prev>[^"]*)" id="dyn-prev" title="Prethodni overkloking">Prethodni overkloking</a>]]></previousregex>
+ <nextregex><![CDATA[<a href="(?<next>[^"]*)" id="dyn-next" title="Sljedeći overkloking">Sljedeći overkloking</a>]]></nextregex>
+ <datetitleregex><![CDATA[<h2 class="title">\s<span>(?<title>.*?)</h2>]]></datetitleregex>
</comic></MyDailyComics>
\ No newline at end of file
Modified: trunk/plugins/MyDailyComics/gui/Setup.Designer.cs
===================================================================
--- trunk/plugins/MyDailyComics/gui/Setup.Designer.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/gui/Setup.Designer.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -141,7 +141,7 @@
// lblStatus
//
this.lblStatus.Name = "lblStatus";
- this.lblStatus.Size = new System.Drawing.Size(107, 17);
+ this.lblStatus.Size = new System.Drawing.Size(103, 17);
this.lblStatus.Text = "My Contacts Setup";
//
// openFileDialogXml
@@ -470,7 +470,6 @@
//
this.rbDatebased.AutoSize = true;
this.rbDatebased.Checked = true;
- this.rbDatebased.Enabled = false;
this.rbDatebased.Location = new System.Drawing.Point(5, 21);
this.rbDatebased.Margin = new System.Windows.Forms.Padding(2);
this.rbDatebased.Name = "rbDatebased";
@@ -483,7 +482,6 @@
// rbNumeric
//
this.rbNumeric.AutoSize = true;
- this.rbNumeric.Enabled = false;
this.rbNumeric.Location = new System.Drawing.Point(5, 46);
this.rbNumeric.Margin = new System.Windows.Forms.Padding(2);
this.rbNumeric.Name = "rbNumeric";
Modified: trunk/plugins/MyDailyComics/gui/Setup.cs
===================================================================
--- trunk/plugins/MyDailyComics/gui/Setup.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/gui/Setup.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -160,9 +160,9 @@
txtBanner.Text = strip.Banner;
chkEnabled.Checked = strip.Enabled;
//TODO for future versions, use this approach for numeric types
- //rbDatebased.Checked = strip.Type.Equals(ComicStrip.TYPE_DATE);
- //rbNumeric.Checked = !rbDatebased.Checked;
- rbDatebased.Checked = true;
+ rbDatebased.Checked = strip.Type.Equals(ComicStrip.TYPE_DATE);
+ rbNumeric.Checked = !rbDatebased.Checked;
+ //rbDatebased.Checked = true;
rbUrlGraphic.Checked = strip.UrlType.Equals(ComicStrip.URLTYPE_IMAGE);
rbUrlWebsite.Checked = !rbUrlGraphic.Checked;
@@ -224,8 +224,8 @@
cs.StartsWith = getText(txtStartsWith);
cs.EndsWith = getText(txtEndsWith);
//TODO for future versions, use this approach for numeric types
- //cs.Type = rbDatebased.Checked ? ComicStrip.TYPE_DATE : ComicStrip.TYPE_NUMERIC;
- cs.Type = ComicStrip.TYPE_DATE;
+ cs.Type = rbDatebased.Checked ? ComicStrip.TYPE_DATE : ComicStrip.TYPE_NUMERIC;
+ //cs.Type = ComicStrip.TYPE_DATE;
cs.UrlType = rbUrlGraphic.Checked ? ComicStrip.URLTYPE_IMAGE : ComicStrip.URLTYPE_WEBPAGE;
int idx = lstComics.SelectedIndex;
lstComics.Items.RemoveAt(idx);
@@ -454,13 +454,22 @@
private void btnMoveLeft_Click(object sender, EventArgs e)
{
- dtpDate.Value = dtpDate.Value.AddDays(-1);
+ ComicStrip cs = CurrentComicStrip;
+ if (!cs.Type.Equals(ComicStrip.TYPE_NUMERIC, StringComparison.OrdinalIgnoreCase))
+ dtpDate.Value = dtpDate.Value.AddDays(-1);
+ else
+ cs.LastUrl = cs.PreviousPage;
+
test();
}
private void btnMoveRight_Click(object sender, EventArgs e)
{
- dtpDate.Value = dtpDate.Value.AddDays(1);
+ ComicStrip cs = CurrentComicStrip;
+ if (!cs.Type.Equals(ComicStrip.TYPE_NUMERIC, StringComparison.OrdinalIgnoreCase))
+ dtpDate.Value = dtpDate.Value.AddDays(1);
+ else
+ cs.LastUrl = cs.NextPage;
test();
}
Modified: trunk/plugins/MyDailyComics/skin/Blue3/MyDailyComics.xml
===================================================================
--- trunk/plugins/MyDailyComics/skin/Blue3/MyDailyComics.xml 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/skin/Blue3/MyDailyComics.xml 2011-06-11 21:40:16 UTC (rev 4243)
@@ -5,7 +5,7 @@
<allowoverlay>yes</allowoverlay>
<allowoverlay>no</allowoverlay>
<define>#header.label:My Daily Comics</define>
- <define>#header.image:comics_logo.png</define>
+ <define>#header.image:</define>
<define>#header.hover:-</define>
<define>#selecteditem:-</define>
<controls>
@@ -19,13 +19,15 @@
<animation effect="fade" time="250">WindowClose</animation>
<animation effect="fade" time="250">WindowOpen</animation>
<description>group element</description>
- <layout>StackLayout</layout>
+ <!--<layout>StackLayout</layout>-->
<posX>40</posX>
<posY>120</posY>
<control>
<description>Comic button</description>
<type>selectbutton</type>
<id>2</id>
+ <posX>40</posX>
+ <posY>120</posY>
<label>Comic</label>
<onup>1</onup>
<ondown>3</ondown>
@@ -34,8 +36,32 @@
<description>Date button</description>
<type>selectbutton</type>
<id>3</id>
+ <posX>40</posX>
+ <posY>160</posY>
<label>Date</label>
<onup>2</onup>
+ <ondown>4</ondown>
+ </control>
+ <control>
+ <description>Previous button</description>
+ <type>button</type>
+ <id>4</id>
+ <posX>250</posX>
+ <posY>120</posY>
+ <width>100</width>
+ <label><<--</label>
+ <onup>3</onup>
+ <ondown>5</ondown>
+ </control>
+ <control>
+ <description>Next button</description>
+ <type>button</type>
+ <id>5</id>
+ <posX>250</posX>
+ <posY>160</posY>
+ <width>100</width>
+ <label>-->></label>
+ <onup>4</onup>
<ondown>1</ondown>
</control>
</control>
@@ -48,6 +74,7 @@
<width>710</width>
<height>365</height>
<centered>true</centered>
+ <keepaspectratio>yes</keepaspectratio>
</control>
<control>
<description>Comic Banner</description>
@@ -57,6 +84,7 @@
<posY>120</posY>
<width>338</width>
<height>60</height>
+ <keepaspectratio>yes</keepaspectratio>
</control>
<control>
<description>Language Flag</description>
Modified: trunk/plugins/MyDailyComics/skin/Blue3wide/MyDailyComics.xml
===================================================================
--- trunk/plugins/MyDailyComics/skin/Blue3wide/MyDailyComics.xml 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/skin/Blue3wide/MyDailyComics.xml 2011-06-11 21:40:16 UTC (rev 4243)
@@ -19,13 +19,15 @@
<animation effect="fade" time="250">WindowClose</animation>
<animation effect="fade" time="250">WindowOpen</animation>
<description>group element</description>
- <layout>StackLayout</layout>
+ <!--<layout>StackLayout</layout>-->
<posX>70</posX>
<posY>150</posY>
<control>
<description>Comic button</description>
<type>selectbutton</type>
<id>2</id>
+ <posX>70</posX>
+ <posY>150</posY>
<label>Comic</label>
<onup>1</onup>
<ondown>3</ondown>
@@ -34,8 +36,30 @@
<description>Date button</description>
<type>selectbutton</type>
<id>3</id>
+ <posX>70</posX>
+ <posY>200</posY>
<label>Date</label>
<onup>2</onup>
+ <ondown>4</ondown>
+ </control>
+ <control>
+ <description>Previous button</description>
+ <type>button</type>
+ <id>4</id>
+ <posX>370</posX>
+ <posY>150</posY>
+ <label>Previous</label>
+ <onup>3</onup>
+ <ondown>5</ondown>
+ </control>
+ <control>
+ <description>Next button</description>
+ <type>button</type>
+ <id>5</id>
+ <posX>370</posX>
+ <posY>200</posY>
+ <label>Next</label>
+ <onup>4</onup>
<ondown>1</ondown>
</control>
</control>
@@ -48,6 +72,7 @@
<width>1260</width>
<height>450</height>
<centered>true</centered>
+ <keepaspectratio>yes</keepaspectratio>
</control>
<control>
<description>Comic Banner</description>
@@ -57,6 +82,7 @@
<posY>150</posY>
<width>442</width>
<height>70</height>
+ <keepaspectratio>yes</keepaspectratio>
</control>
<control>
<description>Language Flag</description>
Modified: trunk/plugins/MyDailyComics/util/ComicHelper.cs
===================================================================
--- trunk/plugins/MyDailyComics/util/ComicHelper.cs 2011-06-08 19:21:26 UTC (rev 4242)
+++ trunk/plugins/MyDailyComics/util/ComicHelper.cs 2011-06-11 21:40:16 UTC (rev 4243)
@@ -36,7 +36,8 @@
{
MyHtmlParser parser = new MyHtmlParser();
tmp_url = decryptUrl(comic, dt);
- tmp_url = parser.parse(tmp_url, comic.StartsWith, comic.EndsWith);
+ if (!string.IsNullOrEmpty(tmp_url))
+ tmp_url = parser.parse(tmp_url, comic.StartsWith, comic.EndsWith);
}
else
{
@@ -106,6 +107,23 @@
if (comic.Type.Equals(ComicStrip.TYPE_NUMERIC, StringComparison.OrdinalIgnoreCase))
{
+ if (string.IsNullOrEmpty(comic.LastUrl))
+ ret = comic.Url;
+ else
+ ret = comic.LastUrl;
+
+ MyHtmlParser parser = new MyHtmlParser();
+ string previous = string.Empty;
+ string next = string.Empty;
+ string datetitle = string.Empty;
+ parser.parse(ret, comic, out previous, out next, out datetitle);
+
+ comic.PreviousPage = previous;
+ comic.NextPage = next;
+ comic.LastUrl = ret;
+ comic.DateTitle = string.IsNullOrEmpty(datetitle) ? "-" : datetitle;
+
+
//TODO for future versions, use this approach for numeric types
/*
// numeric type
@@ -156,16 +174,16 @@
string safe = input;
foreach (char lDisallowed in System.IO.Path.GetInvalidFileNameChars())
{
- safe = safe.Replace(lDisallowed.ToString(), "");
+ safe = safe.Replace(lDisallowed.ToString(), "_");
}
foreach (char lDisallowed in System.IO.Path.GetInvalidPathChars())
{
- safe = safe.Replace(lDisallowed.ToString(), "");
+ safe = safe.Replace(lDisallowed.ToString(), "_");
}
return safe;
}
- public string DownloadBanner(string url)
+ public string Download(string url)
{
string localFilePath = string.Empty;
@@ -192,11 +210,11 @@
}
catch
{
- Log.Debug("load banner exception with " + url);
+ Log.Debug("save: exception with " + url);
return string.Empty;
}
- Log.Debug("load banner: " + localFilePath);
+ Log.Debug("save: " + localFilePath);
return localFilePath;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|