You can subscribe to this list here.
| 2007 |
Jan
(36) |
Feb
(79) |
Mar
(123) |
Apr
(95) |
May
(119) |
Jun
(172) |
Jul
(124) |
Aug
(100) |
Sep
(83) |
Oct
(52) |
Nov
(97) |
Dec
(87) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(131) |
Feb
(80) |
Mar
(163) |
Apr
(178) |
May
(73) |
Jun
(54) |
Jul
(106) |
Aug
(118) |
Sep
(50) |
Oct
(125) |
Nov
(100) |
Dec
(99) |
| 2009 |
Jan
(104) |
Feb
(99) |
Mar
(68) |
Apr
(81) |
May
(52) |
Jun
(87) |
Jul
(67) |
Aug
(33) |
Sep
(27) |
Oct
(37) |
Nov
(60) |
Dec
(116) |
| 2010 |
Jan
(82) |
Feb
(79) |
Mar
(38) |
Apr
(50) |
May
(45) |
Jun
(53) |
Jul
(23) |
Aug
(86) |
Sep
(22) |
Oct
(96) |
Nov
(97) |
Dec
(73) |
| 2011 |
Jan
(24) |
Feb
(45) |
Mar
(28) |
Apr
(31) |
May
(42) |
Jun
(25) |
Jul
|
Aug
(12) |
Sep
(28) |
Oct
(13) |
Nov
(43) |
Dec
(13) |
| 2012 |
Jan
(62) |
Feb
(28) |
Mar
(6) |
Apr
(16) |
May
(7) |
Jun
|
Jul
(16) |
Aug
(2) |
Sep
(1) |
Oct
(4) |
Nov
(1) |
Dec
(3) |
| 2013 |
Jan
(5) |
Feb
|
Mar
(34) |
Apr
(9) |
May
(6) |
Jun
(10) |
Jul
(32) |
Aug
(8) |
Sep
(11) |
Oct
(35) |
Nov
(24) |
Dec
(22) |
| 2014 |
Jan
(44) |
Feb
(9) |
Mar
(9) |
Apr
(15) |
May
(25) |
Jun
(34) |
Jul
(16) |
Aug
(11) |
Sep
(7) |
Oct
(6) |
Nov
(1) |
Dec
(12) |
| 2015 |
Jan
(33) |
Feb
(19) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(5) |
|
From: <ove...@us...> - 2007-03-28 14:07:54
|
Revision: 247
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=247&view=rev
Author: overture
Date: 2007-03-28 07:07:52 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
Added Paths:
-----------
trunk/plugins/IPTVPlugin/XMLs/
trunk/plugins/IPTVPlugin/XMLs/MyIPTVCategoryList.xml
trunk/plugins/IPTVPlugin/XMLs/MyIPTVChannelList.xml
trunk/plugins/IPTVPlugin/XMLs/MyIPTVhome.xml
Modified: trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-28 14:02:06 UTC (rev 246)
+++ trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-28 14:07:52 UTC (rev 247)
@@ -56,5 +56,11 @@
</EmbeddedResource>
<Compile Include="GUIListCategoriesIPTV.cs" />
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="XMLs" />
+ <Content Include="XMLs\MyIPTVChannelList.xml" />
+ <Content Include="XMLs\MyIPTVhome.xml" />
+ <Content Include="XMLs\MyIPTVCategoryList.xml" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
\ No newline at end of file
Added: trunk/plugins/IPTVPlugin/XMLs/MyIPTVCategoryList.xml
===================================================================
--- trunk/plugins/IPTVPlugin/XMLs/MyIPTVCategoryList.xml (rev 0)
+++ trunk/plugins/IPTVPlugin/XMLs/MyIPTVCategoryList.xml 2007-03-28 14:07:52 UTC (rev 247)
@@ -0,0 +1,78 @@
+<window>
+ <id>6600</id>
+ <defaultcontrol>2</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <controls>
+ <control>
+ <description>BackGround</description>
+ <type>image</type>
+ <id>1</id>
+ <posX>0</posX>
+ <posY>0</posY>
+ <width>720</width>
+ <height>576</height>
+ <texture>background.png</texture>
+ </control>
+ <control>
+ <description>an Image</description>
+ <type>image</type>
+ <id>1</id>
+ <posX>75</posX>
+ <posY>370</posY>
+ <texture>hover_my tv.png</texture>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>1</id>
+ <posX>250</posX>
+ <posY>70</posY>
+ <label>My IPTV</label>
+ <font>font16</font>
+ <align>right</align>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <animation>FlyInFromLeft</animation>
+ <control>
+ <description>View-As button</description>
+ <type>button</type>
+ <id>2</id>
+ <posX>60</posX>
+ <posY>150</posY>
+ <width>150</width>
+ <label>100</label>
+ <onleft>10</onleft>
+ <onright>10</onright>
+ </control>
+
+ </control>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <animation>FlyInFromTop</animation>
+ <control>
+ <description>Categories</description>
+ <type>listcontrol</type>
+ <id>10</id>
+ <posX>300</posX>
+ <posY>150</posY>
+ <width>340</width>
+ <height>300</height>
+ <textXOff>10</textXOff>
+ <textYOff>2</textYOff>
+ <textXOff2>320</textXOff2>
+ <textYOff2>2</textYOff2>
+ <spaceBetweenItems>5</spaceBetweenItems>
+ <textureHeight>25</textureHeight>
+ <keepaspectratio>no</keepaspectratio>
+ <font2>font10</font2>
+ <font3>font10</font3>
+ <onleft>2</onleft>
+ <onright>2</onright>
+ </control>
+ </control>
+ </controls>
+</window>
Added: trunk/plugins/IPTVPlugin/XMLs/MyIPTVChannelList.xml
===================================================================
--- trunk/plugins/IPTVPlugin/XMLs/MyIPTVChannelList.xml (rev 0)
+++ trunk/plugins/IPTVPlugin/XMLs/MyIPTVChannelList.xml 2007-03-28 14:07:52 UTC (rev 247)
@@ -0,0 +1,58 @@
+<window>
+ <id>6599</id>
+ <defaultcontrol>2</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <controls>
+ <control>
+ <description>BackGround</description>
+ <type>image</type>
+ <id>1</id>
+ <posX>0</posX>
+ <posY>0</posY>
+ <width>720</width>
+ <height>576</height>
+ <texture>background.png</texture>
+ </control>
+ <control>
+ <description>an Image</description>
+ <type>image</type>
+ <id>1</id>
+ <posX>75</posX>
+ <posY>370</posY>
+ <texture>hover_my tv.png</texture>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>1</id>
+ <posX>250</posX>
+ <posY>70</posY>
+ <label>My IPTV</label>
+ <font>font16</font>
+ <align>right</align>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ <control>
+ <description>Categories</description>
+ <type>listcontrol</type>
+ <id>11</id>
+ <posX>300</posX>
+ <posY>150</posY>
+ <width>340</width>
+ <height>300</height>
+ <textXOff>10</textXOff>
+ <textYOff>2</textYOff>
+ <textXOff2>320</textXOff2>
+ <textYOff2>2</textYOff2>
+ <spaceBetweenItems>5</spaceBetweenItems>
+ <textureHeight>25</textureHeight>
+ <keepaspectratio>no</keepaspectratio>
+ <font2>font10</font2>
+ <font3>font10</font3>
+ <onleft>2</onleft>
+ <onright>2</onright>
+ <onup>2</onup>
+ <ondown>2</ondown>
+ </control>
+ </controls>
+</window>
Added: trunk/plugins/IPTVPlugin/XMLs/MyIPTVhome.xml
===================================================================
--- trunk/plugins/IPTVPlugin/XMLs/MyIPTVhome.xml (rev 0)
+++ trunk/plugins/IPTVPlugin/XMLs/MyIPTVhome.xml 2007-03-28 14:07:52 UTC (rev 247)
@@ -0,0 +1,91 @@
+<window>
+ <id>6598</id>
+ <defaultcontrol>2</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <controls>
+ <control>
+ <description>BackGround</description>
+ <type>image</type>
+ <id>1</id>
+ <posX>0</posX>
+ <posY>0</posY>
+ <width>720</width>
+ <height>576</height>
+ <texture>background.png</texture>
+ </control>
+ <control>
+ <description>an Image</description>
+ <type>image</type>
+ <id>1</id>
+ <posX>75</posX>
+ <posY>370</posY>
+ <texture>hover_my tv.png</texture>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>1</id>
+ <posX>250</posX>
+ <posY>70</posY>
+ <label>My IPTV</label>
+ <font>font16</font>
+ <align>right</align>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <animation>FlyInFromLeft</animation>
+ <control>
+ <description>View-As button</description>
+ <type>button</type>
+ <id>2</id>
+ <posX>60</posX>
+ <posY>150</posY>
+ <width>190</width>
+ <label>100</label>
+ <onleft>99</onleft>
+ <onright>99</onright>
+ <onup>8</onup>
+ <ondown>8</ondown>
+ </control>
+ <control>
+ <description>TV On/Off button</description>
+ <type>togglebutton</type>
+ <id>8</id>
+ <posX>60</posX>
+ <posY>185</posY>
+ <width>190</width>
+ <height>32</height>
+ <textXOff>10</textXOff>
+ <textYOff>5</textYOff>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <colordiffuse>ffffffff</colordiffuse>
+ <disabledcolor>60ffffff</disabledcolor>
+ <label>707</label>
+ <AltTextureFocus>togglebutton-off-focus.png</AltTextureFocus>
+ <AltTextureNoFocus>togglebutton-off-nofocus.png</AltTextureNoFocus>
+ <textureFocus>togglebutton-on-focus.png</textureFocus>
+ <textureNoFocus>togglebutton-on-nofocus.png</textureNoFocus>
+ <onup>2</onup>
+ <ondown>2</ondown>
+ <onright>99</onright>
+ <onleft>99</onleft>
+ </control>
+ </control>
+ <control>
+ <description>video window</description>
+ <type>videowindow</type>
+ <id>99</id>
+ <posX>300</posX>
+ <posY>107</posY>
+ <width>350</width>
+ <height>260</height>
+ <onleft>2</onleft>
+ <onright>2</onright>
+ <action>18</action>
+ <textureFocus>video_window_focus.png</textureFocus>
+ </control>
+ </controls>
+</window>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <moi...@us...> - 2007-03-28 14:02:13
|
Revision: 246
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=246&view=rev
Author: moiristo
Date: 2007-03-28 07:02:06 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/
trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_nlgemist.png
trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_rtlgemist.png
trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_uitgemist.png
trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/nlgemist.png
trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/rtlgemist.png
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_nlgemist.png
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_nlgemist.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_rtlgemist.png
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_rtlgemist.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_uitgemist.png
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/hover_uitgemist.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/nlgemist.png
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/nlgemist.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/rtlgemist.png
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/UitzendingGemist/skin/[Wide skin]/Media/rtlgemist.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <moi...@us...> - 2007-03-28 14:00:52
|
Revision: 245
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=245&view=rev
Author: moiristo
Date: 2007-03-28 07:00:50 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/UitzendingGemist/UitGemist.suo
Added Paths:
-----------
trunk/plugins/UitzendingGemist/skin/[Wide skin]/
trunk/plugins/UitzendingGemist/skin/[Wide skin]/RtlGemist.xml
trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist.xml
trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist2.xml
trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemistMain.xml
Modified: trunk/plugins/UitzendingGemist/UitGemist.suo
===================================================================
(Binary files differ)
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/RtlGemist.xml
===================================================================
--- trunk/plugins/UitzendingGemist/skin/[Wide skin]/RtlGemist.xml (rev 0)
+++ trunk/plugins/UitzendingGemist/skin/[Wide skin]/RtlGemist.xml 2007-03-28 14:00:50 UTC (rev 245)
@@ -0,0 +1,46 @@
+<window>
+ <id>6802</id>
+ <defaultcontrol>50</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <define>#header.label:RTLGemist</define>
+ <define>#header.location:</define>
+<controls>
+ <import>common.window.xml</import>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <animation effect="slide" time="250" start="-300,0">WindowOpen</animation>
+ <animation effect="slide" time="500" end="0,-300">WindowClose</animation>
+ <layout>StackLayout</layout>
+ <posX>50</posX>
+ <posY>130</posY>
+ <control>
+ <description>Favorieten</description>
+ <type>button</type>
+ <id>2</id>
+ <label>Favorieten</label>
+ <onup>17</onup>
+ <ondown>3</ondown>
+ </control>
+ <control>
+ <description>Top Tien</description>
+ <type>button</type>
+ <id>3</id>
+ <label>Top Tien</label>
+ <onup>2</onup>
+ <ondown>4</ondown>
+ </control>
+ <control>
+ <description>Programma's</description>
+ <type>button</type>
+ <id>4</id>
+ <label>Programma's</label>
+ <onup>3</onup>
+ <ondown>2</ondown>
+ </control>
+ </control>
+ <import>common.facade.xml</import>
+</controls>
+</window>
\ No newline at end of file
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist.xml
===================================================================
--- trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist.xml (rev 0)
+++ trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist.xml 2007-03-28 14:00:50 UTC (rev 245)
@@ -0,0 +1,121 @@
+<window>
+ <id>6800</id>
+ <defaultcontrol>50</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <define>#header.label:UitGemist</define>
+ <define>#header.location:</define>
+<controls>
+ <import>common.window.xml</import>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <animation effect="slide" time="250" start="-300,0">WindowOpen</animation>
+ <animation effect="slide" time="500" end="0,-300">WindowClose</animation>
+ <layout>StackLayout</layout>
+ <posX>50</posX>
+ <posY>97</posY>
+ <control>
+ <description>Favorieten</description>
+ <type>button</type>
+ <id>2</id>
+ <label>Favorieten</label>
+ <onup>17</onup>
+ <ondown>3</ondown>
+ </control>
+ <control>
+ <type>selectbutton</type>
+ <description>Letter button</description>
+ <id>3</id>
+ <label>Titel</label>
+ <onup>2</onup>
+ <ondown>4</ondown>
+ </control>
+ <control>
+ <type>selectbutton</type>
+ <description>Letter button</description>
+ <id>4</id>
+ <label>Dag</label>
+ <onup>3</onup>
+ <ondown>5</ondown>
+ </control>
+ <control>
+ <type>selectbutton</type>
+ <description>Letter button</description>
+ <id>5</id>
+ <label>Net/zender</label>
+ <onup>4</onup>
+ <ondown>6</ondown>
+ </control>
+ <control>
+ <type>selectbutton</type>
+ <description>Letter button</description>
+ <id>6</id>
+ <label>Omroep</label>
+ <onup>5</onup>
+ <ondown>7</ondown>
+ </control>
+ <control>
+ <type>selectbutton</type>
+ <description>Letter button</description>
+ <id>7</id>
+ <label>Genre</label>
+ <onup>6</onup>
+ <ondown>8</ondown>
+ </control>
+ <control>
+ <description>Moet je Zien</description>
+ <type>button</type>
+ <id>8</id>
+ <label>Moet je zien</label>
+ <onup>7</onup>
+ <onright>50</onright>
+ <ondown>50</ondown>
+ </control>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <control>
+ <type>imagelist</type>
+ <id>11</id>
+ <posX>1120</posX>
+ <posY>450</posY>
+ <width>100</width>
+ <height>32</height>
+ <textureWidth>16</textureWidth>
+ <textureHeight>16</textureHeight>
+ <subitems>
+ <subitem>greystar.png</subitem>
+ <subitem>star.png</subitem>
+ </subitems>
+ <orientation>horizontal</orientation>
+ <align>left</align>
+ <percentage>#rating</percentage>
+ </control>
+ <control>
+ <type>textboxscrollup</type>
+ <description>Programma-info</description>
+ <id>12</id>
+ <posX>550</posX>
+ <posY>500</posY>
+ <width>375</width>
+ <height>100</height>
+ <label>#plot</label>
+ <textcolor>ffffffff</textcolor>
+ <font>font12</font>
+ </control>
+ <control>
+ <description>Bekeken</description>
+ <type>label</type>
+ <id>13</id>
+ <posX>860</posX>
+ <posY>450</posY>
+ <label>#votes keer bekeken</label>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ </control>
+ </control>
+ <import>common.facade.xml</import>
+</controls>
+</window>
\ No newline at end of file
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist2.xml
===================================================================
--- trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist2.xml (rev 0)
+++ trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemist2.xml 2007-03-28 14:00:50 UTC (rev 245)
@@ -0,0 +1,128 @@
+<window>
+ <id>6801</id>
+ <defaultcontrol>10</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <define>#header.label:Programma</define>
+ <define>#header.location:</define>
+ <controls>
+ <import>common.window.xml</import>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <control>
+ <type>image</type>
+ <description>Program image</description>
+ <id>3</id>
+ <posX>50</posX>
+ <posY>115</posY>
+ <width>100</width>
+ <height>75</height>
+ <texture>background.png</texture>
+ </control>
+ <control>
+ <description>Naam van gekozen programma</description>
+ <type>label</type>
+ <id>2</id>
+ <posX>165</posX>
+ <posY>95</posY>
+ <label>#title</label>
+ </control>
+ <control>
+ <description>Genre</description>
+ <type>label</type>
+ <id>0</id>
+ <posX>550</posX>
+ <posY>115</posY>
+ <label>Genre</label>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ <control>
+ <description>Display wich genre</description>
+ <type>label</type>
+ <id>4</id>
+ <posX>550</posX>
+ <posY>130</posY>
+ <label>#genre</label>
+ </control>
+ <control>
+ <description>Omroep</description>
+ <type>label</type>
+ <id>0</id>
+ <posX>550</posX>
+ <posY>150</posY>
+ <label>Omroep</label>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ <control>
+ <description>Display which omroep</description>
+ <type>label</type>
+ <id>5</id>
+ <posX>550</posX>
+ <posY>165</posY>
+ <label>#credits</label>
+ </control>
+ <control>
+ <type>imagelist</type>
+ <id>1</id>
+ <posX>550</posX>
+ <posY>200</posY>
+ <width>100</width>
+ <height>32</height>
+ <textureWidth>16</textureWidth>
+ <textureHeight>16</textureHeight>
+ <subitems>
+ <subitem>greystar.png</subitem>
+ <subitem>star.png</subitem>
+ </subitems>
+ <orientation>horizontal</orientation>
+ <align>left</align>
+ <percentage>#rating</percentage>
+ </control>
+ <control>
+ <type>textboxscrollup</type>
+ <description>Programma-info</description>
+ <id>6</id>
+ <posX>165</posX>
+ <posY>115</posY>
+ <width>375</width>
+ <height>105</height>
+ <label>#plot</label>
+ <font>font12</font>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ <control>
+ <description>afleveringen</description>
+ <type>listcontrol</type>
+ <id>10</id>
+ <posX>165</posX>
+ <posY>225</posY>
+ <width>485</width>
+ <height>200</height>
+ <textXOff>10</textXOff>
+ <textYOff>2</textYOff>
+ <textXOff2>420</textXOff2>
+ <textYOff2>2</textYOff2>
+ <spaceBetweenItems>5</spaceBetweenItems>
+ <textureHeight>25</textureHeight>
+ <keepaspectratio>no</keepaspectratio>
+ <font2>font10</font2>
+ <font3>font10</font3>
+ <onup>17</onup>
+ </control>
+ <control>
+ <type>textboxscrollup</type>
+ <description>Programma-info</description>
+ <id>1</id>
+ <posX>250</posX>
+ <posY>380</posY>
+ <width>375</width>
+ <height>100</height>
+ <label>#plotoutline</label>
+ <font>font12</font>
+ <textcolor>ffffffff</textcolor>
+ </control>
+ </control>
+ </controls>
+</window>
Added: trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemistMain.xml
===================================================================
--- trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemistMain.xml (rev 0)
+++ trunk/plugins/UitzendingGemist/skin/[Wide skin]/UitGemistMain.xml 2007-03-28 14:00:50 UTC (rev 245)
@@ -0,0 +1,46 @@
+<window>
+ <id>6799</id>
+ <defaultcontrol>2</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <define>#header.label:UitzendingGemist</define>
+ <define>#header.location:</define>
+ <define>#header.image:</define>
+ <define>#header.hover:hover_uitgemist.png</define>
+
+ <controls>
+ <import>common.window.xml</import>
+
+ <!-- topmost item needs an onup with a value of 17 for topbar to work -->
+ <control>
+ <description>UitzendingGemist.nl</description>
+ <type>button</type>
+ <id>2</id>
+ <width>575</width>
+ <height>90</height>
+ <posX>400</posX>
+ <posY>150</posY>
+ <textureNoFocus>nlgemist.png</textureNoFocus>
+ <textureFocus>hover_nlgemist.png</textureFocus>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <onup>17</onup>
+ </control>
+
+ <!-- last item needs an ondown with a value of 2 to support wraparound -->
+ <control>
+ <description>RTL Gemist</description>
+ <type>button</type>
+ <id>3</id>
+ <posX>400</posX>
+ <posY>250</posY>
+ <width>575</width>
+ <height>90</height>
+ <textureNoFocus>rtlgemist.png</textureNoFocus>
+ <textureFocus>hover_rtlgemist.png</textureFocus>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <ondown>2</ondown>
+ </control>
+
+ </controls>
+</window>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ove...@us...> - 2007-03-28 13:55:43
|
Revision: 244
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=244&view=rev
Author: overture
Date: 2007-03-28 06:55:39 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IPTVPlugin/SnapperInterface.cs
Modified: trunk/plugins/IPTVPlugin/SnapperInterface.cs
===================================================================
--- trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-27 21:08:33 UTC (rev 243)
+++ trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-28 13:55:39 UTC (rev 244)
@@ -31,7 +31,7 @@
/// <summary>
/// Should return a DESCRIPTION for the IPTV mini plugin.
/// </summary>
- /// <returns>string with authors name</returns>
+ /// <returns>string with PLUGIN DESCRIPTION name</returns>
string Description();
/// <summary>
/// Should return the current VERSION of the plugin.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ze...@us...> - 2007-03-27 21:08:35
|
Revision: 243
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=243&view=rev
Author: zebons
Date: 2007-03-27 14:08:33 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Corrected some problems with DVDProfiler compatibility.
Modified Paths:
--------------
trunk/plugins/MyFilms/CatalogConverter.cs
trunk/plugins/MyFilms/MesFilms.suo
Modified: trunk/plugins/MyFilms/CatalogConverter.cs
===================================================================
--- trunk/plugins/MyFilms/CatalogConverter.cs 2007-03-27 18:44:08 UTC (rev 242)
+++ trunk/plugins/MyFilms/CatalogConverter.cs 2007-03-27 21:08:33 UTC (rev 243)
@@ -54,6 +54,7 @@
XmlNode nodeID = nodeDVD.SelectSingleNode("ID");
XmlNode nodeNumber = nodeDVD.SelectSingleNode("CollectionNumber");
XmlNode nodeTitle = nodeDVD.SelectSingleNode("Title");
+ XmlNode nodeOTitle = nodeDVD.SelectSingleNode("OriginalTitle");
XmlNode nodeRating = nodeDVD.SelectSingleNode("Rating");
XmlNode nodeYear = nodeDVD.SelectSingleNode("ProductionYear");
XmlNode nodeDuration = nodeDVD.SelectSingleNode("RunningTime");
@@ -63,7 +64,7 @@
XmlNodeList genreList = nodeDVD.SelectNodes("Genres/Genre");
foreach (XmlNode nodeGenre in genreList)
{
- if (genre.Length > 0) genre += " / ";
+ if (genre.Length > 0) genre += ", ";
genre += nodeGenre.InnerText;
}
string cast = String.Empty;
@@ -79,7 +80,11 @@
if (nodeFirstName != null && nodeFirstName.InnerText != null) firstname = nodeFirstName.InnerText;
if (nodeLastName != null && nodeLastName.InnerText != null) lastname = nodeLastName.InnerText;
if (nodeRole != null && nodeRole.InnerText != null) role = nodeRole.InnerText;
- string line = String.Format("{0} {1} as {2}\n", firstname, lastname, role);
+ string line;
+ if (role.Length == 0)
+ line = String.Format("{0} {1}, ", firstname, lastname);
+ else
+ line = String.Format("{0} {1} ({2}), ", firstname, lastname, role);
cast += line;
}
@@ -94,7 +99,7 @@
XmlNode nodeType = nodeCredit.SelectSingleNode("CreditSubtype");
if (nodeType != null && nodeType.InnerText != null && nodeType.InnerText == "Director")
{
- if (credits.Length > 0) credits += " / ";
+ if (credits.Length > 0) credits += ", ";
if (nodeFirstName != null && nodeFirstName.InnerText != null) firstname = nodeFirstName.InnerText;
if (nodeLastName != null && nodeLastName.InnerText != null) lastname = nodeLastName.InnerText;
credits += String.Format("{0} {1}", firstname, lastname);
@@ -105,10 +110,13 @@
WriteAntAtribute(destXml,"CollectionNumber",nodeNumber.InnerText);
else
WriteAntAtribute(destXml, "CollectionNumber", nodeNumber.InnerText);
- WriteAntAtribute(destXml, "Title", nodeTitle.InnerText);
+ if (nodeOTitle != null && nodeOTitle.InnerText != null)
+ WriteAntAtribute(destXml, "Title", nodeOTitle.InnerText);
+ else
+ WriteAntAtribute(destXml, "Title", nodeTitle.InnerText);
WriteAntAtribute(destXml, "SortTitle", nodeTitle.InnerText);
WriteAntAtribute(destXml, "SortTitle1", nodeTitle.InnerText);
- WriteAntAtribute(destXml, "Rating","0" );
+ WriteAntAtribute(destXml, "Rating","0");
WriteAntAtribute(destXml, "Year", nodeYear.InnerText);
WriteAntAtribute(destXml, "RunningTime", nodeDuration.InnerText);
WriteAntAtribute(destXml, "Genres", genre);
Modified: trunk/plugins/MyFilms/MesFilms.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sa...@us...> - 2007-03-27 19:32:49
|
Revision: 242
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=242&view=rev
Author: saamand
Date: 2007-03-27 11:44:08 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj
trunk/plugins/MyLyrics/MyLyrics.suo
Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj
===================================================================
--- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 17:00:56 UTC (rev 241)
+++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 18:44:08 UTC (rev 242)
@@ -46,7 +46,7 @@
<Compile Include="LRC\SimpleLRCTimeAndLineCollection.cs" />
<Compile Include="LyricsDatabase\LyricsDatabase.cs" />
<Compile Include="LyricsDatabase\LyricsItem.cs" />
- <Compile Include="LyricSearch.cs" />
+ <Compile Include="LyricsSites\LyricSearch.cs" />
<Compile Include="LyricDiagnostics.cs" />
<Compile Include="LyricsSites\HotLyrics.cs" />
<Compile Include="LyricsSites\EvilLabs.cs" />
Modified: trunk/plugins/MyLyrics/MyLyrics.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ze...@us...> - 2007-03-27 17:01:34
|
Revision: 241
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=241&view=rev
Author: zebons
Date: 2007-03-27 10:00:56 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Compatibility for DVDProfiler Database : manage a temporary database
Modified Paths:
--------------
trunk/plugins/MyFilms/CatalogConverter.cs
trunk/plugins/MyFilms/MesFilms.cs
trunk/plugins/MyFilms/MesFilms.csproj
trunk/plugins/MyFilms/MesFilms.suo
trunk/plugins/MyFilms/MesFilmsDetail.cs
Modified: trunk/plugins/MyFilms/CatalogConverter.cs
===================================================================
--- trunk/plugins/MyFilms/CatalogConverter.cs 2007-03-27 16:52:34 UTC (rev 240)
+++ trunk/plugins/MyFilms/CatalogConverter.cs 2007-03-27 17:00:56 UTC (rev 241)
@@ -3,6 +3,7 @@
using System.Text;
using System.IO;
using System.Xml;
+using MediaPortal.GUI.Library;
namespace MesFilms
{
@@ -29,7 +30,8 @@
public string ConvertProfiler(string source)
{
- string destFile = Path.GetTempPath()+@"\"+"AntTempFile.xml";
+ //string destFile = Path.GetTempPath()+@"AntTempFile.xml";
+ string destFile = source.Substring(0, source.Length - 4) + "_tmp.xml";
XmlTextWriter destXml = new XmlTextWriter(destFile,Encoding.Default);
destXml.Formatting = Formatting.Indented;
destXml.WriteStartDocument();
Modified: trunk/plugins/MyFilms/MesFilms.cs
===================================================================
--- trunk/plugins/MyFilms/MesFilms.cs 2007-03-27 16:52:34 UTC (rev 240)
+++ trunk/plugins/MyFilms/MesFilms.cs 2007-03-27 17:00:56 UTC (rev 241)
@@ -126,6 +126,7 @@
string StrViewDfltItem = null;
string StrViewDfltText = null;
string StrFileXml = null;
+ string StrFileType = null;
string StrPathImg = null;
string StrSortSens = null;
public string WStrSort = null;
@@ -284,7 +285,7 @@
if (PreviousWindowId == ID_MesFilmsDetail)
{
CurrentConfig = xmlreader.GetValueAsString("MyFilms", "Current_Config", "");
- Load_Config(CurrentConfig);
+ Load_Config(CurrentConfig ,false);
Fin_Charge_Init(false);
}
else
@@ -300,7 +301,7 @@
{
if (CurrentConfig == "")
CurrentConfig = Choice_Config();
- Load_Config(CurrentConfig);
+ Load_Config(CurrentConfig,true);
Fin_Charge_Init(true);
}
}
@@ -1086,9 +1087,17 @@
xmlwriter.SetValueAsBool(CurrentConfig, "boolselect", boolselect);
xmlwriter.SetValue(CurrentConfig, "WStrSort", WStrSort);
xmlwriter.SetValue(CurrentConfig, "Wstar", Wstar);
+ switch (StrFileType)
+ {
+ case "0":
+ break;
+ case "1":
+ xmlwriter.SetValue(CurrentConfig, "AntCatalogTemp", StrFileXml.ToString());
+ break;
+ }
}
}
- private void Load_Config(string CurrentConfig)
+ private void Load_Config(string CurrentConfig,bool create_temp)
{
//-----------------------------------------------------------------------------------------------
// Load Config Parameters in MyFilms.xml file (section CurrentConfig)
@@ -1109,14 +1118,21 @@
StrViewItem2 = xmlreader.GetValueAsString(CurrentConfig, "AntViewItem2", "");
StrViewText2 = xmlreader.GetValueAsString(CurrentConfig, "AntViewText2", "");
StrFileXml = xmlreader.GetValueAsString(CurrentConfig, "AntCatalog", "");
- switch (xmlreader.GetValueAsString(CurrentConfig, "CatalogType", ""))
+ StrFileType = xmlreader.GetValueAsString(CurrentConfig, "CatalogType", "0");
+ switch (StrFileType)
{
case "0":
break;
case "1":
- CatalogConverter cv = new CatalogConverter();
- StrFileXml = cv.ConvertProfiler(StrFileXml);
+ if (create_temp)
+ {
+ CatalogConverter cv = new CatalogConverter();
+ StrFileXml = cv.ConvertProfiler(StrFileXml);
+ }
+ else
+ StrFileXml = xmlreader.GetValueAsString(CurrentConfig, "AntCatalogTemp", "");
break;
+
}
StrPathImg = xmlreader.GetValueAsString(CurrentConfig, "AntPicture", "");
StrSelect = xmlreader.GetValueAsString(CurrentConfig, "StrSelect", "");
@@ -1353,7 +1369,7 @@
{
//Change "Config":
mydivx.Clear();
- Load_Config(Choice_Config());
+ Load_Config(Choice_Config(),true);
Fin_Charge_Init(true);
return;
}
Modified: trunk/plugins/MyFilms/MesFilms.csproj
===================================================================
--- trunk/plugins/MyFilms/MesFilms.csproj 2007-03-27 16:52:34 UTC (rev 240)
+++ trunk/plugins/MyFilms/MesFilms.csproj 2007-03-27 17:00:56 UTC (rev 241)
@@ -31,7 +31,7 @@
<ItemGroup>
<Reference Include="Core, Version=1.0.2548.1824, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\mediaportal_plugin\MesFilms\Core_Svn\Core.dll</HintPath>
+ <HintPath>..\..\mediaportal_plugin\MesFilms\Core_Stable\Core.DLL</HintPath>
</Reference>
<Reference Include="Databases, Version=1.0.2548.1828, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -50,7 +50,7 @@
<Reference Include="System.Xml" />
<Reference Include="Utils, Version=1.0.2548.1816, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\mediaportal_plugin\MesFilms\Core_Svn\Utils.dll</HintPath>
+ <HintPath>..\..\mediaportal_plugin\MesFilms\Core_Stable\Utils.DLL</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Modified: trunk/plugins/MyFilms/MesFilms.suo
===================================================================
(Binary files differ)
Modified: trunk/plugins/MyFilms/MesFilmsDetail.cs
===================================================================
--- trunk/plugins/MyFilms/MesFilmsDetail.cs 2007-03-27 16:52:34 UTC (rev 240)
+++ trunk/plugins/MyFilms/MesFilmsDetail.cs 2007-03-27 17:00:56 UTC (rev 241)
@@ -207,6 +207,14 @@
StrTitleSelect = xmlreader.GetValueAsString(CurrentConfig, "StrTitleSelect", "");
StrFilmSelect = xmlreader.GetValueAsString(CurrentConfig, "StrFilmSelect", "");
TitleDelim = xmlreader.GetValueAsString(CurrentConfig, "TitleDelim", ".");
+ switch (xmlreader.GetValueAsString(CurrentConfig, "CatalogType", "0"))
+ {
+ case "0":
+ break;
+ case "1":
+ StrFileXml = xmlreader.GetValueAsString(CurrentConfig, "AntCatalogTemp", "");
+ break;
+ }
}
if (TxtSelect.Length == 0)
GUIPropertyManager.SetProperty("#select", " ");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sa...@us...> - 2007-03-27 16:52:44
|
Revision: 240
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=240&view=rev
Author: saamand
Date: 2007-03-27 09:52:34 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs
trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj
trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs
Added Paths:
-----------
trunk/plugins/MyLyrics/Lyrics.suo
trunk/plugins/MyLyrics/LyricsEngine/LRC/
trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs
trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs
trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs
trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs
trunk/plugins/MyLyrics/My Lyrics/Changelog.txt
trunk/plugins/MyLyrics/My Lyrics/Convert/
trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs
trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/Refactor/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/TempPE/
trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt
trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.cs
trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.resx
trunk/plugins/MyLyrics/MyLyrics.suo
Added: trunk/plugins/MyLyrics/Lyrics.suo
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/MyLyrics/Lyrics.suo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs
===================================================================
--- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs (rev 0)
+++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRC.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,219 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+
+namespace LRC
+{
+ public class SimpleLRC
+ {
+ string artist;
+ string title;
+ string album;
+ string lyric;
+ bool isValid;
+
+ System.Collections.ArrayList lyricLines;
+ System.Collections.ArrayList simpleLRCTimeAndLineArray;
+ SimpleLRCTimeAndLineCollection simpleLRCTimeAndLineCollection;
+
+ public SimpleLRC(string file)
+ {
+ FileInfo fileInfo = new FileInfo(file);
+ TextReader textReader = new StreamReader(file);
+
+ string line = "";
+ lyricLines = new System.Collections.ArrayList();
+ simpleLRCTimeAndLineArray = new System.Collections.ArrayList();
+
+ while ((line = textReader.ReadLine()) != null)
+ {
+ bool done = false;
+ bool originalLine = true;
+ while (done == false)
+ {
+ done = getLRCinfoFromFile(ref line, originalLine);
+ originalLine = false;
+ }
+ }
+
+ if (simpleLRCTimeAndLineArray.Count > 0)
+ {
+ simpleLRCTimeAndLineCollection = new SimpleLRCTimeAndLineCollection((SimpleLRCTimeAndLine[])simpleLRCTimeAndLineArray.ToArray(typeof(SimpleLRCTimeAndLine)));
+ isValid = true;
+ }
+
+ textReader.Close();
+ }
+
+
+ public SimpleLRC(string artist, string title, string lyric)
+ {
+ this.artist = artist;
+ this.title = title;
+
+ string[] separators = new string[1]{"\n"};
+ string[] lines = lyric.Split(separators, StringSplitOptions.None);
+ string line = "";
+ lyricLines = new System.Collections.ArrayList();
+ simpleLRCTimeAndLineArray = new System.Collections.ArrayList();
+
+ for (int i = 0; i < lines.Length; i++)
+ {
+ bool done = false;
+ bool originalLine = true;
+ line = lines[i];
+ while (done == false)
+ {
+ done = getLRCinfoFromFile(ref line, originalLine);
+ originalLine = false;
+ }
+ }
+
+ if (simpleLRCTimeAndLineArray.Count > 0)
+ {
+ simpleLRCTimeAndLineCollection = new SimpleLRCTimeAndLineCollection((SimpleLRCTimeAndLine[])simpleLRCTimeAndLineArray.ToArray(typeof(SimpleLRCTimeAndLine)));
+ isValid = true;
+ }
+ }
+
+ private bool getLRCinfoFromFile(ref string line, bool originalLine)
+ {
+ System.Text.RegularExpressions.Match m;
+
+ if ((m = LRC.SimpleLRCFormat.Line_Line_Regex.Match(line)).Success)
+ {
+ line = line.Trim();
+ int index;
+ if ((index = m.Value.IndexOf("[")) > 0)
+ {
+ line = line.Substring(index);
+ }
+
+ string lineWithTimeAndNewLine = line + Environment.NewLine;
+
+ // if a line with multiple timetags, only add the first which is the complete with all tags.
+ if (originalLine)
+ {
+ lyric += lineWithTimeAndNewLine;
+ }
+
+ // we update the line for potential further time-tags. This will natural not be regarded as an original line
+ // and will therefore not be added to the lyric. It will however be added to the LRC-object just as every other line
+ line = line.Replace(m.Value, "");
+
+ string lineWithNewLine = line + Environment.NewLine;
+ lyricLines.Add(lineWithNewLine);
+
+ int NEXT = 1;
+ int minStart, minLength, secStart, secLength, msecStart, msecLength = 0;
+ long min, sec, msec = 0;
+ sec = 0;
+
+ minStart = NEXT;
+ minLength = m.Value.IndexOf(":") - minStart;
+ min = long.Parse(m.Value.Substring(minStart, minLength));
+
+ secStart = minStart + minLength + NEXT;
+
+ if (m.Value.IndexOf(".") != -1 && m.Value.IndexOf(".") < m.Value.IndexOf("]"))
+ {
+ secLength = m.Value.IndexOf(".") - secStart;
+ sec = long.Parse(m.Value.Substring(secStart, secLength));
+
+ msecStart = secStart + secLength + NEXT;
+ msecLength = m.Value.IndexOf("]") - msecStart;
+ msec = long.Parse(m.Value.Substring(msecStart, msecLength));
+ }
+ else
+ {
+ secLength = m.Value.IndexOf("]") - secStart;
+ sec = long.Parse(m.Value.Substring(secStart, secLength));
+ }
+
+ string lineTemp = lineWithNewLine;
+ bool done = true;
+
+ while ((m = LRC.SimpleLRCFormat.Line_Line_Regex.Match(lineTemp)).Success)
+ {
+ lineTemp = lineTemp.Replace(m.Value, "");
+ done = false;
+ }
+
+ //System.Text.RegularExpressions.Match firstMatch;
+ //while ((firstMatch = LRC.SimpleLRCFormat.Line_Line_Regex.Match(lineTemp)).Success)
+ //{
+ // System.Text.RegularExpressions.Match lastMatch = firstMatch;
+ // while (lastMatch.NextMatch().Length > 0)
+ // {
+ // lastMatch = (System.Text.RegularExpressions.Match)lastMatch.NextMatch();
+ // }
+
+ // lineTemp = lineTemp.Replace(lastMatch.Value, "");
+ // done = false;
+ //}
+
+ simpleLRCTimeAndLineArray.Add(new SimpleLRCTimeAndLine(min, sec, msec, lineTemp));
+
+ return done;
+ }
+
+ else if ((m = LRC.SimpleLRCFormat.Artist_LineStart_Regex.Match(line)).Success)
+ {
+ artist = line.Substring(m.Index + m.Length);
+ artist = LyricsEngine.LyricUtil.capatalizeString(artist.Substring(0, artist.LastIndexOf("]")));
+ return true;
+ }
+
+ else if ((m = LRC.SimpleLRCFormat.Title_LineStart_Regex.Match(line)).Success)
+ {
+ title = line.Substring(m.Index + m.Length);
+ title = LyricsEngine.LyricUtil.capatalizeString(title.Substring(0, title.LastIndexOf("]")));
+ return true;
+ }
+
+ else if ((m = LRC.SimpleLRCFormat.Album_LineStart_Regex.Match(line)).Success)
+ {
+ album = line.Substring(m.Index + m.Length);
+ album = LyricsEngine.LyricUtil.capatalizeString((album.Substring(0, album.LastIndexOf("]"))));
+ return true;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ #region properties
+ public string Artist
+ {
+ get { return artist; }
+ }
+
+ public string Title
+ {
+ get { return title; }
+ }
+
+ public string Album
+ {
+ get { return album; }
+ }
+
+ public string Lyric
+ {
+ get { return lyric; }
+ }
+
+ public bool IsValid
+ {
+ get { return isValid; }
+ }
+
+ public SimpleLRCTimeAndLineCollection SimpleLRCTimeAndLineCollection
+ {
+ get { return simpleLRCTimeAndLineCollection; }
+ }
+ #endregion
+ }
+}
Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs
===================================================================
--- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs (rev 0)
+++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCFormat.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using System.Text.RegularExpressions;
+
+namespace LRC
+{
+ public static class SimpleLRCFormat
+ {
+ public static Regex Artist_LineStart_Regex;
+ public static Regex Title_LineStart_Regex;
+ public static Regex Album_LineStart_Regex;
+ public static Regex Line_Line_Regex;
+
+ static SimpleLRCFormat()
+ {
+ Artist_LineStart_Regex = new Regex(@"\[ar\w*\:", RegexOptions.IgnoreCase);
+ Title_LineStart_Regex = new Regex(@"\[ti\w*\:", RegexOptions.IgnoreCase);
+ Album_LineStart_Regex = new Regex(@"\[al\w*\:", RegexOptions.IgnoreCase);
+ Line_Line_Regex = new Regex(@"\[\d+:\d+\.*\d*\]");
+ }
+ }
+
+
+}
\ No newline at end of file
Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs
===================================================================
--- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs (rev 0)
+++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLine.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace LRC
+{
+ public class SimpleLRCTimeAndLine : IComparable
+ {
+ long min, sec, msec;
+ string line;
+
+ public SimpleLRCTimeAndLine(long min, long sec, long msec, string line)
+ {
+ this.min = min;
+ this.sec = sec;
+ this.msec = msec;
+ this.line = line;
+ }
+
+ public long Time
+ {
+ get { return min * 60 * 1000 + sec * 1000 + msec; }
+ }
+
+ public string TimeString
+ {
+ get { return min.ToString() + ":" + sec.ToString() + "." + msec.ToString(); }
+ }
+
+ public string Line
+ {
+ get { return line; }
+ }
+
+ public int CompareTo(object obj)
+ {
+ SimpleLRCTimeAndLine objSLRC = (SimpleLRCTimeAndLine)obj;
+ long thisTime = this.min * 60 * 1000 + this.sec * 1000 + this.msec;
+ long objTime = objSLRC.min * 60 * 1000 + objSLRC.sec * 1000 + objSLRC.msec;
+
+ if (thisTime > objTime)
+ return -1;
+ else if (thisTime < objTime)
+ return 1;
+ else
+ return 0;
+ }
+ }
+}
Added: trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs
===================================================================
--- trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs (rev 0)
+++ trunk/plugins/MyLyrics/LyricsEngine/LRC/SimpleLRCTimeAndLineCollection.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,85 @@
+using System;
+using System.Collections;
+using System.Text;
+
+namespace LRC
+{
+ public class SimpleLRCTimeAndLineCollection : IEnumerable
+ {
+
+ private object[] items = null;
+
+ public SimpleLRCTimeAndLineCollection(object[] array)
+ {
+ items = array;
+ Sort(items);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return new Enumerator(items);
+ }
+
+ private class Enumerator : IEnumerator
+ {
+ private int cursor;
+ private object[] elements = null;
+
+ public Enumerator(object[] items)
+ {
+ elements = new object[items.Length];
+ Array.Copy(items, elements, items.Length);
+ cursor = -1;
+ }
+
+ public bool MoveNext()
+ {
+ ++cursor;
+ if (cursor > (elements.Length - 1))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public void Reset()
+ {
+ cursor = -1;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if (cursor > (elements.Length - 1))
+ {
+ throw new InvalidOperationException("Enumration already finished");
+ }
+ if (cursor == -1)
+ {
+ throw new InvalidOperationException("Enumeration not started");
+ }
+ return elements[cursor];
+ }
+ }
+ }
+
+
+ private void Sort(object obj)
+ {
+ IComparer myComparer = new SortAfterTimeClass();
+ Array.Sort(items, myComparer);
+ }
+
+ public class SortAfterTimeClass : IComparer
+ {
+ // Calls CaseInsensitiveComparer.Compare with the parameters reversed.
+ int IComparer.Compare(Object x, Object y)
+ {
+ return ((new CaseInsensitiveComparer()).Compare(y, x));
+ }
+
+ }
+ }
+}
+
Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs
===================================================================
--- trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:07:52 UTC (rev 239)
+++ trunk/plugins/MyLyrics/LyricsEngine/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -78,7 +78,7 @@
{
get
{
- return db[key];
+ return db[key];
}
set
{
Modified: trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj
===================================================================
--- trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 16:07:52 UTC (rev 239)
+++ trunk/plugins/MyLyrics/LyricsEngine/LyricsEngine.csproj 2007-03-27 16:52:34 UTC (rev 240)
@@ -125,7 +125,7 @@
</Target>
-->
<PropertyGroup>
- <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent>
+ <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
Added: trunk/plugins/MyLyrics/My Lyrics/Changelog.txt
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/Changelog.txt (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/Changelog.txt 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,29 @@
+Changes from version 0.14 to 0.15:
+- Fix: A LOT of performance improvemence issues and code-clean up
+- Fix: One lyric site added (HotLyrics), and one removed (SeekLyrics) due to instable server
+- Add: Timer on batch search in configuration mode.
+- Fix: A special formatting on SeekLyrics sites wasn't handled causing fetched of an incomplete lyrics
+- Fix: For some users the tag reader added an additional space causing the search to fail.
+- Fix: Various minor fixes on all the formatting on lyrics fetched from SeekLyrics
+- Fix: Handling of special German and Danish letters
+
+Changes from version 0.13 to 0.14:
+- Add: Added three new lyrics sites. Now there is a total of four lyrics sites to search from.
+- Del: All Google related dependencies have been removed in the plugin.
+- Fix: Even if all lyric search threads had ended the complete search wasn't terminated due to bad validation.
+- Fix: LRC-text saved in music tags wasn't formatted correctly and accordingly shown as regular lyrics.
+- Fix: Fields weren't reset before interpreting a new LRC-fields resulting in wrong timestamps and non-empty status field.
+- Fix: Catches error when accessing displosed treeview due to application shutdown
+- Fix: An improved configuration setup with various smaller bug fixes.
+- Fix: Due to lack of options with the MP scroll-control the default textcontrol is uses once again in the MyLyrics screen.
+
+Changes from version 0.12 to 0.13:
+- Add: Improved log. Logging search information in every session of MyLyric from MP starts to it closes. Saved in log\MyLyrics.log.
+- Fix: All threads are now aborted as intended when search finishes. Both in configuration and play mode.
+- Fix: Proper cleanup of trace objects and log files when configuration is closed.
+- Fix: Lyrics searches optimized in regards to both speed and hit ration.
+- Fix: Some threads ended up in deadlock when changing google license key.
+- Fix: Sometimes when a lyric was found an unsuccessful, and not the succesful lyric site, was written to the MyLyrics.log.
+- Add: MyLyric screen search now only uses lyric sites selected in the configuration.
+- Fix: Exception messages (e.g. when license key is announced invalid for the day) is no longer shown on screen.
+- Fix: Bad library handling caused the configuration in some circumstances to crash on when trying to access the MyLyricsBatch log-file.
Added: trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/Convert/ConvertFromXMLtoLyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Xml;
+
+namespace MyLyrics
+{
+ class ConvertFromXMLtoLyricsDatabase
+ {
+ public ConvertFromXMLtoLyricsDatabase()
+ {
+ }
+
+ public LyricsDatabase Convert(string path)
+ {
+ LyricsDatabase db = new LyricsDatabase();
+ XmlTextReader tr = new XmlTextReader(path);
+
+ string currentArtist = "";
+ string currentTitle = "";
+ while (tr.Read())
+ {
+ switch (tr.Name)
+ {
+ case "section":
+ if (tr.AttributeCount == 1)
+ {
+ currentArtist = tr.GetAttribute(0);
+ }
+ break;
+ case "entry":
+ if (tr.AttributeCount == 1)
+ {
+ currentTitle = tr.GetAttribute(0);
+ LyricsItem item = new LyricsItem(currentArtist, currentTitle, "", "");
+ db.Add(DatabaseUtil.CorrectKeyFormat(currentArtist, currentTitle), item);
+ }
+ break;
+ }
+ }
+ tr.Close();
+
+ LyricsDatabase lyricsDatabase = new LyricsDatabase();
+
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(path, false))
+ {
+ string lyrics;
+ foreach (KeyValuePair<string, LyricsItem> kvp in db)
+ {
+ lyrics = xmlreader.GetValueAsString(kvp.Value.Artist, kvp.Value.Title, "");
+ lyricsDatabase.Add(DatabaseUtil.CorrectKeyFormat(kvp.Value.Artist, kvp.Value.Title), new LyricsItem(kvp.Value.Artist, kvp.Value.Title, lyrics, "old database entry"));
+ }
+ }
+
+ return lyricsDatabase;
+ }
+ }
+}
Added: trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/DatabaseUtil.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,163 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+
+using LyricsEngine;
+
+namespace MyLyrics
+{
+ internal class DatabaseUtil
+ {
+ internal const string MARK = "(no lyric attached)";
+
+ internal const int LYRIC_NOT_FOUND = -1;
+ internal const int LYRIC_MARKED = 0;
+ internal const int LYRIC_FOUND = 1;
+
+ internal static int IsTrackInLyricsDatabase(LyricsDatabase lyricDB, string artist, string title)
+ {
+ string lyricText = "";
+ try
+ {
+ string capatalizedArtist = LyricUtil.capatalizeString(artist);
+ string capatalizedTitle = LyricUtil.capatalizeString(title);
+
+ lyricText = lyricDB[CorrectKeyFormat(capatalizedArtist, capatalizedTitle)].Lyrics;
+ }
+ catch
+ {
+ return LYRIC_NOT_FOUND;
+ }
+
+ if (lyricText.Equals(MARK))
+ {
+ return LYRIC_MARKED;
+ }
+ else
+ {
+ return LYRIC_FOUND;
+ }
+ }
+
+ internal static int IsTrackInLyricsMarkedDatabase(LyricsDatabase lyricMarkedDB, string artist, string title)
+ {
+ string lyricsText = "";
+ try
+ {
+ lyricsText = lyricMarkedDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics;
+ }
+ catch
+ {
+ return LYRIC_NOT_FOUND;
+ }
+ return LYRIC_MARKED;
+ }
+
+
+ public static string LookUpLyricInDatabase(LyricsDatabase lyricDB, string artist, string title)
+ {
+ string lyricText = "";
+ try
+ {
+ lyricText = lyricDB[CorrectKeyFormat(LyricUtil.capatalizeString(artist), LyricUtil.capatalizeString(title))].Lyrics;
+ return lyricText.Replace("\n", "\r\n");
+ }
+ catch
+ {
+ return lyricText;
+ }
+ }
+
+ public static string CorrectKeyFormat(string artist, string title)
+ {
+ return artist + "-" + title;
+ }
+
+ public static void WriteToLyricsDatabase(LyricsDatabase lyricsDB, LyricsDatabase lyricsMarkedDB, string capArtist, string capTitle, string lyric, string site)
+ {
+ if (DatabaseUtil.IsTrackInLyricsDatabase(lyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND))
+ {
+ lyricsDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, lyric, site));
+ }
+
+ if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(lyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED))
+ {
+ lyricsMarkedDB.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle));
+ }
+ }
+
+ public static void ReplaceInLyricsDatabase(LyricsDatabase currentLyricsDB, string capArtist, string capTitle, string lyric, string site)
+ {
+ LyricsDatabase otherDatabase = GetOtherLyricsDatabase(currentLyricsDB);
+
+ string key = DatabaseUtil.CorrectKeyFormat(capArtist, capTitle);
+ if (DatabaseUtil.IsTrackInLyricsDatabase(currentLyricsDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND) == false)
+ {
+ currentLyricsDB.Remove(key);
+ }
+
+ currentLyricsDB.Add(key, new LyricsItem(capArtist, capTitle, lyric, site));
+
+ if (DatabaseUtil.IsTrackInLyricsMarkedDatabase(otherDatabase, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_MARKED))
+ {
+ otherDatabase.Remove(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle));
+ }
+ }
+
+ public static void SerializeDB(LyricsDatabase lyricsDatabase)
+ {
+ if (lyricsDatabase == MyLyricsSettings.LyricsDB)
+ {
+ SerializeLyricDB();
+ }
+ else
+ {
+ SerializeLyricMarkedDB();
+ }
+ }
+
+ public static void SerializeDBs()
+ {
+ SerializeLyricDB();
+ SerializeLyricMarkedDB();
+ }
+
+ public static void SerializeLyricDB()
+ {
+ string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsDBName);
+ using (FileStream fs = new FileStream(path, FileMode.Open))
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ MyLyricsSettings.LyricsDB.SetLastModified();
+ bf.Serialize(fs, MyLyricsSettings.LyricsDB);
+ fs.Close();
+ }
+ }
+
+ public static void SerializeLyricMarkedDB()
+ {
+ string path = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Database, MyLyricsSettings.LyricsMarkedDBName);
+ using (FileStream fs = new FileStream(path, FileMode.Open))
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ MyLyricsSettings.LyricsMarkedDB.SetLastModified();
+ bf.Serialize(fs, MyLyricsSettings.LyricsMarkedDB);
+ fs.Close();
+ }
+ }
+
+ public static LyricsDatabase GetOtherLyricsDatabase(LyricsDatabase currentDatabase)
+ {
+ if (currentDatabase.Equals(MyLyricsSettings.LyricsDB))
+ {
+ return MyLyricsSettings.LyricsMarkedDB;
+ }
+ else
+ {
+ return MyLyricsSettings.LyricsDB;
+ }
+ }
+ }
+}
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.Serialization;
+
+namespace MyLyrics
+{
+ [Serializable]
+ public class LyricsDatabase : IDictionary<string, LyricsItem>, ISerializable
+ {
+ private DateTime created;
+ private DateTime lastModified;
+ private Dictionary<string, LyricsItem> db;
+
+ public LyricsDatabase()
+ {
+ created = DateTime.Now;
+ lastModified = DateTime.Now;
+ db = new Dictionary<string, LyricsItem>();
+ }
+
+ #region Serialization methods
+
+ [OnDeserializing]
+ protected void test(StreamingContext sc)
+ {
+ Console.WriteLine(sc.Context + " - " + sc.State);
+ }
+
+ protected LyricsDatabase(SerializationInfo info, StreamingContext context)
+ {
+ try
+ {
+ Dictionary<string, LyricsItem> dbTemp = new Dictionary<string, LyricsItem>();
+ db = (Dictionary<string, LyricsItem>)info.GetValue("db", dbTemp.GetType());
+ }
+ catch (System.Runtime.Serialization.SerializationException serExc)
+ {
+ }
+
+ }
+
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ Dictionary<string, LyricsItem> dbTemp = new Dictionary<string, LyricsItem>();
+ info.AddValue("db", db, dbTemp.GetType());
+ }
+ #endregion
+
+ #region IDictionary<string,LyricsItem> Members
+
+ public void Add(string key, LyricsItem value)
+ {
+ db.Add(key, value);
+ }
+
+ public bool ContainsKey(string key)
+ {
+ return db.ContainsKey(key);
+ }
+
+ public ICollection<string> Keys
+ {
+ get { return db.Keys; }
+ }
+
+ public bool Remove(string key)
+ {
+ return db.Remove(key);
+ }
+
+ public bool TryGetValue(string key, out LyricsItem value)
+ {
+ return db.TryGetValue(key, out value);
+ }
+
+ public ICollection<LyricsItem> Values
+ {
+ get { return db.Values; }
+ }
+
+ public LyricsItem this[string key]
+ {
+ get
+ {
+ return db[key];
+ }
+ set
+ {
+ db[key] = value;
+ }
+ }
+
+ #endregion
+
+ #region ICollection<KeyValuePair<string,LyricsItem>> Members
+
+ public void Add(KeyValuePair<string, LyricsItem> item)
+ {
+ db.Add(item.Key, item.Value);
+ }
+
+ public void Clear()
+ {
+ db.Clear();
+ }
+
+ public bool Contains(KeyValuePair<string, LyricsItem> item)
+ {
+ return db.ContainsKey(item.Key);
+ }
+
+ public void CopyTo(KeyValuePair<string, LyricsItem>[] array, int arrayIndex)
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+
+ public int Count
+ {
+ get { return db.Count; }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return false; }
+ }
+
+ public bool Remove(KeyValuePair<string, LyricsItem> item)
+ {
+ return db.Remove(item.Key);
+ }
+
+ #endregion
+
+ #region IEnumerable<KeyValuePair<string,LyricsItem>> Members
+
+ public IEnumerator<KeyValuePair<string, LyricsItem>> GetEnumerator()
+ {
+ foreach (KeyValuePair<string, LyricsItem> kvp in db)
+ {
+ yield return kvp;
+ }
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ foreach (KeyValuePair<string, LyricsItem> kvp in db)
+ {
+ yield return kvp;
+ }
+ }
+
+ #endregion
+ }
+}
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsDatabase.csproj 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,51 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{F5789699-28EB-4E09-BD52-3BE057D38005}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LyricsDatabase</RootNamespace>
+ <AssemblyName>LyricsDatabase</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="LyricsDatabase.cs" />
+ <Compile Include="LyricsItem.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal"</PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/LyricsItem.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.Serialization;
+
+namespace MyLyrics
+{
+ [Serializable]
+ public class LyricsItem
+ {
+ private string artist;
+ private string title;
+ private string lyrics;
+ private string source;
+
+ public LyricsItem(string artist, string title, string lyrics, string source)
+ {
+ this.artist = artist;
+ this.title = title;
+ this.lyrics = lyrics;
+ this.source = source;
+ }
+
+ #region Properties
+ public string Artist
+ {
+ get { return artist; }
+ set { artist = value; }
+ }
+
+ public string Title
+ {
+ get { return title; }
+ set { title = value; }
+ }
+
+ public string Lyrics
+ {
+ get { return lyrics; }
+ set { lyrics = value; }
+ }
+
+ public string Source
+ {
+ get { return source; }
+ set { source = value; }
+ }
+ #endregion
+ }
+}
\ No newline at end of file
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/Properties/AssemblyInfo.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("LyricsDatabase")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("LyricsDatabase")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("228d90d2-d845-468a-a6c1-89499e6f0c55")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/bin/Debug/LyricsDatabase.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/Debug/LyricsDatabase.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/LyricsDatabase/obj/LyricsDatabase.csproj.FileList.txt 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,5 @@
+obj\Debug\ResolveAssemblyReference.cache
+bin\Debug\LyricsDatabase.dll
+bin\Debug\LyricsDatabase.pdb
+obj\Debug\LyricsDatabase.dll
+obj\Debug\LyricsDatabase.pdb
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-27 16:07:52 UTC (rev 239)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -101,7 +101,12 @@
public override bool Init()
{
- return Load(GUIGraphicsContext.Skin + @"\myLyrics.xml");
+ string lyricsXML = "";
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"))
+ {
+ lyricsXML = (string)xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml");
+ }
+ return Load(GUIGraphicsContext.Skin + @"\" + lyricsXML);
}
public override void OnAction(Action action)
@@ -705,7 +710,7 @@
public void ShowPlugin()
{
MyLyricsSetup dlg = new MyLyricsSetup();
- dlg.Show();
+ dlg.ShowDialog();
}
#endregion
Added: trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyrics.csproj 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,136 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{BBB2DAE2-0D83-4B4B-85B6-D1B5A7E10039}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>MyLyrics</RootNamespace>
+ <AssemblyName>MyLyrics</AssemblyName>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoWarn>
+ </NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Core, Version=1.0.2546.32606, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Core.DLL</HintPath>
+ </Reference>
+ <Reference Include="Databases, Version=1.0.2546.32610, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Databases.DLL</HintPath>
+ </Reference>
+ <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Plugins\Windows\Dialogs.DLL</HintPath>
+ </Reference>
+ <Reference Include="LyricsEngine, Version=0.13.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\LyricsEngine\bin\Debug\LyricsEngine.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Utils, Version=1.0.2546.32604, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\..\..\Program Files\Team Mediaportal\MediaPortal\Utils.DLL</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Convert\ConvertFromXMLtoLyricsDatabase.cs" />
+ <Compile Include="MyLyricsSettings.cs" />
+ <Compile Include="MyLyricsSetup_test.cs" />
+ <Compile Include="DatabaseUtil.cs" />
+ <Compile Include="MyLyrics.cs" />
+ <Compile Include="MyLyricsSetup.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MyLyricsSetup.Designer.cs">
+ <DependentUpon>MyLyricsSetup.cs</DependentUpon>
+ </Compile>
+ <Compile Include="MyLyricsSetup_AddNewSong.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MyLyricsSetup_AddNewSong.Designer.cs">
+ <DependentUpon>MyLyricsSetup_AddNewSong.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="MyLyricsSetup_LyricsLibrary.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="MyLyricsSetup_LyricsLibrary.Designer.cs">
+ <DependentUpon>MyLyricsSetup_LyricsLibrary.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="MyLyricsSetup_SearchTitleDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MyLyricsSetup_SearchTitleDialog.Designer.cs">
+ <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="MyLyricsSetup_LyricsLibrary.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MyLyricsSetup_LyricsLibrary.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="MyLyricsSetup.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MyLyricsSetup.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="MyLyricsSetup_AddNewSong.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MyLyricsSetup_AddNewSong.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <SubType>Designer</SubType>
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <EmbeddedResource Include="MyLyricsSetup_SearchTitleDialog.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MyLyricsSetup_SearchTitleDialog.cs</DependentUpon>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Changelog.txt" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>::copy $(TargetFileName) "C:\Program Files\Team MediaPortal\MediaPortal\plugins\windows"</PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSettings.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace MyLyrics
+{
+ class MyLyricsSettings
+ {
+ // Database settings
+ internal static LyricsDatabase LyricsDB = null;
+ internal static LyricsDatabase LyricsMarkedDB = null;
+ internal static string LyricsDBName = "LyricsDatabaseV2.db";
+ internal static string LyricsMarkedDBName = "LyricsMarkedDatabaseV2.db";
+ internal static string LyricsXMLName = "Lyrics.xml";
+
+ // log information
+ internal static string LogName = "MyLyrics.log";
+ internal static string LogBatchFileName = "MyLyricsBatch.log";
+ }
+}
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-27 16:07:52 UTC (rev 239)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.Designer.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -94,6 +94,8 @@
this.btSave = new MediaPortal.UserInterface.Controls.MPButton();
this.btClose = new MediaPortal.UserInterface.Controls.MPButton();
this.bgWorkerSearch = new System.ComponentModel.BackgroundWorker();
+ this.lbLyricsPage = new MediaPortal.UserInterface.Controls.MPLabel();
+ this.comboLyricsPage = new MediaPortal.UserInterface.Controls.MPComboBox();
this.tabControl.SuspendLayout();
this.tabPageSetup.SuspendLayout();
this.mpGroupBox2.SuspendLayout();
@@ -146,12 +148,14 @@
// mpGroupBox2
//
this.mpGroupBox2.AutoSize = true;
+ this.mpGroupBox2.Controls.Add(this.comboLyricsPage);
+ this.mpGroupBox2.Controls.Add(this.lbLyricsPage);
this.mpGroupBox2.Controls.Add(this.tbPluginName);
this.mpGroupBox2.Controls.Add(this.lbPluginName);
this.mpGroupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.mpGroupBox2.Location = new System.Drawing.Point(5, 5);
this.mpGroupBox2.Name = "mpGroupBox2";
- this.mpGroupBox2.Size = new System.Drawing.Size(538, 63);
+ this.mpGroupBox2.Size = new System.Drawing.Size(538, 98);
this.mpGroupBox2.TabIndex = 29;
this.mpGroupBox2.TabStop = false;
this.mpGroupBox2.Text = "Basic settings";
@@ -159,10 +163,10 @@
// tbPluginName
//
this.tbPluginName.BorderColor = System.Drawing.Color.Empty;
- this.tbPluginName.Location = new System.Drawing.Point(87, 24);
+ this.tbPluginName.Location = new System.Drawing.Point(96, 24);
this.tbPluginName.MaxLength = 30;
this.tbPluginName.Name = "tbPluginName";
- this.tbPluginName.Size = new System.Drawing.Size(154, 20);
+ this.tbPluginName.Size = new System.Drawing.Size(144, 20);
this.tbPluginName.TabIndex = 13;
this.tbPluginName.Text = "My Lyrics";
//
@@ -183,7 +187,7 @@
this.gbLyricSites.Controls.Add(this.rbUserDefined);
this.gbLyricSites.Controls.Add(this.tbNote);
this.gbLyricSites.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.gbLyricSites.Location = new System.Drawing.Point(5, 74);
+ this.gbLyricSites.Location = new System.Drawing.Point(5, 109);
this.gbLyricSites.Name = "gbLyricSites";
this.gbLyricSites.Size = new System.Drawing.Size(538, 202);
this.gbLyricSites.TabIndex = 28;
@@ -817,18 +821,43 @@
this.bgWorkerSearch.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgWorkerSearch_RunWorkerCompleted);
this.bgWorkerSearch.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgWorkerSearch_ProgressChanged);
//
+ // lbLyricsPage
+ //
+ this.lbLyricsPage.AutoSize = true;
+ this.lbLyricsPage.Location = new System.Drawing.Point(13, 61);
+ this.lbLyricsPage.Name = "lbLyricsPage";
+ this.lbLyricsPage.Size = new System.Drawing.Size(64, 13);
+ this.lbLyricsPage.TabIndex = 15;
+ this.lbLyricsPage.Text = "Lyrics page:";
+ //
+ // comboLyricsPage
+ //
+ this.comboLyricsPage.BorderColor = System.Drawing.Color.Empty;
+ this.comboLyricsPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboLyricsPage.FormattingEnabled = true;
+ this.comboLyricsPage.Items.AddRange(new object[] {
+ "Basic lyrics page",
+ "Wide lyrics page",
+ "LRC creation page"});
+ this.comboLyricsPage.Location = new System.Drawing.Point(96, 58);
+ this.comboLyricsPage.Name = "comboLyricsPage";
+ this.comboLyricsPage.Size = new System.Drawing.Size(144, 21);
+ this.comboLyricsPage.TabIndex = 16;
+ //
// MyLyricsSetup
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(569, 537);
+ this.ClientSize = new System.Drawing.Size(566, 536);
this.ControlBox = false;
this.Controls.Add(this.btClose);
this.Controls.Add(this.tabControl);
this.Controls.Add(this.btSave);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
+ this.MaximumSize = new System.Drawing.Size(576, 572);
this.MinimizeBox = false;
+ this.MinimumSize = new System.Drawing.Size(576, 572);
this.Name = "MyLyricsSetup";
this.ShowIcon = false;
this.Text = "My Lyrics Configuration";
@@ -925,5 +954,7 @@
private MediaPortal.UserInterface.Controls.MPCheckBox cbDisregardSongsWithNoLyric;
private MediaPortal.UserInterface.Controls.MPCheckBox cbMarkSongsWithNoLyrics;
private MediaPortal.UserInterface.Controls.MPCheckBox cbDisconsiderTitlesWithLyrics;
+ private MediaPortal.UserInterface.Controls.MPLabel lbLyricsPage;
+ private MediaPortal.UserInterface.Controls.MPComboBox comboLyricsPage;
}
}
\ No newline at end of file
Modified: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-27 16:07:52 UTC (rev 239)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -120,7 +120,6 @@
m_DelegateThreadFinished = new DelegateThreadFinished(this.ThreadFinishedMethod);
m_DelegateThreadException = new DelegateThreadException(this.ThreadExceptionMethod);
-
// Grab music database
MusicDatabase dbs = new MusicDatabase();
m_TotalTitles = dbs.GetNumOfSongs();
@@ -133,6 +132,22 @@
{
tbLimit.Text = xmlreader.GetValueAsString("myLyrics", "limit", m_TotalTitles.ToString());
tbPluginName.Text = xmlreader.GetValueAsString("myLyrics", "pluginsName", "My Lyrics");
+
+ string xmlPage = xmlreader.GetValueAsString("myLyrics", "myLyricsXml", "myLyrics.xml");
+ if (xmlPage.Equals("myLyrics.xml"))
+ {
+ comboLyricsPage.SelectedIndex = 0;
+ }
+ else if (xmlPage.Equals("myLyricsWide.xml"))
+ {
+ comboLyricsPage.SelectedIndex = 1;
+ }
+ else if (xmlPage.Equals("myLyricsEditor.xml"))
+ {
+ comboLyricsPage.SelectedIndex = 2;
+ }
+
+
lbSongsLimitNote.Text = ("(You have currently " + m_TotalTitles.ToString() + " titles in your music database)");
rdDefault.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useDefaultSitesMode", "True")).ToString().Equals("True") ? true : false;
@@ -316,6 +331,22 @@
xmlwriter.SetValue("myLyrics", "useLyricsOnDemand", cbLyricsOnDemand.Checked.ToString());
xmlwriter.SetValue("myLyrics", "useSeekLyrics", cbSeekLyrics.Checked.ToString());
xmlwriter.SetValue("myLyrics", "useHotLyrics", cbHotLyrics.Checked.ToString());
+
+ string xmlPage = "";
+ if (comboLyricsPage.SelectedIndex == 0)
+ {
+ xmlPage = "myLyrics.xml";
+ }
+ else if (comboLyricsPage.SelectedIndex == 1)
+ {
+ xmlPage = "myLyricsWide.xml";
+ }
+ else if (comboLyricsPage.SelectedIndex == 2)
+ {
+ xmlPage = "myLyricsEditor.xml";
+ }
+
+ xmlwriter.SetValue("myLyrics", "myLyricsXml", xmlPage);
}
}
Added: trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs
===================================================================
--- trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs (rev 0)
+++ trunk/plugins/MyLyrics/My Lyrics/MyLyricsSetup_SearchTitleDialog.Designer.cs 2007-03-27 16:52:34 UTC (rev 240)
@@ -0,0 +1,344 @@
+namespace MyLyrics
+{
+ partial class MyLyricsSetup_SearchTitleDialog
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.gbSearchInfo = new System.Windows.Forms.GroupBox();
+ this.tbTitle = new System.Windows.Forms.TextBox();
+ this.lbTitle = new System.Windows.Forms.Label();
+ this.tbArtist = new System.Windows.Forms.TextBox();
+ this.lbArtist = new System.Windows.Forms.Label();
+ this.btFind = new System.Windows.Forms.Button();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.lvSearchResults = new System.Windows.Forms.ListView();
+ this.cbSite = new System.Windows.Forms.ColumnHeader();
+ this.cbResu...
[truncated message content] |
|
From: <ove...@us...> - 2007-03-27 16:07:53
|
Revision: 239
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=239&view=rev
Author: overture
Date: 2007-03-27 09:07:52 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IPTVPlugin/SnapperInterface.cs
Modified: trunk/plugins/IPTVPlugin/SnapperInterface.cs
===================================================================
--- trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-27 15:57:10 UTC (rev 238)
+++ trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-27 16:07:52 UTC (rev 239)
@@ -10,12 +10,43 @@
public interface IMiniIPTVPlugin
{
/// <summary>
- /// Should return a multi-dimensional array return in this order (string channelname, string channelDescription, string genre, string language, string country, string streamURL)
+ /// Should return CHANNEL INFO in a multi-dim array - returned in this order:-
+ /// [x,1] Channel Name
+ /// [x,2] Channel Description
+ /// [x,3] Genre
+ /// [x,4] Language
+ /// [x,5] Country
+ /// [x,6] Channel Stream URL
+ /// [x,7] Channel EPG
+ /// NOTE: where 'x' above = the ROW index of the multi-dim array.
+ /// NOTE: you must return Null when any of the above info is not available.
/// </summary>
- /// <returns>A multi-dimensional array</returns>
+ /// <returns>A multi-dimensional string array</returns>
string[,] IPTVChannel();
+ /// <summary>
+ /// Should return the name of the IPTV mini plugin AUTHOR.
+ /// </summary>
+ /// <returns>string with authors name</returns>
string Author();
+ /// <summary>
+ /// Should return a DESCRIPTION for the IPTV mini plugin.
+ /// </summary>
+ /// <returns>string with authors name</returns>
+ string Description();
+ /// <summary>
+ /// Should return the current VERSION of the plugin.
+ /// </summary>
+ /// <returns>string with version number</returns>
+ string Version();
+ /// <summary>
+ /// Should return the current PLUGIN NAME.
+ /// </summary>
+ /// <returns>string with version number</returns>
string PluginName();
+ /// <summary>
+ /// Should return the setup form for the minin IPTV plugin.
+ /// </summary>
+ /// <returns>Form</returns>
Form IPTVPluginSetup();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ove...@us...> - 2007-03-27 15:57:15
|
Revision: 238
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=238&view=rev
Author: overture
Date: 2007-03-27 08:57:10 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IPTVPlugin/AddNewPlugin.cs
trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
trunk/plugins/IPTVPlugin/IPTVSetup.cs
trunk/plugins/IPTVPlugin/IPTVsetup.resx
trunk/plugins/IPTVPlugin/SetupManager.cs
trunk/plugins/IPTVPlugin/SnapperInterface.cs
Added Paths:
-----------
trunk/plugins/IPTVPlugin/AddNewPlugins.resx
trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs
trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs
trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs
trunk/plugins/IPTVPlugin/GUIWindowEnum.cs
Modified: trunk/plugins/IPTVPlugin/AddNewPlugin.cs
===================================================================
--- trunk/plugins/IPTVPlugin/AddNewPlugin.cs 2007-03-27 11:13:31 UTC (rev 237)
+++ trunk/plugins/IPTVPlugin/AddNewPlugin.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -10,16 +10,12 @@
/// <summary>
/// Summary description for PluginsAddNew.
/// </summary>
- public class PluginsAddNew : System.Windows.Forms.Form
+ public class AddNewPlugins : System.Windows.Forms.Form
{
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private CheckedListBox chklstBox;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.GroupBox grpDetails;
- private System.Windows.Forms.TextBox txtDesc;
- private System.Windows.Forms.Label lblDescription;
- private System.Windows.Forms.CheckBox chkBstate;
private System.Windows.Forms.GroupBox grpDLLFile;
private System.Windows.Forms.TextBox txtFilePath;
private System.Windows.Forms.Button btnBrowse;
@@ -27,12 +23,12 @@
#region Constructors
- public PluginsAddNew()
+ public AddNewPlugins()
{
InitializeComponent();
}
- public PluginsAddNew(CheckedListBox chkLstBox)
+ public AddNewPlugins(CheckedListBox chkLstBox)
{
InitializeComponent();
this.chklstBox = chkLstBox;
@@ -68,14 +64,9 @@
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
- this.grpDetails = new System.Windows.Forms.GroupBox();
- this.txtDesc = new System.Windows.Forms.TextBox();
- this.lblDescription = new System.Windows.Forms.Label();
- this.chkBstate = new System.Windows.Forms.CheckBox();
this.grpDLLFile = new System.Windows.Forms.GroupBox();
this.txtFilePath = new System.Windows.Forms.TextBox();
this.btnBrowse = new System.Windows.Forms.Button();
- this.grpDetails.SuspendLayout();
this.grpDLLFile.SuspendLayout();
this.SuspendLayout();
//
@@ -83,74 +74,31 @@
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.btnOK.Location = new System.Drawing.Point(336, 216);
+ this.btnOK.Location = new System.Drawing.Point(333, 88);
this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 3;
this.btnOK.Text = "OK";
+ this.btnOK.UseCompatibleTextRendering = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.btnCancel.Location = new System.Drawing.Point(248, 216);
+ this.btnCancel.Location = new System.Drawing.Point(252, 88);
this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseCompatibleTextRendering = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
- // grpDetails
- //
- this.grpDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.grpDetails.Controls.Add(this.txtDesc);
- this.grpDetails.Controls.Add(this.lblDescription);
- this.grpDetails.Controls.Add(this.chkBstate);
- this.grpDetails.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.grpDetails.Location = new System.Drawing.Point(8, 80);
- this.grpDetails.Name = "grpDetails";
- this.grpDetails.Size = new System.Drawing.Size(400, 128);
- this.grpDetails.TabIndex = 1;
- this.grpDetails.TabStop = false;
- this.grpDetails.Text = "Details";
-
- //
- // txtDesc
- //
- this.txtDesc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.txtDesc.Location = new System.Drawing.Point(104, 68);
- this.txtDesc.Name = "txtDesc";
- this.txtDesc.Size = new System.Drawing.Size(280, 20);
- this.txtDesc.TabIndex = 2;
- this.txtDesc.Text = "";
- //
- // lblDescription
- //
- this.lblDescription.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.lblDescription.Location = new System.Drawing.Point(16, 64);
- this.lblDescription.Name = "lblDescription";
- this.lblDescription.Size = new System.Drawing.Size(64, 23);
- this.lblDescription.TabIndex = 1;
- this.lblDescription.Text = "Description";
- this.lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-
- //
- // chkBstate
- //
- this.chkBstate.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.chkBstate.Location = new System.Drawing.Point(16, 24);
- this.chkBstate.Name = "chkBstate";
- this.chkBstate.TabIndex = 0;
- this.chkBstate.Text = "State (On/Off)";
-
- //
// grpDLLFile
//
this.grpDLLFile.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.grpDLLFile.Controls.Add(this.txtFilePath);
this.grpDLLFile.Controls.Add(this.btnBrowse);
this.grpDLLFile.FlatStyle = System.Windows.Forms.FlatStyle.System;
@@ -160,42 +108,41 @@
this.grpDLLFile.TabIndex = 0;
this.grpDLLFile.TabStop = false;
this.grpDLLFile.Text = "File";
-
+ this.grpDLLFile.UseCompatibleTextRendering = true;
//
// txtFilePath
//
this.txtFilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ | System.Windows.Forms.AnchorStyles.Right)));
this.txtFilePath.Location = new System.Drawing.Point(104, 24);
this.txtFilePath.Name = "txtFilePath";
this.txtFilePath.Size = new System.Drawing.Size(280, 20);
this.txtFilePath.TabIndex = 1;
- this.txtFilePath.Text = "";
//
// btnBrowse
//
this.btnBrowse.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnBrowse.Location = new System.Drawing.Point(16, 24);
this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.Size = new System.Drawing.Size(75, 23);
this.btnBrowse.TabIndex = 0;
this.btnBrowse.Text = "Browse";
+ this.btnBrowse.UseCompatibleTextRendering = true;
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
- // PluginsAddNew
+ // AddNewPlugins
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(416, 242);
+ this.ClientSize = new System.Drawing.Size(416, 113);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.btnCancel);
- this.Controls.Add(this.grpDetails);
this.Controls.Add(this.grpDLLFile);
- this.Name = "PluginsAddNew";
+ this.Name = "AddNewPlugins";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "PluginsAddNew";
- this.grpDetails.ResumeLayout(false);
this.grpDLLFile.ResumeLayout(false);
+ this.grpDLLFile.PerformLayout();
this.ResumeLayout(false);
-
}
#endregion
@@ -215,11 +162,11 @@
SetupManager setupManager = new SetupManager();
setupManager.LoadXMLDoc();
- bool ans = setupManager.TestNewItem(this.txtFilePath.Text,this.txtDesc.Text,this.chkBstate.Checked);
+ bool ans = setupManager.TestNewItem(this.txtFilePath.Text);
if(ans)
{
- setupManager.InsertNewItem(this.txtFilePath.Text,this.txtDesc.Text,this.chkBstate.Checked);
- this.chklstBox.Items.Add(this.txtDesc.Text,this.chkBstate.Checked);
+ string sPluginName = setupManager.InsertNewItem(this.txtFilePath.Text);
+ this.chklstBox.Items.Add(sPluginName,true);
}
this.Close();
}
Added: trunk/plugins/IPTVPlugin/AddNewPlugins.resx
===================================================================
--- trunk/plugins/IPTVPlugin/AddNewPlugins.resx (rev 0)
+++ trunk/plugins/IPTVPlugin/AddNewPlugins.resx 2007-03-27 15:57:10 UTC (rev 238)
@@ -0,0 +1,123 @@
+<?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>
+ <metadata name="openFileDialog1.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
Added: trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs
===================================================================
--- trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/GUIHomeIPTV.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -0,0 +1,57 @@
+using System;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using myIPTV;
+using System.Windows.Forms;
+
+namespace IPTVPlugin
+{
+ /// <summary>
+ /// Main IPTV GUI
+ /// </summary>
+ public class GUIHomeIPTV : GUIWindow
+ {
+
+ [SkinControlAttribute(2)] protected GUIButtonControl btnViewAs = null;
+ [SkinControlAttribute(99)] protected GUIVideoControl videoWindow=null;
+ [SkinControlAttribute(8)] protected GUIToggleButtonControl btnTvOnOff=null;
+
+ public GUIHomeIPTV()
+ {
+ GetID=(int)GUIWindowIPTV.Home;
+ }
+
+ public override int GetID
+ {
+ get { return (int)GUIWindowIPTV.Home; }
+ set { base.GetID = value; }
+ }
+
+ public override bool Init()
+ {
+ return Load(GUIGraphicsContext.Skin+@"\MyIPTVhome.xml");
+ }
+
+ protected override void OnPageLoad()
+ {
+ this.btnViewAs.Label = "Channel Guide";
+ this.btnTvOnOff.Label = "IPTV On/Off";
+ base.OnPageLoad();
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control,Action.ActionType actionType)
+ {
+ if(control==btnViewAs)
+ {
+ GUIWindowManager.ActivateWindow((int)GUIWindowIPTV.CategoryList);
+ return;
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ public override void OnAction(Action action)
+ {
+ base.OnAction(action);
+ }
+ }
+}
Added: trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs
===================================================================
--- trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/GUIListCategoriesIPTV.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -0,0 +1,102 @@
+using System;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using myIPTV;
+using System.Windows.Forms;
+
+namespace IPTVPlugin
+{
+ /// <summary>
+ /// Description of GUIListCategoriesIPTV.
+ /// </summary>
+ public class GUIListCategoriesIPTV : GUIWindow
+ {
+ [SkinControlAttribute(10)] protected GUIListControl listControl = null;
+ [SkinControlAttribute(2)] protected GUIButtonControl btnViewAs = null;
+ private SetupManager setupManager;
+ private string[,] sChannelArray;
+ private string sViewType;
+
+ public GUIListCategoriesIPTV()
+ {
+ GetID=(int)GUIWindowIPTV.CategoryList;
+ setupManager = new SetupManager();
+ this.setupManager.LoadXMLDoc();
+ }
+
+ public override int GetID
+ {
+ get { return (int)GUIWindowIPTV.CategoryList; }
+ set { base.GetID = value; }
+ }
+
+ public override bool Init()
+ {
+ bool ans = Load(GUIGraphicsContext.Skin+@"\MyIPTVCategoryList.xml");
+ return ans;
+ }
+
+ internal string ViewType
+ {
+ get
+ {
+ return this.sViewType;
+ }
+ set
+ {
+ this.sViewType = value;
+ }
+ }
+
+ protected override void OnPageLoad()
+ {
+ this.btnViewAs.Label = "View : Genre"; // Default
+ sChannelArray = this.setupManager.GetChannelArray();
+ this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Genre);
+ this.listControl.Focus = true;
+ base.OnPageLoad();
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control,Action.ActionType actionType)
+ {
+ if(control==listControl)
+ {
+// GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED,(int)GUIWindowIPTV.CategoryList,0,10,0,0,null);
+// msg.Label = listControl.SelectedListItem.Label;
+// msg.SenderControlId = 10;
+ GUIWindowManager.ActivateWindow((int)GUIWindowIPTV.ChannelList);
+// OnMessage(msg);
+
+ return;
+// MessageBox.Show(listControl.SelectedListItem.Label);
+// string sSelectedText = listControl.SelectedListItem.Label;
+// return;
+ }
+ else if(control==btnViewAs)
+ {
+ switch(btnViewAs.Label)
+ {
+ case "View : Genre":
+ this.sViewType = "Language";
+ this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Language);
+ break;
+ case "View : Language":
+ this.sViewType = "Country";
+ this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Country);
+ break;
+ case "View : Country":
+ this.sViewType = "Genre";
+ this.setupManager.DisplayInitialScreen(listControl,sChannelArray,ChannelInfo.Genre);
+ break;
+ }
+ btnViewAs.Label = "View : " + this.sViewType;
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ public override void OnAction(Action action)
+ {
+ base.OnAction(action);
+ }
+ }
+}
Added: trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs
===================================================================
--- trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/GUIListChannelsIPTV.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -0,0 +1,62 @@
+using System;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using myIPTV;
+using System.Windows.Forms;
+
+
+namespace IPTVPlugin
+{
+ /// <summary>
+ /// Description of IPTVListChannelsGUI.
+ /// </summary>
+ public class GUIListChannelsIPTV : GUIWindow
+ {
+ [SkinControlAttribute(11)] protected GUIListControl listControl = null;
+
+ public GUIListChannelsIPTV()
+ {
+ GetID=(int)GUIWindowIPTV.ChannelList;
+ }
+
+ public override int GetID
+ {
+ get
+ {
+ return (int)GUIWindowIPTV.ChannelList;
+ }
+ set { base.GetID = value; }
+ }
+
+ public override bool Init()
+ {
+ bool ans = Load(GUIGraphicsContext.Skin+@"\MyIPTVChannelList.xml");
+ return ans;
+ }
+
+ protected override void OnPageLoad()
+ {
+ MessageBox.Show(GUIGraphicsContext.Skin+@"\MyIPTVChannelList.xml");
+ GUIListItem item = new GUIListItem();
+ item.Label = "Blada Blada";
+ listControl.Add(item);
+ listControl.Focus = true;
+ base.OnPageLoad();
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control,Action.ActionType actionType)
+ {
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ public override bool OnMessage(GUIMessage msg)
+ {
+ if(msg.SenderControlId==10)
+ {
+ MessageBox.Show(msg.Label);
+ base.OnMessage(msg);
+ }
+ return false;
+ }
+ }
+}
Added: trunk/plugins/IPTVPlugin/GUIWindowEnum.cs
===================================================================
--- trunk/plugins/IPTVPlugin/GUIWindowEnum.cs (rev 0)
+++ trunk/plugins/IPTVPlugin/GUIWindowEnum.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -0,0 +1,11 @@
+using System;
+
+namespace IPTVPlugin
+{
+ public enum GUIWindowIPTV
+ {
+ Home = 6598, // CODE: GUIHomeIPTV.cs - SKIN: MyIPTVhome.xml
+ ChannelList = 6599, // CODE: GUIListChannelsIPTV.cs - SKIN: MyIPTVChannelList.xml
+ CategoryList = 6600, // CODE: GUIListCategoriesIPTV.cs - SKIN: MyIPTVCategoryList.xml
+ }
+}
Modified: trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-27 11:13:31 UTC (rev 237)
+++ trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-27 15:57:10 UTC (rev 238)
@@ -29,6 +29,14 @@
<Reference Include="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<Reference Include="System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <Reference Include="Dialogs">
+ <HintPath>..\..\..\..\..\MediaPortal\mediaportal\Dialogs\bin\Release\Dialogs.dll</HintPath>
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="Core">
+ <HintPath>..\..\..\..\..\MediaPortal\mediaportal\Core\bin\Debug\Core.dll</HintPath>
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="SnapperInterface.cs" />
@@ -40,6 +48,13 @@
</EmbeddedResource>
<Compile Include="SetupManager.cs" />
<Compile Include="AddNewPlugin.cs" />
+ <Compile Include="GUIHomeIPTV.cs" />
+ <Compile Include="GUIListChannelsIPTV.cs" />
+ <Compile Include="GUIWindowEnum.cs" />
+ <EmbeddedResource Include="AddNewPlugins.resx">
+ <DependentUpon>AddNewPlugin.cs</DependentUpon>
+ </EmbeddedResource>
+ <Compile Include="GUIListCategoriesIPTV.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
\ No newline at end of file
Modified: trunk/plugins/IPTVPlugin/IPTVSetup.cs
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVSetup.cs 2007-03-27 11:13:31 UTC (rev 237)
+++ trunk/plugins/IPTVPlugin/IPTVSetup.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -11,10 +11,14 @@
/// </summary>
public class IPTVsetup : System.Windows.Forms.Form, ISetupForm
{
- private System.ComponentModel.Container components = null;
+ private System.ComponentModel.IContainer components;
+ private string sPath;
public IPTVsetup()
{
+ string sFilePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
+ sPath = sFilePath.Substring(0,sFilePath.LastIndexOf(@"\"));
+
InitializeComponent();
}
@@ -41,6 +45,7 @@
/// </summary>
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.grpBoxConnectInfo = new System.Windows.Forms.GroupBox();
this.chkBoxUseDefaultProxy = new System.Windows.Forms.CheckBox();
this.txtProxyPort = new System.Windows.Forms.TextBox();
@@ -55,17 +60,20 @@
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.lblAuthor = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
this.btnAddNewPlug = new System.Windows.Forms.Button();
this.btnRemove = new System.Windows.Forms.Button();
this.checkedListBox1 = new System.Windows.Forms.CheckedListBox();
- this.label1 = new System.Windows.Forms.Label();
- this.lblAuthor = new System.Windows.Forms.Label();
+ this.tabPage1 = new System.Windows.Forms.TabPage();
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.configurationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.grpBoxConnectInfo.SuspendLayout();
this.tabControl1.SuspendLayout();
+ this.tabPage2.SuspendLayout();
this.tabPage1.SuspendLayout();
- this.tabPage2.SuspendLayout();
+ this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// grpBoxConnectInfo
@@ -213,17 +221,6 @@
this.tabControl1.Size = new System.Drawing.Size(660, 357);
this.tabControl1.TabIndex = 4;
//
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.grpBoxConnectInfo);
- this.tabPage1.Location = new System.Drawing.Point(4, 23);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(652, 330);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "Proxy Settings";
- this.tabPage1.UseVisualStyleBackColor = true;
- //
// tabPage2
//
this.tabPage2.Controls.Add(this.lblAuthor);
@@ -239,6 +236,27 @@
this.tabPage2.Text = "IPTV Mini Plugins";
this.tabPage2.UseVisualStyleBackColor = true;
//
+ // lblAuthor
+ //
+ this.lblAuthor.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblAuthor.Location = new System.Drawing.Point(99, 7);
+ this.lblAuthor.Name = "lblAuthor";
+ this.lblAuthor.Size = new System.Drawing.Size(100, 23);
+ this.lblAuthor.TabIndex = 4;
+ this.lblAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.lblAuthor.UseCompatibleTextRendering = true;
+ //
+ // label1
+ //
+ this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.label1.Location = new System.Drawing.Point(18, 7);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(100, 23);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Author:";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.label1.UseCompatibleTextRendering = true;
+ //
// btnAddNewPlug
//
this.btnAddNewPlug.Location = new System.Drawing.Point(526, 301);
@@ -270,28 +288,32 @@
this.checkedListBox1.TabIndex = 0;
this.checkedListBox1.UseCompatibleTextRendering = true;
this.checkedListBox1.SelectedIndexChanged += new System.EventHandler(this.CheckedListBox1SelectedIndexChanged);
+ this.checkedListBox1.Click += new System.EventHandler(this.CheckedListBox1Click);
//
- // label1
+ // tabPage1
//
- this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.label1.Location = new System.Drawing.Point(18, 7);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(100, 23);
- this.label1.TabIndex = 3;
- this.label1.Text = "Author:";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.label1.UseCompatibleTextRendering = true;
+ this.tabPage1.Controls.Add(this.grpBoxConnectInfo);
+ this.tabPage1.Location = new System.Drawing.Point(4, 23);
+ this.tabPage1.Name = "tabPage1";
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage1.Size = new System.Drawing.Size(652, 330);
+ this.tabPage1.TabIndex = 0;
+ this.tabPage1.Text = "Proxy Settings";
+ this.tabPage1.UseVisualStyleBackColor = true;
//
- // lblAuthor
+ // contextMenuStrip1
//
- this.lblAuthor.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblAuthor.Location = new System.Drawing.Point(99, 7);
- this.lblAuthor.Name = "lblAuthor";
- this.lblAuthor.Size = new System.Drawing.Size(100, 23);
- this.lblAuthor.TabIndex = 4;
- this.lblAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.lblAuthor.UseCompatibleTextRendering = true;
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.configurationToolStripMenuItem});
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(139, 26);
//
+ // configurationToolStripMenuItem
+ //
+ this.configurationToolStripMenuItem.Name = "configurationToolStripMenuItem";
+ this.configurationToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
+ this.configurationToolStripMenuItem.Text = "Configuration";
+ //
// IPTVsetup
//
this.ClientSize = new System.Drawing.Size(686, 410);
@@ -305,10 +327,13 @@
this.grpBoxConnectInfo.ResumeLayout(false);
this.grpBoxConnectInfo.PerformLayout();
this.tabControl1.ResumeLayout(false);
+ this.tabPage2.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
- this.tabPage2.ResumeLayout(false);
+ this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
+ private System.Windows.Forms.ToolStripMenuItem configurationToolStripMenuItem;
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblAuthor;
private System.Windows.Forms.Button btnRemove;
@@ -375,7 +400,7 @@
setupManager.LoadPluginItems(this.checkedListBox1);
XmlDocument xmld = new XmlDocument();
- xmld.Load("iptvsettings.xml");
+ xmld.Load(sPath+@"\iptvsettings.xml");
// Load Proxy Details from XML file
chkBoxUseProxy.Checked = Convert.ToBoolean(xmld.SelectSingleNode("/settings/proxydetails/useproxy").InnerText);
@@ -396,7 +421,7 @@
XmlNode ntxtProxyPortNode;
XmlDocument xmld = new XmlDocument();
- xmld.Load("iptvsettings.xml");
+ xmld.Load(sPath+@"\iptvsettings.xml");
nchkBoxUseProxyNode = xmld.SelectSingleNode("/settings/proxydetails/useproxy");
nchkBoxUseDefaultProxyNode = xmld.SelectSingleNode("/settings/proxydetails/usedefaultproxy");
@@ -412,7 +437,11 @@
ntxtProxyIPAddressNode.InnerText = txtProxyIPAddress.Text;
ntxtProxyPortNode.InnerText = txtProxyPort.Text;
- xmld.Save("iptvsettings.xml");
+ xmld.Save(sPath+@"\iptvsettings.xml");
+
+// SetupManager setupManager = new SetupManager();
+// setupManager.SavePluginItems(this.checkedListBox1);
+
this.Close();
}
@@ -420,7 +449,29 @@
{
this.Close();
}
+
+ void BtnRemoveClick(object sender, System.EventArgs e)
+ {
+ SetupManager setupManager = new SetupManager();
+ setupManager.LoadXMLDoc();
+ setupManager.RemoveItem(checkedListBox1.Text);
+ checkedListBox1.Items.Clear();
+ setupManager.GetPluginDetails();
+ setupManager.LoadPluginItems(checkedListBox1);
+ }
+
+ void BtnAddNewPlugClick(object sender, System.EventArgs e)
+ {
+ AddNewPlugins newplug = new AddNewPlugins(checkedListBox1);
+ newplug.ShowDialog();
+ newplug.Dispose();
+ }
+
+ void CheckedListBox1SelectedIndexChanged(object sender, System.EventArgs e)
+ {
+ }
+
#region ISetupForm Members
public bool CanEnable()
@@ -440,7 +491,7 @@
public int GetWindowId()
{
- return 5699;
+ return 6598;
}
public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
@@ -454,7 +505,7 @@
public string Author()
{
- return "overture/juan pablo";
+ return "overture";
}
public string PluginName()
@@ -475,27 +526,11 @@
}
#endregion
+
-
- void BtnRemoveClick(object sender, System.EventArgs e)
+ void CheckedListBox1Click(object sender, System.EventArgs e)
{
- SetupManager setupManager = new SetupManager();
- setupManager.LoadXMLDoc();
- setupManager.RemoveItem(checkedListBox1.Text);
- checkedListBox1.Items.Clear();
- setupManager.GetPluginDetails();
- setupManager.LoadPluginItems(checkedListBox1);
+ contextMenuStrip1.Show();
}
-
- void BtnAddNewPlugClick(object sender, System.EventArgs e)
- {
- PluginsAddNew newplug = new PluginsAddNew(checkedListBox1);
- newplug.ShowDialog();
- newplug.Dispose();
- }
-
- void CheckedListBox1SelectedIndexChanged(object sender, System.EventArgs e)
- {
- }
}
}
Modified: trunk/plugins/IPTVPlugin/IPTVsetup.resx
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVsetup.resx 2007-03-27 11:13:31 UTC (rev 237)
+++ trunk/plugins/IPTVPlugin/IPTVsetup.resx 2007-03-27 15:57:10 UTC (rev 238)
@@ -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="contextMenuStrip1.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/IPTVPlugin/SetupManager.cs
===================================================================
--- trunk/plugins/IPTVPlugin/SetupManager.cs 2007-03-27 11:13:31 UTC (rev 237)
+++ trunk/plugins/IPTVPlugin/SetupManager.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -4,9 +4,20 @@
using System.Drawing;
using ReflectionManager;
using SnapperInterface;
+using MediaPortal.GUI.Library;
namespace myIPTV
{
+ internal enum ChannelInfo
+ {
+ Name = 0,
+ Description = 1,
+ Genre = 2,
+ Language = 3,
+ Country = 4,
+ StreamURL = 5,
+ }
+
/// <summary>
/// Performs working tasks for this assembly.
/// </summary>
@@ -17,6 +28,8 @@
private string[] sState;
private XmlDocument xmld;
private string sTypeName;
+ private string sPath;
+
#region Default Constructor
@@ -25,10 +38,43 @@
/// </summary>
public SetupManager()
{
+ string sFilePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
+ sPath = sFilePath.Substring(0,sFilePath.LastIndexOf(@"\"));
}
#endregion
+
+ #region Private Methods
+ private bool Contains(string[] list, string comparedValue)
+ {
+ foreach(string listValue in list)
+ {
+ if (listValue == comparedValue)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ private string[] removeDuplicates(string[] inputList)
+ {
+ string[] finalList = new string[200];
+ int i = 0;
+ foreach (string currValue in inputList)
+ {
+ if(currValue==null) { break; }
+ if (!Contains(finalList, currValue))
+ {
+ finalList[i] = currValue;
+ i++;
+ }
+ }
+ return finalList;
+ }
+
+ #endregion
+
#region Internal Methods
/// <summary>
@@ -39,7 +85,7 @@
this.xmld = new XmlDocument();
try
{
- this.xmld.Load("IPTVMiniPluginDLLs.xml");
+ this.xmld.Load(sPath+@"\IPTVMiniPluginDLLs.xml");
}
catch(Exception ex)
{
@@ -71,7 +117,31 @@
}
}
+ internal void DisplayInitialScreen(GUIListControl listBox, string[,] sAllChannels, ChannelInfo channelInfo)
+ {
+ string[] sAllItems = new string[4000];
+ string[] sRes;
+ listBox.Clear();
+
+ for(int r=0;r<4000;r++)
+ {
+ string sItem = sAllChannels[r,Convert.ToInt32(channelInfo)];
+ if(sItem==null) { break; }
+ sAllItems[r] = sItem;
+ }
+
+ sRes = removeDuplicates(sAllItems);
+ foreach(string s in sRes)
+ {
+ if(s==null) { break; }
+ GUIListItem item = new GUIListItem();
+ item.Label = s;
+ listBox.Add(item);
+ }
+ listBox.Focus = true;
+ }
+
internal void GetPluginDetails()
{
XmlNodeList nodeList = null;
@@ -152,36 +222,47 @@
}
nodeStatus.Value = sNewState;
- this.xmld.Save("IPTVMiniPluginDLLs.xml");
+ this.xmld.Save(sPath+@"\IPTVMiniPluginDLLs.xml");
itemIndex++;
}
}
- internal void InsertNewItem(string sFilePath,string sDesc,bool sState)
+ internal string InsertNewItem(string sFilePath)
{
XmlNode root = null;
- root = this.xmld.SelectSingleNode("/interface");
+ string sPluginName = null;
+
+ //Load Assembs.
+ ReflectionControl dir = new ReflectionControl();
+ bool ans = dir.LoadExternalModule(sFilePath);
+ if(ans)
+ {
+ dir.GetCustomAttributes(out sTypeName);
+ object o = dir.GetInstanceOfType(sTypeName);
+ IMiniIPTVPlugin iplug = o as IMiniIPTVPlugin;
+ sPluginName = iplug.PluginName();
+
+ root = this.xmld.SelectSingleNode("/interface");
- //Create new nodes
- XmlElement eleType = this.xmld.CreateElement("type");
- XmlElement eleDLL = this.xmld.CreateElement("dll");
- eleDLL.InnerText = sFilePath;
+ //Create new nodes
+ XmlElement eleType = this.xmld.CreateElement("type");
+ XmlElement eleDLL = this.xmld.CreateElement("dll");
+ eleDLL.InnerText = sFilePath;
- XmlAttribute attState = this.xmld.CreateAttribute("state");
- if(sState)
- { attState.InnerText = "On";}
- else if(!sState)
- { attState.InnerText = "Off";}
- eleDLL.SetAttributeNode(attState);
+ XmlAttribute attState = this.xmld.CreateAttribute("state");
+ attState.InnerText = "On"; // Default
+ eleDLL.SetAttributeNode(attState);
- XmlAttribute attName = this.xmld.CreateAttribute("name");
- attName.InnerText = sDesc;
- eleDLL.SetAttributeNode(attName);
+ XmlAttribute attName = this.xmld.CreateAttribute("name");
+ attName.InnerText = sPluginName;
+ eleDLL.SetAttributeNode(attName);
- root.AppendChild(eleType);
- eleType.InsertBefore(eleDLL,eleType.FirstChild);
+ root.AppendChild(eleType);
+ eleType.InsertBefore(eleDLL,eleType.FirstChild);
- this.xmld.Save("IPTVMiniPluginDLLs.xml");
+ this.xmld.Save(sPath+@"\IPTVMiniPluginDLLs.xml");
+ }
+ return sPluginName;
}
internal void RemoveItem(string sSelected)
@@ -193,7 +274,7 @@
node = this.xmld.SelectSingleNode("/interface");
childnode = node.SelectSingleNode("type[dll/@name='" + sSelected + "']");
node.RemoveChild(childnode);
- this.xmld.Save("IPTVMiniPluginDLLs.xml");
+ this.xmld.Save(sPath+@"\IPTVMiniPluginDLLs.xml");
}
}
@@ -201,9 +282,11 @@
{
XmlNodeList nodeList = this.xmld.SelectNodes("/interface/type");
string[,] sAllChannelDetails;
- sAllChannelDetails = new string[4000,6]; // [Rows,Columns]
- int iLastArrayIndex = 0; // Default Start Index
-
+ sAllChannelDetails = new string[4000,5]; // [Rows,Columns]
+// int iLastArrayIndex = 0; // Default Start Index
+ int iRow;
+ int iColumn;
+
foreach(XmlNode n in nodeList)
{
XmlNode nodeState = n.SelectSingleNode("dll/@state");
@@ -217,9 +300,45 @@
dir.GetCustomAttributes(out sTypeName);
object o = dir.GetInstanceOfType(sTypeName);
IMiniIPTVPlugin iplug = o as IMiniIPTVPlugin;
- string[,] sChannelDetails = iplug.IPTVChannel();
- sChannelDetails.CopyTo(sAllChannelDetails, iLastArrayIndex);
- iLastArrayIndex = sChannelDetails.Length;
+ string[,] sChannelDetails = null;
+ try{
+ sChannelDetails = iplug.IPTVChannel();
+ }
+ catch(Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ int iFreshRow = 0;
+ for(iRow=0;iRow<4000;iRow++)
+ {
+ int iFreshCol = 0;
+ try
+ {
+ if(sChannelDetails[iFreshRow,iFreshCol] == null)
+ {
+ break;
+ }
+ }
+ catch
+ {
+ break;
+ }
+ for(iColumn=0;iColumn<5;iColumn++)
+ {
+ try
+ {
+ sAllChannelDetails[iRow,iColumn] = sChannelDetails[iFreshRow,iFreshCol];
+ }
+ catch(Exception ex)
+ {
+ MessageBox.Show("["+iRow+", "+iColumn+"]: "+ex.Message);
+ }
+ iFreshCol++;
+ }
+ iFreshRow++;
+ }
+// sChannelDetails.CopyTo(sAllChannelDetails, iLastArrayIndex);
+// iLastArrayIndex = sChannelDetails.Length;
}
else
{
@@ -229,6 +348,7 @@
return sAllChannelDetails;
}
+
internal string GetAuthor(string sDLL)
{
string sAuthor = "unknown"; // Default Author
@@ -248,10 +368,10 @@
return sAuthor;
}
- internal bool TestNewItem(string sFilePath,string sDesc,bool sState)
+ internal bool TestNewItem(string sFilePath)
{
bool ans = false;
- if(sFilePath!="" && sDesc!="")
+ if(sFilePath!="")
{
//Load Assem.
ReflectionControl dir = new ReflectionControl();
Modified: trunk/plugins/IPTVPlugin/SnapperInterface.cs
===================================================================
--- trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-27 11:13:31 UTC (rev 237)
+++ trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-27 15:57:10 UTC (rev 238)
@@ -10,39 +10,18 @@
public interface IMiniIPTVPlugin
{
/// <summary>
- /// Should return CHANNEL INFO in a multi-dim array - returned in this order:-
- /// [x,1] Channel Name
- /// [x,2] Channel Description
- /// [x,3] Genre
- /// [x,4] Language
- /// [x,5] Country
- /// [x,6] Channel Stream URL
- /// [x,7] Channel EPG
- /// NOTE: where 'x' above = the ROW index of the multi-dim array.
- /// NOTE: you must return Null when any of the above info is not available.
+ /// Should return a multi-dimensional array return in this order (string channelname, string channelDescription, string genre, string language, string country, string streamURL)
/// </summary>
- /// <returns>A multi-dimensional string array</returns>
+ /// <returns>A multi-dimensional array</returns>
string[,] IPTVChannel();
- /// <summary>
- /// Should return the name of the IPTV mini plugin AUTHOR.
- /// </summary>
- /// <returns>string with authors name</returns>
string Author();
- /// <summary>
- /// Should return a DESCRIPTION for the IPTV mini plugin.
- /// </summary>
- /// <returns>string with authors name</returns>
- string Description();
- /// <summary>
- /// Should return the current VERSION of the plugin.
- /// </summary>
- /// <returns>decimal with version number</returns>
- decimal Version();
+ string PluginName();
+ Form IPTVPluginSetup();
}
#endregion
- #region Plugin Attribute
+ #region MiniIPTVPlugin Attribute
/// <summary>
/// MiniIPTVPluginAttribute will be used by classes which
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 11:13:36
|
Revision: 237
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=237&view=rev
Author: pbb72
Date: 2007-03-27 04:13:31 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
changed id values to avoid conflicts, added home and glossary buttons, more renaming, further conversion imageloader, fixed regex's
Modified Paths:
--------------
trunk/plugins/Documentation plugin/Documentation.cs
trunk/plugins/Documentation plugin/DocumentationImage.cs
trunk/plugins/Documentation plugin/DocumentationPage.cs
trunk/plugins/Documentation plugin/skin/Documentation.xml
Modified: trunk/plugins/Documentation plugin/Documentation.cs
===================================================================
--- trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 11:06:38 UTC (rev 236)
+++ trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 11:13:31 UTC (rev 237)
@@ -45,23 +45,29 @@
{
#region SkinControls
// map skin controls to member variables
- [SkinControlAttribute(10)]
+ [SkinControlAttribute(981)]
+ protected GUIButtonControl buttonHome = null;
+ [SkinControlAttribute(982)]
+ protected GUIButtonControl buttonGlossary = null;
+ [SkinControlAttribute(983)]
protected GUIButtonControl buttonOpen = null;
- [SkinControlAttribute(14)]
- protected GUIButtonControl buttonBack = null;
- [SkinControlAttribute(12)]
+ [SkinControlAttribute(984)]
+ protected GUIButtonControl buttonSearch = null;
+ [SkinControlAttribute(985)]
+ protected GUIButtonControl buttonPrevious = null;
+ [SkinControlAttribute(986)]
+ protected GUIButtonControl buttonText = null;
+ [SkinControlAttribute(987)]
protected GUIButtonControl buttonLinks = null;
- [SkinControlAttribute(13)]
+ [SkinControlAttribute(988)]
protected GUIButtonControl buttonImages = null;
-
- [SkinControlAttribute(4)]
- protected GUILabelControl searchtermLabel = null;
- [SkinControlAttribute(5)]
- protected GUILabelControl imagedescLabel = null;
- [SkinControlAttribute(20)]
+ [SkinControlAttribute(989)]
+ protected GUILabelControl labelPagename = null;
+ [SkinControlAttribute(990)]
+ protected GUILabelControl labelImagename = null;
+ [SkinControlAttribute(991)]
protected GUITextControl txtArticle = null;
-
- [SkinControlAttribute(25)]
+ [SkinControlAttribute(992)]
protected GUIImage imageControl = null;
#endregion
@@ -190,6 +196,16 @@
GetAndDisplayArticle(_currentPage);
}
}
+ if (control == buttonHome)
+ {
+ _currentPage = string.Empty;
+ GetAndDisplayArticle(_currentPage);
+ }
+ if (control == buttonGlossary)
+ {
+ _currentPage = "glossary";
+ GetAndDisplayArticle(_currentPage);
+ }
// The Button holding the Links to other articles
if (control == buttonLinks)
{
@@ -211,7 +227,7 @@
pDlgOK.DoModal(GetID);
if (pDlgOK.SelectedLabel >= 0)
{
- _currentPage = _linkValues[pDlgOK.SelectedId-1].ToString()
+ _currentPage = _linkValues[pDlgOK.SelectedId-1].ToString();
Log.Info(_PluginName + ": new search from the links array: {0}", _currentPage);
GetAndDisplayArticle(_currentPage);
}
@@ -250,10 +266,10 @@
if (pDlgOK.SelectedLabel >= 0)
{
Log.Info(_PluginName + ": new search from the image array: {0}",
- _imageLabels[pDlgOK.SelectedId - 1]);
- GetAndDisplayImage(_currentPage,
- _imageLabels[pDlgOK.SelectedId - 1].ToString(),
- _imageValues[pDlgOK.SelectedId - 1].ToString());
+ _imageValues[pDlgOK.SelectedId - 1]);
+ GetAndDisplayImage(_currentPage,
+ _imageValues[pDlgOK.SelectedId - 1].ToString(),
+ _imageLabels[pDlgOK.SelectedId - 1].ToString());
}
}
}
@@ -268,25 +284,25 @@
}
}
// Back to the text button to switch from image view
- if (control == buttonBack)
+ if (control == buttonText)
{
if (!txtArticle.IsVisible)
GUIControl.ShowControl(GetID, txtArticle.GetID);
if (imageControl.IsVisible)
GUIControl.HideControl(GetID, imageControl.GetID);
- if (!searchtermLabel.IsVisible)
- GUIControl.ShowControl(GetID, searchtermLabel.GetID);
- if (imagedescLabel.IsVisible)
- GUIControl.HideControl(GetID, imagedescLabel.GetID);
- if (buttonBack.IsVisible)
- GUIControl.HideControl(GetID, buttonBack.GetID);
+ if (!labelPagename.IsVisible)
+ GUIControl.ShowControl(GetID, labelPagename.GetID);
+ if (labelImagename.IsVisible)
+ GUIControl.HideControl(GetID, labelImagename.GetID);
+ if (buttonText.IsVisible)
+ GUIControl.HideControl(GetID, buttonText.GetID);
}
base.OnClicked(controlId, control, actionType);
}
- private void GetAndDisplayImage(string pagename, string imagename, string imagedesc)
+ private void GetAndDisplayImage(string pagename, string imagefile, string imagename)
{
- DocumentationImage image = new DocumentationImage(pagename, imagename);
+ DocumentationImage image = new DocumentationImage(pagename, imagefile);
string imagefilename = image.GetImageFilename();
Log.Info(_PluginName + ": Trying to display image file: {0}", imagefilename);
@@ -296,13 +312,13 @@
GUIControl.HideControl(GetID, txtArticle.GetID);
if (!imageControl.IsVisible)
GUIControl.ShowControl(GetID, imageControl.GetID);
- if (searchtermLabel.IsVisible)
- GUIControl.HideControl(GetID, searchtermLabel.GetID);
- if (!imagedescLabel.IsVisible)
- GUIControl.ShowControl(GetID, imagedescLabel.GetID);
- if (!buttonBack.IsVisible)
- GUIControl.ShowControl(GetID, buttonBack.GetID);
- imagedescLabel.Label = imagedesc;
+ if (labelPagename.IsVisible)
+ GUIControl.HideControl(GetID, labelPagename.GetID);
+ if (!labelImagename.IsVisible)
+ GUIControl.ShowControl(GetID, labelImagename.GetID);
+ if (!buttonText.IsVisible)
+ GUIControl.ShowControl(GetID, buttonText.GetID);
+ labelImagename.Label = imagename;
imageControl.SetFileName(imagefilename);
}
else
@@ -340,15 +356,15 @@
GUIControl.ShowControl(GetID, txtArticle.GetID);
if (imageControl.IsVisible)
GUIControl.HideControl(GetID, imageControl.GetID);
- if (!searchtermLabel.IsVisible)
- GUIControl.ShowControl(GetID, searchtermLabel.GetID);
- if (imagedescLabel.IsVisible)
- GUIControl.HideControl(GetID, imagedescLabel.GetID);
- if (buttonBack.IsVisible)
- GUIControl.HideControl(GetID, buttonBack.GetID);
+ if (!labelPagename.IsVisible)
+ GUIControl.ShowControl(GetID, labelPagename.GetID);
+ if (labelImagename.IsVisible)
+ GUIControl.HideControl(GetID, labelImagename.GetID);
+ if (buttonText.IsVisible)
+ GUIControl.HideControl(GetID, buttonText.GetID);
_linkLabels.Clear();
_imageLabels.Clear();
- searchtermLabel.Label = e.Argument.ToString();
+ labelPagename.Label = e.Argument.ToString();
DocumentationPage page =
new DocumentationPage(e.Argument.ToString());
_pageText = page.text;
@@ -368,4 +384,4 @@
volatile bool _workerCompleted = true;
}
-}
+}
\ No newline at end of file
Modified: trunk/plugins/Documentation plugin/DocumentationImage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationImage.cs 2007-03-27 11:06:38 UTC (rev 236)
+++ trunk/plugins/Documentation plugin/DocumentationImage.cs 2007-03-27 11:13:31 UTC (rev 237)
@@ -42,107 +42,53 @@
/// </summary>
public class DocumentationImage
{
+ private string PluginName = "Documentation";
private string ImageURL = "http://wiki.team-mediaportal.com/{0}?action=AttachFile&do=get&target={1}";
private string pagename = string.Empty;
- private string imagename = string.Empty;
+ private string imagefile = string.Empty;
private string imagedesc = string.Empty;
- private string imageurl = string.Empty;
private string imagelocal = string.Empty;
- /// <summary>This constructor creates a new WikipediaImage</summary>
+ /// <summary>This constructor creates a new Image</summary>
/// <summary>The name of the image need to be given</summary>
- /// <param name="imagename">The internal name of the image like "Bild_478.jpg" in "http://de.wikipedia.org/wiki/Bild:Bild_478.jpg"</param>
- public DocumentationImage(string pagename, string imagename)
+ public DocumentationImage(string pagename, string imagefile)
{
this.pagename = pagename;
- this.imagename = imagename;
- GetImageUrl();
+ this.imagefile = imagefile;
GetImageFile();
}
- /// <summary>Getting the link to the full-size image.</summary>
- private void GetImageUrl()
+ /// <summary>Downloads the full-size image from the wiki</summary>
+ private void GetImageFile()
{
- string imagepage = string.Empty;
+ System.Uri url = new System.Uri(String.Format(ImageURL, this.pagename, this.imagefile));
+ //Check if we already have the file.
+ string thumbspath = Config.GetSubFolder(Config.Dir.Thumbs, @"mpwiki\");
- // Build the URL to the Image page
- System.Uri url = new System.Uri(String.Format(ImageURL, this.pagename, this.imagename));
- Log.Info("Wikipedia: Trying to get following Image page: {0}", url.ToString());
+ //Create the mpwiki subdir in thumbs when it not exists.
+ if (!System.IO.Directory.Exists(thumbspath))
+ System.IO.Directory.CreateDirectory(thumbspath);
- // Here we get the content from the web and put it to a string
- try
+ if (!System.IO.File.Exists(thumbspath + imagefile))
{
- WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- Stream data = client.OpenRead(url);
- StreamReader reader = new StreamReader(data);
- imagepage = reader.ReadToEnd();
- reader.Close();
- Log.Info("Wikipedia: Success! Downloaded all data from the image page.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading image page:");
- Log.Info(e.ToString());
- }
- //We're searching for something like this:
- //<div class="fullImageLink" id="file"><a href="http://upload.wikimedia.org/wikipedia/commons/7/7d/Bild_478.jpg">
- if (imagepage.IndexOf("class=\"fullImageLink\"") >= 0)
- {
- Log.Info("Wikipedia: Extracting link to full-size image.");
- int iStart = imagepage.IndexOf("class=\"fullImageLink\"");
- imagepage = imagepage.Substring(iStart, 1000);
-
- iStart = imagepage.IndexOf("href") + 6;
- int iEnd = imagepage.IndexOf("\"", iStart);
-
- this.imageurl = imagepage.Substring(iStart, iEnd - iStart);
- Log.Info("Wikipedia: URL of full-size image extracted.");
- Log.Info(imageurl);
- }
- else
- this.imageurl = string.Empty;
- }
-
- /// <summary>Downloads the full-size image from the wikipedia page</summary>
- private void GetImageFile()
- {
- if (imageurl != "")
- {
- //Check if we already have the file.
- string thumbspath = Config.GetSubFolder(Config.Dir.Thumbs, @"wikipedia\");
-
- //Create the wikipedia subdir in thumbs when it not exists.
- if (!System.IO.Directory.Exists(thumbspath))
- System.IO.Directory.CreateDirectory(thumbspath);
-
- if (!System.IO.File.Exists(thumbspath + imagename))
+ Log.Info(PluginName + ": Trying to get following URL: {0}", url);
+ // Here we get the image from the web and save it to disk
+ try
{
-
- Log.Info("Wikipedia: Trying to get following URL: {0}", imageurl);
- // Here we get the image from the web and save it to disk
- try
- {
- WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- client.DownloadFile(imageurl, thumbspath + imagename);
- Log.Info("Wikipedia: Success! Image downloaded.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading:");
- Log.Info(e.ToString());
- }
+ WebClient client = new WebClient();
+ client.DownloadFile(url, thumbspath + imagefile);
+ Log.Info(PluginName + ": Success! Image downloaded.");
}
- else
+ catch (Exception e)
{
- Log.Info("Wikipedia: Image exists, no need to redownload!");
+ Log.Info(PluginName + ": Exception during downloading:");
+ Log.Info(e.ToString());
}
}
else
{
- Log.Info("Wikipedia: No imageurl. Can't download file.");
+ Log.Info(PluginName + ": Image exists, no need to redownload!");
}
}
@@ -150,10 +96,10 @@
/// <returns>String: filename of the downloaded image.</returns>
public string GetImageFilename()
{
- string imagelocal = Config.GetFile(Config.Dir.Thumbs, @"wikipedia\" + imagename);
+ string imagelocal = Config.GetFile(Config.Dir.Thumbs, @"mpwiki\" + imagefile);
return imagelocal;
}
}
-}
+}
\ No newline at end of file
Modified: trunk/plugins/Documentation plugin/DocumentationPage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 11:06:38 UTC (rev 236)
+++ trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 11:13:31 UTC (rev 237)
@@ -132,10 +132,14 @@
this.text = Regex.Replace(this.text, @"\[(?<url>http://[^ \]]+)(?: (?<label>[^\]]+))?\]",
new MatchEvaluator(StripElements));
+ // prevent camelcase links in code ({{{...}}})
+ this.text = Regex.Replace(this.text, @"{{{[^(?:}}})]}}}", new MatchEvaluator(StripElements));
+
// wikilinks
// this needs to be in one big regex, to maintain their order in the document
this.text = Regex.Replace(this.text,
// enclosed, labelled links ([:page name], [:pagename:link text])
+ // TODO: subpage
@"\[:(?<page>[^:\]]+)(?::(?: |\t)*(?<label>[^\]]+))?\]"
// wiki-labelled links ([wiki:pagename], [wiki:pagename link text])
+ "|" + @"\[wiki:(?<page>[^ \]]+)(?: (?<label>[^\]]+))?\]"
@@ -150,16 +154,17 @@
// re-insert elements
this.text = Regex.Replace(this.text, @"{elm(?<index>[^}]+)}", new MatchEvaluator(ReturnElements));
- Log.Info(_PluginName + ": General replacements.");
+ //Log.Info(_PluginName + ": General replacements.");
// de-linked camelcase (!PageName)
this.text = Regex.Replace(this.text, @"(?<=\W)!((?:[A-Z][a-z0-9]+){2,})(?=\W)",
"$1");
// tables (|| cell 1 || cell 2 ||)
- this.text = Regex.Replace(this.text, @"\|{2,}<[^>]*>", "|");
+ this.text = Regex.Replace(this.text, @"(?<=\r\n) *\|\|.*?\|\|(?:\r\n|$)(?!\|)",
+ new MatchEvaluator(ParseTables), RegexOptions.Singleline);
// TODO: numbered lists (1., 1., 1., ...)
-
+
// single linebreaks in code, except ones around headers and tables
//this.text = Regex.Replace(this.text, @"(?<!\r\n|=|\|)\r\n(?!\r\n|=|\|)", " ");
@@ -167,6 +172,12 @@
this.text = Regex.Replace(this.text, @"(?:\r\n){2,}",
Environment.NewLine + Environment.NewLine);
+ // excessive spaces
+ this.text = Regex.Replace(this.text, @" {2,}", " ");
+
+ // indents (just removed) ( . indented line)
+ this.text = Regex.Replace(this.text, @"(?<=\r\n)[ \.]*(.*) *(?=\r\n)", "$1");
+
// whitespace around titles
//this.text = Regex.Replace(this.text, @"(?:\r\n)+(=.+=)(?:\r\n)+",
// Environment.NewLine + Environment.NewLine + "$1" + Environment.NewLine);
@@ -183,8 +194,8 @@
private string StripElements ( Match m )
{
- Log.Info(_PluginName + ": Strip element " + m.Value);
- Log.Info("match found at " + m.Index);
+ //Log.Info(_PluginName + ": Strip element " + m.Value);
+ //Log.Info("match found at " + m.Index);
if (m.Groups["header"].Value != "")
{
// headers
@@ -202,6 +213,7 @@
else if (m.Groups["page"].Value != "")
{
// wiki links
+ //Log.Info("wiki link found");
string label = m.Groups["label"].Value;
string page = m.Groups["page"].Value;
if (label == "") label = page;
@@ -217,7 +229,7 @@
if (!linkLabels.Contains(label))
{
linkLabels.Add(label);
- linkValues.Add(m.Groups["page"].Value);
+ linkValues.Add(page);
}
elms.Add("<" + label + "(" + (linkLabels.IndexOf(label)+1) + ")>");
}
@@ -246,6 +258,10 @@
}
elms.Add("[" + img + "(" + (imageLabels.IndexOf(img)+1) + ")]");
}
+ else
+ {
+ elms.Add(m.Value);
+ }
return "{elm" + (elms.Count-1) + "}";
}
@@ -254,5 +270,14 @@
return elms[ Int32.Parse( m.Groups["index"].Value ) ].ToString();
}
+ private string ParseTables ( Match m )
+ {
+ string str = m.Value;
+ Log.Info(_PluginName + ": table found: " + Environment.NewLine + str);
+ Log.Info("number of rows: " + str.Split(Environment.NewLine.ToCharArray()).Length);
+ str = Regex.Replace(str, @"\|{2,}(?:<[^>]*>)?", "|");
+ return "{"+str+"}";
+ }
+
}
-}
+}
\ No newline at end of file
Modified: trunk/plugins/Documentation plugin/skin/Documentation.xml
===================================================================
--- trunk/plugins/Documentation plugin/skin/Documentation.xml 2007-03-27 11:06:38 UTC (rev 236)
+++ trunk/plugins/Documentation plugin/skin/Documentation.xml 2007-03-27 11:13:31 UTC (rev 237)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
<id>9999</id>
- <defaultcontrol>10</defaultcontrol>
+ <defaultcontrol>1</defaultcontrol>
<allowoverlay>yes</allowoverlay>
<define>#header.label:Documentation</define>
<define>#header.image:wiki.team-mediaportal.com.png</define>
- <define>#header.hover:hover_wikipedia.png</define>
+ <define>#header.hover:hover_test.png</define>
<controls>
<import>common.window.xml</import>
<control>
@@ -19,30 +19,53 @@
<posX>60</posX>
<posY>97</posY>
<control>
+ <description>Homepage</description>
+ <type>button</type>
+ <id>981</id>
+ <onup>17</onup>
+ <label>Startpage</label>
+ </control>
+ <control>
+ <description>Keyword reference</description>
+ <type>button</type>
+ <id>982</id>
+ <label>Glossary</label>
+ </control>
+ <control>
<description>Page name entry</description>
<type>button</type>
- <id>10</id>
- <onup>17</onup>
+ <id>983</id>
<label>Go to...</label>
</control>
<control>
+ <description>Search pages</description>
+ <type>button</type>
+ <id>984</id>
+ <label>Search...</label>
+ </control>
+ <control>
+ <description>Previous page</description>
+ <type>button</type>
+ <id>985</id>
+ <label>Back</label>
+ </control>
+ <control>
<description>Back to the text (when viewing an image)</description>
<type>button</type>
- <id>14</id>
+ <id>986</id>
<label>2514</label>
<visible>no</visible>
</control>
<control>
<description>Links Button</description>
<type>button</type>
- <id>12</id>
+ <id>987</id>
<label>2511</label>
</control>
<control>
<description>Images Button</description>
<type>button</type>
- <id>13</id>
- <ondown>99</ondown>
+ <id>988</id>
<label>2515</label>
</control>
</control>
@@ -51,7 +74,7 @@
<animation effect="fade" time="500">WindowClose</animation>
<description>Article title/searchterm</description>
<type>label</type>
- <id>4</id>
+ <id>989</id>
<posX>280</posX>
<posY>70</posY>
<visible>no</visible>
@@ -64,7 +87,7 @@
<animation effect="fade" time="500">WindowClose</animation>
<description>Image description</description>
<type>label</type>
- <id>5</id>
+ <id>990</id>
<posX>264</posX>
<posY>70</posY>
<visible>no</visible>
@@ -77,7 +100,7 @@
<animation effect="fade" time="500">WindowClose</animation>
<description>Here is the article text displayed</description>
<type>textbox</type>
- <id>20</id>
+ <id>991</id>
<posX>280</posX>
<posY>92</posY>
<visible>no</visible>
@@ -90,7 +113,7 @@
<animation effect="fade" time="500">WindowClose</animation>
<description>Article Image</description>
<type>image</type>
- <id>25</id>
+ <id>992</id>
<posX>264</posX>
<posY>72</posY>
<visible>no</visible>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 11:06:40
|
Revision: 236
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=236&view=rev
Author: pbb72
Date: 2007-03-27 04:06:38 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
simplification again, disabled configuration dialog, converted image loader, code cleanup, extended interpretation regex's
Modified Paths:
--------------
trunk/plugins/Documentation plugin/Documentation.cs
trunk/plugins/Documentation plugin/DocumentationImage.cs
trunk/plugins/Documentation plugin/DocumentationPage.cs
Property Changed:
----------------
trunk/plugins/Documentation plugin/skin/
Modified: trunk/plugins/Documentation plugin/Documentation.cs
===================================================================
--- trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 10:49:51 UTC (rev 235)
+++ trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 11:06:38 UTC (rev 236)
@@ -38,338 +38,334 @@
namespace Documentation
{
- /// <summary>
- /// MediaPortal Window plugin to display the documentation wiki.
- /// </summary>
- public class GUIDocumentation : GUIWindow, ISetupForm
- {
- #region SkinControls
- // map skin controls to member variables
- [SkinControlAttribute(10)]
- protected GUIButtonControl buttonOpen = null;
- [SkinControlAttribute(14)]
- protected GUIButtonControl buttonBack = null;
- [SkinControlAttribute(12)]
- protected GUIButtonControl buttonLinks = null;
- [SkinControlAttribute(13)]
- protected GUIButtonControl buttonImages = null;
+ /// <summary>
+ /// MediaPortal Window plugin to display the documentation wiki.
+ /// </summary>
+ public class GUIDocumentation : GUIWindow, ISetupForm
+ {
+ #region SkinControls
+ // map skin controls to member variables
+ [SkinControlAttribute(10)]
+ protected GUIButtonControl buttonOpen = null;
+ [SkinControlAttribute(14)]
+ protected GUIButtonControl buttonBack = null;
+ [SkinControlAttribute(12)]
+ protected GUIButtonControl buttonLinks = null;
+ [SkinControlAttribute(13)]
+ protected GUIButtonControl buttonImages = null;
- [SkinControlAttribute(4)]
- protected GUILabelControl searchtermLabel = null;
- [SkinControlAttribute(5)]
- protected GUILabelControl imagedescLabel = null;
- [SkinControlAttribute(20)]
- protected GUITextControl txtArticle = null;
+ [SkinControlAttribute(4)]
+ protected GUILabelControl searchtermLabel = null;
+ [SkinControlAttribute(5)]
+ protected GUILabelControl imagedescLabel = null;
+ [SkinControlAttribute(20)]
+ protected GUITextControl txtArticle = null;
- [SkinControlAttribute(25)]
- protected GUIImage imageControl = null;
- #endregion
+ [SkinControlAttribute(25)]
+ protected GUIImage imageControl = null;
+ #endregion
- public string _PluginName = "Documentation";
+ private string _PluginName = "Documentation";
private int _WindowID = 9999;
- private string _pageText = string.Empty;
- private ArrayList _linkArray = new ArrayList();
- private ArrayList _imageNameArray = new ArrayList();
- private ArrayList _imageDescArray = new ArrayList();
+ private string _currentPage = string.Empty;
+ private string _pageText = string.Empty;
+ private ArrayList _linkLabels = new ArrayList();
+ private ArrayList _linkValues = new ArrayList();
+ private ArrayList _imageLabels = new ArrayList();
+ private ArrayList _imageValues = new ArrayList();
- public GUIDocumentation()
- {
- GetID = _WindowID;
- }
+ public GUIDocumentation()
+ {
+ GetID = _WindowID;
+ }
- #region ISetupForm Members
+ #region ISetupForm Members
- // Returns the name of the plugin which is shown in the plugin menu
- public string PluginName()
- {
- return _PluginName;
- }
+ // Returns the name of the plugin which is shown in the plugin menu
+ public string PluginName()
+ {
+ return _PluginName;
+ }
- // Returns the description of the plugin is shown in the plugin menu
- public string Description()
- {
- return "Displays the MediaPortal Documentation wiki.";
- }
+ // Returns the description of the plugin is shown in the plugin menu
+ public string Description()
+ {
+ return "Displays the MediaPortal Documentation wiki.";
+ }
- // Returns the author of the plugin which is shown in the plugin menu
- public string Author()
- {
- return "Peter";
- }
+ // Returns the author of the plugin which is shown in the plugin menu
+ public string Author()
+ {
+ return "Peter";
+ }
- // show the setup dialog
- public void ShowPlugin()
- {
- MessageBox.Show("Edit the wikipedia.xml file in MP's root directory to add new sites.");
- }
+ // show the setup dialog
+ public void ShowPlugin()
+ {
+ }
- // Indicates whether plugin can be enabled/disabled
- public bool CanEnable()
- {
- return true;
- }
+ // Indicates whether plugin can be enabled/disabled
+ public bool CanEnable()
+ {
+ return true;
+ }
- // get ID of windowplugin belonging to this setup
- public int GetWindowId()
- {
- return _WindowID;
- }
+ // get ID of windowplugin belonging to this setup
+ public int GetWindowId()
+ {
+ return _WindowID;
+ }
- // Indicates if plugin is enabled by default;
- public bool DefaultEnabled()
- {
- return true;
- }
+ // Indicates if plugin is enabled by default;
+ public bool DefaultEnabled()
+ {
+ return true;
+ }
- // indicates if a plugin has its own setup screen
- public bool HasSetup()
- {
- return true;
- }
+ // indicates if a plugin has its own setup screen
+ public bool HasSetup()
+ {
+ return false;
+ }
- /// <summary>
- /// If the plugin should have its own button on the main menu of Media Portal then it
- /// should return true to this method, otherwise if it should not be on home
- /// it should return false
- /// </summary>
- /// <param name="strButtonText">text the button should have</param>
- /// <param name="strButtonImage">image for the button, or empty for default</param>
- /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
- /// <param name="strPictureImage">subpicture for the button or empty for none</param>
- /// <returns>true : plugin needs its own button on home
- /// false : plugin does not need its own button on home</returns>
- public bool GetHome(out string strButtonText, out string strButtonImage,
- out string strButtonImageFocus, out string strPictureImage)
- {
- strButtonText = _PluginName;
- strButtonImage = String.Empty;
- strButtonImageFocus = String.Empty;
- strPictureImage = String.Empty;
- return true;
- }
- #endregion
+ /// <summary>
+ /// If the plugin should have its own button on the main menu of Media Portal then it
+ /// should return true to this method, otherwise if it should not be on home
+ /// it should return false
+ /// </summary>
+ /// <param name="strButtonText">text the button should have</param>
+ /// <param name="strButtonImage">image for the button, or empty for default</param>
+ /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
+ /// <param name="strPictureImage">subpicture for the button or empty for none</param>
+ /// <returns>true : plugin needs its own button on home
+ /// false : plugin does not need its own button on home</returns>
+ public bool GetHome(out string strButtonText, out string strButtonImage,
+ out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = _PluginName;
+ strButtonImage = String.Empty;
+ strButtonImageFocus = String.Empty;
+ strPictureImage = String.Empty;
+ return true;
+ }
+ #endregion
- public override bool Init()
- {
- return Load(GUIGraphicsContext.Skin + @"\Documentation.xml");
- }
+ public override bool Init()
+ {
+ return Load(GUIGraphicsContext.Skin + @"\Documentation.xml");
+ }
protected override void OnPageLoad()
{
- GetAndDisplayArticle(String.Empty); // display start page
+ GetAndDisplayArticle(_currentPage); // display start page
base.OnPageLoad();
}
protected override void OnClicked(int controlId, GUIControl control,
- MediaPortal.GUI.Library.Action.ActionType actionType)
- {
- // we don't want the user to start another search while one is already active
- if (_workerCompleted == false)
- return;
+ MediaPortal.GUI.Library.Action.ActionType actionType)
+ {
+ // we don't want the user to start another search while one is already active
+ if (_workerCompleted == false)
+ return;
- // Here we want to open the OSD Keyboard to enter the searchstring
- if (control == buttonOpen)
- {
- // If the search Button was clicked we need to bring up the search keyboard.
- VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow(
- (int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
- if (null == keyboard) return;
- string searchterm = string.Empty;
- keyboard.IsSearchKeyboard = true;
- keyboard.Reset();
- keyboard.Text = "";
- keyboard.DoModal(GetID); // show it...
+ // Here we want to open the OSD Keyboard to enter the searchstring
+ if (control == buttonOpen)
+ {
+ // If the search Button was clicked we need to bring up the search keyboard.
+ VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
+ if (null == keyboard) return;
+ keyboard.IsSearchKeyboard = true;
+ keyboard.Reset();
+ keyboard.Text = "";
+ keyboard.DoModal(GetID); // show it...
- Log.Info(_PluginName + ": OSD keyboard loaded!");
+ Log.Info(_PluginName + ": OSD keyboard loaded!");
- // If input is finished, the string is saved to the searchterm var.
- if (keyboard.IsConfirmed)
- searchterm = keyboard.Text;
+ // If input is finished, the string is saved to the searchterm var.
+ if (keyboard.IsConfirmed)
+ {
+ _currentPage = keyboard.Text;
+ Log.Info(_PluginName + ": Searchterm gotten from OSD keyboard: {0}", _currentPage);
+ GetAndDisplayArticle(_currentPage);
+ }
+ }
+ // The Button holding the Links to other articles
+ if (control == buttonLinks)
+ {
+ if (_linkLabels.Count > 0)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:
- // If there was a string entered try getting the article.
- Log.Info(_PluginName + ": Searchterm gotten from OSD keyboard: {0}",
- searchterm);
- GetAndDisplayArticle(searchterm);
- }
- // The Button holding the Links to other articles
- if (control == buttonLinks)
- {
- if (_linkArray.Count > 0)
- {
- // Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow(
- (int)GUIWindow.Window.WINDOW_DIALOG_MENU);
- if (pDlgOK != null)
- {
- pDlgOK.Reset();
- pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:
+ // Add all the links from the linkarray.
+ for (int i = 0; i < _linkLabels.Count; i++)
+ {
+ pDlgOK.Add(_linkLabels[i].ToString());
+ }
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ _currentPage = _linkValues[pDlgOK.SelectedId-1].ToString()
+ Log.Info(_PluginName + ": new search from the links array: {0}", _currentPage);
+ GetAndDisplayArticle(_currentPage);
+ }
+ }
+ }
+ else
+ {
+ // no links available
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2506)); // No Links from this article.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
- // Add all the links from the linkarray.
- foreach (string link in _linkArray)
- {
- pDlgOK.Add(link);
- }
- pDlgOK.DoModal(GetID);
- if (pDlgOK.SelectedLabel >= 0)
- {
- Log.Info(_PluginName + ": new search from the links array: {0}",
- pDlgOK.SelectedLabelText);
- GetAndDisplayArticle(pDlgOK.SelectedLabelText);
- }
- }
- }
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
- (int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2506)); // No Links from this article.
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
+ }
+ // The Button containing a list of all images from the article
+ if (control == buttonImages)
+ {
+ if (_imageLabels.Count > 0)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2507)); //Images from this article
- }
- // The Button containing a list of all images from the article
- if (control == buttonImages)
- {
- if (_imageDescArray.Count > 0)
- {
- // Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow(
- (int)GUIWindow.Window.WINDOW_DIALOG_MENU);
- if (pDlgOK != null)
- {
- pDlgOK.Reset();
- pDlgOK.SetHeading(GUILocalizeStrings.Get(2507)); //Images from this article
+ // Add all the images from the imagearray.
+ for (int i = 0; i < _imageLabels.Count; i++)
+ {
+ pDlgOK.Add(_imageLabels[i].ToString());
+ }
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ Log.Info(_PluginName + ": new search from the image array: {0}",
+ _imageLabels[pDlgOK.SelectedId - 1]);
+ GetAndDisplayImage(_currentPage,
+ _imageLabels[pDlgOK.SelectedId - 1].ToString(),
+ _imageValues[pDlgOK.SelectedId - 1].ToString());
+ }
+ }
+ }
+ else
+ {
+ // no images available
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in art.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
+ // Back to the text button to switch from image view
+ if (control == buttonBack)
+ {
+ if (!txtArticle.IsVisible)
+ GUIControl.ShowControl(GetID, txtArticle.GetID);
+ if (imageControl.IsVisible)
+ GUIControl.HideControl(GetID, imageControl.GetID);
+ if (!searchtermLabel.IsVisible)
+ GUIControl.ShowControl(GetID, searchtermLabel.GetID);
+ if (imagedescLabel.IsVisible)
+ GUIControl.HideControl(GetID, imagedescLabel.GetID);
+ if (buttonBack.IsVisible)
+ GUIControl.HideControl(GetID, buttonBack.GetID);
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
- // Add all the images from the imagearray.
- foreach (string image in _imageDescArray)
- {
- pDlgOK.Add(image);
- }
- pDlgOK.DoModal(GetID);
- if (pDlgOK.SelectedLabel >= 0)
- {
- Log.Info(_PluginName + ": new search from the image array: {0}",
- _imageDescArray[pDlgOK.SelectedId - 1]);
- GetAndDisplayImage(_imageNameArray[pDlgOK.SelectedId - 1].ToString(),
- _imageDescArray[pDlgOK.SelectedId - 1].ToString());
- }
- }
- }
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
- (int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in art.
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
- }
- // Back to the text button to switch from image view
- if (control == buttonBack)
- {
- if (!txtArticle.IsVisible)
- GUIControl.ShowControl(GetID, txtArticle.GetID);
- if (imageControl.IsVisible)
- GUIControl.HideControl(GetID, imageControl.GetID);
- if (!searchtermLabel.IsVisible)
- GUIControl.ShowControl(GetID, searchtermLabel.GetID);
- if (imagedescLabel.IsVisible)
- GUIControl.HideControl(GetID, imagedescLabel.GetID);
- if (buttonBack.IsVisible)
- GUIControl.HideControl(GetID, buttonBack.GetID);
- }
- base.OnClicked(controlId, control, actionType);
- }
+ private void GetAndDisplayImage(string pagename, string imagename, string imagedesc)
+ {
+ DocumentationImage image = new DocumentationImage(pagename, imagename);
+ string imagefilename = image.GetImageFilename();
+ Log.Info(_PluginName + ": Trying to display image file: {0}", imagefilename);
- private void GetAndDisplayImage(string imagename, string imagedesc)
- {
- WikipediaImage image = new WikipediaImage(imagename);
- string imagefilename = image.GetImageFilename();
- Log.Info(_PluginName + ": Trying to display image file: {0}", imagefilename);
+ if (imagefilename != string.Empty && System.IO.File.Exists(imagefilename))
+ {
+ if (txtArticle.IsVisible)
+ GUIControl.HideControl(GetID, txtArticle.GetID);
+ if (!imageControl.IsVisible)
+ GUIControl.ShowControl(GetID, imageControl.GetID);
+ if (searchtermLabel.IsVisible)
+ GUIControl.HideControl(GetID, searchtermLabel.GetID);
+ if (!imagedescLabel.IsVisible)
+ GUIControl.ShowControl(GetID, imagedescLabel.GetID);
+ if (!buttonBack.IsVisible)
+ GUIControl.ShowControl(GetID, buttonBack.GetID);
+ imagedescLabel.Label = imagedesc;
+ imageControl.SetFileName(imagefilename);
+ }
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2512)); // Can't display image.
+ dlg.SetLine(2, GUILocalizeStrings.Get(2513)); // Please have a look at the logfile.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
- if (imagefilename != string.Empty && System.IO.File.Exists(imagefilename))
- {
- if (txtArticle.IsVisible)
- GUIControl.HideControl(GetID, txtArticle.GetID);
- if (!imageControl.IsVisible)
- GUIControl.ShowControl(GetID, imageControl.GetID);
- if (searchtermLabel.IsVisible)
- GUIControl.HideControl(GetID, searchtermLabel.GetID);
- if (!imagedescLabel.IsVisible)
- GUIControl.ShowControl(GetID, imagedescLabel.GetID);
- if (!buttonBack.IsVisible)
- GUIControl.ShowControl(GetID, buttonBack.GetID);
- imagedescLabel.Label = imagedesc;
- imageControl.SetFileName(imagefilename);
- }
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
- (int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2512)); // Can't display image.
- dlg.SetLine(2, GUILocalizeStrings.Get(2513)); // Please have a look at the logfile.
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
- }
+ // The core function.
+ void GetAndDisplayArticle(string searchterm)
+ {
+ BackgroundWorker worker = new BackgroundWorker();
- // The core function.
- void GetAndDisplayArticle(string searchterm)
- {
- BackgroundWorker worker = new BackgroundWorker();
+ worker.DoWork += new DoWorkEventHandler(DownloadWorker);
+ worker.RunWorkerAsync(searchterm);
- worker.DoWork += new DoWorkEventHandler(DownloadWorker);
- worker.RunWorkerAsync(searchterm);
+ while (_workerCompleted == false)
+ GUIWindowManager.Process();
+ }
- while (_workerCompleted == false)
- GUIWindowManager.Process();
- }
+ // All kind of stuff because of the wait cursor ;-)
+ void DownloadWorker(object sender, DoWorkEventArgs e)
+ {
+ _workerCompleted = false;
- // All kind of stuff because of the wait cursor ;-)
- void DownloadWorker(object sender, DoWorkEventArgs e)
- {
- _workerCompleted = false;
+ using (WaitCursor cursor = new WaitCursor())
+ lock (this)
+ {
+ if (!txtArticle.IsVisible)
+ GUIControl.ShowControl(GetID, txtArticle.GetID);
+ if (imageControl.IsVisible)
+ GUIControl.HideControl(GetID, imageControl.GetID);
+ if (!searchtermLabel.IsVisible)
+ GUIControl.ShowControl(GetID, searchtermLabel.GetID);
+ if (imagedescLabel.IsVisible)
+ GUIControl.HideControl(GetID, imagedescLabel.GetID);
+ if (buttonBack.IsVisible)
+ GUIControl.HideControl(GetID, buttonBack.GetID);
+ _linkLabels.Clear();
+ _imageLabels.Clear();
+ searchtermLabel.Label = e.Argument.ToString();
+ DocumentationPage page =
+ new DocumentationPage(e.Argument.ToString());
+ _pageText = page.text;
+ _linkLabels = page.linkLabels;
+ _linkValues = page.linkValues;
+ _imageLabels = page.imageLabels;
+ _imageValues = page.imageValues;
- using (WaitCursor cursor = new WaitCursor())
- lock (this)
- {
- if (!txtArticle.IsVisible)
- GUIControl.ShowControl(GetID, txtArticle.GetID);
- if (imageControl.IsVisible)
- GUIControl.HideControl(GetID, imageControl.GetID);
- if (!searchtermLabel.IsVisible)
- GUIControl.ShowControl(GetID, searchtermLabel.GetID);
- if (imagedescLabel.IsVisible)
- GUIControl.HideControl(GetID, imagedescLabel.GetID);
- if (buttonBack.IsVisible)
- GUIControl.HideControl(GetID, buttonBack.GetID);
- _linkArray.Clear();
- _imageNameArray.Clear();
- _imageDescArray.Clear();
- searchtermLabel.Label = e.Argument.ToString();
- DocumentationPage page =
- new DocumentationPage(e.Argument.ToString());
- _pageText = page.text;
- _linkArray = page.linkArray();
- _imageNameArray = page.GetImageArray();
- _imageDescArray = page.GetImagedescArray();
+ if (_pageText == string.Empty)
+ txtArticle.Label = "This page does not exist (yet).";
+ else
+ txtArticle.Label = _pageText;
+ }
- if (_pageText == "REDIRECT")
- txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" +
- GUILocalizeStrings.Get(2510);
- //This page is only a redirect.
- //Please chose the redirect aim from the link list.
- else if (_pageText == string.Empty)
- txtArticle.Label = GUILocalizeStrings.Get(2504);
- //Sorry, no Article was found for your searchterm...
- else
- txtArticle.Label = _pageText;
- }
+ _workerCompleted = true;
+ }
- _workerCompleted = true;
- }
-
- volatile bool _workerCompleted = true;
- }
-}
\ No newline at end of file
+ volatile bool _workerCompleted = true;
+ }
+}
Modified: trunk/plugins/Documentation plugin/DocumentationImage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationImage.cs 2007-03-27 10:49:51 UTC (rev 235)
+++ trunk/plugins/Documentation plugin/DocumentationImage.cs 2007-03-27 11:06:38 UTC (rev 236)
@@ -37,160 +37,123 @@
namespace Documentation
{
- /// <summary>
- /// This class holds all the logic to get an image from Wikipedia for further using in MP.
- /// </summary>
- public class WikipediaImage
- {
- #region vars
- private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
- private string imagename = string.Empty;
- private string imagedesc = string.Empty;
- private string imageurl = string.Empty;
- private string imagelocal = string.Empty;
+ /// <summary>
+ /// This class holds all the logic to get an image from the MediaPortal wiki
+ /// </summary>
+ public class DocumentationImage
+ {
+ private string ImageURL = "http://wiki.team-mediaportal.com/{0}?action=AttachFile&do=get&target={1}";
+ private string pagename = string.Empty;
+ private string imagename = string.Empty;
+ private string imagedesc = string.Empty;
+ private string imageurl = string.Empty;
+ private string imagelocal = string.Empty;
- #endregion
+ /// <summary>This constructor creates a new WikipediaImage</summary>
+ /// <summary>The name of the image need to be given</summary>
+ /// <param name="imagename">The internal name of the image like "Bild_478.jpg" in "http://de.wikipedia.org/wiki/Bild:Bild_478.jpg"</param>
+ public DocumentationImage(string pagename, string imagename)
+ {
+ this.pagename = pagename;
+ this.imagename = imagename;
+ GetImageUrl();
+ GetImageFile();
+ }
- #region constructors
- /// <summary>This constructor creates a new WikipediaImage</summary>
- /// <summary>The name of the image and language need to be given</summary>
- /// <param name="imagename">The internal name of the image like "Bild_478.jpg" in "http://de.wikipedia.org/wiki/Bild:Bild_478.jpg"</param>
- /// <param name="language">Language of the Wikipedia page</param>
- public WikipediaImage(string imagename, string language)
- {
- SetLanguage(language);
- this.imagename = imagename;
- GetImageUrl();
- GetImageFile();
- }
+ /// <summary>Getting the link to the full-size image.</summary>
+ private void GetImageUrl()
+ {
+ string imagepage = string.Empty;
- /// <summary>This constructor creates a new WikipediaArticle.</summary>
- /// <summary>Only called with a title string, language set to default.</summary>
- /// <param name="title">The article's title</param>
- public WikipediaImage(string imagename)
- : this(imagename, "Default")
- {
- }
+ // Build the URL to the Image page
+ System.Uri url = new System.Uri(String.Format(ImageURL, this.pagename, this.imagename));
+ Log.Info("Wikipedia: Trying to get following Image page: {0}", url.ToString());
- /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
- /// <summary>Uses an empty searchterm and the default language.</summary>
- public WikipediaImage()
- : this(string.Empty, "Default")
- {
- }
- #endregion
+ // Here we get the content from the web and put it to a string
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ Stream data = client.OpenRead(url);
+ StreamReader reader = new StreamReader(data);
+ imagepage = reader.ReadToEnd();
+ reader.Close();
+ Log.Info("Wikipedia: Success! Downloaded all data from the image page.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading image page:");
+ Log.Info(e.ToString());
+ }
- #region class methods
- /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
- private void SetLanguage(string language)
- {
- if (language == "Default")
- {
- MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
- language = xmlreader.GetValueAsString("skin", "language", "English");
- }
+ //We're searching for something like this:
+ //<div class="fullImageLink" id="file"><a href="http://upload.wikimedia.org/wikipedia/commons/7/7d/Bild_478.jpg">
+ if (imagepage.IndexOf("class=\"fullImageLink\"") >= 0)
+ {
+ Log.Info("Wikipedia: Extracting link to full-size image.");
+ int iStart = imagepage.IndexOf("class=\"fullImageLink\"");
+ imagepage = imagepage.Substring(iStart, 1000);
- MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- this.WikipediaURL = detailxmlreader.GetValueAsString(language, "imageurl", "http://en.wikipedia.org/wiki/Image:");
- Log.Info("Wikipedia: Image language set to " + language + ".");
- }
+ iStart = imagepage.IndexOf("href") + 6;
+ int iEnd = imagepage.IndexOf("\"", iStart);
- /// <summary>Get the local filename of the downloaded image.</summary>
- /// <returns>String: filename of the downloaded image.</returns>
- public string GetImageFilename()
- {
- string imagelocal = Config.GetFile(Config.Dir.Thumbs, @"wikipedia\" + imagename);
- return imagelocal;
- }
+ this.imageurl = imagepage.Substring(iStart, iEnd - iStart);
+ Log.Info("Wikipedia: URL of full-size image extracted.");
+ Log.Info(imageurl);
+ }
+ else
+ this.imageurl = string.Empty;
+ }
- /// <summary>Getting the link to the full-size image.</summary>
- /// <returns>String: parsed article</returns>
- private void GetImageUrl()
- {
- string imagepage = string.Empty;
+ /// <summary>Downloads the full-size image from the wikipedia page</summary>
+ private void GetImageFile()
+ {
+ if (imageurl != "")
+ {
+ //Check if we already have the file.
+ string thumbspath = Config.GetSubFolder(Config.Dir.Thumbs, @"wikipedia\");
- // Build the URL to the Image page
- System.Uri url = new System.Uri(WikipediaURL + this.imagename);
- Log.Info("Wikipedia: Trying to get following Image page: {0}", url.ToString());
+ //Create the wikipedia subdir in thumbs when it not exists.
+ if (!System.IO.Directory.Exists(thumbspath))
+ System.IO.Directory.CreateDirectory(thumbspath);
- // Here we get the content from the web and put it to a string
- try
- {
- WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- Stream data = client.OpenRead(url);
- StreamReader reader = new StreamReader(data);
- imagepage = reader.ReadToEnd();
- reader.Close();
- Log.Info("Wikipedia: Success! Downloaded all data from the image page.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading image page:");
- Log.Info(e.ToString());
- }
+ if (!System.IO.File.Exists(thumbspath + imagename))
+ {
- //We're searching for something like this:
- //<div class="fullImageLink" id="file"><a href="http://upload.wikimedia.org/wikipedia/commons/7/7d/Bild_478.jpg">
- if (imagepage.IndexOf("class=\"fullImageLink\"") >= 0)
- {
- Log.Info("Wikipedia: Extracting link to full-size image.");
- int iStart = imagepage.IndexOf("class=\"fullImageLink\"");
- imagepage = imagepage.Substring(iStart, 1000);
+ Log.Info("Wikipedia: Trying to get following URL: {0}", imageurl);
+ // Here we get the image from the web and save it to disk
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ client.DownloadFile(imageurl, thumbspath + imagename);
+ Log.Info("Wikipedia: Success! Image downloaded.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading:");
+ Log.Info(e.ToString());
+ }
+ }
+ else
+ {
+ Log.Info("Wikipedia: Image exists, no need to redownload!");
+ }
+ }
+ else
+ {
+ Log.Info("Wikipedia: No imageurl. Can't download file.");
+ }
+ }
- iStart = imagepage.IndexOf("href") + 6;
- int iEnd = imagepage.IndexOf("\"", iStart);
+ /// <summary>Get the local filename of the downloaded image.</summary>
+ /// <returns>String: filename of the downloaded image.</returns>
+ public string GetImageFilename()
+ {
+ string imagelocal = Config.GetFile(Config.Dir.Thumbs, @"wikipedia\" + imagename);
+ return imagelocal;
+ }
- this.imageurl = imagepage.Substring(iStart, iEnd - iStart);
- Log.Info("Wikipedia: URL of full-size image extracted.");
- Log.Info(imageurl);
- }
- else
- this.imageurl = string.Empty;
- }
+ }
- /// <summary>Downloads the full-size image from the wikipedia page</summary>
- private void GetImageFile()
- {
- if (imageurl != "")
- {
- //Check if we already have the file.
- string thumbspath = Config.GetSubFolder(Config.Dir.Thumbs, @"wikipedia\");
-
- //Create the wikipedia subdir in thumbs when it not exists.
- if (!System.IO.Directory.Exists(thumbspath))
- System.IO.Directory.CreateDirectory(thumbspath);
-
- if (!System.IO.File.Exists(thumbspath + imagename))
- {
-
- Log.Info("Wikipedia: Trying to get following URL: {0}", imageurl);
- // Here we get the image from the web and save it to disk
- try
- {
- WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- client.DownloadFile(imageurl, thumbspath + imagename);
- Log.Info("Wikipedia: Success! Image downloaded.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading:");
- Log.Info(e.ToString());
- }
- }
- else
- {
- Log.Info("Wikipedia: Image exists, no need to redownload!");
- }
- }
- else
- {
- Log.Info("Wikipedia: No imageurl. Can't download file.");
- }
- }
-
- #endregion
- }
-
-}
\ No newline at end of file
+}
Modified: trunk/plugins/Documentation plugin/DocumentationPage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 10:49:51 UTC (rev 235)
+++ trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 11:06:38 UTC (rev 236)
@@ -1,6 +1,6 @@
#region Copyright (C) 2005-2007 Team MediaPortal
-/*
+/*
* Copyright (C) 2005-2007 Team MediaPortal
* http://www.team-mediaportal.com
*
@@ -8,15 +8,15 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -38,131 +38,138 @@
namespace Documentation
{
- /// <summary>
- /// This class holds all the logic to get info from the MediaPortal Wiki and parse it for
- /// further usage.
- /// </summary>
- public class DocumentationPage
- {
- #region vars
+ /// <summary>
+ /// This class holds all the logic to get info from the MediaPortal Wiki and parse it for
+ /// further usage.
+ /// </summary>
+ public class DocumentationPage
+ {
public string text = string.Empty;
- public ArrayList linkArray = new ArrayList();
- public ArrayList imageArray = new ArrayList();
- public ArrayList imageDescArray = new ArrayList();
+ public ArrayList linkLabels = new ArrayList();
+ public ArrayList linkValues = new ArrayList();
+ public ArrayList imageLabels = new ArrayList();
+ public ArrayList imageValues = new ArrayList();
+ private string _PluginName = "Documentation";
private string _WikiURL = "http://wiki.team-mediaportal.com/{0}?action=raw";
- private string _imagePattern = "attachment:";
- #endregion
+ private string _currentPage;
+ private ArrayList headers = new ArrayList();
+ private ArrayList elms = new ArrayList();
- #region constructors
- /// <summary>This constructor creates a new WikipediaArticle</summary>
- /// <param name="pageName">The article's page name</param>
- public DocumentationPage(string pageName)
- {
- GetWikiPage(pageName);
- ParseWikipediaArticle();
- ParseLinksAndImages();
- }
- #endregion
+ /// <summary>This constructor creates a new DocumentationPage</summary>
+ /// <param name="pageName">The article's page name</param>
+ public DocumentationPage(string pageName)
+ {
+ _currentPage = pageName;
+ GetWikiPage();
+ ParseArticle();
+ }
- /// <summary>Downloads the raw Wiki code.</summary>
- private void GetWikiPage(string pageName)
- {
- // Build the URL to the Wikipedia page
- System.Uri url = new System.Uri(String.Format(_WikiURL, this._pageName));
- Log.Info("Wikipedia: Trying to get following URL: {0}", url.ToString());
+ /// <summary>Downloads the raw Wiki code.</summary>
+ private void GetWikiPage()
+ {
+ // Build the URL to the Wiki page
+ System.Uri url = new System.Uri(String.Format(_WikiURL, _currentPage));
+ Log.Info(_PluginName + ": Trying to get following URL: {0}", url.ToString());
- // Here we get the content from the web and put it to a string
- try
- {
- WebClient client = new WebClient();
- client.Headers.Add("user-agent",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- Stream data = client.OpenRead(url);
- StreamReader reader = new StreamReader(data);
- //this._unparsedPage = reader.ReadToEnd();
+ // Here we get the content from the web and put it to a string
+ try
+ {
+ WebClient client = new WebClient();
+ Stream data = client.OpenRead(url);
+ StreamReader reader = new StreamReader(data);
+ //this._unparsedPage = reader.ReadToEnd();
this.text = reader.ReadToEnd();
- reader.Close();
- Log.Info("Wikipedia: Success! Downloaded all data.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading:");
- Log.Info(e.ToString());
- }
- }
+ reader.Close();
+ Log.Info(_PluginName + ": Success! Downloaded all data.");
+ }
+ catch (Exception e)
+ {
+ Log.Info(_PluginName + ": Exception during downloading.");
+ Log.Info(e.ToString());
+ }
+ }
- /// <summary>Cuts all special wiki syntax from the article to display plain text</summary>
- private void ParseWikipediaArticle()
- {
- //string tempParsedPage = this._unparsedPage;
+ /// <summary>Cuts all special wiki syntax from the article to display plain text</summary>
+ private void ParseArticle()
+ {
+ //string tempParsedPage = this._unparsedPage;
string tempParsedPage = this.text;
if (this.text.Length > 10 && this.text.Substring(0, 10) == "#REDIRECT ")
- {
- Log.Info("Wikipedia: #REDIRECT found.");
- GetWikiPage(this.text.Substring(10));
- ParseWikipediaArticle();
- }
- else
- {
- Log.Info("Wikipedia: Starting parsing.");
+ {
+ Log.Info(_PluginName + ": #REDIRECT found.");
+ _currentPage = this.text.Substring(10);
+ GetWikiPage();
+ ParseArticle();
+ }
+ else
+ {
+ Log.Info(_PluginName + ": Starting parsing.");
// remove control codes & remarks (#blah)
- this.text = Regex.Replace(this.text, @"^#.+\n", String.Empty,
+ // $ only matches \n, not \r\n ????
+ this.text = Regex.Replace(this.text, @"^#.+\r\n", String.Empty,
RegexOptions.Multiline);
- // TODO: no interpretation in headers (not even ``)
-
- // explicit hyperlinks ([:pagename:link text])
- this.text = Regex.Replace(this.text, @"\[:[^:]+:(?: |\t)*([^\]]+)\]",
- "[$1]");
+ // sorry, no TOC
+ this.text = Regex.Replace(this.text, @"\[\[TableOfContents\]\](?:\r\n)?", String.Empty);
- // TODO: [:page name]
- // TODO: ["page name"]
-
- // camelcase hyperlinks that are not in headers (PageName)
- // TODO: prevent camelcase links inside explicit hyperlinks
- this.text = Regex.Replace(this.text, @"(?<!^=(?: )+|\w)((?:[A-Z][a-z0-9]+){2,})(?!\w)",
- "[$1]", RegexOptions.Multiline);
+ // remove certain elements from further processing (to prevent camelcase words in them from
+ // being converted to links)
- // de-linked camelcase (!PageName)
- this.text = Regex.Replace(this.text, @"(?<=\W)!((?:[A-Z][a-z0-9]+){2,})(?=\W)",
- "$1");
+ // headers
+ this.text = Regex.Replace(this.text, @"(?:\r|\n)*(?<headlvl>=+) (?<header>[^=]+) =+(?:\r|\n)+",
+ new MatchEvaluator(StripElements));
- // TODO: /SubPage, SomePage/SomeSubPage
-
- // TODO: Wiki:WikiPage, MoinMoin:SomePage
-
- // enclosed external hyperlinks ([http://example.com])
- this.text = Regex.Replace(this.text, @"\[(http://[^ \]]+)\]", "$1");
+ // image attachments
+ this.text = Regex.Replace(this.text, @"attachment:(?<img>[\w\-_]+)(?<ext>\.gif|\.jpg|.png)",
+ new MatchEvaluator(StripElements));
+ // TODO: external images (http://example.org/image.jpg)
+ // TODO: attachment:file.zip
+ // enclosed external hyperlinks ([http://example.com])
// external hyperlinks with label ([http://example.com an example])
- this.text = Regex.Replace(this.text, @"\[(http://[^ \]]+) ([^\]]+)\]", "$2 ($1)");
+ this.text = Regex.Replace(this.text, @"\[(?<url>http://[^ \]]+)(?: (?<label>[^\]]+))?\]",
+ new MatchEvaluator(StripElements));
- // images (attachment:file.gif)
- this.text = Regex.Replace(this.text, @"attachment:([^\s\|]+)(?:\.gif|\.jpg)",
- "[img:$1]");
+ // wikilinks
+ // this needs to be in one big regex, to maintain their order in the document
+ this.text = Regex.Replace(this.text,
+ // enclosed, labelled links ([:page name], [:pagename:link text])
+ @"\[:(?<page>[^:\]]+)(?::(?: |\t)*(?<label>[^\]]+))?\]"
+ // wiki-labelled links ([wiki:pagename], [wiki:pagename link text])
+ + "|" + @"\[wiki:(?<page>[^ \]]+)(?: (?<label>[^\]]+))?\]"
+ // quoted links (["page name"])
+ + "|" + @"\[""(?<page>[^\]]+)""\]"
+ // camelcase links (PageName)
+ + "|" + @"\b(?<!!)(?<page>/?(?:[A-Z][a-z0-9]+){2,})\b"
+ // TODO: SomePage/SomeSubPage
+ // TODO: Wiki:WikiPage, MoinMoin:SomePage
+ , new MatchEvaluator(StripElements));
- // TODO: attachment:file.zip
-
- // TODO: bold & italic ('''text''' -> *text* & /text/)
+ // re-insert elements
+ this.text = Regex.Replace(this.text, @"{elm(?<index>[^}]+)}", new MatchEvaluator(ReturnElements));
- // TODO: lists
-
+ Log.Info(_PluginName + ": General replacements.");
+ // de-linked camelcase (!PageName)
+ this.text = Regex.Replace(this.text, @"(?<=\W)!((?:[A-Z][a-z0-9]+){2,})(?=\W)",
+ "$1");
+
// tables (|| cell 1 || cell 2 ||)
this.text = Regex.Replace(this.text, @"\|{2,}<[^>]*>", "|");
+
+ // TODO: numbered lists (1., 1., 1., ...)
// single linebreaks in code, except ones around headers and tables
- this.text = Regex.Replace(this.text, @"(?<!\r\n|=|\|)\r\n(?!\r\n|=|\|)",
- " ");
+ //this.text = Regex.Replace(this.text, @"(?<!\r\n|=|\|)\r\n(?!\r\n|=|\|)", " ");
// paragraphs with excessive linebreaks
- this.text = Regex.Replace(this.text, @"(?:\r\n){2,}",
+ this.text = Regex.Replace(this.text, @"(?:\r\n){2,}",
Environment.NewLine + Environment.NewLine);
// whitespace around titles
- this.text = Regex.Replace(this.text, @"(?:\r\n)+(=.+=)(?:\r\n)+",
- Environment.NewLine + Environment.NewLine + "$1" + Environment.NewLine);
+ //this.text = Regex.Replace(this.text, @"(?:\r\n)+(=.+=)(?:\r\n)+",
+ // Environment.NewLine + Environment.NewLine + "$1" + Environment.NewLine);
// forced linebreaks ([[BR]])
this.text = Regex.Replace(this.text, @"\[\[BR\]\]", Environment.NewLine);
@@ -170,159 +177,82 @@
// quote escaping (``)
this.text = Regex.Replace(this.text, @"``", String.Empty);
- Log.Info("Wikipedia: Finished parsing.");
- }
- }
+ Log.Info(_PluginName + ": Finished parsing.");
+ }
+ }
- /// <summary>Gets Links out of the article. External links are thrown away, links to other
- /// wikipedia articles get into the link array, images to the image array</summary>
- private void ParseLinksAndImages()
- {
- Log.Info("Wikipedia: Starting parsing of links and images.");
- //string tempParsedArticle = this._unparsedPage;
- string tempParsedArticle = this.text;
- int iStart = 0, iEnd = 0, iPipe = 0;
+ private string StripElements ( Match m )
+ {
+ Log.Info(_PluginName + ": Strip element " + m.Value);
+ Log.Info("match found at " + m.Index);
+ if (m.Groups["header"].Value != "")
+ {
+ // headers
+ if (m.Index < 10)
+ {
+ // no newlines when first header
+ elms.Add(m.Value.ToUpper().Trim() + Environment.NewLine);
+ }
+ else
+ {
+ elms.Add(Environment.NewLine + Environment.NewLine + m.Value.ToUpper().Trim() +
+ Environment.NewLine);
+ }
+ }
+ else if (m.Groups["page"].Value != "")
+ {
+ // wiki links
+ string label = m.Groups["label"].Value;
+ string page = m.Groups["page"].Value;
+ if (label == "") label = page;
+ if (page == _currentPage)
+ {
+ // don't return links to current page, but do format them properly
+ elms.Add(label);
+ }
+ else
+ {
+ if (page[0] == '/') page = _currentPage + page;
+ // FIXME: different links with identical labels may exist!
+ if (!linkLabels.Contains(label))
+ {
+ linkLabels.Add(label);
+ linkValues.Add(m.Groups["page"].Value);
+ }
+ elms.Add("<" + label + "(" + (linkLabels.IndexOf(label)+1) + ")>");
+ }
+ }
+ else if (m.Groups["url"].Value != "")
+ {
+ // external hyperlinks
+ if (m.Groups["label"].Value == "")
+ {
+ elms.Add(m.Groups["url"].Value);
+ }
+ else
+ {
+ elms.Add(m.Groups["label"].Value + " (" + m.Groups["url"].Value + ")");
+ }
+ }
+ else if (m.Groups["img"].Value != "")
+ {
+ // image attachments
+ string img = m.Groups["img"].Value;
+ // FIXME: images with same name but different extension may exist!
+ if (!imageLabels.Contains(img))
+ {
+ imageLabels.Add(img);
+ imageValues.Add(m.Groups["img"].Value + m.Groups["ext"].Value);
+ }
+ elms.Add("[" + img + "(" + (imageLabels.IndexOf(img)+1) + ")]");
+ }
+ return "{elm" + (elms.Count-1) + "}";
+ }
- // Surrounded by [[IMAGEPATTERN: and ]] are the links to IMAGES.
- // We need to check for the localized image keyword but also for the English as this
- // is commonly used in some local sites.
- // Example: [[Bild:H_NeuesRathaus1.jpg|left|thumb|Das [[Neues Rathaus (Hannover)|Neue Rathaus]] mit Maschteich]]
- while ((iStart = tempParsedArticle.IndexOf("[[" + _imagePattern + ":", iStart)) >= 0 ||
- (iStart = tempParsedArticle.IndexOf("[[Image:")) >= 0)
- {
- iEnd = tempParsedArticle.IndexOf("]]", (iStart + 2)) + 2;
- int disturbingLink = iStart;
-
- // Descriptions of images can contain links!
- // [[Bild:Hannover Merian.png|thumb|[[Mattheus Merian|Merian]]-Kupferstich um 1650, im Vordergrund Windmohle auf dem [[Lindener Berg]]]]
- while (tempParsedArticle.IndexOf("[[", disturbingLink + 2) >= 0 &&
- tempParsedArticle.IndexOf("[[", disturbingLink + 2) < iEnd)
- {
- disturbingLink = tempParsedArticle.IndexOf("[[", disturbingLink + 2);
- iEnd = tempParsedArticle.IndexOf("]]", disturbingLink) + 2;
- iEnd = tempParsedArticle.IndexOf("]]", iEnd) + 2;
- }
- // Extract the Text
- string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
-
- //Remove all links from the image description.
- while (keyword.IndexOf("[[", 2) >= 0)
- {
- int iStartlink = keyword.IndexOf("[[", 2);
- int iEndlink = keyword.IndexOf("]]", iStartlink) + 2;
- // Extract the Text
- string linkkeyword = keyword.Substring(iStartlink, iEndlink - iStartlink);
-
- // Parse Links to other keywords.
- // 1st type of keywords is like [[article|displaytext]]
- // for the 2nd the article and displayed text are equal [[article]].
- if (linkkeyword.IndexOf("|") > 0)
- linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("|") + 1,
- linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("|") - 1);
- else
- linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("[[") + 2,
- linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("[[") - 2);
-
- keyword = keyword.Substring(0, iStartlink) + linkkeyword +
- keyword.Substring(iEndlink, keyword.Length - iEndlink);
- }
-
- int iStartname = keyword.IndexOf(":") + 1;
- int iEndname = keyword.IndexOf("|");
- string imagename = keyword.Substring(iStartname, iEndname - iStartname);
-
- //Image names must not contain spaces!
- imagename = imagename.Replace(" ", "_");
-
- int iStartdesc = keyword.LastIndexOf("|") + 1;
- int iEnddesc = keyword.LastIndexOf("]]");
- string imagedesc = keyword.Substring(iStartdesc, iEnddesc - iStartdesc); ;
-
- this.imageArray.Add(imagename);
- this.imageDescArray.Add(imagedesc);
- Log.Debug("Wikipedia: Image added: {0}, {1}", imagedesc, imagename);
-
- tempParsedArticle = tempParsedArticle.Substring(0, iStart) +
- tempParsedArticle.Substring(iEnd, tempParsedArticle.Length - iEnd);
- }
-
- // surrounded by [[ and ]] are the links to other articles.
- Log.Debug("Wikipedia: Starting Link parsing.");
- string parsedKeyword, parsedLink;
- iStart = iEnd = 0;
- try
- {
- while ((iStart = tempParsedArticle.IndexOf("[[", iStart)) >= 0)
- {
- iEnd = tempParsedArticle.IndexOf("]]") + 2;
- // Extract the Text
- string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
-
- // Parse Links to other keywords.
- // 1st type of keywords is like [[article|displaytext]]
- if ((iPipe = keyword.IndexOf("|")) > 0)
- {
- parsedKeyword = keyword.Substring(iPipe + 1, keyword.Length - iPipe - 3);
- parsedLink = keyword.Substring(2, iPipe - 2);
- if (!this.linkArray.Contains(parsedLink))
- {
- this.linkArray.Add(parsedLink);
- //Log.Debug("Wikipedia: Link added: {0}, {1}", parsedLink, parsedKeyword);
- }
- }
- else if (keyword.IndexOf(":") > 0)
- {
- // for the 2nd a ":" is a link to the article in another language.
- // TODO Add links to other languages!!!
- parsedKeyword = String.Empty;
- }
- else
- {
- // for the 3rd the article and displayed text are equal [[article]].
- parsedKeyword = keyword.Substring(2, keyword.Length - 4);
- if (!this.linkArray.Contains(parsedKeyword))
- {
- this.linkArray.Add(parsedKeyword);
- //Log.Debug("Wikipedia: Link added: {0}", parsedKeyword);
- }
- }
-
- StringBuilder builder = new StringBuilder(tempParsedArticle);
- builder.Remove(iStart, iEnd - iStart);
- builder.Insert(iStart, parsedKeyword);
- tempParsedArticle = builder.ToString();
- }
- }
- catch (Exception e)
- {
- Log.Error("Wikipedia: {0}", e.ToString());
- Log.Error("Wikipedia: tempArticle: {0}", tempParsedArticle);
- }
- Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", linkArray.Count);
-
- // surrounded by [ and ] are external Links. Need to be removed.
- Log.Debug("Wikipedia: Removing external links");
- iStart = -1;
- try
- {
- while ((iStart = tempParsedArticle.IndexOf("[")) >= 0)
- {
- iEnd = tempParsedArticle.IndexOf("]") + 1;
-
- StringBuilder builder = new StringBuilder(tempParsedArticle);
- builder.Remove(iStart, iEnd - iStart);
- tempParsedArticle = builder.ToString();
- }
- }
- catch (Exception e)
- {
- Log.Error("Wikipedia: {0}", e.ToString());
- Log.Error("Parsing Error: " + tempParsedArticle + "\nSTART: " + iStart + "\nEND: "
- + iEnd);
- }
-
- Log.Info("Wikipedia: Finished parsing of links and images.");
- //this._parsedPage = tempParsedArticle;
- }
- }
-}
\ No newline at end of file
+ private string ReturnElements ( Match m )
+ {
+ return elms[ Int32.Parse( m.Groups["index"].Value ) ].ToString();
+ }
+
+ }
+}
Property changes on: trunk/plugins/Documentation plugin/skin
___________________________________________________________________
Name: svn:ignore
+ *.bak
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 10:49:53
|
Revision: 235
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=235&view=rev
Author: pbb72
Date: 2007-03-27 03:49:51 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
more simplification and identifier renaming, fixed redirects, replaced substring conversion by regex conversion, added skin file
Modified Paths:
--------------
trunk/plugins/Documentation plugin/Documentation.cs
trunk/plugins/Documentation plugin/DocumentationPage.cs
Added Paths:
-----------
trunk/plugins/Documentation plugin/skin/
trunk/plugins/Documentation plugin/skin/Documentation.xml
Property Changed:
----------------
trunk/plugins/Documentation plugin/
Property changes on: trunk/plugins/Documentation plugin
___________________________________________________________________
Name: svn:ignore
+ *.bak
Modified: trunk/plugins/Documentation plugin/Documentation.cs
===================================================================
--- trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 10:35:10 UTC (rev 234)
+++ trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 10:49:51 UTC (rev 235)
@@ -46,7 +46,7 @@
#region SkinControls
// map skin controls to member variables
[SkinControlAttribute(10)]
- protected GUIButtonControl buttonSearch = null;
+ protected GUIButtonControl buttonOpen = null;
[SkinControlAttribute(14)]
protected GUIButtonControl buttonBack = null;
[SkinControlAttribute(12)]
@@ -154,7 +154,13 @@
return Load(GUIGraphicsContext.Skin + @"\Documentation.xml");
}
- protected override void OnClicked(int controlId, GUIControl control,
+ protected override void OnPageLoad()
+ {
+ GetAndDisplayArticle(String.Empty); // display start page
+ base.OnPageLoad();
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control,
MediaPortal.GUI.Library.Action.ActionType actionType)
{
// we don't want the user to start another search while one is already active
@@ -162,7 +168,7 @@
return;
// Here we want to open the OSD Keyboard to enter the searchstring
- if (control == buttonSearch)
+ if (control == buttonOpen)
{
// If the search Button was clicked we need to bring up the search keyboard.
VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow(
@@ -181,23 +187,9 @@
searchterm = keyboard.Text;
// If there was a string entered try getting the article.
- if (searchterm != "")
- {
- Log.Info(_PluginName + ": Searchterm gotten from OSD keyboard: {0}",
- searchterm);
- GetAndDisplayArticle(searchterm);
- }
- // Else display an error dialog.
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
- (int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2500)); // No searchterm entered!
- dlg.SetLine(2, String.Empty);
- dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter valid searchterm!
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
+ Log.Info(_PluginName + ": Searchterm gotten from OSD keyboard: {0}",
+ searchterm);
+ GetAndDisplayArticle(searchterm);
}
// The Button holding the Links to other articles
if (control == buttonLinks)
@@ -322,7 +314,7 @@
}
}
- // The main function.
+ // The core function.
void GetAndDisplayArticle(string searchterm)
{
BackgroundWorker worker = new BackgroundWorker();
@@ -358,8 +350,8 @@
searchtermLabel.Label = e.Argument.ToString();
DocumentationPage page =
new DocumentationPage(e.Argument.ToString());
- _pageText = page.GetText();
- _linkArray = page.GetLinkArray();
+ _pageText = page.text;
+ _linkArray = page.linkArray();
_imageNameArray = page.GetImageArray();
_imageDescArray = page.GetImagedescArray();
Modified: trunk/plugins/Documentation plugin/DocumentationPage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 10:35:10 UTC (rev 234)
+++ trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 10:49:51 UTC (rev 235)
@@ -29,6 +29,7 @@
using System.Net;
using System.IO;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading;
using System.Collections;
using MediaPortal.GUI.Library;
@@ -44,72 +45,30 @@
public class DocumentationPage
{
#region vars
- private string _WikiURL = "http://wiki.team-mediaportal.com/{0}?action=raw";
+ public string text = string.Empty;
+ public ArrayList linkArray = new ArrayList();
+ public ArrayList imageArray = new ArrayList();
+ public ArrayList imageDescArray = new ArrayList();
+ private string _WikiURL = "http://wiki.team-mediaportal.com/{0}?action=raw";
private string _imagePattern = "attachment:";
- private string _title = string.Empty;
- private string _unparsedPage = string.Empty;
- private string _parsedPage = string.Empty;
- private ArrayList _linkArray = new ArrayList();
- private ArrayList _imageArray = new ArrayList();
- private ArrayList _imageDescArray = new ArrayList();
#endregion
#region constructors
/// <summary>This constructor creates a new WikipediaArticle</summary>
- /// <summary>Searchterm and language need to be given</summary>
- /// <param name="title">The article's title</param>
- /// <param name="language">Language of the Wikipedia page</param>
- public DocumentationPage(string title)
+ /// <param name="pageName">The article's page name</param>
+ public DocumentationPage(string pageName)
{
- this._title = title;
- GetWikipediaXML();
+ GetWikiPage(pageName);
ParseWikipediaArticle();
ParseLinksAndImages();
}
#endregion
- /// <summary>Returns the parsed article text.</summary>
- /// <returns>String: parsed article</returns>
- public string GetText()
+ /// <summary>Downloads the raw Wiki code.</summary>
+ private void GetWikiPage(string pageName)
{
- return _parsedPage;
- }
-
- /// <summary>Returns the title of the article. Can differ from the passed parameter on
- /// redirects for example.</summary>
- /// <returns>String: title of the article</returns>
- public string GetTitle()
- {
- return _title;
- }
-
- /// <summary>Returns all names of images.</summary>
- /// <returns>StringArray: images used in this article</returns>
- public ArrayList GetImageArray()
- {
- return _imageArray;
- }
-
- /// <summary>Returns all descriptions of images.</summary>
- /// <returns>StringArray: images used in this article</returns>
- public ArrayList GetImagedescArray()
- {
- return _imageDescArray;
- }
-
- /// <summary>Returns the titles of all linked articles.</summary>
- /// <returns>StringArray: titles of linked (internal) Wikipedia articles</returns>
- public ArrayList GetLinkArray()
- {
- return _linkArray;
- }
-
- /// <summary>Downloads the xml content from Wikipedia and cuts metadata like version
- /// info.</summary>
- private void GetWikipediaXML()
- {
// Build the URL to the Wikipedia page
- System.Uri url = new System.Uri(String.Format(_WikiURL, this._title));
+ System.Uri url = new System.Uri(String.Format(_WikiURL, this._pageName));
Log.Info("Wikipedia: Trying to get following URL: {0}", url.ToString());
// Here we get the content from the web and put it to a string
@@ -120,7 +79,8 @@
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
Stream data = client.OpenRead(url);
StreamReader reader = new StreamReader(data);
- this._unparsedPage = reader.ReadToEnd();
+ //this._unparsedPage = reader.ReadToEnd();
+ this.text = reader.ReadToEnd();
reader.Close();
Log.Info("Wikipedia: Success! Downloaded all data.");
}
@@ -134,227 +94,83 @@
/// <summary>Cuts all special wiki syntax from the article to display plain text</summary>
private void ParseWikipediaArticle()
{
- string tempParsedArticle = this._unparsedPage;
+ //string tempParsedPage = this._unparsedPage;
+ string tempParsedPage = this.text;
- // Check if the article is empty, if so do not parse.
- if (tempParsedArticle == string.Empty)
+ if (this.text.Length > 10 && this.text.Substring(0, 10) == "#REDIRECT ")
{
- Log.Info("Wikipedia: Empty article found. Try another Searchterm.");
- this._unparsedPage = string.Empty;
- }
- // Here we check if there is only a redirect as article to handle it as a special
- // article type
- else if (tempParsedArticle.IndexOf("#REDIRECT") == 0)
- {
Log.Info("Wikipedia: #REDIRECT found.");
- int iStart = tempParsedArticle.IndexOf("[[") + 2;
- int iEnd = tempParsedArticle.IndexOf("]]", iStart);
- // Extract the Text
- string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
- this._unparsedPage = string.Empty;
- this._title = keyword;
- GetWikipediaXML();
+ GetWikiPage(this.text.Substring(10));
ParseWikipediaArticle();
}
- // Finally a well-formed article ;-)
else
{
Log.Info("Wikipedia: Starting parsing.");
- StringBuilder builder = new StringBuilder(tempParsedArticle);
- int iStart = 0;
- int iEnd = 0;
- // Remove HTML comments
- Log.Debug("Wikipedia: Remove HTML comments.");
- while (tempParsedArticle.IndexOf("<!--") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("<!--");
- iEnd = tempParsedArticle.IndexOf("-->", iStart) + 6;
+ // remove control codes & remarks (#blah)
+ this.text = Regex.Replace(this.text, @"^#.+\n", String.Empty,
+ RegexOptions.Multiline);
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
- tempParsedArticle = builder.ToString();
- }
+ // TODO: no interpretation in headers (not even ``)
+
+ // explicit hyperlinks ([:pagename:link text])
+ this.text = Regex.Replace(this.text, @"\[:[^:]+:(?: |\t)*([^\]]+)\]",
+ "[$1]");
- // surrounded by {{ and }} is (atm) unusable stuff.
- //Log.Debug("Wikipedia: Remove stuff between {{ and }}.");
- while (tempParsedArticle.IndexOf("{{") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("{{");
- int iStart2 = iStart;
- iEnd = tempParsedArticle.IndexOf("}}") + 2;
+ // TODO: [:page name]
+ // TODO: ["page name"]
+
+ // camelcase hyperlinks that are not in headers (PageName)
+ // TODO: prevent camelcase links inside explicit hyperlinks
+ this.text = Regex.Replace(this.text, @"(?<!^=(?: )+|\w)((?:[A-Z][a-z0-9]+){2,})(?!\w)",
+ "[$1]", RegexOptions.Multiline);
- // Between {{ and }} we can again have inner sets of {{ and }}
- while (tempParsedArticle.IndexOf("{{", iStart2 + 2) >= 0 &&
- tempParsedArticle.IndexOf("{{", iStart2 + 2) < iEnd)
- {
- iStart2 = tempParsedArticle.IndexOf("{{", iStart2 + 2);
- iEnd = tempParsedArticle.IndexOf("}}", iStart2) + 2;
- iEnd = tempParsedArticle.IndexOf("}}", iEnd) + 2;
- }
+ // de-linked camelcase (!PageName)
+ this.text = Regex.Replace(this.text, @"(?<=\W)!((?:[A-Z][a-z0-9]+){2,})(?=\W)",
+ "$1");
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
+ // TODO: /SubPage, SomePage/SomeSubPage
+
+ // TODO: Wiki:WikiPage, MoinMoin:SomePage
+
+ // enclosed external hyperlinks ([http://example.com])
+ this.text = Regex.Replace(this.text, @"\[(http://[^ \]]+)\]", "$1");
- tempParsedArticle = builder.ToString();
- }
+ // external hyperlinks with label ([http://example.com an example])
+ this.text = Regex.Replace(this.text, @"\[(http://[^ \]]+) ([^\]]+)\]", "$2 ($1)");
- // surrounded by {| and |} is (atm) unusable stuff.
- //Log.Debug("Wikipedia: Remove stuff between {| and |}.");
- while (tempParsedArticle.IndexOf("{|") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("{|");
- iEnd = tempParsedArticle.IndexOf("|}") + 2;
+ // images (attachment:file.gif)
+ this.text = Regex.Replace(this.text, @"attachment:([^\s\|]+)(?:\.gif|\.jpg)",
+ "[img:$1]");
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
+ // TODO: attachment:file.zip
+
+ // TODO: bold & italic ('''text''' -> *text* & /text/)
- tempParsedArticle = builder.ToString();
- }
+ // TODO: lists
+
+ // tables (|| cell 1 || cell 2 ||)
+ this.text = Regex.Replace(this.text, @"\|{2,}<[^>]*>", "|");
- // Remove audio links.
- Log.Debug("Wikipedia: Remove audio links.");
- while (tempParsedArticle.IndexOf("<span") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("<span");
- iEnd = tempParsedArticle.IndexOf("</span>") + 13;
+ // single linebreaks in code, except ones around headers and tables
+ this.text = Regex.Replace(this.text, @"(?<!\r\n|=|\|)\r\n(?!\r\n|=|\|)",
+ " ");
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
+ // paragraphs with excessive linebreaks
+ this.text = Regex.Replace(this.text, @"(?:\r\n){2,}",
+ Environment.NewLine + Environment.NewLine);
- tempParsedArticle = builder.ToString();
- }
+ // whitespace around titles
+ this.text = Regex.Replace(this.text, @"(?:\r\n)+(=.+=)(?:\r\n)+",
+ Environment.NewLine + Environment.NewLine + "$1" + Environment.NewLine);
- // Remove web references.
- Log.Debug("Wikipedia: Remove web references.");
- while (tempParsedArticle.IndexOf("<ref>") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("<ref");
- iEnd = tempParsedArticle.IndexOf("</ref>") + 12;
+ // forced linebreaks ([[BR]])
+ this.text = Regex.Replace(this.text, @"\[\[BR\]\]", Environment.NewLine);
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
+ // quote escaping (``)
+ this.text = Regex.Replace(this.text, @"``", String.Empty);
- tempParsedArticle = builder.ToString();
- }
-
- // Remove <br />
- Log.Debug("Wikipedia: Remove <br />.");
- builder.Replace("<br />", "\n");
- builder.Replace("<br style="clear:both"/>", "\n");
- builder.Replace("<br style="clear:left"/>", "\n");
- builder.Replace("<br style="clear:right"/>", "\n");
-
- // Remove <sup>
- Log.Debug("Wikipedia: Remove <sup>.");
- builder.Replace("<sup>", "^");
- builder.Replace("</sup>", "");
-
- // surrounded by ''' and ''' is bold text, atm also unusable.
- Log.Debug("Wikipedia: Remove \'\'\'.");
- builder.Replace("'''", "");
-
- // surrounded by '' and '' is italic text, atm also unusable.
- Log.Debug("Wikipedia: Remove \'\'.");
- builder.Replace("''", "");
-
- // Display === as newlines (meaning new line for every ===).
- Log.Debug("Wikipedia: Display === as 1 newlines.");
- builder.Replace("===", "\n");
-
- // Display == as newlines (meaning new line for every ==).
- Log.Debug("Wikipedia: Display == as 1 newline.");
- builder.Replace("==", "\n");
-
- // Display * as list (meaning new line for every *).
- Log.Debug("Wikipedia: Display * as list.");
- builder.Replace("*", "\n +");
-
- // Remove HTML whitespace.
- Log.Debug("Wikipedia: Remove HTML whitespace.");
- builder.Replace(" ", " ");
-
- // Display " as ".
- Log.Debug("Wikipedia: Remove Quotations.");
- builder.Replace(""", "\"");
-
- // Display — as -.
- Log.Debug("Wikipedia: Remove —.");
- builder.Replace("—", "-");
-
- // Remove gallery tags.
- Log.Debug("Wikipedia: Remove gallery tags.");
- builder.Replace("<gallery>", "");
- builder.Replace("</gallery>", "");
-
- // Remove gallery tags.
- Log.Debug("Wikipedia: Remove &.");
- builder.Replace("&", "&");
-
- // Remove (too many) newlines
- Log.Debug("Wikipedia: Remove (too many) newlines.");
- builder.Replace("\n\n\n\n", "\n");
- builder.Replace("\n\n\n", "\n");
- builder.Replace("\n\n", "\n");
-
- // Remove (too many) newlines
- Log.Debug("Wikipedia: Remove (too many) whitespaces.");
- builder.Replace(" ", " ");
- builder.Replace(" ", " ");
- builder.Replace(" ", " ");
-
- tempParsedArticle = builder.ToString();
-
- // The text shouldn't start with a newline.
- if (tempParsedArticle.IndexOf("\n") == 0)
- tempParsedArticle.Remove(0, 2);
-
- // For Debug purposes it is nice to see how the whole article text is parsed until
- // here
- //Log.Debug(tempParsedArticle);
-
Log.Info("Wikipedia: Finished parsing.");
- this._unparsedPage = tempParsedArticle;
}
}
@@ -363,8 +179,9 @@
private void ParseLinksAndImages()
{
Log.Info("Wikipedia: Starting parsing of links and images.");
- string tempParsedArticle = this._unparsedPage;
- int iStart = 0, iEnd = 0, iPipe = 0;
+ //string tempParsedArticle = this._unparsedPage;
+ string tempParsedArticle = this.text;
+ int iStart = 0, iEnd = 0, iPipe = 0;
// Surrounded by [[IMAGEPATTERN: and ]] are the links to IMAGES.
// We need to check for the localized image keyword but also for the English as this
@@ -421,8 +238,8 @@
int iEnddesc = keyword.LastIndexOf("]]");
string imagedesc = keyword.Substring(iStartdesc, iEnddesc - iStartdesc); ;
- this._imageArray.Add(imagename);
- this._imageDescArray.Add(imagedesc);
+ this.imageArray.Add(imagename);
+ this.imageDescArray.Add(imagedesc);
Log.Debug("Wikipedia: Image added: {0}, {1}", imagedesc, imagename);
tempParsedArticle = tempParsedArticle.Substring(0, iStart) +
@@ -447,9 +264,9 @@
{
parsedKeyword = keyword.Substring(iPipe + 1, keyword.Length - iPipe - 3);
parsedLink = keyword.Substring(2, iPipe - 2);
- if (!this._linkArray.Contains(parsedLink))
+ if (!this.linkArray.Contains(parsedLink))
{
- this._linkArray.Add(parsedLink);
+ this.linkArray.Add(parsedLink);
//Log.Debug("Wikipedia: Link added: {0}, {1}", parsedLink, parsedKeyword);
}
}
@@ -463,9 +280,9 @@
{
// for the 3rd the article and displayed text are equal [[article]].
parsedKeyword = keyword.Substring(2, keyword.Length - 4);
- if (!this._linkArray.Contains(parsedKeyword))
+ if (!this.linkArray.Contains(parsedKeyword))
{
- this._linkArray.Add(parsedKeyword);
+ this.linkArray.Add(parsedKeyword);
//Log.Debug("Wikipedia: Link added: {0}", parsedKeyword);
}
}
@@ -481,7 +298,7 @@
Log.Error("Wikipedia: {0}", e.ToString());
Log.Error("Wikipedia: tempArticle: {0}", tempParsedArticle);
}
- Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", _linkArray.Count);
+ Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", linkArray.Count);
// surrounded by [ and ] are external Links. Need to be removed.
Log.Debug("Wikipedia: Removing external links");
@@ -505,7 +322,7 @@
}
Log.Info("Wikipedia: Finished parsing of links and images.");
- this._parsedPage = tempParsedArticle;
+ //this._parsedPage = tempParsedArticle;
}
}
}
\ No newline at end of file
Added: trunk/plugins/Documentation plugin/skin/Documentation.xml
===================================================================
--- trunk/plugins/Documentation plugin/skin/Documentation.xml (rev 0)
+++ trunk/plugins/Documentation plugin/skin/Documentation.xml 2007-03-27 10:49:51 UTC (rev 235)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<window>
+ <id>9999</id>
+ <defaultcontrol>10</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <define>#header.label:Documentation</define>
+ <define>#header.image:wiki.team-mediaportal.com.png</define>
+ <define>#header.hover:hover_wikipedia.png</define>
+ <controls>
+ <import>common.window.xml</import>
+ <control>
+ <type>group</type>
+ <description>group element</description>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <animation effect="slide" time="250" start="-300,0">WindowOpen</animation>
+ <animation effect="slide" time="500" end="0,-300">WindowClose</animation>
+ <layout>StackLayout</layout>
+ <posX>60</posX>
+ <posY>97</posY>
+ <control>
+ <description>Page name entry</description>
+ <type>button</type>
+ <id>10</id>
+ <onup>17</onup>
+ <label>Go to...</label>
+ </control>
+ <control>
+ <description>Back to the text (when viewing an image)</description>
+ <type>button</type>
+ <id>14</id>
+ <label>2514</label>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Links Button</description>
+ <type>button</type>
+ <id>12</id>
+ <label>2511</label>
+ </control>
+ <control>
+ <description>Images Button</description>
+ <type>button</type>
+ <id>13</id>
+ <ondown>99</ondown>
+ <label>2515</label>
+ </control>
+ </control>
+ <control>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <description>Article title/searchterm</description>
+ <type>label</type>
+ <id>4</id>
+ <posX>280</posX>
+ <posY>70</posY>
+ <visible>no</visible>
+ <label>Article title/searchterm</label>
+ <font>font16</font>
+ <align>left</align>
+ </control>
+ <control>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <description>Image description</description>
+ <type>label</type>
+ <id>5</id>
+ <posX>264</posX>
+ <posY>70</posY>
+ <visible>no</visible>
+ <label>Image description</label>
+ <font>font16</font>
+ <align>left</align>
+ </control>
+ <control>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <description>Here is the article text displayed</description>
+ <type>textbox</type>
+ <id>20</id>
+ <posX>280</posX>
+ <posY>92</posY>
+ <visible>no</visible>
+ <width>380</width>
+ <height>444</height>
+ <text />
+ </control>
+ <control>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <description>Article Image</description>
+ <type>image</type>
+ <id>25</id>
+ <posX>264</posX>
+ <posY>72</posY>
+ <visible>no</visible>
+ <width>440</width>
+ <height>466</height>
+ <texture />
+ <colorkey>00000000</colorkey>
+ <colordiffuse>White</colordiffuse>
+ <centered>yes</centered>
+ <keepaspectratio>yes</keepaspectratio>
+ </control>
+ </controls>
+</window>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 10:35:49
|
Revision: 234
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=234&view=rev
Author: pbb72
Date: 2007-03-27 03:35:10 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
fixed projectfile, renamed identifiers, some simplifications
Modified Paths:
--------------
trunk/plugins/Documentation plugin/Documentation.cs
trunk/plugins/Documentation plugin/Documentation.csproj
trunk/plugins/Documentation plugin/DocumentationImage.cs
trunk/plugins/Documentation plugin/DocumentationPage.cs
Modified: trunk/plugins/Documentation plugin/Documentation.cs
===================================================================
--- trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 10:23:29 UTC (rev 233)
+++ trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 10:35:10 UTC (rev 234)
@@ -36,18 +36,17 @@
using MediaPortal.Util;
using MediaPortal.Configuration;
-namespace Wikipedia
+namespace Documentation
{
/// <summary>
- /// Windowplugin to search in Wikipedia and display articles using the MP Wikipedia Classes.
+ /// MediaPortal Window plugin to display the documentation wiki.
/// </summary>
- public class GUIWikipedia : GUIWindow, ISetupForm
+ public class GUIDocumentation : GUIWindow, ISetupForm
{
#region SkinControls
+ // map skin controls to member variables
[SkinControlAttribute(10)]
protected GUIButtonControl buttonSearch = null;
- [SkinControlAttribute(11)]
- protected GUIButtonControl buttonLocal = null;
[SkinControlAttribute(14)]
protected GUIButtonControl buttonBack = null;
[SkinControlAttribute(12)]
@@ -66,35 +65,36 @@
protected GUIImage imageControl = null;
#endregion
- private string language = "Default";
- private string articletext = string.Empty;
- private ArrayList linkArray = new ArrayList();
- private ArrayList imagenameArray = new ArrayList();
- private ArrayList imagedescArray = new ArrayList();
+ public string _PluginName = "Documentation";
+ private int _WindowID = 9999;
+ private string _pageText = string.Empty;
+ private ArrayList _linkArray = new ArrayList();
+ private ArrayList _imageNameArray = new ArrayList();
+ private ArrayList _imageDescArray = new ArrayList();
-
- public GUIWikipedia()
+ public GUIDocumentation()
{
- GetID = (int)GUIWindow.Window.WINDOW_WIKIPEDIA;
+ GetID = _WindowID;
}
+
#region ISetupForm Members
// Returns the name of the plugin which is shown in the plugin menu
public string PluginName()
{
- return "Wikipedia";
+ return _PluginName;
}
// Returns the description of the plugin is shown in the plugin menu
public string Description()
{
- return "A Plugin to search in Wikipedia";
+ return "Displays the MediaPortal Documentation wiki.";
}
// Returns the author of the plugin which is shown in the plugin menu
public string Author()
{
- return "Maschine";
+ return "Peter";
}
// show the setup dialog
@@ -112,19 +112,19 @@
// get ID of windowplugin belonging to this setup
public int GetWindowId()
{
- return 4711;
+ return _WindowID;
}
// Indicates if plugin is enabled by default;
public bool DefaultEnabled()
{
- return false;
+ return true;
}
// indicates if a plugin has its own setup screen
public bool HasSetup()
{
- return false;
+ return true;
}
/// <summary>
@@ -138,22 +138,24 @@
/// <param name="strPictureImage">subpicture for the button or empty for none</param>
/// <returns>true : plugin needs its own button on home
/// false : plugin does not need its own button on home</returns>
- public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ public bool GetHome(out string strButtonText, out string strButtonImage,
+ out string strButtonImageFocus, out string strPictureImage)
{
- strButtonText = GUILocalizeStrings.Get(2516);
- strButtonImage = "";
- strButtonImageFocus = "";
- strPictureImage = "";
+ strButtonText = _PluginName;
+ strButtonImage = String.Empty;
+ strButtonImageFocus = String.Empty;
+ strPictureImage = String.Empty;
return true;
}
#endregion
public override bool Init()
{
- return Load(GUIGraphicsContext.Skin + @"\wikipedia.xml");
+ return Load(GUIGraphicsContext.Skin + @"\Documentation.xml");
}
- protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
+ protected override void OnClicked(int controlId, GUIControl control,
+ MediaPortal.GUI.Library.Action.ActionType actionType)
{
// we don't want the user to start another search while one is already active
if (_workerCompleted == false)
@@ -163,7 +165,8 @@
if (control == buttonSearch)
{
// If the search Button was clicked we need to bring up the search keyboard.
- VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
+ VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
if (null == keyboard) return;
string searchterm = string.Empty;
keyboard.IsSearchKeyboard = true;
@@ -171,7 +174,7 @@
keyboard.Text = "";
keyboard.DoModal(GetID); // show it...
- Log.Info("Wikipedia: OSD keyboard loaded!");
+ Log.Info(_PluginName + ": OSD keyboard loaded!");
// If input is finished, the string is saved to the searchterm var.
if (keyboard.IsConfirmed)
@@ -180,76 +183,53 @@
// If there was a string entered try getting the article.
if (searchterm != "")
{
- Log.Info("Wikipedia: Searchterm gotten from OSD keyboard: {0}", searchterm);
+ Log.Info(_PluginName + ": Searchterm gotten from OSD keyboard: {0}",
+ searchterm);
GetAndDisplayArticle(searchterm);
}
// Else display an error dialog.
else
{
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
dlg.SetLine(1, GUILocalizeStrings.Get(2500)); // No searchterm entered!
dlg.SetLine(2, String.Empty);
- dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter a valid searchterm!
+ dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter valid searchterm!
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
}
- // This is the control to select the local Wikipedia site.
- if (control == buttonLocal)
- {
- // Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
- if (pDlgOK != null)
- {
- pDlgOK.Reset();
- pDlgOK.SetHeading(GUILocalizeStrings.Get(2502)); //Select your local Wikipedia:
-
- // Add all the local sites we want to be displayed starting with int 0.
- MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- String allsites = langreader.GetValueAsString("Allsites", "sitenames", "");
- Log.Info("Wikipedia: available sites: " + allsites);
- String[] siteArray = allsites.Split(',');
- for (int i = 0; i < siteArray.Length; i++)
- {
- int stringno = langreader.GetValueAsInt(siteArray[i], "string", 2006);
- pDlgOK.Add(GUILocalizeStrings.Get(stringno)); //English, German, French ...
- }
-
- pDlgOK.DoModal(GetID);
- if (pDlgOK.SelectedLabel >= 0)
- {
- SelectLocalWikipedia(pDlgOK.SelectedLabel, siteArray);
- }
- }
- }
// The Button holding the Links to other articles
if (control == buttonLinks)
{
- if (linkArray.Count > 0)
+ if (_linkArray.Count > 0)
{
// Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_MENU);
if (pDlgOK != null)
{
pDlgOK.Reset();
pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:
// Add all the links from the linkarray.
- foreach (string link in linkArray)
+ foreach (string link in _linkArray)
{
pDlgOK.Add(link);
}
pDlgOK.DoModal(GetID);
if (pDlgOK.SelectedLabel >= 0)
{
- Log.Info("Wikipedia: new search from the links array: {0}", pDlgOK.SelectedLabelText);
+ Log.Info(_PluginName + ": new search from the links array: {0}",
+ pDlgOK.SelectedLabelText);
GetAndDisplayArticle(pDlgOK.SelectedLabelText);
}
}
}
else
{
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
dlg.SetLine(1, GUILocalizeStrings.Get(2506)); // No Links from this article.
dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -259,33 +239,37 @@
// The Button containing a list of all images from the article
if (control == buttonImages)
{
- if (imagedescArray.Count > 0)
+ if (_imageDescArray.Count > 0)
{
// Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_MENU);
if (pDlgOK != null)
{
pDlgOK.Reset();
pDlgOK.SetHeading(GUILocalizeStrings.Get(2507)); //Images from this article
// Add all the images from the imagearray.
- foreach (string image in imagedescArray)
+ foreach (string image in _imageDescArray)
{
pDlgOK.Add(image);
}
pDlgOK.DoModal(GetID);
if (pDlgOK.SelectedLabel >= 0)
{
- Log.Info("Wikipedia: new search from the image array: {0}", imagedescArray[pDlgOK.SelectedId - 1]);
- GetAndDisplayImage(imagenameArray[pDlgOK.SelectedId - 1].ToString(), imagedescArray[pDlgOK.SelectedId - 1].ToString());
+ Log.Info(_PluginName + ": new search from the image array: {0}",
+ _imageDescArray[pDlgOK.SelectedId - 1]);
+ GetAndDisplayImage(_imageNameArray[pDlgOK.SelectedId - 1].ToString(),
+ _imageDescArray[pDlgOK.SelectedId - 1].ToString());
}
}
}
else
{
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in this article.
+ dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in art.
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
}
@@ -306,24 +290,11 @@
base.OnClicked(controlId, control, actionType);
}
- // Depending on which Entry was selected from the listbox we chose the language here.
- private void SelectLocalWikipedia(int labelnumber, String[] siteArray)
- {
- MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- language = siteArray[labelnumber];
-
- if (searchtermLabel.Label != string.Empty && searchtermLabel.Label != "Wikipedia")
- {
- Log.Info("Wikipedia: language changed to {0}. Display article {1} again.", language, searchtermLabel.Label);
- GetAndDisplayArticle(searchtermLabel.Label);
- }
- }
-
private void GetAndDisplayImage(string imagename, string imagedesc)
{
- WikipediaImage image = new WikipediaImage(imagename, language);
+ WikipediaImage image = new WikipediaImage(imagename);
string imagefilename = image.GetImageFilename();
- Log.Info("Wikipedia: Trying to display image file: {0}", imagefilename);
+ Log.Info(_PluginName + ": Trying to display image file: {0}", imagefilename);
if (imagefilename != string.Empty && System.IO.File.Exists(imagefilename))
{
@@ -342,7 +313,8 @@
}
else
{
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
+ (int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
dlg.SetLine(1, GUILocalizeStrings.Get(2512)); // Can't display image.
dlg.SetLine(2, GUILocalizeStrings.Get(2513)); // Please have a look at the logfile.
@@ -380,23 +352,27 @@
GUIControl.HideControl(GetID, imagedescLabel.GetID);
if (buttonBack.IsVisible)
GUIControl.HideControl(GetID, buttonBack.GetID);
- linkArray.Clear();
- imagenameArray.Clear();
- imagedescArray.Clear();
+ _linkArray.Clear();
+ _imageNameArray.Clear();
+ _imageDescArray.Clear();
searchtermLabel.Label = e.Argument.ToString();
- WikipediaArticle article = new WikipediaArticle(e.Argument.ToString(), language);
- articletext = article.GetArticleText();
- linkArray = article.GetLinkArray();
- imagenameArray = article.GetImageArray();
- imagedescArray = article.GetImagedescArray();
- language = article.GetLanguage();
+ DocumentationPage page =
+ new DocumentationPage(e.Argument.ToString());
+ _pageText = page.GetText();
+ _linkArray = page.GetLinkArray();
+ _imageNameArray = page.GetImageArray();
+ _imageDescArray = page.GetImagedescArray();
- if (articletext == "REDIRECT")
- txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" + GUILocalizeStrings.Get(2510); //This page is only a redirect. Please chose the redirect aim from the link list.
- else if (articletext == string.Empty)
- txtArticle.Label = GUILocalizeStrings.Get(2504); //Sorry, no Article was found for your searchterm...
+ if (_pageText == "REDIRECT")
+ txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" +
+ GUILocalizeStrings.Get(2510);
+ //This page is only a redirect.
+ //Please chose the redirect aim from the link list.
+ else if (_pageText == string.Empty)
+ txtArticle.Label = GUILocalizeStrings.Get(2504);
+ //Sorry, no Article was found for your searchterm...
else
- txtArticle.Label = articletext;
+ txtArticle.Label = _pageText;
}
_workerCompleted = true;
Modified: trunk/plugins/Documentation plugin/Documentation.csproj
===================================================================
--- trunk/plugins/Documentation plugin/Documentation.csproj 2007-03-27 10:23:29 UTC (rev 233)
+++ trunk/plugins/Documentation plugin/Documentation.csproj 2007-03-27 10:35:10 UTC (rev 234)
@@ -32,15 +32,30 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\Apps\Desktop\MediaPortal\Core.DLL</HintPath>
</Reference>
+ <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>D:\Apps\Desktop\MediaPortal\Plugins\Windows\Dialogs.DLL</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
+ <Reference Include="Utils, Version=1.0.2588.17918, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>D:\Apps\Desktop\MediaPortal\Utils.DLL</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="Class1.cs" />
+ <Compile Include="Documentation.cs" />
+ <Compile Include="DocumentationImage.cs" />
+ <Compile Include="DocumentationPage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="skin\Documentation.xml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Modified: trunk/plugins/Documentation plugin/DocumentationImage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationImage.cs 2007-03-27 10:23:29 UTC (rev 233)
+++ trunk/plugins/Documentation plugin/DocumentationImage.cs 2007-03-27 10:35:10 UTC (rev 234)
@@ -35,7 +35,7 @@
using MediaPortal.Util;
using MediaPortal.Configuration;
-namespace Wikipedia
+namespace Documentation
{
/// <summary>
/// This class holds all the logic to get an image from Wikipedia for further using in MP.
Modified: trunk/plugins/Documentation plugin/DocumentationPage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 10:23:29 UTC (rev 233)
+++ trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 10:35:10 UTC (rev 234)
@@ -35,23 +35,23 @@
using MediaPortal.Util;
using MediaPortal.Configuration;
-namespace Wikipedia
+namespace Documentation
{
/// <summary>
- /// This class holds all the logic to get info from Wikipedia and parse it for further using in MP.
+ /// This class holds all the logic to get info from the MediaPortal Wiki and parse it for
+ /// further usage.
/// </summary>
- public class WikipediaArticle
+ public class DocumentationPage
{
#region vars
- private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
- private string imagePattern = "Image";
- private string title = string.Empty;
- private string unparsedArticle = string.Empty;
- private string parsedArticle = string.Empty;
- private string language = "Default";
- private ArrayList linkArray = new ArrayList();
- private ArrayList imageArray = new ArrayList();
- private ArrayList imagedescArray = new ArrayList();
+ private string _WikiURL = "http://wiki.team-mediaportal.com/{0}?action=raw";
+ private string _imagePattern = "attachment:";
+ private string _title = string.Empty;
+ private string _unparsedPage = string.Empty;
+ private string _parsedPage = string.Empty;
+ private ArrayList _linkArray = new ArrayList();
+ private ArrayList _imageArray = new ArrayList();
+ private ArrayList _imageDescArray = new ArrayList();
#endregion
#region constructors
@@ -59,106 +59,68 @@
/// <summary>Searchterm and language need to be given</summary>
/// <param name="title">The article's title</param>
/// <param name="language">Language of the Wikipedia page</param>
- public WikipediaArticle(string title, string language)
+ public DocumentationPage(string title)
{
- SetLanguage(language);
- this.title = title;
+ this._title = title;
GetWikipediaXML();
ParseWikipediaArticle();
ParseLinksAndImages();
}
-
- /// <summary>This constructor creates a new WikipediaArticle.</summary>
- /// <summary>Only called with a title string, language set to default.</summary>
- /// <param name="title">The article's title</param>
- public WikipediaArticle(string title)
- : this(title, "Default")
- {
- }
-
- /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
- /// <summary>Uses an empty searchterm and the default language.</summary>
- public WikipediaArticle()
- : this(string.Empty, "Default")
- {
- }
#endregion
- /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
- private void SetLanguage(string language)
- {
- if (language == "Default")
- {
- MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
- language = xmlreader.GetValueAsString("skin", "language", "English");
- }
-
- this.language = language;
-
- MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- this.WikipediaURL = detailxmlreader.GetValueAsString(language, "url", "http://en.wikipedia.org/wiki/Special:Export/");
- this.imagePattern = detailxmlreader.GetValueAsString(language, "imagepattern", "Image");
- Log.Info("Wikipedia: Language set to " + language + ".");
- }
-
/// <summary>Returns the parsed article text.</summary>
/// <returns>String: parsed article</returns>
- public string GetArticleText()
+ public string GetText()
{
- return parsedArticle;
+ return _parsedPage;
}
- /// <summary>Returns the title of the article. Can differ from the passed parameter on redirects for example.</summary>
+ /// <summary>Returns the title of the article. Can differ from the passed parameter on
+ /// redirects for example.</summary>
/// <returns>String: title of the article</returns>
public string GetTitle()
{
- return title;
+ return _title;
}
/// <summary>Returns all names of images.</summary>
/// <returns>StringArray: images used in this article</returns>
public ArrayList GetImageArray()
{
- return imageArray;
+ return _imageArray;
}
/// <summary>Returns all descriptions of images.</summary>
/// <returns>StringArray: images used in this article</returns>
public ArrayList GetImagedescArray()
{
- return imagedescArray;
+ return _imageDescArray;
}
/// <summary>Returns the titles of all linked articles.</summary>
/// <returns>StringArray: titles of linked (internal) Wikipedia articles</returns>
public ArrayList GetLinkArray()
{
- return linkArray;
+ return _linkArray;
}
- /// <summary>Returns the currently active language.</summary>
- /// <returns>String: language</returns>
- public string GetLanguage()
- {
- return language;
- }
-
- /// <summary>Downloads the xml content from Wikipedia and cuts metadata like version info.</summary>
+ /// <summary>Downloads the xml content from Wikipedia and cuts metadata like version
+ /// info.</summary>
private void GetWikipediaXML()
{
- string wikipediaXML = string.Empty;
// Build the URL to the Wikipedia page
- System.Uri url = new System.Uri(WikipediaURL + this.title);
+ System.Uri url = new System.Uri(String.Format(_WikiURL, this._title));
Log.Info("Wikipedia: Trying to get following URL: {0}", url.ToString());
// Here we get the content from the web and put it to a string
try
{
WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ client.Headers.Add("user-agent",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
Stream data = client.OpenRead(url);
StreamReader reader = new StreamReader(data);
- wikipediaXML = reader.ReadToEnd();
+ this._unparsedPage = reader.ReadToEnd();
reader.Close();
Log.Info("Wikipedia: Success! Downloaded all data.");
}
@@ -167,36 +129,21 @@
Log.Info("Wikipedia: Exception during downloading:");
Log.Info(e.ToString());
}
-
- if (wikipediaXML.IndexOf("<text xml:space=\"preserve\">") > 0)
- {
- Log.Info("Wikipedia: Extracting unparsed string.");
- int iStart = 0;
- int iEnd = wikipediaXML.Length;
- // Start of the Entry
- iStart = wikipediaXML.IndexOf("<text xml:space=\"preserve\">") + 27;
- // End of the Entry
- iEnd = wikipediaXML.IndexOf("</text>");
- // Extract the Text and update the var
- this.unparsedArticle = wikipediaXML.Substring(iStart, iEnd - iStart);
- Log.Info("Wikipedia: Unparsed string extracted.");
- }
- else
- this.unparsedArticle = string.Empty;
}
/// <summary>Cuts all special wiki syntax from the article to display plain text</summary>
private void ParseWikipediaArticle()
{
- string tempParsedArticle = this.unparsedArticle;
+ string tempParsedArticle = this._unparsedPage;
// Check if the article is empty, if so do not parse.
if (tempParsedArticle == string.Empty)
{
Log.Info("Wikipedia: Empty article found. Try another Searchterm.");
- this.unparsedArticle = string.Empty;
+ this._unparsedPage = string.Empty;
}
- // Here we check if there is only a redirect as article to handle it as a special article type
+ // Here we check if there is only a redirect as article to handle it as a special
+ // article type
else if (tempParsedArticle.IndexOf("#REDIRECT") == 0)
{
Log.Info("Wikipedia: #REDIRECT found.");
@@ -204,8 +151,8 @@
int iEnd = tempParsedArticle.IndexOf("]]", iStart);
// Extract the Text
string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
- this.unparsedArticle = string.Empty;
- this.title = keyword;
+ this._unparsedPage = string.Empty;
+ this._title = keyword;
GetWikipediaXML();
ParseWikipediaArticle();
}
@@ -247,7 +194,8 @@
iEnd = tempParsedArticle.IndexOf("}}") + 2;
// Between {{ and }} we can again have inner sets of {{ and }}
- while (tempParsedArticle.IndexOf("{{", iStart2 + 2) >= 0 && tempParsedArticle.IndexOf("{{", iStart2 + 2) < iEnd)
+ while (tempParsedArticle.IndexOf("{{", iStart2 + 2) >= 0 &&
+ tempParsedArticle.IndexOf("{{", iStart2 + 2) < iEnd)
{
iStart2 = tempParsedArticle.IndexOf("{{", iStart2 + 2);
iEnd = tempParsedArticle.IndexOf("}}", iStart2) + 2;
@@ -401,32 +349,37 @@
if (tempParsedArticle.IndexOf("\n") == 0)
tempParsedArticle.Remove(0, 2);
- // For Debug purposes it is nice to see how the whole article text is parsed until here
+ // For Debug purposes it is nice to see how the whole article text is parsed until
+ // here
//Log.Debug(tempParsedArticle);
Log.Info("Wikipedia: Finished parsing.");
- this.unparsedArticle = tempParsedArticle;
+ this._unparsedPage = tempParsedArticle;
}
}
- /// <summary>Gets Links out of the article. External links are thrown away, links to other wikipedia articles get into the link array, images to the image array</summary>
+ /// <summary>Gets Links out of the article. External links are thrown away, links to other
+ /// wikipedia articles get into the link array, images to the image array</summary>
private void ParseLinksAndImages()
{
Log.Info("Wikipedia: Starting parsing of links and images.");
- string tempParsedArticle = this.unparsedArticle;
+ string tempParsedArticle = this._unparsedPage;
int iStart = 0, iEnd = 0, iPipe = 0;
// Surrounded by [[IMAGEPATTERN: and ]] are the links to IMAGES.
- // We need to check for the localized image keyword but also for the English as this is commonly used in some local sites.
+ // We need to check for the localized image keyword but also for the English as this
+ // is commonly used in some local sites.
// Example: [[Bild:H_NeuesRathaus1.jpg|left|thumb|Das [[Neues Rathaus (Hannover)|Neue Rathaus]] mit Maschteich]]
- while ((iStart = tempParsedArticle.IndexOf("[[" + imagePattern + ":", iStart)) >= 0 || (iStart = tempParsedArticle.IndexOf("[[Image:")) >= 0)
+ while ((iStart = tempParsedArticle.IndexOf("[[" + _imagePattern + ":", iStart)) >= 0 ||
+ (iStart = tempParsedArticle.IndexOf("[[Image:")) >= 0)
{
iEnd = tempParsedArticle.IndexOf("]]", (iStart + 2)) + 2;
int disturbingLink = iStart;
// Descriptions of images can contain links!
- // [[Bild:Hannover Merian.png|thumb|[[Matth?us Merian|Merian]]-Kupferstich um 1650, im Vordergrund Windm?hle auf dem [[Lindener Berg]]]]
- while (tempParsedArticle.IndexOf("[[", disturbingLink + 2) >= 0 && tempParsedArticle.IndexOf("[[", disturbingLink + 2) < iEnd)
+ // [[Bild:Hannover Merian.png|thumb|[[Mattheus Merian|Merian]]-Kupferstich um 1650, im Vordergrund Windmohle auf dem [[Lindener Berg]]]]
+ while (tempParsedArticle.IndexOf("[[", disturbingLink + 2) >= 0 &&
+ tempParsedArticle.IndexOf("[[", disturbingLink + 2) < iEnd)
{
disturbingLink = tempParsedArticle.IndexOf("[[", disturbingLink + 2);
iEnd = tempParsedArticle.IndexOf("]]", disturbingLink) + 2;
@@ -447,11 +400,14 @@
// 1st type of keywords is like [[article|displaytext]]
// for the 2nd the article and displayed text are equal [[article]].
if (linkkeyword.IndexOf("|") > 0)
- linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("|") + 1, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("|") - 1);
+ linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("|") + 1,
+ linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("|") - 1);
else
- linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("[[") + 2, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("[[") - 2);
+ linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("[[") + 2,
+ linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("[[") - 2);
- keyword = keyword.Substring(0, iStartlink) + linkkeyword + keyword.Substring(iEndlink, keyword.Length - iEndlink);
+ keyword = keyword.Substring(0, iStartlink) + linkkeyword +
+ keyword.Substring(iEndlink, keyword.Length - iEndlink);
}
int iStartname = keyword.IndexOf(":") + 1;
@@ -465,11 +421,12 @@
int iEnddesc = keyword.LastIndexOf("]]");
string imagedesc = keyword.Substring(iStartdesc, iEnddesc - iStartdesc); ;
- this.imageArray.Add(imagename);
- this.imagedescArray.Add(imagedesc);
+ this._imageArray.Add(imagename);
+ this._imageDescArray.Add(imagedesc);
Log.Debug("Wikipedia: Image added: {0}, {1}", imagedesc, imagename);
- tempParsedArticle = tempParsedArticle.Substring(0, iStart) + tempParsedArticle.Substring(iEnd, tempParsedArticle.Length - iEnd);
+ tempParsedArticle = tempParsedArticle.Substring(0, iStart) +
+ tempParsedArticle.Substring(iEnd, tempParsedArticle.Length - iEnd);
}
// surrounded by [[ and ]] are the links to other articles.
@@ -490,9 +447,9 @@
{
parsedKeyword = keyword.Substring(iPipe + 1, keyword.Length - iPipe - 3);
parsedLink = keyword.Substring(2, iPipe - 2);
- if (!this.linkArray.Contains(parsedLink))
+ if (!this._linkArray.Contains(parsedLink))
{
- this.linkArray.Add(parsedLink);
+ this._linkArray.Add(parsedLink);
//Log.Debug("Wikipedia: Link added: {0}, {1}", parsedLink, parsedKeyword);
}
}
@@ -506,9 +463,9 @@
{
// for the 3rd the article and displayed text are equal [[article]].
parsedKeyword = keyword.Substring(2, keyword.Length - 4);
- if (!this.linkArray.Contains(parsedKeyword))
+ if (!this._linkArray.Contains(parsedKeyword))
{
- this.linkArray.Add(parsedKeyword);
+ this._linkArray.Add(parsedKeyword);
//Log.Debug("Wikipedia: Link added: {0}", parsedKeyword);
}
}
@@ -524,7 +481,7 @@
Log.Error("Wikipedia: {0}", e.ToString());
Log.Error("Wikipedia: tempArticle: {0}", tempParsedArticle);
}
- Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", linkArray.Count);
+ Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", _linkArray.Count);
// surrounded by [ and ] are external Links. Need to be removed.
Log.Debug("Wikipedia: Removing external links");
@@ -543,11 +500,12 @@
catch (Exception e)
{
Log.Error("Wikipedia: {0}", e.ToString());
- Log.Error("Parsing Error: " + tempParsedArticle + "\nSTART: " + iStart + "\nEND: " + iEnd);
+ Log.Error("Parsing Error: " + tempParsedArticle + "\nSTART: " + iStart + "\nEND: "
+ + iEnd);
}
Log.Info("Wikipedia: Finished parsing of links and images.");
- this.parsedArticle = tempParsedArticle;
+ this._parsedPage = tempParsedArticle;
}
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 10:23:57
|
Revision: 233
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=233&view=rev
Author: pbb72
Date: 2007-03-27 03:23:29 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
added AssemblyInfo
Added Paths:
-----------
trunk/plugins/Documentation plugin/Properties/
trunk/plugins/Documentation plugin/Properties/AssemblyInfo.cs
Added: trunk/plugins/Documentation plugin/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/Documentation plugin/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/Documentation plugin/Properties/AssemblyInfo.cs 2007-03-27 10:23:29 UTC (rev 233)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Documentation")]
+[assembly: AssemblyDescription("MediaPortal Documentation Plugin")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Peter Bremer")]
+[assembly: AssemblyProduct("Documentation")]
+[assembly: AssemblyCopyright("Copyright \xA9 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("dfa46817-9ad5-47d0-b442-4150769a8e1b")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 09:07:34
|
Revision: 232
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=232&view=rev
Author: pbb72
Date: 2007-03-27 02:07:31 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Documentation plugin to browse MP wiki from within MediaPortal.
Based on Wikipedia plugin.
Added Paths:
-----------
trunk/plugins/Documentation plugin/
trunk/plugins/Documentation plugin/Documentation.cs
trunk/plugins/Documentation plugin/Documentation.csproj
trunk/plugins/Documentation plugin/DocumentationImage.cs
trunk/plugins/Documentation plugin/DocumentationPage.cs
Added: trunk/plugins/Documentation plugin/Documentation.cs
===================================================================
--- trunk/plugins/Documentation plugin/Documentation.cs (rev 0)
+++ trunk/plugins/Documentation plugin/Documentation.cs 2007-03-27 09:07:31 UTC (rev 232)
@@ -0,0 +1,407 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+
+namespace Wikipedia
+{
+ /// <summary>
+ /// Windowplugin to search in Wikipedia and display articles using the MP Wikipedia Classes.
+ /// </summary>
+ public class GUIWikipedia : GUIWindow, ISetupForm
+ {
+ #region SkinControls
+ [SkinControlAttribute(10)]
+ protected GUIButtonControl buttonSearch = null;
+ [SkinControlAttribute(11)]
+ protected GUIButtonControl buttonLocal = null;
+ [SkinControlAttribute(14)]
+ protected GUIButtonControl buttonBack = null;
+ [SkinControlAttribute(12)]
+ protected GUIButtonControl buttonLinks = null;
+ [SkinControlAttribute(13)]
+ protected GUIButtonControl buttonImages = null;
+
+ [SkinControlAttribute(4)]
+ protected GUILabelControl searchtermLabel = null;
+ [SkinControlAttribute(5)]
+ protected GUILabelControl imagedescLabel = null;
+ [SkinControlAttribute(20)]
+ protected GUITextControl txtArticle = null;
+
+ [SkinControlAttribute(25)]
+ protected GUIImage imageControl = null;
+ #endregion
+
+ private string language = "Default";
+ private string articletext = string.Empty;
+ private ArrayList linkArray = new ArrayList();
+ private ArrayList imagenameArray = new ArrayList();
+ private ArrayList imagedescArray = new ArrayList();
+
+
+ public GUIWikipedia()
+ {
+ GetID = (int)GUIWindow.Window.WINDOW_WIKIPEDIA;
+ }
+ #region ISetupForm Members
+
+ // Returns the name of the plugin which is shown in the plugin menu
+ public string PluginName()
+ {
+ return "Wikipedia";
+ }
+
+ // Returns the description of the plugin is shown in the plugin menu
+ public string Description()
+ {
+ return "A Plugin to search in Wikipedia";
+ }
+
+ // Returns the author of the plugin which is shown in the plugin menu
+ public string Author()
+ {
+ return "Maschine";
+ }
+
+ // show the setup dialog
+ public void ShowPlugin()
+ {
+ MessageBox.Show("Edit the wikipedia.xml file in MP's root directory to add new sites.");
+ }
+
+ // Indicates whether plugin can be enabled/disabled
+ public bool CanEnable()
+ {
+ return true;
+ }
+
+ // get ID of windowplugin belonging to this setup
+ public int GetWindowId()
+ {
+ return 4711;
+ }
+
+ // Indicates if plugin is enabled by default;
+ public bool DefaultEnabled()
+ {
+ return false;
+ }
+
+ // indicates if a plugin has its own setup screen
+ public bool HasSetup()
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// If the plugin should have its own button on the main menu of Media Portal then it
+ /// should return true to this method, otherwise if it should not be on home
+ /// it should return false
+ /// </summary>
+ /// <param name="strButtonText">text the button should have</param>
+ /// <param name="strButtonImage">image for the button, or empty for default</param>
+ /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
+ /// <param name="strPictureImage">subpicture for the button or empty for none</param>
+ /// <returns>true : plugin needs its own button on home
+ /// false : plugin does not need its own button on home</returns>
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = GUILocalizeStrings.Get(2516);
+ strButtonImage = "";
+ strButtonImageFocus = "";
+ strPictureImage = "";
+ return true;
+ }
+ #endregion
+
+ public override bool Init()
+ {
+ return Load(GUIGraphicsContext.Skin + @"\wikipedia.xml");
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
+ {
+ // we don't want the user to start another search while one is already active
+ if (_workerCompleted == false)
+ return;
+
+ // Here we want to open the OSD Keyboard to enter the searchstring
+ if (control == buttonSearch)
+ {
+ // If the search Button was clicked we need to bring up the search keyboard.
+ VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
+ if (null == keyboard) return;
+ string searchterm = string.Empty;
+ keyboard.IsSearchKeyboard = true;
+ keyboard.Reset();
+ keyboard.Text = "";
+ keyboard.DoModal(GetID); // show it...
+
+ Log.Info("Wikipedia: OSD keyboard loaded!");
+
+ // If input is finished, the string is saved to the searchterm var.
+ if (keyboard.IsConfirmed)
+ searchterm = keyboard.Text;
+
+ // If there was a string entered try getting the article.
+ if (searchterm != "")
+ {
+ Log.Info("Wikipedia: Searchterm gotten from OSD keyboard: {0}", searchterm);
+ GetAndDisplayArticle(searchterm);
+ }
+ // Else display an error dialog.
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2500)); // No searchterm entered!
+ dlg.SetLine(2, String.Empty);
+ dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter a valid searchterm!
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
+ // This is the control to select the local Wikipedia site.
+ if (control == buttonLocal)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2502)); //Select your local Wikipedia:
+
+ // Add all the local sites we want to be displayed starting with int 0.
+ MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ String allsites = langreader.GetValueAsString("Allsites", "sitenames", "");
+ Log.Info("Wikipedia: available sites: " + allsites);
+ String[] siteArray = allsites.Split(',');
+ for (int i = 0; i < siteArray.Length; i++)
+ {
+ int stringno = langreader.GetValueAsInt(siteArray[i], "string", 2006);
+ pDlgOK.Add(GUILocalizeStrings.Get(stringno)); //English, German, French ...
+ }
+
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ SelectLocalWikipedia(pDlgOK.SelectedLabel, siteArray);
+ }
+ }
+ }
+ // The Button holding the Links to other articles
+ if (control == buttonLinks)
+ {
+ if (linkArray.Count > 0)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:
+
+ // Add all the links from the linkarray.
+ foreach (string link in linkArray)
+ {
+ pDlgOK.Add(link);
+ }
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ Log.Info("Wikipedia: new search from the links array: {0}", pDlgOK.SelectedLabelText);
+ GetAndDisplayArticle(pDlgOK.SelectedLabelText);
+ }
+ }
+ }
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2506)); // No Links from this article.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+
+ }
+ // The Button containing a list of all images from the article
+ if (control == buttonImages)
+ {
+ if (imagedescArray.Count > 0)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2507)); //Images from this article
+
+ // Add all the images from the imagearray.
+ foreach (string image in imagedescArray)
+ {
+ pDlgOK.Add(image);
+ }
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ Log.Info("Wikipedia: new search from the image array: {0}", imagedescArray[pDlgOK.SelectedId - 1]);
+ GetAndDisplayImage(imagenameArray[pDlgOK.SelectedId - 1].ToString(), imagedescArray[pDlgOK.SelectedId - 1].ToString());
+ }
+ }
+ }
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in this article.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
+ // Back to the text button to switch from image view
+ if (control == buttonBack)
+ {
+ if (!txtArticle.IsVisible)
+ GUIControl.ShowControl(GetID, txtArticle.GetID);
+ if (imageControl.IsVisible)
+ GUIControl.HideControl(GetID, imageControl.GetID);
+ if (!searchtermLabel.IsVisible)
+ GUIControl.ShowControl(GetID, searchtermLabel.GetID);
+ if (imagedescLabel.IsVisible)
+ GUIControl.HideControl(GetID, imagedescLabel.GetID);
+ if (buttonBack.IsVisible)
+ GUIControl.HideControl(GetID, buttonBack.GetID);
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ // Depending on which Entry was selected from the listbox we chose the language here.
+ private void SelectLocalWikipedia(int labelnumber, String[] siteArray)
+ {
+ MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ language = siteArray[labelnumber];
+
+ if (searchtermLabel.Label != string.Empty && searchtermLabel.Label != "Wikipedia")
+ {
+ Log.Info("Wikipedia: language changed to {0}. Display article {1} again.", language, searchtermLabel.Label);
+ GetAndDisplayArticle(searchtermLabel.Label);
+ }
+ }
+
+ private void GetAndDisplayImage(string imagename, string imagedesc)
+ {
+ WikipediaImage image = new WikipediaImage(imagename, language);
+ string imagefilename = image.GetImageFilename();
+ Log.Info("Wikipedia: Trying to display image file: {0}", imagefilename);
+
+ if (imagefilename != string.Empty && System.IO.File.Exists(imagefilename))
+ {
+ if (txtArticle.IsVisible)
+ GUIControl.HideControl(GetID, txtArticle.GetID);
+ if (!imageControl.IsVisible)
+ GUIControl.ShowControl(GetID, imageControl.GetID);
+ if (searchtermLabel.IsVisible)
+ GUIControl.HideControl(GetID, searchtermLabel.GetID);
+ if (!imagedescLabel.IsVisible)
+ GUIControl.ShowControl(GetID, imagedescLabel.GetID);
+ if (!buttonBack.IsVisible)
+ GUIControl.ShowControl(GetID, buttonBack.GetID);
+ imagedescLabel.Label = imagedesc;
+ imageControl.SetFileName(imagefilename);
+ }
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2512)); // Can't display image.
+ dlg.SetLine(2, GUILocalizeStrings.Get(2513)); // Please have a look at the logfile.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
+
+ // The main function.
+ void GetAndDisplayArticle(string searchterm)
+ {
+ BackgroundWorker worker = new BackgroundWorker();
+
+ worker.DoWork += new DoWorkEventHandler(DownloadWorker);
+ worker.RunWorkerAsync(searchterm);
+
+ while (_workerCompleted == false)
+ GUIWindowManager.Process();
+ }
+
+ // All kind of stuff because of the wait cursor ;-)
+ void DownloadWorker(object sender, DoWorkEventArgs e)
+ {
+ _workerCompleted = false;
+
+ using (WaitCursor cursor = new WaitCursor())
+ lock (this)
+ {
+ if (!txtArticle.IsVisible)
+ GUIControl.ShowControl(GetID, txtArticle.GetID);
+ if (imageControl.IsVisible)
+ GUIControl.HideControl(GetID, imageControl.GetID);
+ if (!searchtermLabel.IsVisible)
+ GUIControl.ShowControl(GetID, searchtermLabel.GetID);
+ if (imagedescLabel.IsVisible)
+ GUIControl.HideControl(GetID, imagedescLabel.GetID);
+ if (buttonBack.IsVisible)
+ GUIControl.HideControl(GetID, buttonBack.GetID);
+ linkArray.Clear();
+ imagenameArray.Clear();
+ imagedescArray.Clear();
+ searchtermLabel.Label = e.Argument.ToString();
+ WikipediaArticle article = new WikipediaArticle(e.Argument.ToString(), language);
+ articletext = article.GetArticleText();
+ linkArray = article.GetLinkArray();
+ imagenameArray = article.GetImageArray();
+ imagedescArray = article.GetImagedescArray();
+ language = article.GetLanguage();
+
+ if (articletext == "REDIRECT")
+ txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" + GUILocalizeStrings.Get(2510); //This page is only a redirect. Please chose the redirect aim from the link list.
+ else if (articletext == string.Empty)
+ txtArticle.Label = GUILocalizeStrings.Get(2504); //Sorry, no Article was found for your searchterm...
+ else
+ txtArticle.Label = articletext;
+ }
+
+ _workerCompleted = true;
+ }
+
+ volatile bool _workerCompleted = true;
+ }
+}
\ No newline at end of file
Added: trunk/plugins/Documentation plugin/Documentation.csproj
===================================================================
--- trunk/plugins/Documentation plugin/Documentation.csproj (rev 0)
+++ trunk/plugins/Documentation plugin/Documentation.csproj 2007-03-27 09:07:31 UTC (rev 232)
@@ -0,0 +1,52 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{B3A735EA-AE81-430A-AB33-214D11F5BE6E}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Documentation</RootNamespace>
+ <AssemblyName>Documentation</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Core, Version=1.0.2588.17924, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>D:\Apps\Desktop\MediaPortal\Core.DLL</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Class1.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/plugins/Documentation plugin/DocumentationImage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationImage.cs (rev 0)
+++ trunk/plugins/Documentation plugin/DocumentationImage.cs 2007-03-27 09:07:31 UTC (rev 232)
@@ -0,0 +1,196 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+
+namespace Wikipedia
+{
+ /// <summary>
+ /// This class holds all the logic to get an image from Wikipedia for further using in MP.
+ /// </summary>
+ public class WikipediaImage
+ {
+ #region vars
+ private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
+ private string imagename = string.Empty;
+ private string imagedesc = string.Empty;
+ private string imageurl = string.Empty;
+ private string imagelocal = string.Empty;
+
+ #endregion
+
+ #region constructors
+ /// <summary>This constructor creates a new WikipediaImage</summary>
+ /// <summary>The name of the image and language need to be given</summary>
+ /// <param name="imagename">The internal name of the image like "Bild_478.jpg" in "http://de.wikipedia.org/wiki/Bild:Bild_478.jpg"</param>
+ /// <param name="language">Language of the Wikipedia page</param>
+ public WikipediaImage(string imagename, string language)
+ {
+ SetLanguage(language);
+ this.imagename = imagename;
+ GetImageUrl();
+ GetImageFile();
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle.</summary>
+ /// <summary>Only called with a title string, language set to default.</summary>
+ /// <param name="title">The article's title</param>
+ public WikipediaImage(string imagename)
+ : this(imagename, "Default")
+ {
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
+ /// <summary>Uses an empty searchterm and the default language.</summary>
+ public WikipediaImage()
+ : this(string.Empty, "Default")
+ {
+ }
+ #endregion
+
+ #region class methods
+ /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
+ private void SetLanguage(string language)
+ {
+ if (language == "Default")
+ {
+ MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
+ language = xmlreader.GetValueAsString("skin", "language", "English");
+ }
+
+ MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ this.WikipediaURL = detailxmlreader.GetValueAsString(language, "imageurl", "http://en.wikipedia.org/wiki/Image:");
+ Log.Info("Wikipedia: Image language set to " + language + ".");
+ }
+
+ /// <summary>Get the local filename of the downloaded image.</summary>
+ /// <returns>String: filename of the downloaded image.</returns>
+ public string GetImageFilename()
+ {
+ string imagelocal = Config.GetFile(Config.Dir.Thumbs, @"wikipedia\" + imagename);
+ return imagelocal;
+ }
+
+ /// <summary>Getting the link to the full-size image.</summary>
+ /// <returns>String: parsed article</returns>
+ private void GetImageUrl()
+ {
+ string imagepage = string.Empty;
+
+ // Build the URL to the Image page
+ System.Uri url = new System.Uri(WikipediaURL + this.imagename);
+ Log.Info("Wikipedia: Trying to get following Image page: {0}", url.ToString());
+
+ // Here we get the content from the web and put it to a string
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ Stream data = client.OpenRead(url);
+ StreamReader reader = new StreamReader(data);
+ imagepage = reader.ReadToEnd();
+ reader.Close();
+ Log.Info("Wikipedia: Success! Downloaded all data from the image page.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading image page:");
+ Log.Info(e.ToString());
+ }
+
+ //We're searching for something like this:
+ //<div class="fullImageLink" id="file"><a href="http://upload.wikimedia.org/wikipedia/commons/7/7d/Bild_478.jpg">
+ if (imagepage.IndexOf("class=\"fullImageLink\"") >= 0)
+ {
+ Log.Info("Wikipedia: Extracting link to full-size image.");
+ int iStart = imagepage.IndexOf("class=\"fullImageLink\"");
+ imagepage = imagepage.Substring(iStart, 1000);
+
+ iStart = imagepage.IndexOf("href") + 6;
+ int iEnd = imagepage.IndexOf("\"", iStart);
+
+ this.imageurl = imagepage.Substring(iStart, iEnd - iStart);
+ Log.Info("Wikipedia: URL of full-size image extracted.");
+ Log.Info(imageurl);
+ }
+ else
+ this.imageurl = string.Empty;
+ }
+
+ /// <summary>Downloads the full-size image from the wikipedia page</summary>
+ private void GetImageFile()
+ {
+ if (imageurl != "")
+ {
+ //Check if we already have the file.
+ string thumbspath = Config.GetSubFolder(Config.Dir.Thumbs, @"wikipedia\");
+
+ //Create the wikipedia subdir in thumbs when it not exists.
+ if (!System.IO.Directory.Exists(thumbspath))
+ System.IO.Directory.CreateDirectory(thumbspath);
+
+ if (!System.IO.File.Exists(thumbspath + imagename))
+ {
+
+ Log.Info("Wikipedia: Trying to get following URL: {0}", imageurl);
+ // Here we get the image from the web and save it to disk
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ client.DownloadFile(imageurl, thumbspath + imagename);
+ Log.Info("Wikipedia: Success! Image downloaded.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading:");
+ Log.Info(e.ToString());
+ }
+ }
+ else
+ {
+ Log.Info("Wikipedia: Image exists, no need to redownload!");
+ }
+ }
+ else
+ {
+ Log.Info("Wikipedia: No imageurl. Can't download file.");
+ }
+ }
+
+ #endregion
+ }
+
+}
\ No newline at end of file
Added: trunk/plugins/Documentation plugin/DocumentationPage.cs
===================================================================
--- trunk/plugins/Documentation plugin/DocumentationPage.cs (rev 0)
+++ trunk/plugins/Documentation plugin/DocumentationPage.cs 2007-03-27 09:07:31 UTC (rev 232)
@@ -0,0 +1,553 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+
+namespace Wikipedia
+{
+ /// <summary>
+ /// This class holds all the logic to get info from Wikipedia and parse it for further using in MP.
+ /// </summary>
+ public class WikipediaArticle
+ {
+ #region vars
+ private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
+ private string imagePattern = "Image";
+ private string title = string.Empty;
+ private string unparsedArticle = string.Empty;
+ private string parsedArticle = string.Empty;
+ private string language = "Default";
+ private ArrayList linkArray = new ArrayList();
+ private ArrayList imageArray = new ArrayList();
+ private ArrayList imagedescArray = new ArrayList();
+ #endregion
+
+ #region constructors
+ /// <summary>This constructor creates a new WikipediaArticle</summary>
+ /// <summary>Searchterm and language need to be given</summary>
+ /// <param name="title">The article's title</param>
+ /// <param name="language">Language of the Wikipedia page</param>
+ public WikipediaArticle(string title, string language)
+ {
+ SetLanguage(language);
+ this.title = title;
+ GetWikipediaXML();
+ ParseWikipediaArticle();
+ ParseLinksAndImages();
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle.</summary>
+ /// <summary>Only called with a title string, language set to default.</summary>
+ /// <param name="title">The article's title</param>
+ public WikipediaArticle(string title)
+ : this(title, "Default")
+ {
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
+ /// <summary>Uses an empty searchterm and the default language.</summary>
+ public WikipediaArticle()
+ : this(string.Empty, "Default")
+ {
+ }
+ #endregion
+
+ /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
+ private void SetLanguage(string language)
+ {
+ if (language == "Default")
+ {
+ MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
+ language = xmlreader.GetValueAsString("skin", "language", "English");
+ }
+
+ this.language = language;
+
+ MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ this.WikipediaURL = detailxmlreader.GetValueAsString(language, "url", "http://en.wikipedia.org/wiki/Special:Export/");
+ this.imagePattern = detailxmlreader.GetValueAsString(language, "imagepattern", "Image");
+ Log.Info("Wikipedia: Language set to " + language + ".");
+ }
+
+ /// <summary>Returns the parsed article text.</summary>
+ /// <returns>String: parsed article</returns>
+ public string GetArticleText()
+ {
+ return parsedArticle;
+ }
+
+ /// <summary>Returns the title of the article. Can differ from the passed parameter on redirects for example.</summary>
+ /// <returns>String: title of the article</returns>
+ public string GetTitle()
+ {
+ return title;
+ }
+
+ /// <summary>Returns all names of images.</summary>
+ /// <returns>StringArray: images used in this article</returns>
+ public ArrayList GetImageArray()
+ {
+ return imageArray;
+ }
+
+ /// <summary>Returns all descriptions of images.</summary>
+ /// <returns>StringArray: images used in this article</returns>
+ public ArrayList GetImagedescArray()
+ {
+ return imagedescArray;
+ }
+
+ /// <summary>Returns the titles of all linked articles.</summary>
+ /// <returns>StringArray: titles of linked (internal) Wikipedia articles</returns>
+ public ArrayList GetLinkArray()
+ {
+ return linkArray;
+ }
+
+ /// <summary>Returns the currently active language.</summary>
+ /// <returns>String: language</returns>
+ public string GetLanguage()
+ {
+ return language;
+ }
+
+ /// <summary>Downloads the xml content from Wikipedia and cuts metadata like version info.</summary>
+ private void GetWikipediaXML()
+ {
+ string wikipediaXML = string.Empty;
+ // Build the URL to the Wikipedia page
+ System.Uri url = new System.Uri(WikipediaURL + this.title);
+ Log.Info("Wikipedia: Trying to get following URL: {0}", url.ToString());
+
+ // Here we get the content from the web and put it to a string
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ Stream data = client.OpenRead(url);
+ StreamReader reader = new StreamReader(data);
+ wikipediaXML = reader.ReadToEnd();
+ reader.Close();
+ Log.Info("Wikipedia: Success! Downloaded all data.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading:");
+ Log.Info(e.ToString());
+ }
+
+ if (wikipediaXML.IndexOf("<text xml:space=\"preserve\">") > 0)
+ {
+ Log.Info("Wikipedia: Extracting unparsed string.");
+ int iStart = 0;
+ int iEnd = wikipediaXML.Length;
+ // Start of the Entry
+ iStart = wikipediaXML.IndexOf("<text xml:space=\"preserve\">") + 27;
+ // End of the Entry
+ iEnd = wikipediaXML.IndexOf("</text>");
+ // Extract the Text and update the var
+ this.unparsedArticle = wikipediaXML.Substring(iStart, iEnd - iStart);
+ Log.Info("Wikipedia: Unparsed string extracted.");
+ }
+ else
+ this.unparsedArticle = string.Empty;
+ }
+
+ /// <summary>Cuts all special wiki syntax from the article to display plain text</summary>
+ private void ParseWikipediaArticle()
+ {
+ string tempParsedArticle = this.unparsedArticle;
+
+ // Check if the article is empty, if so do not parse.
+ if (tempParsedArticle == string.Empty)
+ {
+ Log.Info("Wikipedia: Empty article found. Try another Searchterm.");
+ this.unparsedArticle = string.Empty;
+ }
+ // Here we check if there is only a redirect as article to handle it as a special article type
+ else if (tempParsedArticle.IndexOf("#REDIRECT") == 0)
+ {
+ Log.Info("Wikipedia: #REDIRECT found.");
+ int iStart = tempParsedArticle.IndexOf("[[") + 2;
+ int iEnd = tempParsedArticle.IndexOf("]]", iStart);
+ // Extract the Text
+ string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
+ this.unparsedArticle = string.Empty;
+ this.title = keyword;
+ GetWikipediaXML();
+ ParseWikipediaArticle();
+ }
+ // Finally a well-formed article ;-)
+ else
+ {
+ Log.Info("Wikipedia: Starting parsing.");
+ StringBuilder builder = new StringBuilder(tempParsedArticle);
+ int iStart = 0;
+ int iEnd = 0;
+
+ // Remove HTML comments
+ Log.Debug("Wikipedia: Remove HTML comments.");
+ while (tempParsedArticle.IndexOf("<!--") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("<!--");
+ iEnd = tempParsedArticle.IndexOf("-->", iStart) + 6;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+ tempParsedArticle = builder.ToString();
+ }
+
+ // surrounded by {{ and }} is (atm) unusable stuff.
+ //Log.Debug("Wikipedia: Remove stuff between {{ and }}.");
+ while (tempParsedArticle.IndexOf("{{") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("{{");
+ int iStart2 = iStart;
+ iEnd = tempParsedArticle.IndexOf("}}") + 2;
+
+ // Between {{ and }} we can again have inner sets of {{ and }}
+ while (tempParsedArticle.IndexOf("{{", iStart2 + 2) >= 0 && tempParsedArticle.IndexOf("{{", iStart2 + 2) < iEnd)
+ {
+ iStart2 = tempParsedArticle.IndexOf("{{", iStart2 + 2);
+ iEnd = tempParsedArticle.IndexOf("}}", iStart2) + 2;
+ iEnd = tempParsedArticle.IndexOf("}}", iEnd) + 2;
+ }
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // surrounded by {| and |} is (atm) unusable stuff.
+ //Log.Debug("Wikipedia: Remove stuff between {| and |}.");
+ while (tempParsedArticle.IndexOf("{|") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("{|");
+ iEnd = tempParsedArticle.IndexOf("|}") + 2;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // Remove audio links.
+ Log.Debug("Wikipedia: Remove audio links.");
+ while (tempParsedArticle.IndexOf("<span") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("<span");
+ iEnd = tempParsedArticle.IndexOf("</span>") + 13;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // Remove web references.
+ Log.Debug("Wikipedia: Remove web references.");
+ while (tempParsedArticle.IndexOf("<ref>") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("<ref");
+ iEnd = tempParsedArticle.IndexOf("</ref>") + 12;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // Remove <br />
+ Log.Debug("Wikipedia: Remove <br />.");
+ builder.Replace("<br />", "\n");
+ builder.Replace("<br style="clear:both"/>", "\n");
+ builder.Replace("<br style="clear:left"/>", "\n");
+ builder.Replace("<br style="clear:right"/>", "\n");
+
+ // Remove <sup>
+ Log.Debug("Wikipedia: Remove <sup>.");
+ builder.Replace("<sup>", "^");
+ builder.Replace("</sup>", "");
+
+ // surrounded by ''' and ''' is bold text, atm also unusable.
+ Log.Debug("Wikipedia: Remove \'\'\'.");
+ builder.Replace("'''", "");
+
+ // surrounded by '' and '' is italic text, atm also unusable.
+ Log.Debug("Wikipedia: Remove \'\'.");
+ builder.Replace("''", "");
+
+ // Display === as newlines (meaning new line for every ===).
+ Log.Debug("Wikipedia: Display === as 1 newlines.");
+ builder.Replace("===", "\n");
+
+ // Display == as newlines (meaning new line for every ==).
+ Log.Debug("Wikipedia: Display == as 1 newline.");
+ builder.Replace("==", "\n");
+
+ // Display * as list (meaning new line for every *).
+ Log.Debug("Wikipedia: Display * as list.");
+ builder.Replace("*", "\n +");
+
+ // Remove HTML whitespace.
+ Log.Debug("Wikipedia: Remove HTML whitespace.");
+ builder.Replace(" ", " ");
+
+ // Display " as ".
+ Log.Debug("Wikipedia: Remove Quotations.");
+ builder.Replace(""", "\"");
+
+ // Display — as -.
+ Log.Debug("Wikipedia: Remove —.");
+ builder.Replace("—", "-");
+
+ // Remove gallery tags.
+ Log.Debug("Wikipedia: Remove gallery tags.");
+ builder.Replace("<gallery>", "");
+ builder.Replace("</gallery>", "");
+
+ // Remove gallery tags.
+ Log.Debug("Wikipedia: Remove &.");
+ builder.Replace("&", "&");
+
+ // Remove (too many) newlines
+ Log.Debug("Wikipedia: Remove (too many) newlines.");
+ builder.Replace("\n\n\n\n", "\n");
+ builder.Replace("\n\n\n", "\n");
+ builder.Replace("\n\n", "\n");
+
+ // Remove (too many) newlines
+ Log.Debug("Wikipedia: Remove (too many) whitespaces.");
+ builder.Replace(" ", " ");
+ builder.Replace(" ", " ");
+ builder.Replace(" ", " ");
+
+ tempParsedArticle = builder.ToString();
+
+ // The text shouldn't start with a newline.
+ if (tempParsedArticle.IndexOf("\n") == 0)
+ tempParsedArticle.Remove(0, 2);
+
+ // For Debug purposes it is nice to see how the whole article text is parsed until here
+ //Log.Debug(tempParsedArticle);
+
+ Log.Info("Wikipedia: Finished parsing.");
+ this.unparsedArticle = tempParsedArticle;
+ }
+ }
+
+ /// <summary>Gets Links out of the article. External links are thrown away, links to other wikipedia articles get into the link array, images to the image array</summary>
+ private void ParseLinksAndImages()
+ {
+ Log.Info("Wikipedia: Starting parsing of links and images.");
+ string tempParsedArticle = this.unparsedArticle;
+ int iStart = 0, iEnd = 0, iPipe = 0;
+
+ // Surrounded by [[IMAGEPATTERN: and ]] are the links to IMAGES.
+ // We need to check for the localized image keyword but also for the English as this is commonly used in some local sites.
+ // Example: [[Bild:H_NeuesRathaus1.jpg|left|thumb|Das [[Neues Rathaus (Hannover)|Neue Rathaus]] mit Maschteich]]
+ while ((iStart = tempParsedArticle.IndexOf("[[" + imagePattern + ":", iStart)) >= 0 || (iStart = tempParsedArticle.IndexOf("[[Image:")) >= 0)
+ {
+ iEnd = tempParsedArticle.IndexOf("]]", (iStart + 2)) + 2;
+ int disturbingLink = iStart;
+
+ // Descriptions of images can contain links!
+ // [[Bild:Hannover Merian.png|thumb|[[Matth?us Merian|Merian]]-Kupferstich um 1650, im Vordergrund Windm?hle auf dem [[Lindener Berg]]]]
+ while (tempParsedArticle.IndexOf("[[", disturbingLink + 2) >= 0 && tempParsedArticle.IndexOf("[[", disturbingLink + 2) < iEnd)
+ {
+ disturbingLink = tempParsedArticle.IndexOf("[[", disturbingLink + 2);
+ iEnd = tempParsedArticle.IndexOf("]]", disturbingLink) + 2;
+ iEnd = tempParsedArticle.IndexOf("]]", iEnd) + 2;
+ }
+ // Extract the Text
+ string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
+
+ //Remove all links from the image description.
+ while (keyword.IndexOf("[[", 2) >= 0)
+ {
+ int iStartlink = keyword.IndexOf("[[", 2);
+ int iEndlink = keyword.IndexOf("]]", iStartlink) + 2;
+ // Extract the Text
+ string linkkeyword = keyword.Substring(iStartlink, iEndlink - iStartlink);
+
+ // Parse Links to other keywords.
+ // 1st type of keywords is like [[article|displaytext]]
+ // for the 2nd the article and displayed text are equal [[article]].
+ if (linkkeyword.IndexOf("|") > 0)
+ linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("|") + 1, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("|") - 1);
+ else
+ linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("[[") + 2, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("[[") - 2);
+
+ keyword = keyword.Substring(0, iStartlink) + linkkeyword + keyword.Substring(iEndlink, keyword.Length - iEndlink);
+ }
+
+ int iStartname = keyword.IndexOf(":") + 1;
+ int iEndname = keyword.IndexOf("|");
+ string imagename = keyword.Substring(iStartname, iEndname - iStartname);
+
+ //Image names must not contain spaces!
+ imagename = imagename.Replace(" ", "_");
+
+ int iStartdesc = keyword.LastIndexOf("|") + 1;
+ int iEnddesc = keyword.LastIndexOf("]]");
+ string imagedesc = keyword.Substring(iStartdesc, iEnddesc - iStartdesc); ;
+
+ this.imageArray.Add(imagename);
+ this.imagedescArray.Add(imagedesc);
+ Log.Debug("Wikipedia: Image added: {0}, {1}", imagedesc, imagename);
+
+ tempParsedArticle = tempParsedArticle.Substring(0, iStart) + tempParsedArticle.Substring(iEnd, tempParsedArticle.Length - iEnd);
+ }
+
+ // surrounded by [[ and ]] are the links to other articles.
+ Log.Debug("Wikipedia: Starting Link parsing.");
+ string parsedKeyword, parsedLink;
+ iStart = iEnd = 0;
+ try
+ {
+ while ((iStart = tempParsedArticle.IndexOf("[[", iStart)) >= 0)
+ {
+ iEnd = tempParsedArticle.IndexOf("]]") + 2;
+ // Extract the Text
+ string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
+
+ // Parse Links to other keywords.
+ // 1st type of keywords is like [[article|displaytext]]
+ if ((iPipe = keyword.IndexOf("|")) > 0)
+ {
+ parsedKeyword = keyword.Substring(iPipe + 1, keyword.Length - iPipe - 3);
+ parsedLink = keyword.Substring(2, iPipe - 2);
+ if (!this.linkArray.Contains(parsedLink))
+ {
+ this.linkArray.Add(parsedLink);
+ //Log.Debug("Wikipedia: Link added: {0}, {1}", parsedLink, parsedKeyword);
+ }
+ }
+ else if (keyword.IndexOf(":") > 0)
+ {
+ // for the 2nd a ":" is a link to the article in another language.
+ // TODO Add links to other languages!!!
+ parsedKeyword = String.Empty;
+ }
+ else
+ {
+ // for the 3rd the article and displayed text are equal [[article]].
+ parsedKeyword = keyword.Substring(2, keyword.Length - 4);
+ if (!this.linkArray.Contains(parsedKeyword))
+ {
+ this.linkArray.Add(parsedKeyword);
+ //Log.Debug("Wikipedia: Link added: {0}", parsedKeyword);
+ }
+ }
+
+ StringBuilder builder = new StringBuilder(tempParsedArticle);
+ builder.Remove(iStart, iEnd - iStart);
+ builder.Insert(iStart, parsedKeyword);
+ tempParsedArticle = builder.ToString();
+ }
+ }
+ catch (Exception e)
+ {
+ Log.Error("Wikipedia: {0}", e.ToString());
+ Log.Error("Wikipedia: tempArticle: {0}", tempParsedArticle);
+ }
+ Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", linkArray.Count);
+
+ // surrounded by [ and ] are external Links. Need to be removed.
+ Log.Debug("Wikipedia: Removing external links");
+ iStart = -1;
+ try
+ {
+ while ((iStart = tempParsedArticle.IndexOf("[")) >= 0)
+ {
+ iEnd = tempParsedArticle.IndexOf("]") + 1;
+
+ StringBuilder builder = new StringBuilder(tempParsedArticle);
+ builder.Remove(iStart, iEnd - iStart);
+ tempParsedArticle = builder.ToString();
+ }
+ }
+ catch (Exception e)
+ {
+ Log.Error("Wikipedia: {0}", e.ToString());
+ Log.Error("Parsing Error: " + tempParsedArticle + "\nSTART: " + iStart + "\nEND: " + iEnd);
+ }
+
+ Log.Info("Wikipedia: Finished parsing of links and images.");
+ this.parsedArticle = tempParsedArticle;
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 09:06:40
|
Revision: 231
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=231&view=rev
Author: pbb72
Date: 2007-03-27 02:06:39 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Sorry, meant to put them in subfolder...
Removed Paths:
-------------
trunk/plugins/Documentation.cs
trunk/plugins/Documentation.csproj
trunk/plugins/DocumentationImage.cs
trunk/plugins/DocumentationPage.cs
Deleted: trunk/plugins/Documentation.cs
===================================================================
--- trunk/plugins/Documentation.cs 2007-03-27 09:05:32 UTC (rev 230)
+++ trunk/plugins/Documentation.cs 2007-03-27 09:06:39 UTC (rev 231)
@@ -1,407 +0,0 @@
-#region Copyright (C) 2005-2007 Team MediaPortal
-
-/*
- * Copyright (C) 2005-2007 Team MediaPortal
- * http://www.team-mediaportal.com
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#endregion
-
-using System;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Net;
-using System.IO;
-using System.Text;
-using System.Threading;
-using System.Collections;
-using MediaPortal.GUI.Library;
-using MediaPortal.Dialogs;
-using MediaPortal.Util;
-using MediaPortal.Configuration;
-
-namespace Wikipedia
-{
- /// <summary>
- /// Windowplugin to search in Wikipedia and display articles using the MP Wikipedia Classes.
- /// </summary>
- public class GUIWikipedia : GUIWindow, ISetupForm
- {
- #region SkinControls
- [SkinControlAttribute(10)]
- protected GUIButtonControl buttonSearch = null;
- [SkinControlAttribute(11)]
- protected GUIButtonControl buttonLocal = null;
- [SkinControlAttribute(14)]
- protected GUIButtonControl buttonBack = null;
- [SkinControlAttribute(12)]
- protected GUIButtonControl buttonLinks = null;
- [SkinControlAttribute(13)]
- protected GUIButtonControl buttonImages = null;
-
- [SkinControlAttribute(4)]
- protected GUILabelControl searchtermLabel = null;
- [SkinControlAttribute(5)]
- protected GUILabelControl imagedescLabel = null;
- [SkinControlAttribute(20)]
- protected GUITextControl txtArticle = null;
-
- [SkinControlAttribute(25)]
- protected GUIImage imageControl = null;
- #endregion
-
- private string language = "Default";
- private string articletext = string.Empty;
- private ArrayList linkArray = new ArrayList();
- private ArrayList imagenameArray = new ArrayList();
- private ArrayList imagedescArray = new ArrayList();
-
-
- public GUIWikipedia()
- {
- GetID = (int)GUIWindow.Window.WINDOW_WIKIPEDIA;
- }
- #region ISetupForm Members
-
- // Returns the name of the plugin which is shown in the plugin menu
- public string PluginName()
- {
- return "Wikipedia";
- }
-
- // Returns the description of the plugin is shown in the plugin menu
- public string Description()
- {
- return "A Plugin to search in Wikipedia";
- }
-
- // Returns the author of the plugin which is shown in the plugin menu
- public string Author()
- {
- return "Maschine";
- }
-
- // show the setup dialog
- public void ShowPlugin()
- {
- MessageBox.Show("Edit the wikipedia.xml file in MP's root directory to add new sites.");
- }
-
- // Indicates whether plugin can be enabled/disabled
- public bool CanEnable()
- {
- return true;
- }
-
- // get ID of windowplugin belonging to this setup
- public int GetWindowId()
- {
- return 4711;
- }
-
- // Indicates if plugin is enabled by default;
- public bool DefaultEnabled()
- {
- return false;
- }
-
- // indicates if a plugin has its own setup screen
- public bool HasSetup()
- {
- return false;
- }
-
- /// <summary>
- /// If the plugin should have its own button on the main menu of Media Portal then it
- /// should return true to this method, otherwise if it should not be on home
- /// it should return false
- /// </summary>
- /// <param name="strButtonText">text the button should have</param>
- /// <param name="strButtonImage">image for the button, or empty for default</param>
- /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
- /// <param name="strPictureImage">subpicture for the button or empty for none</param>
- /// <returns>true : plugin needs its own button on home
- /// false : plugin does not need its own button on home</returns>
- public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
- {
- strButtonText = GUILocalizeStrings.Get(2516);
- strButtonImage = "";
- strButtonImageFocus = "";
- strPictureImage = "";
- return true;
- }
- #endregion
-
- public override bool Init()
- {
- return Load(GUIGraphicsContext.Skin + @"\wikipedia.xml");
- }
-
- protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
- {
- // we don't want the user to start another search while one is already active
- if (_workerCompleted == false)
- return;
-
- // Here we want to open the OSD Keyboard to enter the searchstring
- if (control == buttonSearch)
- {
- // If the search Button was clicked we need to bring up the search keyboard.
- VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
- if (null == keyboard) return;
- string searchterm = string.Empty;
- keyboard.IsSearchKeyboard = true;
- keyboard.Reset();
- keyboard.Text = "";
- keyboard.DoModal(GetID); // show it...
-
- Log.Info("Wikipedia: OSD keyboard loaded!");
-
- // If input is finished, the string is saved to the searchterm var.
- if (keyboard.IsConfirmed)
- searchterm = keyboard.Text;
-
- // If there was a string entered try getting the article.
- if (searchterm != "")
- {
- Log.Info("Wikipedia: Searchterm gotten from OSD keyboard: {0}", searchterm);
- GetAndDisplayArticle(searchterm);
- }
- // Else display an error dialog.
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2500)); // No searchterm entered!
- dlg.SetLine(2, String.Empty);
- dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter a valid searchterm!
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
- }
- // This is the control to select the local Wikipedia site.
- if (control == buttonLocal)
- {
- // Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
- if (pDlgOK != null)
- {
- pDlgOK.Reset();
- pDlgOK.SetHeading(GUILocalizeStrings.Get(2502)); //Select your local Wikipedia:
-
- // Add all the local sites we want to be displayed starting with int 0.
- MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- String allsites = langreader.GetValueAsString("Allsites", "sitenames", "");
- Log.Info("Wikipedia: available sites: " + allsites);
- String[] siteArray = allsites.Split(',');
- for (int i = 0; i < siteArray.Length; i++)
- {
- int stringno = langreader.GetValueAsInt(siteArray[i], "string", 2006);
- pDlgOK.Add(GUILocalizeStrings.Get(stringno)); //English, German, French ...
- }
-
- pDlgOK.DoModal(GetID);
- if (pDlgOK.SelectedLabel >= 0)
- {
- SelectLocalWikipedia(pDlgOK.SelectedLabel, siteArray);
- }
- }
- }
- // The Button holding the Links to other articles
- if (control == buttonLinks)
- {
- if (linkArray.Count > 0)
- {
- // Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
- if (pDlgOK != null)
- {
- pDlgOK.Reset();
- pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:
-
- // Add all the links from the linkarray.
- foreach (string link in linkArray)
- {
- pDlgOK.Add(link);
- }
- pDlgOK.DoModal(GetID);
- if (pDlgOK.SelectedLabel >= 0)
- {
- Log.Info("Wikipedia: new search from the links array: {0}", pDlgOK.SelectedLabelText);
- GetAndDisplayArticle(pDlgOK.SelectedLabelText);
- }
- }
- }
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2506)); // No Links from this article.
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
-
- }
- // The Button containing a list of all images from the article
- if (control == buttonImages)
- {
- if (imagedescArray.Count > 0)
- {
- // Create a new selection dialog.
- GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
- if (pDlgOK != null)
- {
- pDlgOK.Reset();
- pDlgOK.SetHeading(GUILocalizeStrings.Get(2507)); //Images from this article
-
- // Add all the images from the imagearray.
- foreach (string image in imagedescArray)
- {
- pDlgOK.Add(image);
- }
- pDlgOK.DoModal(GetID);
- if (pDlgOK.SelectedLabel >= 0)
- {
- Log.Info("Wikipedia: new search from the image array: {0}", imagedescArray[pDlgOK.SelectedId - 1]);
- GetAndDisplayImage(imagenameArray[pDlgOK.SelectedId - 1].ToString(), imagedescArray[pDlgOK.SelectedId - 1].ToString());
- }
- }
- }
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in this article.
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
- }
- // Back to the text button to switch from image view
- if (control == buttonBack)
- {
- if (!txtArticle.IsVisible)
- GUIControl.ShowControl(GetID, txtArticle.GetID);
- if (imageControl.IsVisible)
- GUIControl.HideControl(GetID, imageControl.GetID);
- if (!searchtermLabel.IsVisible)
- GUIControl.ShowControl(GetID, searchtermLabel.GetID);
- if (imagedescLabel.IsVisible)
- GUIControl.HideControl(GetID, imagedescLabel.GetID);
- if (buttonBack.IsVisible)
- GUIControl.HideControl(GetID, buttonBack.GetID);
- }
- base.OnClicked(controlId, control, actionType);
- }
-
- // Depending on which Entry was selected from the listbox we chose the language here.
- private void SelectLocalWikipedia(int labelnumber, String[] siteArray)
- {
- MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- language = siteArray[labelnumber];
-
- if (searchtermLabel.Label != string.Empty && searchtermLabel.Label != "Wikipedia")
- {
- Log.Info("Wikipedia: language changed to {0}. Display article {1} again.", language, searchtermLabel.Label);
- GetAndDisplayArticle(searchtermLabel.Label);
- }
- }
-
- private void GetAndDisplayImage(string imagename, string imagedesc)
- {
- WikipediaImage image = new WikipediaImage(imagename, language);
- string imagefilename = image.GetImageFilename();
- Log.Info("Wikipedia: Trying to display image file: {0}", imagefilename);
-
- if (imagefilename != string.Empty && System.IO.File.Exists(imagefilename))
- {
- if (txtArticle.IsVisible)
- GUIControl.HideControl(GetID, txtArticle.GetID);
- if (!imageControl.IsVisible)
- GUIControl.ShowControl(GetID, imageControl.GetID);
- if (searchtermLabel.IsVisible)
- GUIControl.HideControl(GetID, searchtermLabel.GetID);
- if (!imagedescLabel.IsVisible)
- GUIControl.ShowControl(GetID, imagedescLabel.GetID);
- if (!buttonBack.IsVisible)
- GUIControl.ShowControl(GetID, buttonBack.GetID);
- imagedescLabel.Label = imagedesc;
- imageControl.SetFileName(imagefilename);
- }
- else
- {
- GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
- dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
- dlg.SetLine(1, GUILocalizeStrings.Get(2512)); // Can't display image.
- dlg.SetLine(2, GUILocalizeStrings.Get(2513)); // Please have a look at the logfile.
- dlg.DoModal(GUIWindowManager.ActiveWindow);
- }
- }
-
- // The main function.
- void GetAndDisplayArticle(string searchterm)
- {
- BackgroundWorker worker = new BackgroundWorker();
-
- worker.DoWork += new DoWorkEventHandler(DownloadWorker);
- worker.RunWorkerAsync(searchterm);
-
- while (_workerCompleted == false)
- GUIWindowManager.Process();
- }
-
- // All kind of stuff because of the wait cursor ;-)
- void DownloadWorker(object sender, DoWorkEventArgs e)
- {
- _workerCompleted = false;
-
- using (WaitCursor cursor = new WaitCursor())
- lock (this)
- {
- if (!txtArticle.IsVisible)
- GUIControl.ShowControl(GetID, txtArticle.GetID);
- if (imageControl.IsVisible)
- GUIControl.HideControl(GetID, imageControl.GetID);
- if (!searchtermLabel.IsVisible)
- GUIControl.ShowControl(GetID, searchtermLabel.GetID);
- if (imagedescLabel.IsVisible)
- GUIControl.HideControl(GetID, imagedescLabel.GetID);
- if (buttonBack.IsVisible)
- GUIControl.HideControl(GetID, buttonBack.GetID);
- linkArray.Clear();
- imagenameArray.Clear();
- imagedescArray.Clear();
- searchtermLabel.Label = e.Argument.ToString();
- WikipediaArticle article = new WikipediaArticle(e.Argument.ToString(), language);
- articletext = article.GetArticleText();
- linkArray = article.GetLinkArray();
- imagenameArray = article.GetImageArray();
- imagedescArray = article.GetImagedescArray();
- language = article.GetLanguage();
-
- if (articletext == "REDIRECT")
- txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" + GUILocalizeStrings.Get(2510); //This page is only a redirect. Please chose the redirect aim from the link list.
- else if (articletext == string.Empty)
- txtArticle.Label = GUILocalizeStrings.Get(2504); //Sorry, no Article was found for your searchterm...
- else
- txtArticle.Label = articletext;
- }
-
- _workerCompleted = true;
- }
-
- volatile bool _workerCompleted = true;
- }
-}
\ No newline at end of file
Deleted: trunk/plugins/Documentation.csproj
===================================================================
--- trunk/plugins/Documentation.csproj 2007-03-27 09:05:32 UTC (rev 230)
+++ trunk/plugins/Documentation.csproj 2007-03-27 09:06:39 UTC (rev 231)
@@ -1,52 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{B3A735EA-AE81-430A-AB33-214D11F5BE6E}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Documentation</RootNamespace>
- <AssemblyName>Documentation</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Core, Version=1.0.2588.17924, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>D:\Apps\Desktop\MediaPortal\Core.DLL</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Class1.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
Deleted: trunk/plugins/DocumentationImage.cs
===================================================================
--- trunk/plugins/DocumentationImage.cs 2007-03-27 09:05:32 UTC (rev 230)
+++ trunk/plugins/DocumentationImage.cs 2007-03-27 09:06:39 UTC (rev 231)
@@ -1,196 +0,0 @@
-#region Copyright (C) 2005-2007 Team MediaPortal
-
-/*
- * Copyright (C) 2005-2007 Team MediaPortal
- * http://www.team-mediaportal.com
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#endregion
-
-using System;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Net;
-using System.IO;
-using System.Text;
-using System.Threading;
-using System.Collections;
-using MediaPortal.GUI.Library;
-using MediaPortal.Util;
-using MediaPortal.Configuration;
-
-namespace Wikipedia
-{
- /// <summary>
- /// This class holds all the logic to get an image from Wikipedia for further using in MP.
- /// </summary>
- public class WikipediaImage
- {
- #region vars
- private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
- private string imagename = string.Empty;
- private string imagedesc = string.Empty;
- private string imageurl = string.Empty;
- private string imagelocal = string.Empty;
-
- #endregion
-
- #region constructors
- /// <summary>This constructor creates a new WikipediaImage</summary>
- /// <summary>The name of the image and language need to be given</summary>
- /// <param name="imagename">The internal name of the image like "Bild_478.jpg" in "http://de.wikipedia.org/wiki/Bild:Bild_478.jpg"</param>
- /// <param name="language">Language of the Wikipedia page</param>
- public WikipediaImage(string imagename, string language)
- {
- SetLanguage(language);
- this.imagename = imagename;
- GetImageUrl();
- GetImageFile();
- }
-
- /// <summary>This constructor creates a new WikipediaArticle.</summary>
- /// <summary>Only called with a title string, language set to default.</summary>
- /// <param name="title">The article's title</param>
- public WikipediaImage(string imagename)
- : this(imagename, "Default")
- {
- }
-
- /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
- /// <summary>Uses an empty searchterm and the default language.</summary>
- public WikipediaImage()
- : this(string.Empty, "Default")
- {
- }
- #endregion
-
- #region class methods
- /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
- private void SetLanguage(string language)
- {
- if (language == "Default")
- {
- MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
- language = xmlreader.GetValueAsString("skin", "language", "English");
- }
-
- MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- this.WikipediaURL = detailxmlreader.GetValueAsString(language, "imageurl", "http://en.wikipedia.org/wiki/Image:");
- Log.Info("Wikipedia: Image language set to " + language + ".");
- }
-
- /// <summary>Get the local filename of the downloaded image.</summary>
- /// <returns>String: filename of the downloaded image.</returns>
- public string GetImageFilename()
- {
- string imagelocal = Config.GetFile(Config.Dir.Thumbs, @"wikipedia\" + imagename);
- return imagelocal;
- }
-
- /// <summary>Getting the link to the full-size image.</summary>
- /// <returns>String: parsed article</returns>
- private void GetImageUrl()
- {
- string imagepage = string.Empty;
-
- // Build the URL to the Image page
- System.Uri url = new System.Uri(WikipediaURL + this.imagename);
- Log.Info("Wikipedia: Trying to get following Image page: {0}", url.ToString());
-
- // Here we get the content from the web and put it to a string
- try
- {
- WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- Stream data = client.OpenRead(url);
- StreamReader reader = new StreamReader(data);
- imagepage = reader.ReadToEnd();
- reader.Close();
- Log.Info("Wikipedia: Success! Downloaded all data from the image page.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading image page:");
- Log.Info(e.ToString());
- }
-
- //We're searching for something like this:
- //<div class="fullImageLink" id="file"><a href="http://upload.wikimedia.org/wikipedia/commons/7/7d/Bild_478.jpg">
- if (imagepage.IndexOf("class=\"fullImageLink\"") >= 0)
- {
- Log.Info("Wikipedia: Extracting link to full-size image.");
- int iStart = imagepage.IndexOf("class=\"fullImageLink\"");
- imagepage = imagepage.Substring(iStart, 1000);
-
- iStart = imagepage.IndexOf("href") + 6;
- int iEnd = imagepage.IndexOf("\"", iStart);
-
- this.imageurl = imagepage.Substring(iStart, iEnd - iStart);
- Log.Info("Wikipedia: URL of full-size image extracted.");
- Log.Info(imageurl);
- }
- else
- this.imageurl = string.Empty;
- }
-
- /// <summary>Downloads the full-size image from the wikipedia page</summary>
- private void GetImageFile()
- {
- if (imageurl != "")
- {
- //Check if we already have the file.
- string thumbspath = Config.GetSubFolder(Config.Dir.Thumbs, @"wikipedia\");
-
- //Create the wikipedia subdir in thumbs when it not exists.
- if (!System.IO.Directory.Exists(thumbspath))
- System.IO.Directory.CreateDirectory(thumbspath);
-
- if (!System.IO.File.Exists(thumbspath + imagename))
- {
-
- Log.Info("Wikipedia: Trying to get following URL: {0}", imageurl);
- // Here we get the image from the web and save it to disk
- try
- {
- WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- client.DownloadFile(imageurl, thumbspath + imagename);
- Log.Info("Wikipedia: Success! Image downloaded.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading:");
- Log.Info(e.ToString());
- }
- }
- else
- {
- Log.Info("Wikipedia: Image exists, no need to redownload!");
- }
- }
- else
- {
- Log.Info("Wikipedia: No imageurl. Can't download file.");
- }
- }
-
- #endregion
- }
-
-}
\ No newline at end of file
Deleted: trunk/plugins/DocumentationPage.cs
===================================================================
--- trunk/plugins/DocumentationPage.cs 2007-03-27 09:05:32 UTC (rev 230)
+++ trunk/plugins/DocumentationPage.cs 2007-03-27 09:06:39 UTC (rev 231)
@@ -1,553 +0,0 @@
-#region Copyright (C) 2005-2007 Team MediaPortal
-
-/*
- * Copyright (C) 2005-2007 Team MediaPortal
- * http://www.team-mediaportal.com
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#endregion
-
-using System;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Net;
-using System.IO;
-using System.Text;
-using System.Threading;
-using System.Collections;
-using MediaPortal.GUI.Library;
-using MediaPortal.Util;
-using MediaPortal.Configuration;
-
-namespace Wikipedia
-{
- /// <summary>
- /// This class holds all the logic to get info from Wikipedia and parse it for further using in MP.
- /// </summary>
- public class WikipediaArticle
- {
- #region vars
- private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
- private string imagePattern = "Image";
- private string title = string.Empty;
- private string unparsedArticle = string.Empty;
- private string parsedArticle = string.Empty;
- private string language = "Default";
- private ArrayList linkArray = new ArrayList();
- private ArrayList imageArray = new ArrayList();
- private ArrayList imagedescArray = new ArrayList();
- #endregion
-
- #region constructors
- /// <summary>This constructor creates a new WikipediaArticle</summary>
- /// <summary>Searchterm and language need to be given</summary>
- /// <param name="title">The article's title</param>
- /// <param name="language">Language of the Wikipedia page</param>
- public WikipediaArticle(string title, string language)
- {
- SetLanguage(language);
- this.title = title;
- GetWikipediaXML();
- ParseWikipediaArticle();
- ParseLinksAndImages();
- }
-
- /// <summary>This constructor creates a new WikipediaArticle.</summary>
- /// <summary>Only called with a title string, language set to default.</summary>
- /// <param name="title">The article's title</param>
- public WikipediaArticle(string title)
- : this(title, "Default")
- {
- }
-
- /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
- /// <summary>Uses an empty searchterm and the default language.</summary>
- public WikipediaArticle()
- : this(string.Empty, "Default")
- {
- }
- #endregion
-
- /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
- private void SetLanguage(string language)
- {
- if (language == "Default")
- {
- MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
- language = xmlreader.GetValueAsString("skin", "language", "English");
- }
-
- this.language = language;
-
- MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
- this.WikipediaURL = detailxmlreader.GetValueAsString(language, "url", "http://en.wikipedia.org/wiki/Special:Export/");
- this.imagePattern = detailxmlreader.GetValueAsString(language, "imagepattern", "Image");
- Log.Info("Wikipedia: Language set to " + language + ".");
- }
-
- /// <summary>Returns the parsed article text.</summary>
- /// <returns>String: parsed article</returns>
- public string GetArticleText()
- {
- return parsedArticle;
- }
-
- /// <summary>Returns the title of the article. Can differ from the passed parameter on redirects for example.</summary>
- /// <returns>String: title of the article</returns>
- public string GetTitle()
- {
- return title;
- }
-
- /// <summary>Returns all names of images.</summary>
- /// <returns>StringArray: images used in this article</returns>
- public ArrayList GetImageArray()
- {
- return imageArray;
- }
-
- /// <summary>Returns all descriptions of images.</summary>
- /// <returns>StringArray: images used in this article</returns>
- public ArrayList GetImagedescArray()
- {
- return imagedescArray;
- }
-
- /// <summary>Returns the titles of all linked articles.</summary>
- /// <returns>StringArray: titles of linked (internal) Wikipedia articles</returns>
- public ArrayList GetLinkArray()
- {
- return linkArray;
- }
-
- /// <summary>Returns the currently active language.</summary>
- /// <returns>String: language</returns>
- public string GetLanguage()
- {
- return language;
- }
-
- /// <summary>Downloads the xml content from Wikipedia and cuts metadata like version info.</summary>
- private void GetWikipediaXML()
- {
- string wikipediaXML = string.Empty;
- // Build the URL to the Wikipedia page
- System.Uri url = new System.Uri(WikipediaURL + this.title);
- Log.Info("Wikipedia: Trying to get following URL: {0}", url.ToString());
-
- // Here we get the content from the web and put it to a string
- try
- {
- WebClient client = new WebClient();
- client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
- Stream data = client.OpenRead(url);
- StreamReader reader = new StreamReader(data);
- wikipediaXML = reader.ReadToEnd();
- reader.Close();
- Log.Info("Wikipedia: Success! Downloaded all data.");
- }
- catch (Exception e)
- {
- Log.Info("Wikipedia: Exception during downloading:");
- Log.Info(e.ToString());
- }
-
- if (wikipediaXML.IndexOf("<text xml:space=\"preserve\">") > 0)
- {
- Log.Info("Wikipedia: Extracting unparsed string.");
- int iStart = 0;
- int iEnd = wikipediaXML.Length;
- // Start of the Entry
- iStart = wikipediaXML.IndexOf("<text xml:space=\"preserve\">") + 27;
- // End of the Entry
- iEnd = wikipediaXML.IndexOf("</text>");
- // Extract the Text and update the var
- this.unparsedArticle = wikipediaXML.Substring(iStart, iEnd - iStart);
- Log.Info("Wikipedia: Unparsed string extracted.");
- }
- else
- this.unparsedArticle = string.Empty;
- }
-
- /// <summary>Cuts all special wiki syntax from the article to display plain text</summary>
- private void ParseWikipediaArticle()
- {
- string tempParsedArticle = this.unparsedArticle;
-
- // Check if the article is empty, if so do not parse.
- if (tempParsedArticle == string.Empty)
- {
- Log.Info("Wikipedia: Empty article found. Try another Searchterm.");
- this.unparsedArticle = string.Empty;
- }
- // Here we check if there is only a redirect as article to handle it as a special article type
- else if (tempParsedArticle.IndexOf("#REDIRECT") == 0)
- {
- Log.Info("Wikipedia: #REDIRECT found.");
- int iStart = tempParsedArticle.IndexOf("[[") + 2;
- int iEnd = tempParsedArticle.IndexOf("]]", iStart);
- // Extract the Text
- string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
- this.unparsedArticle = string.Empty;
- this.title = keyword;
- GetWikipediaXML();
- ParseWikipediaArticle();
- }
- // Finally a well-formed article ;-)
- else
- {
- Log.Info("Wikipedia: Starting parsing.");
- StringBuilder builder = new StringBuilder(tempParsedArticle);
- int iStart = 0;
- int iEnd = 0;
-
- // Remove HTML comments
- Log.Debug("Wikipedia: Remove HTML comments.");
- while (tempParsedArticle.IndexOf("<!--") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("<!--");
- iEnd = tempParsedArticle.IndexOf("-->", iStart) + 6;
-
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
- tempParsedArticle = builder.ToString();
- }
-
- // surrounded by {{ and }} is (atm) unusable stuff.
- //Log.Debug("Wikipedia: Remove stuff between {{ and }}.");
- while (tempParsedArticle.IndexOf("{{") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("{{");
- int iStart2 = iStart;
- iEnd = tempParsedArticle.IndexOf("}}") + 2;
-
- // Between {{ and }} we can again have inner sets of {{ and }}
- while (tempParsedArticle.IndexOf("{{", iStart2 + 2) >= 0 && tempParsedArticle.IndexOf("{{", iStart2 + 2) < iEnd)
- {
- iStart2 = tempParsedArticle.IndexOf("{{", iStart2 + 2);
- iEnd = tempParsedArticle.IndexOf("}}", iStart2) + 2;
- iEnd = tempParsedArticle.IndexOf("}}", iEnd) + 2;
- }
-
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
-
- tempParsedArticle = builder.ToString();
- }
-
- // surrounded by {| and |} is (atm) unusable stuff.
- //Log.Debug("Wikipedia: Remove stuff between {| and |}.");
- while (tempParsedArticle.IndexOf("{|") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("{|");
- iEnd = tempParsedArticle.IndexOf("|}") + 2;
-
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
-
- tempParsedArticle = builder.ToString();
- }
-
- // Remove audio links.
- Log.Debug("Wikipedia: Remove audio links.");
- while (tempParsedArticle.IndexOf("<span") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("<span");
- iEnd = tempParsedArticle.IndexOf("</span>") + 13;
-
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
-
- tempParsedArticle = builder.ToString();
- }
-
- // Remove web references.
- Log.Debug("Wikipedia: Remove web references.");
- while (tempParsedArticle.IndexOf("<ref>") >= 0)
- {
- builder = new StringBuilder(tempParsedArticle);
- iStart = tempParsedArticle.IndexOf("<ref");
- iEnd = tempParsedArticle.IndexOf("</ref>") + 12;
-
- try
- {
- builder.Remove(iStart, iEnd - iStart);
- }
- catch (Exception e)
- {
- Log.Error(e.ToString());
- Log.Error(builder.ToString());
- }
-
- tempParsedArticle = builder.ToString();
- }
-
- // Remove <br />
- Log.Debug("Wikipedia: Remove <br />.");
- builder.Replace("<br />", "\n");
- builder.Replace("<br style="clear:both"/>", "\n");
- builder.Replace("<br style="clear:left"/>", "\n");
- builder.Replace("<br style="clear:right"/>", "\n");
-
- // Remove <sup>
- Log.Debug("Wikipedia: Remove <sup>.");
- builder.Replace("<sup>", "^");
- builder.Replace("</sup>", "");
-
- // surrounded by ''' and ''' is bold text, atm also unusable.
- Log.Debug("Wikipedia: Remove \'\'\'.");
- builder.Replace("'''", "");
-
- // surrounded by '' and '' is italic text, atm also unusable.
- Log.Debug("Wikipedia: Remove \'\'.");
- builder.Replace("''", "");
-
- // Display === as newlines (meaning new line for every ===).
- Log.Debug("Wikipedia: Display === as 1 newlines.");
- builder.Replace("===", "\n");
-
- // Display == as newlines (meaning new line for every ==).
- Log.Debug("Wikipedia: Display == as 1 newline.");
- builder.Replace("==", "\n");
-
- // Display * as list (meaning new line for every *).
- Log.Debug("Wikipedia: Display * as list.");
- builder.Replace("*", "\n +");
-
- // Remove HTML whitespace.
- Log.Debug("Wikipedia: Remove HTML whitespace.");
- builder.Replace(" ", " ");
-
- // Display " as ".
- Log.Debug("Wikipedia: Remove Quotations.");
- builder.Replace(""", "\"");
-
- // Display — as -.
- Log.Debug("Wikipedia: Remove —.");
- builder.Replace("—", "-");
-
- // Remove gallery tags.
- Log.Debug("Wikipedia: Remove gallery tags.");
- builder.Replace("<gallery>", "");
- builder.Replace("</gallery>", "");
-
- // Remove gallery tags.
- Log.Debug("Wikipedia: Remove &.");
- builder.Replace("&", "&");
-
- // Remove (too many) newlines
- Log.Debug("Wikipedia: Remove (too many) newlines.");
- builder.Replace("\n\n\n\n", "\n");
- builder.Replace("\n\n\n", "\n");
- builder.Replace("\n\n", "\n");
-
- // Remove (too many) newlines
- Log.Debug("Wikipedia: Remove (too many) whitespaces.");
- builder.Replace(" ", " ");
- builder.Replace(" ", " ");
- builder.Replace(" ", " ");
-
- tempParsedArticle = builder.ToString();
-
- // The text shouldn't start with a newline.
- if (tempParsedArticle.IndexOf("\n") == 0)
- tempParsedArticle.Remove(0, 2);
-
- // For Debug purposes it is nice to see how the whole article text is parsed until here
- //Log.Debug(tempParsedArticle);
-
- Log.Info("Wikipedia: Finished parsing.");
- this.unparsedArticle = tempParsedArticle;
- }
- }
-
- /// <summary>Gets Links out of the article. External links are thrown away, links to other wikipedia articles get into the link array, images to the image array</summary>
- private void ParseLinksAndImages()
- {
- Log.Info("Wikipedia: Starting parsing of links and images.");
- string tempParsedArticle = this.unparsedArticle;
- int iStart = 0, iEnd = 0, iPipe = 0;
-
- // Surrounded by [[IMAGEPATTERN: and ]] are the links to IMAGES.
- // We need to check for the localized image keyword but also for the English as this is commonly used in some local sites.
- // Example: [[Bild:H_NeuesRathaus1.jpg|left|thumb|Das [[Neues Rathaus (Hannover)|Neue Rathaus]] mit Maschteich]]
- while ((iStart = tempParsedArticle.IndexOf("[[" + imagePattern + ":", iStart)) >= 0 || (iStart = tempParsedArticle.IndexOf("[[Image:")) >= 0)
- {
- iEnd = tempParsedArticle.IndexOf("]]", (iStart + 2)) + 2;
- int disturbingLink = iStart;
-
- // Descriptions of images can contain links!
- // [[Bild:Hannover Merian.png|thumb|[[Matth?us Merian|Merian]]-Kupferstich um 1650, im Vordergrund Windm?hle auf dem [[Lindener Berg]]]]
- while (tempParsedArticle.IndexOf("[[", disturbingLink + 2) >= 0 && tempParsedArticle.IndexOf("[[", disturbingLink + 2) < iEnd)
- {
- disturbingLink = tempParsedArticle.IndexOf("[[", disturbingLink + 2);
- iEnd = tempParsedArticle.IndexOf("]]", disturbingLink) + 2;
- iEnd = tempParsedArticle.IndexOf("]]", iEnd) + 2;
- }
- // Extract the Text
- string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
-
- //Remove all links from the image description.
- while (keyword.IndexOf("[[", 2) >= 0)
- {
- int iStartlink = keyword.IndexOf("[[", 2);
- int iEndlink = keyword.IndexOf("]]", iStartlink) + 2;
- // Extract the Text
- string linkkeyword = keyword.Substring(iStartlink, iEndlink - iStartlink);
-
- // Parse Links to other keywords.
- // 1st type of keywords is like [[article|displaytext]]
- // for the 2nd the article and displayed text are equal [[article]].
- if (linkkeyword.IndexOf("|") > 0)
- linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("|") + 1, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("|") - 1);
- else
- linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("[[") + 2, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("[[") - 2);
-
- keyword = keyword.Substring(0, iStartlink) + linkkeyword + keyword.Substring(iEndlink, keyword.Length - iEndlink);
- }
-
- int iStartname = keyword.IndexOf(":") + 1;
- int iEndname = keyword.IndexOf("|");
- string imagename = keyword.Substring(iStartname, iEndname - iStartname);
-
- //Image names must not contain spaces!
- imagename = imagename.Replace(" ", "_");
-
- int iStartdesc = keyword.LastIndexOf("|") + 1;
- int iEnddesc = keyword.LastIndexOf("]]");
- string imagedesc = keyword.Substring(iStartdesc, iEnddesc - iStartdesc); ;
-
- this.imageArray.Add(imagename);
- this.imagedescArray.Add(imagedesc);
- Log.Debug("Wikipedia: Image added: {0}, {1}", imagedesc, imagename);
-
- tempParsedArticle = tempParsedArticle.Substring(0, iStart) + tempParsedArticle.Substring(iEnd, tempParsedArticle.Length - iEnd);
- }
-
- // surrounded by [[ and ]] are the links to other articles.
- Log.Debug("Wikipedia: Starting Link parsing.");
- string parsedKeyword, parsedLink;
- iStart = iEnd = 0;
- try
- {
- while ((iStart = tempParsedArticle.IndexOf("[[", iStart)) >= 0)
- {
- iEnd = tempParsedArticle.IndexOf("]]") + 2;
- // Extract the Text
- string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
-
- // Parse Links to other keywords.
- // 1st type of keywords is like [[article|displaytext]]
- if ((iPipe = keyword.IndexOf("|")) > 0)
- {
- parsedKeyword = keyword.Substring(iPipe + 1, keyword.Length - iPipe - 3);
- parsedLink = keyword.Substring(2, iPipe - 2);
- if (!this.linkArray.Contains(parsedLink))
- {
- this.linkArray.Add(parsedLink);
- //Log.Debug("Wikipedia: Link added: {0}, {1}", parsedLink, parsedKeyword);
- }
- }
- else if (keyword.IndexOf(":") > 0)
- {
- // for the 2nd a ":" is a link to the article in another language.
- // TODO Add links to other languages!!!
- parsedKeyword = String.Empty;
- }
- else
- {
- // for the 3rd the article and displayed text are equal [[article]].
- parsedKeyword = keyword.Substring(2, keyword.Length - 4);
- if (!this.linkArray.Contains(parsedKeyword))
- {
- this.linkArray.Add(parsedKeyword);
- //Log.Debug("Wikipedia: Link added: {0}", parsedKeyword);
- }
- }
-
- StringBuilder builder = new StringBuilder(tempParsedArticle);
- builder.Remove(iStart, iEnd - iStart);
- builder.Insert(iStart, parsedKeyword);
- tempParsedArticle = builder.ToString();
- }
- }
- catch (Exception e)
- {
- Log.Error("Wikipedia: {0}", e.ToString());
- Log.Error("Wikipedia: tempArticle: {0}", tempParsedArticle);
- }
- Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", linkArray.Count);
-
- // surrounded by [ and ] are external Links. Need to be removed.
- Log.Debug("Wikipedia: Removing external links");
- iStart = -1;
- try
- {
- while ((iStart = tempParsedArticle.IndexOf("[")) >= 0)
- {
- iEnd = tempParsedArticle.IndexOf("]") + 1;
-
- StringBuilder builder = new StringBuilder(tempParsedArticle);
- builder.Remove(iStart, iEnd - iStart);
- tempParsedArticle = builder.ToString();
- }
- }
- catch (Exception e)
- {
- Log.Error("Wikipedia: {0}", e.ToString());
- Log.Error("Parsing Error: " + tempParsedArticle + "\nSTART: " + iStart + "\nEND: " + iEnd);
- }
-
- Log.Info("Wikipedia: Finished parsing of links and images.");
- this.parsedArticle = tempParsedArticle;
- }
- }
-}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pb...@us...> - 2007-03-27 09:05:34
|
Revision: 230
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=230&view=rev
Author: pbb72
Date: 2007-03-27 02:05:32 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Documentation plugin to browse MP wiki from within MediaPortal.
Based on Wikipedia plugin.
Added Paths:
-----------
trunk/plugins/Documentation.cs
trunk/plugins/Documentation.csproj
trunk/plugins/DocumentationImage.cs
trunk/plugins/DocumentationPage.cs
Added: trunk/plugins/Documentation.cs
===================================================================
--- trunk/plugins/Documentation.cs (rev 0)
+++ trunk/plugins/Documentation.cs 2007-03-27 09:05:32 UTC (rev 230)
@@ -0,0 +1,407 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+
+namespace Wikipedia
+{
+ /// <summary>
+ /// Windowplugin to search in Wikipedia and display articles using the MP Wikipedia Classes.
+ /// </summary>
+ public class GUIWikipedia : GUIWindow, ISetupForm
+ {
+ #region SkinControls
+ [SkinControlAttribute(10)]
+ protected GUIButtonControl buttonSearch = null;
+ [SkinControlAttribute(11)]
+ protected GUIButtonControl buttonLocal = null;
+ [SkinControlAttribute(14)]
+ protected GUIButtonControl buttonBack = null;
+ [SkinControlAttribute(12)]
+ protected GUIButtonControl buttonLinks = null;
+ [SkinControlAttribute(13)]
+ protected GUIButtonControl buttonImages = null;
+
+ [SkinControlAttribute(4)]
+ protected GUILabelControl searchtermLabel = null;
+ [SkinControlAttribute(5)]
+ protected GUILabelControl imagedescLabel = null;
+ [SkinControlAttribute(20)]
+ protected GUITextControl txtArticle = null;
+
+ [SkinControlAttribute(25)]
+ protected GUIImage imageControl = null;
+ #endregion
+
+ private string language = "Default";
+ private string articletext = string.Empty;
+ private ArrayList linkArray = new ArrayList();
+ private ArrayList imagenameArray = new ArrayList();
+ private ArrayList imagedescArray = new ArrayList();
+
+
+ public GUIWikipedia()
+ {
+ GetID = (int)GUIWindow.Window.WINDOW_WIKIPEDIA;
+ }
+ #region ISetupForm Members
+
+ // Returns the name of the plugin which is shown in the plugin menu
+ public string PluginName()
+ {
+ return "Wikipedia";
+ }
+
+ // Returns the description of the plugin is shown in the plugin menu
+ public string Description()
+ {
+ return "A Plugin to search in Wikipedia";
+ }
+
+ // Returns the author of the plugin which is shown in the plugin menu
+ public string Author()
+ {
+ return "Maschine";
+ }
+
+ // show the setup dialog
+ public void ShowPlugin()
+ {
+ MessageBox.Show("Edit the wikipedia.xml file in MP's root directory to add new sites.");
+ }
+
+ // Indicates whether plugin can be enabled/disabled
+ public bool CanEnable()
+ {
+ return true;
+ }
+
+ // get ID of windowplugin belonging to this setup
+ public int GetWindowId()
+ {
+ return 4711;
+ }
+
+ // Indicates if plugin is enabled by default;
+ public bool DefaultEnabled()
+ {
+ return false;
+ }
+
+ // indicates if a plugin has its own setup screen
+ public bool HasSetup()
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// If the plugin should have its own button on the main menu of Media Portal then it
+ /// should return true to this method, otherwise if it should not be on home
+ /// it should return false
+ /// </summary>
+ /// <param name="strButtonText">text the button should have</param>
+ /// <param name="strButtonImage">image for the button, or empty for default</param>
+ /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
+ /// <param name="strPictureImage">subpicture for the button or empty for none</param>
+ /// <returns>true : plugin needs its own button on home
+ /// false : plugin does not need its own button on home</returns>
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = GUILocalizeStrings.Get(2516);
+ strButtonImage = "";
+ strButtonImageFocus = "";
+ strPictureImage = "";
+ return true;
+ }
+ #endregion
+
+ public override bool Init()
+ {
+ return Load(GUIGraphicsContext.Skin + @"\wikipedia.xml");
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
+ {
+ // we don't want the user to start another search while one is already active
+ if (_workerCompleted == false)
+ return;
+
+ // Here we want to open the OSD Keyboard to enter the searchstring
+ if (control == buttonSearch)
+ {
+ // If the search Button was clicked we need to bring up the search keyboard.
+ VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
+ if (null == keyboard) return;
+ string searchterm = string.Empty;
+ keyboard.IsSearchKeyboard = true;
+ keyboard.Reset();
+ keyboard.Text = "";
+ keyboard.DoModal(GetID); // show it...
+
+ Log.Info("Wikipedia: OSD keyboard loaded!");
+
+ // If input is finished, the string is saved to the searchterm var.
+ if (keyboard.IsConfirmed)
+ searchterm = keyboard.Text;
+
+ // If there was a string entered try getting the article.
+ if (searchterm != "")
+ {
+ Log.Info("Wikipedia: Searchterm gotten from OSD keyboard: {0}", searchterm);
+ GetAndDisplayArticle(searchterm);
+ }
+ // Else display an error dialog.
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2500)); // No searchterm entered!
+ dlg.SetLine(2, String.Empty);
+ dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter a valid searchterm!
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
+ // This is the control to select the local Wikipedia site.
+ if (control == buttonLocal)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2502)); //Select your local Wikipedia:
+
+ // Add all the local sites we want to be displayed starting with int 0.
+ MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ String allsites = langreader.GetValueAsString("Allsites", "sitenames", "");
+ Log.Info("Wikipedia: available sites: " + allsites);
+ String[] siteArray = allsites.Split(',');
+ for (int i = 0; i < siteArray.Length; i++)
+ {
+ int stringno = langreader.GetValueAsInt(siteArray[i], "string", 2006);
+ pDlgOK.Add(GUILocalizeStrings.Get(stringno)); //English, German, French ...
+ }
+
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ SelectLocalWikipedia(pDlgOK.SelectedLabel, siteArray);
+ }
+ }
+ }
+ // The Button holding the Links to other articles
+ if (control == buttonLinks)
+ {
+ if (linkArray.Count > 0)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:
+
+ // Add all the links from the linkarray.
+ foreach (string link in linkArray)
+ {
+ pDlgOK.Add(link);
+ }
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ Log.Info("Wikipedia: new search from the links array: {0}", pDlgOK.SelectedLabelText);
+ GetAndDisplayArticle(pDlgOK.SelectedLabelText);
+ }
+ }
+ }
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2506)); // No Links from this article.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+
+ }
+ // The Button containing a list of all images from the article
+ if (control == buttonImages)
+ {
+ if (imagedescArray.Count > 0)
+ {
+ // Create a new selection dialog.
+ GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
+ if (pDlgOK != null)
+ {
+ pDlgOK.Reset();
+ pDlgOK.SetHeading(GUILocalizeStrings.Get(2507)); //Images from this article
+
+ // Add all the images from the imagearray.
+ foreach (string image in imagedescArray)
+ {
+ pDlgOK.Add(image);
+ }
+ pDlgOK.DoModal(GetID);
+ if (pDlgOK.SelectedLabel >= 0)
+ {
+ Log.Info("Wikipedia: new search from the image array: {0}", imagedescArray[pDlgOK.SelectedId - 1]);
+ GetAndDisplayImage(imagenameArray[pDlgOK.SelectedId - 1].ToString(), imagedescArray[pDlgOK.SelectedId - 1].ToString());
+ }
+ }
+ }
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in this article.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
+ // Back to the text button to switch from image view
+ if (control == buttonBack)
+ {
+ if (!txtArticle.IsVisible)
+ GUIControl.ShowControl(GetID, txtArticle.GetID);
+ if (imageControl.IsVisible)
+ GUIControl.HideControl(GetID, imageControl.GetID);
+ if (!searchtermLabel.IsVisible)
+ GUIControl.ShowControl(GetID, searchtermLabel.GetID);
+ if (imagedescLabel.IsVisible)
+ GUIControl.HideControl(GetID, imagedescLabel.GetID);
+ if (buttonBack.IsVisible)
+ GUIControl.HideControl(GetID, buttonBack.GetID);
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ // Depending on which Entry was selected from the listbox we chose the language here.
+ private void SelectLocalWikipedia(int labelnumber, String[] siteArray)
+ {
+ MediaPortal.Profile.Settings langreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ language = siteArray[labelnumber];
+
+ if (searchtermLabel.Label != string.Empty && searchtermLabel.Label != "Wikipedia")
+ {
+ Log.Info("Wikipedia: language changed to {0}. Display article {1} again.", language, searchtermLabel.Label);
+ GetAndDisplayArticle(searchtermLabel.Label);
+ }
+ }
+
+ private void GetAndDisplayImage(string imagename, string imagedesc)
+ {
+ WikipediaImage image = new WikipediaImage(imagename, language);
+ string imagefilename = image.GetImageFilename();
+ Log.Info("Wikipedia: Trying to display image file: {0}", imagefilename);
+
+ if (imagefilename != string.Empty && System.IO.File.Exists(imagefilename))
+ {
+ if (txtArticle.IsVisible)
+ GUIControl.HideControl(GetID, txtArticle.GetID);
+ if (!imageControl.IsVisible)
+ GUIControl.ShowControl(GetID, imageControl.GetID);
+ if (searchtermLabel.IsVisible)
+ GUIControl.HideControl(GetID, searchtermLabel.GetID);
+ if (!imagedescLabel.IsVisible)
+ GUIControl.ShowControl(GetID, imagedescLabel.GetID);
+ if (!buttonBack.IsVisible)
+ GUIControl.ShowControl(GetID, buttonBack.GetID);
+ imagedescLabel.Label = imagedesc;
+ imageControl.SetFileName(imagefilename);
+ }
+ else
+ {
+ GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
+ dlg.SetHeading(GUILocalizeStrings.Get(257)); // Error
+ dlg.SetLine(1, GUILocalizeStrings.Get(2512)); // Can't display image.
+ dlg.SetLine(2, GUILocalizeStrings.Get(2513)); // Please have a look at the logfile.
+ dlg.DoModal(GUIWindowManager.ActiveWindow);
+ }
+ }
+
+ // The main function.
+ void GetAndDisplayArticle(string searchterm)
+ {
+ BackgroundWorker worker = new BackgroundWorker();
+
+ worker.DoWork += new DoWorkEventHandler(DownloadWorker);
+ worker.RunWorkerAsync(searchterm);
+
+ while (_workerCompleted == false)
+ GUIWindowManager.Process();
+ }
+
+ // All kind of stuff because of the wait cursor ;-)
+ void DownloadWorker(object sender, DoWorkEventArgs e)
+ {
+ _workerCompleted = false;
+
+ using (WaitCursor cursor = new WaitCursor())
+ lock (this)
+ {
+ if (!txtArticle.IsVisible)
+ GUIControl.ShowControl(GetID, txtArticle.GetID);
+ if (imageControl.IsVisible)
+ GUIControl.HideControl(GetID, imageControl.GetID);
+ if (!searchtermLabel.IsVisible)
+ GUIControl.ShowControl(GetID, searchtermLabel.GetID);
+ if (imagedescLabel.IsVisible)
+ GUIControl.HideControl(GetID, imagedescLabel.GetID);
+ if (buttonBack.IsVisible)
+ GUIControl.HideControl(GetID, buttonBack.GetID);
+ linkArray.Clear();
+ imagenameArray.Clear();
+ imagedescArray.Clear();
+ searchtermLabel.Label = e.Argument.ToString();
+ WikipediaArticle article = new WikipediaArticle(e.Argument.ToString(), language);
+ articletext = article.GetArticleText();
+ linkArray = article.GetLinkArray();
+ imagenameArray = article.GetImageArray();
+ imagedescArray = article.GetImagedescArray();
+ language = article.GetLanguage();
+
+ if (articletext == "REDIRECT")
+ txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" + GUILocalizeStrings.Get(2510); //This page is only a redirect. Please chose the redirect aim from the link list.
+ else if (articletext == string.Empty)
+ txtArticle.Label = GUILocalizeStrings.Get(2504); //Sorry, no Article was found for your searchterm...
+ else
+ txtArticle.Label = articletext;
+ }
+
+ _workerCompleted = true;
+ }
+
+ volatile bool _workerCompleted = true;
+ }
+}
\ No newline at end of file
Added: trunk/plugins/Documentation.csproj
===================================================================
--- trunk/plugins/Documentation.csproj (rev 0)
+++ trunk/plugins/Documentation.csproj 2007-03-27 09:05:32 UTC (rev 230)
@@ -0,0 +1,52 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{B3A735EA-AE81-430A-AB33-214D11F5BE6E}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Documentation</RootNamespace>
+ <AssemblyName>Documentation</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Core, Version=1.0.2588.17924, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>D:\Apps\Desktop\MediaPortal\Core.DLL</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Class1.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/plugins/DocumentationImage.cs
===================================================================
--- trunk/plugins/DocumentationImage.cs (rev 0)
+++ trunk/plugins/DocumentationImage.cs 2007-03-27 09:05:32 UTC (rev 230)
@@ -0,0 +1,196 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+
+namespace Wikipedia
+{
+ /// <summary>
+ /// This class holds all the logic to get an image from Wikipedia for further using in MP.
+ /// </summary>
+ public class WikipediaImage
+ {
+ #region vars
+ private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
+ private string imagename = string.Empty;
+ private string imagedesc = string.Empty;
+ private string imageurl = string.Empty;
+ private string imagelocal = string.Empty;
+
+ #endregion
+
+ #region constructors
+ /// <summary>This constructor creates a new WikipediaImage</summary>
+ /// <summary>The name of the image and language need to be given</summary>
+ /// <param name="imagename">The internal name of the image like "Bild_478.jpg" in "http://de.wikipedia.org/wiki/Bild:Bild_478.jpg"</param>
+ /// <param name="language">Language of the Wikipedia page</param>
+ public WikipediaImage(string imagename, string language)
+ {
+ SetLanguage(language);
+ this.imagename = imagename;
+ GetImageUrl();
+ GetImageFile();
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle.</summary>
+ /// <summary>Only called with a title string, language set to default.</summary>
+ /// <param name="title">The article's title</param>
+ public WikipediaImage(string imagename)
+ : this(imagename, "Default")
+ {
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
+ /// <summary>Uses an empty searchterm and the default language.</summary>
+ public WikipediaImage()
+ : this(string.Empty, "Default")
+ {
+ }
+ #endregion
+
+ #region class methods
+ /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
+ private void SetLanguage(string language)
+ {
+ if (language == "Default")
+ {
+ MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
+ language = xmlreader.GetValueAsString("skin", "language", "English");
+ }
+
+ MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ this.WikipediaURL = detailxmlreader.GetValueAsString(language, "imageurl", "http://en.wikipedia.org/wiki/Image:");
+ Log.Info("Wikipedia: Image language set to " + language + ".");
+ }
+
+ /// <summary>Get the local filename of the downloaded image.</summary>
+ /// <returns>String: filename of the downloaded image.</returns>
+ public string GetImageFilename()
+ {
+ string imagelocal = Config.GetFile(Config.Dir.Thumbs, @"wikipedia\" + imagename);
+ return imagelocal;
+ }
+
+ /// <summary>Getting the link to the full-size image.</summary>
+ /// <returns>String: parsed article</returns>
+ private void GetImageUrl()
+ {
+ string imagepage = string.Empty;
+
+ // Build the URL to the Image page
+ System.Uri url = new System.Uri(WikipediaURL + this.imagename);
+ Log.Info("Wikipedia: Trying to get following Image page: {0}", url.ToString());
+
+ // Here we get the content from the web and put it to a string
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ Stream data = client.OpenRead(url);
+ StreamReader reader = new StreamReader(data);
+ imagepage = reader.ReadToEnd();
+ reader.Close();
+ Log.Info("Wikipedia: Success! Downloaded all data from the image page.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading image page:");
+ Log.Info(e.ToString());
+ }
+
+ //We're searching for something like this:
+ //<div class="fullImageLink" id="file"><a href="http://upload.wikimedia.org/wikipedia/commons/7/7d/Bild_478.jpg">
+ if (imagepage.IndexOf("class=\"fullImageLink\"") >= 0)
+ {
+ Log.Info("Wikipedia: Extracting link to full-size image.");
+ int iStart = imagepage.IndexOf("class=\"fullImageLink\"");
+ imagepage = imagepage.Substring(iStart, 1000);
+
+ iStart = imagepage.IndexOf("href") + 6;
+ int iEnd = imagepage.IndexOf("\"", iStart);
+
+ this.imageurl = imagepage.Substring(iStart, iEnd - iStart);
+ Log.Info("Wikipedia: URL of full-size image extracted.");
+ Log.Info(imageurl);
+ }
+ else
+ this.imageurl = string.Empty;
+ }
+
+ /// <summary>Downloads the full-size image from the wikipedia page</summary>
+ private void GetImageFile()
+ {
+ if (imageurl != "")
+ {
+ //Check if we already have the file.
+ string thumbspath = Config.GetSubFolder(Config.Dir.Thumbs, @"wikipedia\");
+
+ //Create the wikipedia subdir in thumbs when it not exists.
+ if (!System.IO.Directory.Exists(thumbspath))
+ System.IO.Directory.CreateDirectory(thumbspath);
+
+ if (!System.IO.File.Exists(thumbspath + imagename))
+ {
+
+ Log.Info("Wikipedia: Trying to get following URL: {0}", imageurl);
+ // Here we get the image from the web and save it to disk
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ client.DownloadFile(imageurl, thumbspath + imagename);
+ Log.Info("Wikipedia: Success! Image downloaded.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading:");
+ Log.Info(e.ToString());
+ }
+ }
+ else
+ {
+ Log.Info("Wikipedia: Image exists, no need to redownload!");
+ }
+ }
+ else
+ {
+ Log.Info("Wikipedia: No imageurl. Can't download file.");
+ }
+ }
+
+ #endregion
+ }
+
+}
\ No newline at end of file
Added: trunk/plugins/DocumentationPage.cs
===================================================================
--- trunk/plugins/DocumentationPage.cs (rev 0)
+++ trunk/plugins/DocumentationPage.cs 2007-03-27 09:05:32 UTC (rev 230)
@@ -0,0 +1,553 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Net;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Collections;
+using MediaPortal.GUI.Library;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+
+namespace Wikipedia
+{
+ /// <summary>
+ /// This class holds all the logic to get info from Wikipedia and parse it for further using in MP.
+ /// </summary>
+ public class WikipediaArticle
+ {
+ #region vars
+ private string WikipediaURL = "http://en.wikipedia.org/wiki/Special:Export/";
+ private string imagePattern = "Image";
+ private string title = string.Empty;
+ private string unparsedArticle = string.Empty;
+ private string parsedArticle = string.Empty;
+ private string language = "Default";
+ private ArrayList linkArray = new ArrayList();
+ private ArrayList imageArray = new ArrayList();
+ private ArrayList imagedescArray = new ArrayList();
+ #endregion
+
+ #region constructors
+ /// <summary>This constructor creates a new WikipediaArticle</summary>
+ /// <summary>Searchterm and language need to be given</summary>
+ /// <param name="title">The article's title</param>
+ /// <param name="language">Language of the Wikipedia page</param>
+ public WikipediaArticle(string title, string language)
+ {
+ SetLanguage(language);
+ this.title = title;
+ GetWikipediaXML();
+ ParseWikipediaArticle();
+ ParseLinksAndImages();
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle.</summary>
+ /// <summary>Only called with a title string, language set to default.</summary>
+ /// <param name="title">The article's title</param>
+ public WikipediaArticle(string title)
+ : this(title, "Default")
+ {
+ }
+
+ /// <summary>This constructor creates a new WikipediaArticle if no parameter is given.</summary>
+ /// <summary>Uses an empty searchterm and the default language.</summary>
+ public WikipediaArticle()
+ : this(string.Empty, "Default")
+ {
+ }
+ #endregion
+
+ /// <summary>Gets the current MP language from mediaportal.xml and sets the Wikipedia URL accordingly</summary>
+ private void SetLanguage(string language)
+ {
+ if (language == "Default")
+ {
+ MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
+ language = xmlreader.GetValueAsString("skin", "language", "English");
+ }
+
+ this.language = language;
+
+ MediaPortal.Profile.Settings detailxmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
+ this.WikipediaURL = detailxmlreader.GetValueAsString(language, "url", "http://en.wikipedia.org/wiki/Special:Export/");
+ this.imagePattern = detailxmlreader.GetValueAsString(language, "imagepattern", "Image");
+ Log.Info("Wikipedia: Language set to " + language + ".");
+ }
+
+ /// <summary>Returns the parsed article text.</summary>
+ /// <returns>String: parsed article</returns>
+ public string GetArticleText()
+ {
+ return parsedArticle;
+ }
+
+ /// <summary>Returns the title of the article. Can differ from the passed parameter on redirects for example.</summary>
+ /// <returns>String: title of the article</returns>
+ public string GetTitle()
+ {
+ return title;
+ }
+
+ /// <summary>Returns all names of images.</summary>
+ /// <returns>StringArray: images used in this article</returns>
+ public ArrayList GetImageArray()
+ {
+ return imageArray;
+ }
+
+ /// <summary>Returns all descriptions of images.</summary>
+ /// <returns>StringArray: images used in this article</returns>
+ public ArrayList GetImagedescArray()
+ {
+ return imagedescArray;
+ }
+
+ /// <summary>Returns the titles of all linked articles.</summary>
+ /// <returns>StringArray: titles of linked (internal) Wikipedia articles</returns>
+ public ArrayList GetLinkArray()
+ {
+ return linkArray;
+ }
+
+ /// <summary>Returns the currently active language.</summary>
+ /// <returns>String: language</returns>
+ public string GetLanguage()
+ {
+ return language;
+ }
+
+ /// <summary>Downloads the xml content from Wikipedia and cuts metadata like version info.</summary>
+ private void GetWikipediaXML()
+ {
+ string wikipediaXML = string.Empty;
+ // Build the URL to the Wikipedia page
+ System.Uri url = new System.Uri(WikipediaURL + this.title);
+ Log.Info("Wikipedia: Trying to get following URL: {0}", url.ToString());
+
+ // Here we get the content from the web and put it to a string
+ try
+ {
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
+ Stream data = client.OpenRead(url);
+ StreamReader reader = new StreamReader(data);
+ wikipediaXML = reader.ReadToEnd();
+ reader.Close();
+ Log.Info("Wikipedia: Success! Downloaded all data.");
+ }
+ catch (Exception e)
+ {
+ Log.Info("Wikipedia: Exception during downloading:");
+ Log.Info(e.ToString());
+ }
+
+ if (wikipediaXML.IndexOf("<text xml:space=\"preserve\">") > 0)
+ {
+ Log.Info("Wikipedia: Extracting unparsed string.");
+ int iStart = 0;
+ int iEnd = wikipediaXML.Length;
+ // Start of the Entry
+ iStart = wikipediaXML.IndexOf("<text xml:space=\"preserve\">") + 27;
+ // End of the Entry
+ iEnd = wikipediaXML.IndexOf("</text>");
+ // Extract the Text and update the var
+ this.unparsedArticle = wikipediaXML.Substring(iStart, iEnd - iStart);
+ Log.Info("Wikipedia: Unparsed string extracted.");
+ }
+ else
+ this.unparsedArticle = string.Empty;
+ }
+
+ /// <summary>Cuts all special wiki syntax from the article to display plain text</summary>
+ private void ParseWikipediaArticle()
+ {
+ string tempParsedArticle = this.unparsedArticle;
+
+ // Check if the article is empty, if so do not parse.
+ if (tempParsedArticle == string.Empty)
+ {
+ Log.Info("Wikipedia: Empty article found. Try another Searchterm.");
+ this.unparsedArticle = string.Empty;
+ }
+ // Here we check if there is only a redirect as article to handle it as a special article type
+ else if (tempParsedArticle.IndexOf("#REDIRECT") == 0)
+ {
+ Log.Info("Wikipedia: #REDIRECT found.");
+ int iStart = tempParsedArticle.IndexOf("[[") + 2;
+ int iEnd = tempParsedArticle.IndexOf("]]", iStart);
+ // Extract the Text
+ string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
+ this.unparsedArticle = string.Empty;
+ this.title = keyword;
+ GetWikipediaXML();
+ ParseWikipediaArticle();
+ }
+ // Finally a well-formed article ;-)
+ else
+ {
+ Log.Info("Wikipedia: Starting parsing.");
+ StringBuilder builder = new StringBuilder(tempParsedArticle);
+ int iStart = 0;
+ int iEnd = 0;
+
+ // Remove HTML comments
+ Log.Debug("Wikipedia: Remove HTML comments.");
+ while (tempParsedArticle.IndexOf("<!--") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("<!--");
+ iEnd = tempParsedArticle.IndexOf("-->", iStart) + 6;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+ tempParsedArticle = builder.ToString();
+ }
+
+ // surrounded by {{ and }} is (atm) unusable stuff.
+ //Log.Debug("Wikipedia: Remove stuff between {{ and }}.");
+ while (tempParsedArticle.IndexOf("{{") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("{{");
+ int iStart2 = iStart;
+ iEnd = tempParsedArticle.IndexOf("}}") + 2;
+
+ // Between {{ and }} we can again have inner sets of {{ and }}
+ while (tempParsedArticle.IndexOf("{{", iStart2 + 2) >= 0 && tempParsedArticle.IndexOf("{{", iStart2 + 2) < iEnd)
+ {
+ iStart2 = tempParsedArticle.IndexOf("{{", iStart2 + 2);
+ iEnd = tempParsedArticle.IndexOf("}}", iStart2) + 2;
+ iEnd = tempParsedArticle.IndexOf("}}", iEnd) + 2;
+ }
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // surrounded by {| and |} is (atm) unusable stuff.
+ //Log.Debug("Wikipedia: Remove stuff between {| and |}.");
+ while (tempParsedArticle.IndexOf("{|") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("{|");
+ iEnd = tempParsedArticle.IndexOf("|}") + 2;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // Remove audio links.
+ Log.Debug("Wikipedia: Remove audio links.");
+ while (tempParsedArticle.IndexOf("<span") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("<span");
+ iEnd = tempParsedArticle.IndexOf("</span>") + 13;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // Remove web references.
+ Log.Debug("Wikipedia: Remove web references.");
+ while (tempParsedArticle.IndexOf("<ref>") >= 0)
+ {
+ builder = new StringBuilder(tempParsedArticle);
+ iStart = tempParsedArticle.IndexOf("<ref");
+ iEnd = tempParsedArticle.IndexOf("</ref>") + 12;
+
+ try
+ {
+ builder.Remove(iStart, iEnd - iStart);
+ }
+ catch (Exception e)
+ {
+ Log.Error(e.ToString());
+ Log.Error(builder.ToString());
+ }
+
+ tempParsedArticle = builder.ToString();
+ }
+
+ // Remove <br />
+ Log.Debug("Wikipedia: Remove <br />.");
+ builder.Replace("<br />", "\n");
+ builder.Replace("<br style="clear:both"/>", "\n");
+ builder.Replace("<br style="clear:left"/>", "\n");
+ builder.Replace("<br style="clear:right"/>", "\n");
+
+ // Remove <sup>
+ Log.Debug("Wikipedia: Remove <sup>.");
+ builder.Replace("<sup>", "^");
+ builder.Replace("</sup>", "");
+
+ // surrounded by ''' and ''' is bold text, atm also unusable.
+ Log.Debug("Wikipedia: Remove \'\'\'.");
+ builder.Replace("'''", "");
+
+ // surrounded by '' and '' is italic text, atm also unusable.
+ Log.Debug("Wikipedia: Remove \'\'.");
+ builder.Replace("''", "");
+
+ // Display === as newlines (meaning new line for every ===).
+ Log.Debug("Wikipedia: Display === as 1 newlines.");
+ builder.Replace("===", "\n");
+
+ // Display == as newlines (meaning new line for every ==).
+ Log.Debug("Wikipedia: Display == as 1 newline.");
+ builder.Replace("==", "\n");
+
+ // Display * as list (meaning new line for every *).
+ Log.Debug("Wikipedia: Display * as list.");
+ builder.Replace("*", "\n +");
+
+ // Remove HTML whitespace.
+ Log.Debug("Wikipedia: Remove HTML whitespace.");
+ builder.Replace(" ", " ");
+
+ // Display " as ".
+ Log.Debug("Wikipedia: Remove Quotations.");
+ builder.Replace(""", "\"");
+
+ // Display — as -.
+ Log.Debug("Wikipedia: Remove —.");
+ builder.Replace("—", "-");
+
+ // Remove gallery tags.
+ Log.Debug("Wikipedia: Remove gallery tags.");
+ builder.Replace("<gallery>", "");
+ builder.Replace("</gallery>", "");
+
+ // Remove gallery tags.
+ Log.Debug("Wikipedia: Remove &.");
+ builder.Replace("&", "&");
+
+ // Remove (too many) newlines
+ Log.Debug("Wikipedia: Remove (too many) newlines.");
+ builder.Replace("\n\n\n\n", "\n");
+ builder.Replace("\n\n\n", "\n");
+ builder.Replace("\n\n", "\n");
+
+ // Remove (too many) newlines
+ Log.Debug("Wikipedia: Remove (too many) whitespaces.");
+ builder.Replace(" ", " ");
+ builder.Replace(" ", " ");
+ builder.Replace(" ", " ");
+
+ tempParsedArticle = builder.ToString();
+
+ // The text shouldn't start with a newline.
+ if (tempParsedArticle.IndexOf("\n") == 0)
+ tempParsedArticle.Remove(0, 2);
+
+ // For Debug purposes it is nice to see how the whole article text is parsed until here
+ //Log.Debug(tempParsedArticle);
+
+ Log.Info("Wikipedia: Finished parsing.");
+ this.unparsedArticle = tempParsedArticle;
+ }
+ }
+
+ /// <summary>Gets Links out of the article. External links are thrown away, links to other wikipedia articles get into the link array, images to the image array</summary>
+ private void ParseLinksAndImages()
+ {
+ Log.Info("Wikipedia: Starting parsing of links and images.");
+ string tempParsedArticle = this.unparsedArticle;
+ int iStart = 0, iEnd = 0, iPipe = 0;
+
+ // Surrounded by [[IMAGEPATTERN: and ]] are the links to IMAGES.
+ // We need to check for the localized image keyword but also for the English as this is commonly used in some local sites.
+ // Example: [[Bild:H_NeuesRathaus1.jpg|left|thumb|Das [[Neues Rathaus (Hannover)|Neue Rathaus]] mit Maschteich]]
+ while ((iStart = tempParsedArticle.IndexOf("[[" + imagePattern + ":", iStart)) >= 0 || (iStart = tempParsedArticle.IndexOf("[[Image:")) >= 0)
+ {
+ iEnd = tempParsedArticle.IndexOf("]]", (iStart + 2)) + 2;
+ int disturbingLink = iStart;
+
+ // Descriptions of images can contain links!
+ // [[Bild:Hannover Merian.png|thumb|[[Matth?us Merian|Merian]]-Kupferstich um 1650, im Vordergrund Windm?hle auf dem [[Lindener Berg]]]]
+ while (tempParsedArticle.IndexOf("[[", disturbingLink + 2) >= 0 && tempParsedArticle.IndexOf("[[", disturbingLink + 2) < iEnd)
+ {
+ disturbingLink = tempParsedArticle.IndexOf("[[", disturbingLink + 2);
+ iEnd = tempParsedArticle.IndexOf("]]", disturbingLink) + 2;
+ iEnd = tempParsedArticle.IndexOf("]]", iEnd) + 2;
+ }
+ // Extract the Text
+ string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
+
+ //Remove all links from the image description.
+ while (keyword.IndexOf("[[", 2) >= 0)
+ {
+ int iStartlink = keyword.IndexOf("[[", 2);
+ int iEndlink = keyword.IndexOf("]]", iStartlink) + 2;
+ // Extract the Text
+ string linkkeyword = keyword.Substring(iStartlink, iEndlink - iStartlink);
+
+ // Parse Links to other keywords.
+ // 1st type of keywords is like [[article|displaytext]]
+ // for the 2nd the article and displayed text are equal [[article]].
+ if (linkkeyword.IndexOf("|") > 0)
+ linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("|") + 1, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("|") - 1);
+ else
+ linkkeyword = linkkeyword.Substring(linkkeyword.IndexOf("[[") + 2, linkkeyword.IndexOf("]]") - linkkeyword.IndexOf("[[") - 2);
+
+ keyword = keyword.Substring(0, iStartlink) + linkkeyword + keyword.Substring(iEndlink, keyword.Length - iEndlink);
+ }
+
+ int iStartname = keyword.IndexOf(":") + 1;
+ int iEndname = keyword.IndexOf("|");
+ string imagename = keyword.Substring(iStartname, iEndname - iStartname);
+
+ //Image names must not contain spaces!
+ imagename = imagename.Replace(" ", "_");
+
+ int iStartdesc = keyword.LastIndexOf("|") + 1;
+ int iEnddesc = keyword.LastIndexOf("]]");
+ string imagedesc = keyword.Substring(iStartdesc, iEnddesc - iStartdesc); ;
+
+ this.imageArray.Add(imagename);
+ this.imagedescArray.Add(imagedesc);
+ Log.Debug("Wikipedia: Image added: {0}, {1}", imagedesc, imagename);
+
+ tempParsedArticle = tempParsedArticle.Substring(0, iStart) + tempParsedArticle.Substring(iEnd, tempParsedArticle.Length - iEnd);
+ }
+
+ // surrounded by [[ and ]] are the links to other articles.
+ Log.Debug("Wikipedia: Starting Link parsing.");
+ string parsedKeyword, parsedLink;
+ iStart = iEnd = 0;
+ try
+ {
+ while ((iStart = tempParsedArticle.IndexOf("[[", iStart)) >= 0)
+ {
+ iEnd = tempParsedArticle.IndexOf("]]") + 2;
+ // Extract the Text
+ string keyword = tempParsedArticle.Substring(iStart, iEnd - iStart);
+
+ // Parse Links to other keywords.
+ // 1st type of keywords is like [[article|displaytext]]
+ if ((iPipe = keyword.IndexOf("|")) > 0)
+ {
+ parsedKeyword = keyword.Substring(iPipe + 1, keyword.Length - iPipe - 3);
+ parsedLink = keyword.Substring(2, iPipe - 2);
+ if (!this.linkArray.Contains(parsedLink))
+ {
+ this.linkArray.Add(parsedLink);
+ //Log.Debug("Wikipedia: Link added: {0}, {1}", parsedLink, parsedKeyword);
+ }
+ }
+ else if (keyword.IndexOf(":") > 0)
+ {
+ // for the 2nd a ":" is a link to the article in another language.
+ // TODO Add links to other languages!!!
+ parsedKeyword = String.Empty;
+ }
+ else
+ {
+ // for the 3rd the article and displayed text are equal [[article]].
+ parsedKeyword = keyword.Substring(2, keyword.Length - 4);
+ if (!this.linkArray.Contains(parsedKeyword))
+ {
+ this.linkArray.Add(parsedKeyword);
+ //Log.Debug("Wikipedia: Link added: {0}", parsedKeyword);
+ }
+ }
+
+ StringBuilder builder = new StringBuilder(tempParsedArticle);
+ builder.Remove(iStart, iEnd - iStart);
+ builder.Insert(iStart, parsedKeyword);
+ tempParsedArticle = builder.ToString();
+ }
+ }
+ catch (Exception e)
+ {
+ Log.Error("Wikipedia: {0}", e.ToString());
+ Log.Error("Wikipedia: tempArticle: {0}", tempParsedArticle);
+ }
+ Log.Debug("Wikipedia: Finished Link parsing: {0} Links added.", linkArray.Count);
+
+ // surrounded by [ and ] are external Links. Need to be removed.
+ Log.Debug("Wikipedia: Removing external links");
+ iStart = -1;
+ try
+ {
+ while ((iStart = tempParsedArticle.IndexOf("[")) >= 0)
+ {
+ iEnd = tempParsedArticle.IndexOf("]") + 1;
+
+ StringBuilder builder = new StringBuilder(tempParsedArticle);
+ builder.Remove(iStart, iEnd - iStart);
+ tempParsedArticle = builder.ToString();
+ }
+ }
+ catch (Exception e)
+ {
+ Log.Error("Wikipedia: {0}", e.ToString());
+ Log.Error("Parsing Error: " + tempParsedArticle + "\nSTART: " + iStart + "\nEND: " + iEnd);
+ }
+
+ Log.Info("Wikipedia: Finished parsing of links and images.");
+ this.parsedArticle = tempParsedArticle;
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hap...@us...> - 2007-03-27 08:43:17
|
Revision: 229
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=229&view=rev
Author: happytalk
Date: 2007-03-27 01:43:15 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
Remembers navigational position & Prev button now works as in other media plugs
Modified Paths:
--------------
trunk/plugins/MyFilms/MesFilms.cs
trunk/plugins/MyFilms/MesFilmsDetail.cs
Modified: trunk/plugins/MyFilms/MesFilms.cs
===================================================================
--- trunk/plugins/MyFilms/MesFilms.cs 2007-03-26 20:59:59 UTC (rev 228)
+++ trunk/plugins/MyFilms/MesFilms.cs 2007-03-27 08:43:15 UTC (rev 229)
@@ -251,11 +251,9 @@
//---------------------------------------------------------------------------------------
public override void OnAction(Action actionType)
{
- if ((actionType.wID == Action.ActionType.ACTION_PREVIOUS_MENU))// || (actionType.wID == Action.ActionType.ACTION_CONTEXT_MENU))
- // Previous Menu (I disabled 'press menu button exits plugin' = very annoying)
+ if ((actionType.wID == Action.ActionType.ACTION_PREVIOUS_MENU) || (actionType.wID == Action.ActionType.ACTION_PARENT_DIR))
{
- if (GetPrevFilmList()) return;
- //actionType.wID = Action.ActionType.ACTION_PREVIOUS_MENU; // exit plugin DEINIT Msg will call save func
+ if (GetPrevFilmList() || (actionType.wID != Action.ActionType.ACTION_PREVIOUS_MENU)) return;
}
base.OnAction(actionType);
}
@@ -1136,6 +1134,7 @@
boolselect = xmlreader.GetValueAsBool(CurrentConfig, "boolselect", false);
WStrSort = xmlreader.GetValueAsString(CurrentConfig, "WStrSort", "");
Wstar = xmlreader.GetValueAsString(CurrentConfig, "Wstar", "");
+ LastID = xmlreader.GetValueAsInt(CurrentConfig, "LastID", -1);
}
}
//--------------------------------------------------------------------------------------------
@@ -1223,7 +1222,7 @@
StrSelect = StrTitle1.ToString() + " not like ''";
TxtSelect.Label = StrTxtSelect = "";
boolselect = false;
- l_index = -1;
+ //l_index = -1;
if (StrSortSens == " ASC")
BtnSrtBy.IsAscending = true;
else
Modified: trunk/plugins/MyFilms/MesFilmsDetail.cs
===================================================================
--- trunk/plugins/MyFilms/MesFilmsDetail.cs 2007-03-26 20:59:59 UTC (rev 228)
+++ trunk/plugins/MyFilms/MesFilmsDetail.cs 2007-03-27 08:43:15 UTC (rev 229)
@@ -153,11 +153,10 @@
//---------------------------------------------------------------------------------------
public override void OnAction(Action actionType)
{
- if ((actionType.wID == Action.ActionType.ACTION_PREVIOUS_MENU))// || (actionType.wID == Action.ActionType.ACTION_CONTEXT_MENU)) // press menu button exits plugin!!?
- // Previous Menu
+ if ((actionType.wID == Action.ActionType.ACTION_PREVIOUS_MENU) || (actionType.wID == Action.ActionType.ACTION_PARENT_DIR))
{
save_config_values(0);
- //actionType.wID = Action.ActionType.ACTION_PREVIOUS_MENU; // exit plugin DEINIT Msg will call save func
+ actionType.wID = Action.ActionType.ACTION_PREVIOUS_MENU; // exit plugin DEINIT Msg will call save func
}
base.OnAction(actionType);
return;
@@ -763,7 +762,7 @@
using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MyFilms.xml"))
{
xmlwriter.SetValue(CurrentConfig, "IndexItem", r[StrIndex]["Number"]);
- if (ID != -1) xmlwriter.SetValue("MesFilms", "LastID", ID);
+ if (ID != -1) xmlwriter.SetValue(CurrentConfig, "LastID", ID);
}
}
#endregion
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ove...@us...> - 2007-03-26 21:00:09
|
Revision: 228
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=228&view=rev
Author: overture
Date: 2007-03-26 13:59:59 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
Modified: trunk/plugins/IPTVPlugin/IPTVPlugin.csproj
===================================================================
--- trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-26 17:39:11 UTC (rev 227)
+++ trunk/plugins/IPTVPlugin/IPTVPlugin.csproj 2007-03-26 20:59:59 UTC (rev 228)
@@ -28,10 +28,6 @@
<Reference Include="System.Xml" />
<Reference Include="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<Reference Include="System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
- <Reference Include="Core">
- <HintPath>..\..\..\..\..\MediaPortal\mediaportal\Core\bin\Release\Core.dll</HintPath>
- <SpecificVersion>False</SpecificVersion>
- </Reference>
<Reference Include="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</ItemGroup>
<ItemGroup>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mab...@us...> - 2007-03-26 17:39:17
|
Revision: 227
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=227&view=rev
Author: mablebee
Date: 2007-03-26 10:39:11 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Rewrite of Generation 1 of AutoStart (no source code available) - Basic Configuration & startup as process plugin
Added Paths:
-----------
trunk/plugins/AutoStart/readme.txt
Added: trunk/plugins/AutoStart/readme.txt
===================================================================
--- trunk/plugins/AutoStart/readme.txt (rev 0)
+++ trunk/plugins/AutoStart/readme.txt 2007-03-26 17:39:11 UTC (rev 227)
@@ -0,0 +1,5 @@
+This is generation 2 of AutoStart - there seems no source code left of generation 1
+
+Included is basic configuration which will store values in mediaportal.xml which will
+enumerate possible windows to launch and startup as a process plugin and try to launch
+the preconfigured window.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mab...@us...> - 2007-03-26 17:26:03
|
Revision: 226
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=226&view=rev
Author: mablebee
Date: 2007-03-26 10:25:54 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Removed file/folder
Removed Paths:
-------------
trunk/plugins/AutoStart.sln
trunk/plugins/AutoStart.suo
Deleted: trunk/plugins/AutoStart.sln
===================================================================
--- trunk/plugins/AutoStart.sln 2007-03-26 17:25:24 UTC (rev 225)
+++ trunk/plugins/AutoStart.sln 2007-03-26 17:25:54 UTC (rev 226)
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C# Express 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoStart", "AutoStart\AutoStart.csproj", "{9A71624D-ABAE-4D49-B05D-F1C83DE77C07}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
Deleted: trunk/plugins/AutoStart.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mab...@us...> - 2007-03-26 17:25:37
|
Revision: 225
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=225&view=rev
Author: mablebee
Date: 2007-03-26 10:25:24 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Removed file/folder
Removed Paths:
-------------
trunk/plugins/autostart/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mab...@us...> - 2007-03-26 17:22:54
|
Revision: 224
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=224&view=rev
Author: mablebee
Date: 2007-03-26 10:22:50 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/plugins/AutoStart/
trunk/plugins/AutoStart/AutoStart.cs
trunk/plugins/AutoStart/AutoStart.csproj
trunk/plugins/AutoStart/AutoStartConfig.Designer.cs
trunk/plugins/AutoStart/AutoStartConfig.cs
trunk/plugins/AutoStart/AutoStartConfig.resx
trunk/plugins/AutoStart/Properties/
trunk/plugins/AutoStart/Properties/AssemblyInfo.cs
trunk/plugins/AutoStart/Properties/Resources.Designer.cs
trunk/plugins/AutoStart/Properties/Resources.resx
trunk/plugins/AutoStart/Resources/
trunk/plugins/AutoStart/Resources/mplogo.gif
trunk/plugins/AutoStart/bin/
trunk/plugins/AutoStart/bin/Debug/
trunk/plugins/AutoStart/bin/Debug/AutoStart.dll
trunk/plugins/AutoStart/bin/Debug/AutoStart.pdb
trunk/plugins/AutoStart/bin/Debug/AxInterop.WMPLib.dll
trunk/plugins/AutoStart/bin/Debug/Bass.Net.dll
trunk/plugins/AutoStart/bin/Debug/BassRegistration.dll
trunk/plugins/AutoStart/bin/Debug/Core.DLL
trunk/plugins/AutoStart/bin/Debug/DirectShowLib.dll
trunk/plugins/AutoStart/bin/Debug/ICSharpCode.SharpZipLib.dll
trunk/plugins/AutoStart/bin/Debug/Interop.WMPLib.dll
trunk/plugins/AutoStart/bin/Debug/MediaPortal.Support.dll
trunk/plugins/AutoStart/bin/Debug/MediaPortal.Support.pdb
trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.Direct3D.dll
trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.Direct3DX.dll
trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.dll
trunk/plugins/AutoStart/bin/Debug/Utils.DLL
trunk/plugins/AutoStart/bin/Debug/edtftpnet-1.2.2.dll
trunk/plugins/AutoStart/bin/Release/
trunk/plugins/AutoStart/bin/Release/AutoStart.dll
trunk/plugins/AutoStart/bin/Release/AutoStart.pdb
trunk/plugins/AutoStart/bin/Release/AxInterop.WMPLib.dll
trunk/plugins/AutoStart/bin/Release/Bass.Net.dll
trunk/plugins/AutoStart/bin/Release/BassRegistration.dll
trunk/plugins/AutoStart/bin/Release/Core.DLL
trunk/plugins/AutoStart/bin/Release/DirectShowLib.dll
trunk/plugins/AutoStart/bin/Release/ICSharpCode.SharpZipLib.dll
trunk/plugins/AutoStart/bin/Release/Interop.WMPLib.dll
trunk/plugins/AutoStart/bin/Release/MediaPortal.Support.dll
trunk/plugins/AutoStart/bin/Release/MediaPortal.Support.pdb
trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.Direct3D.dll
trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.Direct3DX.dll
trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.dll
trunk/plugins/AutoStart/bin/Release/Utils.dll
trunk/plugins/AutoStart/bin/Release/edtftpnet-1.2.2.dll
trunk/plugins/AutoStart/obj/
trunk/plugins/AutoStart/obj/AutoStart.csproj.FileList.txt
trunk/plugins/AutoStart/obj/Debug/
trunk/plugins/AutoStart/obj/Debug/AutoStart.csproj.GenerateResource.Cache
trunk/plugins/AutoStart/obj/Debug/AutoStart.dll
trunk/plugins/AutoStart/obj/Debug/AutoStart.pdb
trunk/plugins/AutoStart/obj/Debug/AutoStartConfig.ConfigAutoStart.resources
trunk/plugins/AutoStart/obj/Debug/TempPE/
trunk/plugins/AutoStart/obj/Release/
trunk/plugins/AutoStart/obj/Release/AutoStart.csproj.GenerateResource.Cache
trunk/plugins/AutoStart/obj/Release/AutoStart.dll
trunk/plugins/AutoStart/obj/Release/AutoStart.pdb
trunk/plugins/AutoStart/obj/Release/AutoStartConfig.ConfigAutoStart.resources
trunk/plugins/AutoStart/obj/Release/ClassLibrary1.Properties.Resources.resources
trunk/plugins/AutoStart/obj/Release/Refactor/
trunk/plugins/AutoStart/obj/Release/ResolveAssemblyReference.cache
trunk/plugins/AutoStart/obj/Release/TempPE/
trunk/plugins/AutoStart/obj/Release/TempPE/Properties.Resources.Designer.cs.dll
trunk/plugins/AutoStart.sln
trunk/plugins/AutoStart.suo
Added: trunk/plugins/AutoStart/AutoStart.cs
===================================================================
--- trunk/plugins/AutoStart/AutoStart.cs (rev 0)
+++ trunk/plugins/AutoStart/AutoStart.cs 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+using MediaPortal.Util;
+using MediaPortal.Profile;
+using MediaPortal.Services;
+using MediaPortal.Configuration;
+using MediaPortal.GUI.Library;
+using MediaPortal.Player;
+using AutoStartConfig;
+
+/* AutoStart Generation II
+ *
+ * Author: Martin Werner
+ *
+ * Version 1.0: 2007-03-19
+ * -------------------------
+ * Basic functionallity as Process Plugin
+ * Startup-Choices (TV, Weather, Audio, Video, ...) from available window handles
+ * Configuration Dialog and settings via mediaportal.xml
+ *
+ * Version 1.1: 2007-03-20
+ * -------------------------
+ * Code cleanup, commenting for better readability
+ *
+ *---------------------------------------------------------------------------
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+namespace AutoStart
+{
+ public class AutoStart : IPlugin, ISetupForm
+ {
+ #region vars
+
+ ILog _epgLog;
+ String l_startwhat = "";
+
+ #endregion
+
+ #region Ctor
+ public AutoStart()
+ {
+ }
+ #endregion
+
+ #region IPlugin members
+
+ public void Stop()
+ {
+ }
+
+ public void Start()
+ {
+ // setup logging
+ ServiceProvider services = GlobalServiceProvider.Instance;
+ _epgLog = services.Get<ILog>();
+
+ // load settings
+ using (Settings reader = new Settings(Config.GetFile(Config.Dir.Config, "mediaportal.xml")))
+ {
+ l_startwhat = reader.GetValue("autostart", "startscreen");
+ }
+
+ Log.Info("AutoStart: started");
+
+ // Let's see if we could read out something from settings - if so let's try to launch it
+ if (l_startwhat.Length > 0)
+ {
+ Log.Info("AutoStart: Enumerating Windows {0}", l_startwhat);
+
+ Array nativeWindowsList = Enum.GetValues(typeof(GUIWindow.Window));
+ foreach (GUIWindow.Window wnd in nativeWindowsList)
+ {
+ if (String.Compare(l_startwhat,wnd.ToString()) == 0)
+ {
+ // Yep, is a valid window we can try to launch :-)
+
+ // if (Recorder.IsRecording()) <-- maybe we'll need to take care of this sometime...
+
+ GUIWindowManager.ActivateWindow((int)wnd);
+ Log.Info("AutoStart: Launching Window {0}", (int)wnd);
+ }
+ }
+ }
+ }
+
+ #endregion
+
+ #region ISetupForm Members
+
+ public string PluginName()
+ {
+ return "AutoStart";
+ }
+
+ public string Description()
+ {
+ return "AutoStart Plugin for MediaPortal";
+ }
+
+ public string Author()
+ {
+ return "mablebee";
+ }
+
+ public void ShowPlugin()
+ {
+ // Configure this plugin
+ ConfigAutoStart l_form = new ConfigAutoStart();
+ l_form.Show();
+ }
+
+ public bool DefaultEnabled()
+ {
+ return false;
+ }
+
+ public bool CanEnable()
+ {
+ return true;
+ }
+
+ public int GetWindowId()
+ {
+ return 47110815;
+ }
+
+ public bool HasSetup()
+ {
+ return true;
+ }
+
+ /// <summary>
+ /// If the plugin should have it's own button on the main menu of MediaPortal then it
+ /// should return true to this method, otherwise if it should not be on home
+ /// it should return false
+ /// </summary>
+ /// <param name="strButtonText">text the button should have</param>
+ /// <param name="strButtonImage">image for the button, or empty for default</param>
+ /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
+ /// <param name="strPictureImage">subpicture for the button or empty for none</param>
+ /// <returns>true : plugin needs it's own button on home
+ /// false : plugin does not need it's own button on home</returns>
+
+ public bool GetHome(out string strButtonText, out string strButtonImage,
+ out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = String.Empty;
+ strButtonImage = String.Empty;
+ strButtonImageFocus = String.Empty;
+ strPictureImage = String.Empty;
+ return false;
+ }
+
+ #endregion
+ }
+}
Added: trunk/plugins/AutoStart/AutoStart.csproj
===================================================================
--- trunk/plugins/AutoStart/AutoStart.csproj (rev 0)
+++ trunk/plugins/AutoStart/AutoStart.csproj 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,82 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9A71624D-ABAE-4D49-B05D-F1C83DE77C07}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ClassLibrary1</RootNamespace>
+ <AssemblyName>AutoStart</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Core, Version=1.0.2634.1793, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\..\Programme\Team MediaPortal\MediaPortal\Core.DLL</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Utils, Version=2.1.2634.1787, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\..\Programme\Team MediaPortal\MediaPortal\Utils.DLL</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AutoStart.cs" />
+ <Compile Include="AutoStartConfig.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="AutoStartConfig.Designer.cs">
+ <DependentUpon>AutoStartConfig.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="AutoStartConfig.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>AutoStartConfig.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <SubType>Designer</SubType>
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Resources\mplogo.gif" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/plugins/AutoStart/AutoStartConfig.Designer.cs
===================================================================
--- trunk/plugins/AutoStart/AutoStartConfig.Designer.cs (rev 0)
+++ trunk/plugins/AutoStart/AutoStartConfig.Designer.cs 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,121 @@
+namespace AutoStartConfig
+{
+ partial class ConfigAutoStart
+ {
+ /// <summary>
+ /// Erforderliche Designervariable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Verwendete Ressourcen bereinigen.
+ /// </summary>
+ /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Vom Windows Form-Designer generierter Code
+
+ /// <summary>
+ /// Erforderliche Methode für die Designerunterstützung.
+ /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.buttonOK = new System.Windows.Forms.Button();
+ this.butCancel = new System.Windows.Forms.Button();
+ this.f_combobox = new System.Windows.Forms.ComboBox();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.BackColor = System.Drawing.SystemColors.Window;
+ this.label1.Location = new System.Drawing.Point(12, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(66, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Startup with:";
+ //
+ // buttonOK
+ //
+ this.buttonOK.Location = new System.Drawing.Point(142, 142);
+ this.buttonOK.Name = "buttonOK";
+ this.buttonOK.Size = new System.Drawing.Size(75, 23);
+ this.buttonOK.TabIndex = 2;
+ this.buttonOK.Text = "&OK";
+ this.buttonOK.UseVisualStyleBackColor = true;
+ this.buttonOK.Click += new System.EventHandler(this.button1_Click);
+ //
+ // butCancel
+ //
+ this.butCancel.Location = new System.Drawing.Point(61, 142);
+ this.butCancel.Name = "butCancel";
+ this.butCancel.Size = new System.Drawing.Size(75, 23);
+ this.butCancel.TabIndex = 3;
+ this.butCancel.Text = "&Cancel";
+ this.butCancel.UseVisualStyleBackColor = true;
+ this.butCancel.Click += new System.EventHandler(this.butCancel_Click);
+ //
+ // f_combobox
+ //
+ this.f_combobox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.f_combobox.FormattingEnabled = true;
+ this.f_combobox.Items.AddRange(new object[] {
+ "DVD",
+ "Radio",
+ "TV",
+ "Videos"});
+ this.f_combobox.Location = new System.Drawing.Point(84, 6);
+ this.f_combobox.Name = "f_combobox";
+ this.f_combobox.Size = new System.Drawing.Size(192, 21);
+ this.f_combobox.Sorted = true;
+ this.f_combobox.TabIndex = 4;
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Image = global::ClassLibrary1.Properties.Resources.mplogo;
+ this.pictureBox1.Location = new System.Drawing.Point(-33, -17);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(420, 290);
+ this.pictureBox1.TabIndex = 6;
+ this.pictureBox1.TabStop = false;
+ //
+ // ConfigAutoStart
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.SystemColors.Window;
+ this.ClientSize = new System.Drawing.Size(288, 185);
+ this.Controls.Add(this.f_combobox);
+ this.Controls.Add(this.butCancel);
+ this.Controls.Add(this.buttonOK);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.pictureBox1);
+ this.Name = "ConfigAutoStart";
+ this.Text = "AutoStart Configuration";
+ this.Load += new System.EventHandler(this.AutoStartConfig_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button buttonOK;
+ private System.Windows.Forms.Button butCancel;
+ private System.Windows.Forms.ComboBox f_combobox;
+ private System.Windows.Forms.PictureBox pictureBox1;
+ }
+}
\ No newline at end of file
Added: trunk/plugins/AutoStart/AutoStartConfig.cs
===================================================================
--- trunk/plugins/AutoStart/AutoStartConfig.cs (rev 0)
+++ trunk/plugins/AutoStart/AutoStartConfig.cs 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using MediaPortal.Util;
+using MediaPortal.Profile;
+using MediaPortal.UserInterface.Controls;
+using MediaPortal.Services;
+using MediaPortal.Configuration;
+using MediaPortal.GUI.Library;
+
+namespace AutoStartConfig
+{
+ public partial class ConfigAutoStart : Form
+ {
+ ILog _epgLog;
+
+ public ConfigAutoStart()
+ {
+ InitializeComponent();
+
+ // setup logging
+ ServiceProvider services = GlobalServiceProvider.Instance;
+ _epgLog = services.Get<ILog>();
+
+ Array nativeWindowsList = Enum.GetValues(typeof(GUIWindow.Window));
+
+ f_combobox.Items.Clear();
+
+ foreach (GUIWindow.Window wnd in nativeWindowsList)
+ {
+ String l_itemtoadd;
+
+ l_itemtoadd = wnd.ToString().Substring(7);
+
+ // Lets get rid of some unneeded windows for the combobox
+ if (((l_itemtoadd.IndexOf("SETTINGS") != -1) ||
+ (l_itemtoadd.IndexOf("STATUS") != -1) ||
+ (l_itemtoadd.IndexOf("_") != -1) ||
+ (l_itemtoadd.IndexOf("INVALID") != -1) ||
+ (l_itemtoadd.IndexOf("DIALOG") != -1) ||
+ (l_itemtoadd.IndexOf("WIZARD") != -1)) == false)
+ {
+ // Add Windows Handles to List
+ f_combobox.Items.Add(l_itemtoadd);
+ //Log.Info("AutoStartConfig: Found Windows {0}", wnd.ToString());
+ }
+ }
+ }
+
+ private void AutoStartConfig_Load(object sender, EventArgs e)
+ {
+ LoadSettings();
+ }
+
+ private void SaveSettings()
+ {
+ // save settings
+ using (Settings writer = new Settings(Config.GetFile(Config.Dir.Config, "mediaportal.xml")))
+ {
+ writer.SetValue("autostart","startscreen","WINDOW_"+f_combobox.SelectedItem.ToString());
+ }
+ }
+
+
+ private void LoadSettings()
+ {
+ // load settings
+ using (Settings reader = new Settings(Config.GetFile(Config.Dir.Config, "mediaportal.xml")))
+ {
+ String l_setting = reader.GetValue("autostart", "startscreen");
+ Log.Info("AutoStartConfig: Loaded Config-Value {0}", l_setting);
+
+ if (l_setting.Length > 0)
+ {
+ f_combobox.SelectedIndex = f_combobox.FindString(l_setting.Substring(7));
+ }
+ }
+ }
+ private void button1_Click(object sender, EventArgs e)
+ {
+ SaveSettings();
+ Close();
+ }
+
+ private void butCancel_Click(object sender, EventArgs e)
+ {
+ // Closing without saving...
+ Close();
+ }
+
+
+ }
+}
\ No newline at end of file
Added: trunk/plugins/AutoStart/AutoStartConfig.resx
===================================================================
--- trunk/plugins/AutoStart/AutoStartConfig.resx (rev 0)
+++ trunk/plugins/AutoStart/AutoStartConfig.resx 2007-03-26 17:22:50 UTC (rev 224)
@@ -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
Added: trunk/plugins/AutoStart/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/AutoStart/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/AutoStart/Properties/AssemblyInfo.cs 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Allgemeine Informationen über eine Assembly werden über die folgenden
+// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
+// die mit einer Assembly verknüpft sind.
+[assembly: AssemblyTitle("ClassLibrary1")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ClassLibrary1")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
+// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
+// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
+[assembly: ComVisible(false)]
+
+// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
+[assembly: Guid("3aa97c20-f35a-4ded-b3f1-3bb3236339ca")]
+
+// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
+//
+// Hauptversion
+// Nebenversion
+// Buildnummer
+// Revision
+//
+// Sie können alle Werte angeben oder die standardmäßigen Revisions- und Buildnummern
+// übernehmen, indem Sie "*" eingeben:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: trunk/plugins/AutoStart/Properties/Resources.Designer.cs
===================================================================
--- trunk/plugins/AutoStart/Properties/Resources.Designer.cs (rev 0)
+++ trunk/plugins/AutoStart/Properties/Resources.Designer.cs 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,70 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion:2.0.50727.42
+//
+// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+// der Code erneut generiert wird.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ClassLibrary1.Properties {
+ using System;
+
+
+ /// <summary>
+ /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ /// </summary>
+ // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
+ // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
+ // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
+ // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClassLibrary1.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
+ /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ internal static System.Drawing.Bitmap mplogo {
+ get {
+ object obj = ResourceManager.GetObject("mplogo", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
Added: trunk/plugins/AutoStart/Properties/Resources.resx
===================================================================
--- trunk/plugins/AutoStart/Properties/Resources.resx (rev 0)
+++ trunk/plugins/AutoStart/Properties/Resources.resx 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,124 @@
+<?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>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="mplogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\mplogo.gif;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+</root>
\ No newline at end of file
Added: trunk/plugins/AutoStart/Resources/mplogo.gif
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/Resources/mplogo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/AutoStart.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/AutoStart.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/AutoStart.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/AutoStart.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/AxInterop.WMPLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/AxInterop.WMPLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/Bass.Net.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/Bass.Net.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/BassRegistration.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/BassRegistration.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/Core.DLL
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/Core.DLL
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/DirectShowLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/DirectShowLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/ICSharpCode.SharpZipLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/ICSharpCode.SharpZipLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/Interop.WMPLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/Interop.WMPLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/MediaPortal.Support.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/MediaPortal.Support.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/MediaPortal.Support.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/MediaPortal.Support.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.Direct3D.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.Direct3D.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.Direct3DX.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.Direct3DX.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/Microsoft.DirectX.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/Utils.DLL
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/Utils.DLL
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Debug/edtftpnet-1.2.2.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Debug/edtftpnet-1.2.2.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/AutoStart.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/AutoStart.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/AutoStart.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/AutoStart.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/AxInterop.WMPLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/AxInterop.WMPLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/Bass.Net.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/Bass.Net.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/BassRegistration.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/BassRegistration.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/Core.DLL
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/Core.DLL
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/DirectShowLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/DirectShowLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/ICSharpCode.SharpZipLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/ICSharpCode.SharpZipLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/Interop.WMPLib.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/Interop.WMPLib.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/MediaPortal.Support.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/MediaPortal.Support.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/MediaPortal.Support.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/MediaPortal.Support.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.Direct3D.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.Direct3D.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.Direct3DX.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.Direct3DX.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/Microsoft.DirectX.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/Utils.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/Utils.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/bin/Release/edtftpnet-1.2.2.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/bin/Release/edtftpnet-1.2.2.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/AutoStart.csproj.FileList.txt
===================================================================
--- trunk/plugins/AutoStart/obj/AutoStart.csproj.FileList.txt (rev 0)
+++ trunk/plugins/AutoStart/obj/AutoStart.csproj.FileList.txt 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,43 @@
+obj\Release\ResolveAssemblyReference.cache
+bin\Release\AutoStart.dll
+bin\Release\AutoStart.pdb
+bin\Release\Core.DLL
+bin\Release\Microsoft.DirectX.Direct3DX.dll
+bin\Release\Microsoft.DirectX.Direct3D.dll
+bin\Release\Microsoft.DirectX.dll
+bin\Release\DirectShowLib.dll
+bin\Release\Utils.dll
+bin\Release\edtftpnet-1.2.2.dll
+bin\Release\Interop.WMPLib.dll
+bin\Release\MediaPortal.Support.dll
+bin\Release\ICSharpCode.SharpZipLib.dll
+bin\Release\BassRegistration.dll
+bin\Release\Bass.Net.dll
+bin\Release\AxInterop.WMPLib.dll
+bin\Release\MediaPortal.Support.pdb
+obj\Release\AutoStart.dll
+obj\Release\AutoStart.pdb
+obj\Release\AutoStart.csproj.GenerateResource.Cache
+obj\Release\AutoStartConfig.ConfigAutoStart.resources
+bin\Debug\AutoStart.dll
+bin\Debug\AutoStart.pdb
+bin\Debug\Core.DLL
+bin\Debug\Utils.DLL
+bin\Debug\Microsoft.DirectX.Direct3DX.dll
+bin\Debug\Microsoft.DirectX.dll
+bin\Debug\DirectShowLib.dll
+bin\Debug\Microsoft.DirectX.Direct3D.dll
+bin\Debug\edtftpnet-1.2.2.dll
+bin\Debug\Interop.WMPLib.dll
+bin\Debug\MediaPortal.Support.dll
+bin\Debug\ICSharpCode.SharpZipLib.dll
+bin\Debug\BassRegistration.dll
+bin\Debug\Bass.Net.dll
+bin\Debug\AxInterop.WMPLib.dll
+bin\Debug\MediaPortal.Support.pdb
+obj\Debug\ResolveAssemblyReference.cache
+obj\Debug\AutoStartConfig.ConfigAutoStart.resources
+obj\Debug\AutoStart.csproj.GenerateResource.Cache
+obj\Debug\AutoStart.dll
+obj\Debug\AutoStart.pdb
+obj\Release\ClassLibrary1.Properties.Resources.resources
Added: trunk/plugins/AutoStart/obj/Debug/AutoStart.csproj.GenerateResource.Cache
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Debug/AutoStart.csproj.GenerateResource.Cache
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Debug/AutoStart.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Debug/AutoStart.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Debug/AutoStart.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Debug/AutoStart.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Debug/AutoStartConfig.ConfigAutoStart.resources
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Debug/AutoStartConfig.ConfigAutoStart.resources
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Release/AutoStart.csproj.GenerateResource.Cache
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Release/AutoStart.csproj.GenerateResource.Cache
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Release/AutoStart.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Release/AutoStart.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Release/AutoStart.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Release/AutoStart.pdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Release/AutoStartConfig.ConfigAutoStart.resources
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Release/AutoStartConfig.ConfigAutoStart.resources
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Release/ClassLibrary1.Properties.Resources.resources
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Release/ClassLibrary1.Properties.Resources.resources
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Release/ResolveAssemblyReference.cache
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Release/ResolveAssemblyReference.cache
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart/obj/Release/TempPE/Properties.Resources.Designer.cs.dll
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart/obj/Release/TempPE/Properties.Resources.Designer.cs.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/AutoStart.sln
===================================================================
--- trunk/plugins/AutoStart.sln (rev 0)
+++ trunk/plugins/AutoStart.sln 2007-03-26 17:22:50 UTC (rev 224)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C# Express 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoStart", "AutoStart\AutoStart.csproj", "{9A71624D-ABAE-4D49-B05D-F1C83DE77C07}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9A71624D-ABAE-4D49-B05D-F1C83DE77C07}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Added: trunk/plugins/AutoStart.suo
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/AutoStart.suo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ove...@us...> - 2007-03-26 09:51:22
|
Revision: 223
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=223&view=rev
Author: overture
Date: 2007-03-26 02:25:41 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IPTVPlugin/SnapperInterface.cs
Modified: trunk/plugins/IPTVPlugin/SnapperInterface.cs
===================================================================
--- trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-25 20:46:35 UTC (rev 222)
+++ trunk/plugins/IPTVPlugin/SnapperInterface.cs 2007-03-26 09:25:41 UTC (rev 223)
@@ -10,11 +10,34 @@
public interface IMiniIPTVPlugin
{
/// <summary>
- /// Should return a multi-dimensional array return in this order (string channelname, string channelDescription, string genre, string language, string country, string streamURL)
+ /// Should return CHANNEL INFO in a multi-dim array - returned in this order:-
+ /// [x,1] Channel Name
+ /// [x,2] Channel Description
+ /// [x,3] Genre
+ /// [x,4] Language
+ /// [x,5] Country
+ /// [x,6] Channel Stream URL
+ /// [x,7] Channel EPG
+ /// NOTE: where 'x' above = the ROW index of the multi-dim array.
+ /// NOTE: you must return Null when any of the above info is not available.
/// </summary>
- /// <returns>A multi-dimensional array</returns>
+ /// <returns>A multi-dimensional string array</returns>
string[,] IPTVChannel();
+ /// <summary>
+ /// Should return the name of the IPTV mini plugin AUTHOR.
+ /// </summary>
+ /// <returns>string with authors name</returns>
string Author();
+ /// <summary>
+ /// Should return a DESCRIPTION for the IPTV mini plugin.
+ /// </summary>
+ /// <returns>string with authors name</returns>
+ string Description();
+ /// <summary>
+ /// Should return the current VERSION of the plugin.
+ /// </summary>
+ /// <returns>decimal with version number</returns>
+ decimal Version();
}
#endregion
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|