Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

VNSI: add channel filter

  • Loading branch information...
commit 73ea0396fa26736e41cfa708367512d2936b4600 1 parent 294a976
@FernetMenta FernetMenta authored
View
1  addons/pvr.vdr.vnsi/Makefile.am
@@ -19,6 +19,7 @@ libvdrvnsi_addon_la_SOURCES = src/client.cpp \
src/VNSIRecording.cpp \
src/VNSISession.cpp \
src/VNSIAdmin.cpp \
+ src/VNSIChannels.cpp \
src/requestpacket.cpp \
src/responsepacket.cpp \
src/tools.cpp
View
30 addons/pvr.vdr.vnsi/addon/resources/language/English/strings.po
@@ -241,4 +241,32 @@ msgstr ""
msgctxt "#30107"
msgid "VDR Admin"
-msgstr ""
+msgstr ""
+
+msgctxt "#30108"
+msgid "Channels"
+msgstr ""
+
+msgctxt "#30109"
+msgid "Provider whitelist"
+msgstr ""
+
+msgctxt "#30110"
+msgid "Channel blacklist"
+msgstr ""
+
+msgctxt "#30111"
+msgid "Channel filters"
+msgstr ""
+
+msgctxt "#30112"
+msgid "Radio Channels"
+msgstr ""
+
+msgctxt "#30113"
+msgid "Save filters"
+msgstr ""
+
+msgctxt "#30114"
+msgid "Provider Unknown"
+msgstr ""
View
395 addons/pvr.vdr.vnsi/addon/resources/skins/skin.aeon.nox/1080i/Admin.xml
@@ -2,97 +2,108 @@
<defaultcontrol always="true">10</defaultcontrol>
<onload>SetProperty(menu,osd)</onload>
<allowoverlay>no</allowoverlay>
+ <views>36</views>
<include condition="!Skin.HasSetting(firstrun4.0)">AutoConfig</include>
- <animation type="WindowOpen" reversible="false" condition="![Window.Previous(settings) | Window.Previous(skinsettings)]">
- <effect type="zoom" start="150" end="100" center="960,540" time="900" tween="cubic" />
+ <animation type="WindowOpen" reversible="false"
+ condition="![Window.Previous(settings) | Window.Previous(skinsettings)]">
+ <effect type="zoom" start="150" end="100" center="960,540"
+ time="900" tween="cubic" />
<effect type="fade" end="100" time="900" />
</animation>
- <animation type="WindowClose" reversible="false" condition="![Window.Next(settings) | Window.Next(skinsettings)]">
+ <animation type="WindowClose" reversible="false"
+ condition="![Window.Next(settings) | Window.Next(skinsettings)]">
<effect type="fade" start="100" end="0" time="300" />
- <effect type="zoom" start="100" end="130" center="960,540" time="300" tween="cubic" easing="in" />
+ <effect type="zoom" start="100" end="130" center="960,540"
+ time="300" tween="cubic" easing="in" />
</animation>
<controls>
- <control type="group">
- <include>CommonSettingsBackground</include>
- <include>CommonMediaPlayingBackground</include>
- <include>Furniture_SettingsFloor</include>
- </control>
- <control type="group">
- <animation effect="zoom" end="91" center="960,360" time="400" tween="cubic" easing="inout" condition="true">Conditional</animation>
- <include>Furniture_SettingsBackPanel</include>
+ <control type="group">
+ <include>CommonSettingsBackground</include>
+ <include>CommonMediaPlayingBackground</include>
+ <include>Furniture_SettingsFloor</include>
+ </control>
+ <control type="group">
+ <animation effect="zoom" end="91" center="960,360" time="400"
+ tween="cubic" easing="inout" condition="true">Conditional</animation>
+ <include>Furniture_SettingsBackPanel</include>
<control type="list" id="10">
<defaultcontrol always="true">1</defaultcontrol>
- <left>63</left>
- <top>180</top>
- <width>326</width>
- <height>768</height>
- <onleft>10</onleft>
- <onright>11</onright>
- <onup>10</onup>
- <ondown>9000</ondown>
- <pagecontrol>-</pagecontrol>
- <scrolltime>300</scrolltime>
- <itemlayout height="74" width="334">
- <control type="label">
- <width>334</width>
- <height>74</height>
- <font>Font_Bold20</font>
+ <posx>63</posx>
+ <posy>180</posy>
+ <width>326</width>
+ <height>768</height>
+ <onleft>10</onleft>
+ <onright>11</onright>
+ <onup>10</onup>
+ <ondown>9000</ondown>
+ <pagecontrol>-</pagecontrol>
+ <scrolltime>300</scrolltime>
+ <itemlayout height="74" width="334">
+ <control type="label">
+ <width>334</width>
+ <height>74</height>
+ <font>Font_Bold20</font>
<textcolor>grey2</textcolor>
<label>$INFO[ListItem.Label]</label>
- </control>
- </itemlayout>
- <focusedlayout height="74" width="334">
- <control type="image">
+ </control>
+ </itemlayout>
+ <focusedlayout height="74" width="334">
+ <control type="image">
<width>334</width>
<height>74</height>
<texture>views/tripanel/listselect_fo.png</texture>
- <animation effect="fade" start="100" end="50" time="50" condition="!Control.HasFocus(9000)">Conditional</animation>
+ <animation effect="fade" start="100" end="50"
+ time="50" condition="!Control.HasFocus(9000)">Conditional</animation>
<colordiffuse>$VAR[FocusTextureColorVar]</colordiffuse>
- </control>
- <control type="label">
+ </control>
+ <control type="label">
<width>334</width>
<height>74</height>
<font>Font_Bold20</font>
<label>$INFO[ListItem.Label]</label>
- </control>
- </focusedlayout>
- <content>
- <item id="1">
- <label>$ADDON[pvr.vdr.vnsi 30100]</label>
- <onclick>SetProperty(menu,osd)</onclick>
- </item>
- <item id="2">
- <label>$ADDON[pvr.vdr.vnsi 30101]</label>
- <onclick>SetProperty(menu,setup)</onclick>
- </item>
+ </control>
+ </focusedlayout>
+ <content>
+ <item id="1">
+ <label>$ADDON[pvr.vdr.vnsi 30100]</label>
+ <onclick>SetProperty(menu,osd)</onclick>
+ </item>
+ <item id="2">
+ <label>$ADDON[pvr.vdr.vnsi 30101]</label>
+ <onclick>SetProperty(menu,setup)</onclick>
+ </item>
+ <item id="3">
+ <label>$ADDON[pvr.vdr.vnsi 30108]</label>
+ <onclick>SetProperty(menu,channels)</onclick>
+ </item>
</content>
</control>
<control type="group" id="11">
- <left>387</left>
- <top>120</top>
+ <posx>387</posx>
+ <posy>120</posy>
<control type="image">
<description>Background</description>
- <left>0</left>
- <top>0</top>
+ <posx>0</posx>
+ <posy>0</posy>
<width>1469</width>
<height>741</height>
<texture background="true">$INFO[Container(9000).ListItem.Icon]</texture>
</control>
<control type="image">
<description>Background Title</description>
- <left>0</left>
- <top>0</top>
+ <posx>0</posx>
+ <posy>0</posy>
<width>1469</width>
<height>50</height>
<aspectratio>stretch</aspectratio>
<texture>GlassTitleBar.png</texture>
</control>
- <control type="group" id="12">
- <visible>StringCompare(Window.Property(menu),osd)</visible>
- <control type="button" id="13">
+ <control type="group" id="12">
+ <visible>StringCompare(Window.Property(menu),osd)</visible>
+ <control type="button" id="13">
<description>osd control label</description>
- <left>25</left>
- <top>10</top>
+ <posx>25</posx>
+ <posy>10</posy>
<width>1400</width>
<height>30</height>
<texturefocus>views/tripanel/listselect_fo.png</texturefocus>
@@ -102,36 +113,22 @@
<font>font16caps</font>
<textcolor>grey</textcolor>
<focusedcolor>white2</focusedcolor>
- <onleft>10</onleft>
- </control>
- <control type="label">
- <description>not focused label</description>
- <visible>Control.HasFocus(11)</visible>
- <left>300</left>
- <top>20</top>
- <width>1380</width>
- <height>30</height>
- <font>font16caps</font>
- <label>$ADDON[pvr.vdr.vnsi 30103]</label>
- <align>left</align>
- <aligny>center</aligny>
- <textcolor>white</textcolor>
- <shadowcolor>black</shadowcolor>
+ <onleft>10</onleft>
</control>
- <control type="renderaddon" id ="9">
- <left>5</left>
- <top>50</top>
+ <control type="renderaddon" id="9">
+ <posx>5</posx>
+ <posy>50</posy>
<width>1453</width>
<height>740</height>
</control>
- </control>
- <control type="group" id="20">
- <visible>StringCompare(Window.Property(menu),setup)</visible>
- <defaultcontrol always="true">21</defaultcontrol>
- <control type="spincontrolex" id="21">
+ </control>
+ <control type="group" id="20">
+ <visible>StringCompare(Window.Property(menu),setup)</visible>
+ <defaultcontrol always="true">21</defaultcontrol>
+ <control type="spincontrolex" id="21">
<description>Source Type</description>
- <left>10</left>
- <top>50</top>
+ <posx>10</posx>
+ <posy>50</posy>
<width>1400</width>
<height>40</height>
<texturefocus>views/tripanel/listselect_fo.png</texturefocus>
@@ -143,12 +140,12 @@
<aligny>center</aligny>
<label>$ADDON[pvr.vdr.vnsi 30104]</label>
<onleft>10</onleft>
- <ondown>22</ondown>
- </control>
- <control type="spincontrolex" id="22">
+ <ondown>22</ondown>
+ </control>
+ <control type="spincontrolex" id="22">
<description>Source Type</description>
- <left>10</left>
- <top>100</top>
+ <posx>10</posx>
+ <posy>100</posy>
<width>1400</width>
<height>40</height>
<texturefocus>views/tripanel/listselect_fo.png</texturefocus>
@@ -160,13 +157,13 @@
<aligny>center</aligny>
<label>$ADDON[pvr.vdr.vnsi 30105]</label>
<onleft>10</onleft>
- <onup>21</onup>
- <ondown>23</ondown>
- </control>
- <control type="spincontrolex" id="23">
+ <onup>21</onup>
+ <ondown>23</ondown>
+ </control>
+ <control type="spincontrolex" id="23">
<description>Source Type</description>
- <left>10</left>
- <top>150</top>
+ <posx>10</posx>
+ <posy>150</posy>
<width>1400</width>
<height>40</height>
<texturefocus>views/tripanel/listselect_fo.png</texturefocus>
@@ -178,11 +175,217 @@
<aligny>center</aligny>
<label>$ADDON[pvr.vdr.vnsi 30106]</label>
<onleft>10</onleft>
- <onup>22</onup>
+ <onup>22</onup>
+ </control>
+ </control>
+ <control type="group" id="30">
+ <visible>StringCompare(Window.Property(menu),channels)</visible>
+ <defaultcontrol always="true">33</defaultcontrol>
+ <control type="label" id="31">
+ <description>Channels label</description>
+ <posx>25</posx>
+ <posy>10</posy>
+ <width>1000</width>
+ <height>30</height>
+ <font>font16caps</font>
+ <label>$ADDON[pvr.vdr.vnsi 30111]</label>
+ <align>posx</align>
+ <aligny>center</aligny>
+ <textcolor>white</textcolor>
+ <shadowcolor>black</shadowcolor>
+ </control>
+ <control type="image">
+ <posx>1090</posx>
+ <posy>30</posy>
+ <width>30</width>
+ <height>30</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>FFCC0000</colordiffuse>
+ <texture>views/scrollbarnub-focus.png</texture>
+ <visible>StringCompare(Window.Property(IsDirty),1)</visible>
+ </control>
+ <control type="image">
+ <posx>1090</posx>
+ <posy>30</posy>
+ <width>30</width>
+ <height>30</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>FF00FF00</colordiffuse>
+ <texture>views/scrollbarnub-focus.png</texture>
+ <visible>!StringCompare(Window.Property(IsDirty),1)</visible>
+ </control>
+ <control type="radiobutton" id="32">
+ <description>Is Radio</description>
+ <posx>75</posx>
+ <posy>150</posy>
+ <width>375</width>
+ <height>30</height>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturefocus>views/tripanel/listselect_fo.png</texturefocus>
+ <colordiffuse>$VAR[FocusTextureColorVar]</colordiffuse>
+ <texturenofocus>settings/settings_radiobuttonoff.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30112]</label>
+ <onleft>10</onleft>
+ <ondown>33</ondown>
+ <onright>36</onright>
+ </control>
+ <control type="button" id="33">
+ <description>providers</description>
+ <posx>75</posx>
+ <posy>250</posy>
+ <width>375</width>
+ <height>30</height>
+ <texturefocus>views/tripanel/listselect_fo.png</texturefocus>
+ <texturenofocus>settings/settings_radiobuttonoff.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30109]</label>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <onleft>10</onleft>
+ <onright>36</onright>
+ <onup>32</onup>
+ <ondown>34</ondown>
+ </control>
+ <control type="button" id="34">
+ <description>channels</description>
+ <posx>75</posx>
+ <posy>350</posy>
+ <width>375</width>
+ <height>30</height>
+ <texturefocus>views/tripanel/listselect_fo.png</texturefocus>
+ <texturenofocus>settings/settings_radiobuttonoff.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30110]</label>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <onleft>10</onleft>
+ <onright>36</onright>
+ <onup>33</onup>
+ <ondown>35</ondown>
+ </control>
+ <control type="button" id="35">
+ <description>save</description>
+ <posx>75</posx>
+ <posy>450</posy>
+ <width>375</width>
+ <height>30</height>
+ <texturefocus>views/tripanel/listselect_fo.png</texturefocus>
+ <texturenofocus>settings/settings_radiobuttonoff.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30113]</label>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <onleft>10</onleft>
+ <onright>36</onright>
+ <onup>34</onup>
+ </control>
+ <control type="image">
+ <description>background image</description>
+ <posx>700</posx>
+ <posy>75</posy>
+ <width>740</width>
+ <height>670</height>
+ <texture background="true">$INFO[Container(9000).ListItem.Icon]</texture>
+ </control>
+ <control type="list" id ="36">
+ <posx>720</posx>
+ <posy>95</posy>
+ <width>650</width>
+ <height>630</height>
+ <onleft>33</onleft>
+ <onright>37</onright>
+ <viewtype label="30106">list</viewtype>
+ <pagecontrol>37</pagecontrol>
+ <scrolltime>200</scrolltime>
+ <itemlayout height="20" width="650">
+ <control type="image">
+ <posx>2</posx>
+ <posy>2</posy>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>7790EE90</colordiffuse>
+ <texture>arrowright.png</texture>
+ <visible>ListItem.Property(IsWhitelist)</visible>
+ </control>
+ <control type="image">
+ <posx>2</posx>
+ <posy>2</posy>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>77FF0000</colordiffuse>
+ <texture>arrowright.png</texture>
+ <visible>ListItem.Property(IsBlacklist)</visible>
+ </control>
+ <control type="label">
+ <posx>40</posx>
+ <posy>0</posy>
+ <width>550</width>
+ <height>20</height>
+ <font>Font_Reg10</font>
+ <align>posx</align>
+ <aligny>center</aligny>
+ <textcolor>grey2</textcolor>
+ <selectedcolor>selected</selectedcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </itemlayout>
+ <focusedlayout height="20" width="650">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>650</width>
+ <height>20</height>
+ <aspectratio>stretch</aspectratio>
+ <texture>views/tripanel/listselect_fo.png</texture>
+ <colordiffuse>$VAR[FocusTextureColorVar]</colordiffuse>
+ <visible>Control.HasFocus(36)</visible>
+ </control>
+ <control type="image">
+ <posx>2</posx>
+ <posy>2</posy>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>7790EE90</colordiffuse>
+ <texture>arrowright.png</texture>
+ <visible>ListItem.Property(IsWhitelist)</visible>
+ </control>
+ <control type="image">
+ <posx>2</posx>
+ <posy>2</posy>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>77FF0000</colordiffuse>
+ <texture>arrowright.png</texture>
+ <visible>ListItem.Property(IsBlacklist)</visible>
+ </control>
+ <control type="label">
+ <posx>40</posx>
+ <posy>0</posy>
+ <width>550</width>
+ <height>20</height>
+ <font>Font_Reg10</font>
+ <align>posx</align>
+ <aligny>center</aligny>
+ <textcolor>grey2</textcolor>
+ <selectedcolor>selected</selectedcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </focusedlayout>
+ </control>
+ <control type="scrollbar" id="37">
+ <posx>1400</posx>
+ <posy>75</posy>
+ <width>25</width>
+ <height>630</height>
+ <onleft>36</onleft>
+ <showonepage>false</showonepage>
+ <orientation>vertical</orientation>
+ </control>
</control>
- </control>
</control>
- </control>
- <include>Clock</include>
+ </control>
</controls>
</window>
View
524 addons/pvr.vdr.vnsi/addon/resources/skins/skin.confluence/720p/Admin.xml
@@ -2,129 +2,134 @@
<defaultcontrol always="true">10</defaultcontrol>
<onload>SetProperty(menu,osd)</onload>
<allowoverlay>no</allowoverlay>
+ <views>36</views>
<controls>
<include>CommonBackground</include>
- <control type="image">
- <left>0</left>
- <top>100r</top>
- <width>1280</width>
- <height>100</height>
- <texture>floor.png</texture>
- <include>VisibleFadeEffect</include>
- </control>
- <control type="group">
- <left>90</left>
- <top>30</top>
- <animation type="WindowOpen" reversible="false">
- <effect type="zoom" start="80" end="100" center="640,360" easing="out" tween="back" time="300" />
- <effect type="fade" start="0" end="100" time="300" />
- </animation>
- <animation type="WindowClose" reversible="false">
- <effect type="zoom" start="100" end="80" center="640,360" easing="in" tween="back" time="300" />
- <effect type="fade" start="100" end="0" time="300" />
- </animation>
- <control type="image">
- <left>5</left>
- <top>5</top>
- <width>1090</width>
- <height>630</height>
- <texture border="15">ContentPanel.png</texture>
- </control>
- <control type="image">
- <left>5</left>
- <top>625</top>
- <width>1090</width>
- <height>64</height>
- <texture border="15">ContentPanelMirror.png</texture>
- </control>
- <control type="button">
- <description>Close Window button</description>
- <left>980</left>
- <top>11</top>
- <width>64</width>
- <height>32</height>
- <label>-</label>
- <font>-</font>
- <onclick>PreviousMenu</onclick>
- <texturefocus>DialogCloseButton-focus.png</texturefocus>
- <texturenofocus>DialogCloseButton.png</texturenofocus>
- <onleft>1</onleft>
- <onright>1</onright>
- <onup>1</onup>
- <ondown>1</ondown>
- <visible>system.getbool(input.enablemouse)</visible>
- <include>VisibleFadeEffect</include>
- </control>
- <control type="image">
- <description>LOGO</description>
- <left>30</left>
- <top>15</top>
- <width>220</width>
- <height>80</height>
- <aspectratio>keep</aspectratio>
- <texture>Confluence_Logo.png</texture>
- </control>
+ <control type="image">
+ <left>0</left>
+ <top>100r</top>
+ <width>1280</width>
+ <height>100</height>
+ <texture>floor.png</texture>
+ <include>VisibleFadeEffect</include>
+ </control>
+ <control type="group">
+ <left>90</left>
+ <top>30</top>
+ <animation type="WindowOpen" reversible="false">
+ <effect type="zoom" start="80" end="100" center="640,360" easing="out" tween="back" time="300" />
+ <effect type="fade" start="0" end="100" time="300" />
+ </animation>
+ <animation type="WindowClose" reversible="false">
+ <effect type="zoom" start="100" end="80" center="640,360" easing="in" tween="back" time="300" />
+ <effect type="fade" start="100" end="0" time="300" />
+ </animation>
+ <control type="image">
+ <left>5</left>
+ <top>5</top>
+ <width>1090</width>
+ <height>630</height>
+ <texture border="15">ContentPanel.png</texture>
+ </control>
+ <control type="image">
+ <left>5</left>
+ <top>625</top>
+ <width>1090</width>
+ <height>64</height>
+ <texture border="15">ContentPanelMirror.png</texture>
+ </control>
+ <control type="button">
+ <description>Close Window button</description>
+ <left>980</left>
+ <top>11</top>
+ <width>64</width>
+ <height>32</height>
+ <label>-</label>
+ <font>-</font>
+ <onclick>PreviousMenu</onclick>
+ <texturefocus>DialogCloseButton-focus.png</texturefocus>
+ <texturenofocus>DialogCloseButton.png</texturenofocus>
+ <onleft>1</onleft>
+ <onright>1</onright>
+ <onup>1</onup>
+ <ondown>1</ondown>
+ <visible>system.getbool(input.enablemouse)</visible>
+ <include>VisibleFadeEffect</include>
+ </control>
+ <control type="image">
+ <description>LOGO</description>
+ <left>30</left>
+ <top>15</top>
+ <width>220</width>
+ <height>80</height>
+ <aspectratio>keep</aspectratio>
+ <texture>Confluence_Logo.png</texture>
+ </control>
<control type="list" id="10">
<defaultcontrol always="true">1</defaultcontrol>
- <left>10</left>
- <top>90</top>
- <width>260</width>
- <height>481</height>
- <onleft>10</onleft>
- <onright>11</onright>
- <onup>10</onup>
- <ondown>9000</ondown>
- <pagecontrol>-</pagecontrol>
- <scrolltime>300</scrolltime>
- <itemlayout height="54" width="260">
- <control type="image">
- <left>0</left>
- <top>0</top>
- <width>260</width>
- <height>55</height>
- <texture border="5">MenuItemNF.png</texture>
- </control>
- <control type="label">
- <left>250</left>
- <top>0</top>
- <width>380</width>
- <height>55</height>
- <font>font24_title</font>
- <textcolor>grey3</textcolor>
- <align>right</align>
- <aligny>center</aligny>
- <label>$INFO[ListItem.Label]</label>
- </control>
- </itemlayout>
- <focusedlayout height="54" width="260">
- <control type="image">
- <left>0</left>
- <top>0</top>
- <width>260</width>
- <height>55</height>
- <texture border="5">MenuItemFO.png</texture>
- </control>
- <control type="label">
- <left>250</left>
- <top>0</top>
- <width>380</width>
- <height>55</height>
- <font>font24_title</font>
- <textcolor>white</textcolor>
- <align>right</align>
- <aligny>center</aligny>
- <label>$INFO[ListItem.Label]</label>
- </control>
- </focusedlayout>
- <content>
- <item id="1">
- <label>$ADDON[pvr.vdr.vnsi 30100]</label>
- <onclick>SetProperty(menu,osd)</onclick>
- </item>
- <item id="2">
- <label>$ADDON[pvr.vdr.vnsi 30101]</label>
- <onclick>SetProperty(menu,setup)</onclick>
- </item>
+ <left>10</left>
+ <top>90</top>
+ <width>260</width>
+ <height>481</height>
+ <onleft>10</onleft>
+ <onright>11</onright>
+ <onup>10</onup>
+ <ondown>9000</ondown>
+ <pagecontrol>-</pagecontrol>
+ <scrolltime>300</scrolltime>
+ <itemlayout height="54" width="260">
+ <control type="image">
+ <left>0</left>
+ <top>0</top>
+ <width>260</width>
+ <height>55</height>
+ <texture border="5">MenuItemNF.png</texture>
+ </control>
+ <control type="label">
+ <left>250</left>
+ <top>0</top>
+ <width>380</width>
+ <height>55</height>
+ <font>font24_title</font>
+ <textcolor>grey3</textcolor>
+ <align>right</align>
+ <aligny>center</aligny>
+ <label>$INFO[ListItem.Label]</label>
+ </control>
+ </itemlayout>
+ <focusedlayout height="54" width="260">
+ <control type="image">
+ <left>0</left>
+ <top>0</top>
+ <width>260</width>
+ <height>55</height>
+ <texture border="5">MenuItemFO.png</texture>
+ </control>
+ <control type="label">
+ <left>250</left>
+ <top>0</top>
+ <width>380</width>
+ <height>55</height>
+ <font>font24_title</font>
+ <textcolor>white</textcolor>
+ <align>right</align>
+ <aligny>center</aligny>
+ <label>$INFO[ListItem.Label]</label>
+ </control>
+ </focusedlayout>
+ <content>
+ <item id="1">
+ <label>$ADDON[pvr.vdr.vnsi 30100]</label>
+ <onclick>SetProperty(menu,osd)</onclick>
+ </item>
+ <item id="2">
+ <label>$ADDON[pvr.vdr.vnsi 30101]</label>
+ <onclick>SetProperty(menu,setup)</onclick>
+ </item>
+ <item id="3">
+ <label>$ADDON[pvr.vdr.vnsi 30108]</label>
+ <onclick>SetProperty(menu,channels)</onclick>
+ </item>
</content>
</control>
<control type="group" id="11">
@@ -147,9 +152,9 @@
<aspectratio>stretch</aspectratio>
<texture>GlassTitleBar.png</texture>
</control>
- <control type="group" id="12">
- <visible>StringCompare(Window.Property(menu),osd)</visible>
- <control type="button" id="13">
+ <control type="group" id="12">
+ <visible>StringCompare(Window.Property(menu),osd)</visible>
+ <control type="button" id="13">
<description>osd control label</description>
<left>25</left>
<top>20</top>
@@ -160,21 +165,7 @@
<label>$ADDON[pvr.vdr.vnsi 30103]</label>
<font>font16caps</font>
<textcolor>white</textcolor>
- <onleft>10</onleft>
- </control>
- <control type="label">
- <description>not focused label</description>
- <visible>Control.HasFocus(11)</visible>
- <left>300</left>
- <top>30</top>
- <width>740</width>
- <height>30</height>
- <font>font16caps</font>
- <label>$ADDON[pvr.vdr.vnsi 30103]</label>
- <align>left</align>
- <aligny>center</aligny>
- <textcolor>white</textcolor>
- <shadowcolor>black</shadowcolor>
+ <onleft>10</onleft>
</control>
<control type="renderaddon" id ="9">
<left>5</left>
@@ -182,11 +173,11 @@
<width>780</width>
<height>515</height>
</control>
- </control>
- <control type="group" id="20">
- <visible>StringCompare(Window.Property(menu),setup)</visible>
- <defaultcontrol always="true">21</defaultcontrol>
- <control type="spincontrolex" id="21">
+ </control>
+ <control type="group" id="20">
+ <visible>StringCompare(Window.Property(menu),setup)</visible>
+ <defaultcontrol always="true">21</defaultcontrol>
+ <control type="spincontrolex" id="21">
<description>Source Type</description>
<left>10</left>
<top>50</top>
@@ -200,9 +191,9 @@
<aligny>center</aligny>
<label>$ADDON[pvr.vdr.vnsi 30104]</label>
<onleft>10</onleft>
- <ondown>22</ondown>
- </control>
- <control type="spincontrolex" id="22">
+ <ondown>22</ondown>
+ </control>
+ <control type="spincontrolex" id="22">
<description>Source Type</description>
<left>10</left>
<top>100</top>
@@ -216,10 +207,10 @@
<aligny>center</aligny>
<label>$ADDON[pvr.vdr.vnsi 30105]</label>
<onleft>10</onleft>
- <onup>21</onup>
- <ondown>23</ondown>
- </control>
- <control type="spincontrolex" id="23">
+ <onup>21</onup>
+ <ondown>23</ondown>
+ </control>
+ <control type="spincontrolex" id="23">
<description>Source Type</description>
<left>10</left>
<top>150</top>
@@ -233,11 +224,240 @@
<aligny>center</aligny>
<label>$ADDON[pvr.vdr.vnsi 30106]</label>
<onleft>10</onleft>
- <onup>22</onup>
+ <onup>22</onup>
+ </control>
+ </control>
+ <control type="group" id="30">
+ <visible>StringCompare(Window.Property(menu),channels)</visible>
+ <defaultcontrol always="true">33</defaultcontrol>
+ <control type="label" id="31">
+ <description>Channels label</description>
+ <left>30</left>
+ <top>20</top>
+ <width>500</width>
+ <height>30</height>
+ <font>font16caps</font>
+ <label>$ADDON[pvr.vdr.vnsi 30111]</label>
+ <align>left</align>
+ <aligny>center</aligny>
+ <textcolor>white</textcolor>
+ <shadowcolor>black</shadowcolor>
+ </control>
+ <control type="image">
+ <left>730</left>
+ <top>20</top>
+ <width>30</width>
+ <height>30</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>FFCC0000</colordiffuse>
+ <texture>radiobutton-nofocus.png</texture>
+ <visible>StringCompare(Window.Property(IsDirty),1)</visible>
+ </control>
+ <control type="image">
+ <left>730</left>
+ <top>20</top>
+ <width>30</width>
+ <height>30</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>FF00FF00</colordiffuse>
+ <texture>radiobutton-nofocus.png</texture>
+ <visible>!StringCompare(Window.Property(IsDirty),1)</visible>
+ </control>
+ <control type="radiobutton" id="32">
+ <description>Is Radio</description>
+ <left>50</left>
+ <top>100</top>
+ <width>250</width>
+ <height>30</height>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturefocus border="0,2,0,2">MenuItemFO.png</texturefocus>
+ <texturenofocus border="0,2,0,2">MenuItemNF.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30112]</label>
+ <onleft>10</onleft>
+ <ondown>33</ondown>
+ <onright>36</onright>
+ </control>
+ <control type="button" id="33">
+ <description>providers</description>
+ <left>50</left>
+ <top>150</top>
+ <width>250</width>
+ <height>30</height>
+ <texturefocus border="5">MenuItemFO.png</texturefocus>
+ <texturenofocus border="5">MenuItemNF.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30109]</label>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <onleft>10</onleft>
+ <onright>36</onright>
+ <onup>32</onup>
+ <ondown>34</ondown>
+ </control>
+ <control type="button" id="34">
+ <description>channels</description>
+ <left>50</left>
+ <top>200</top>
+ <width>250</width>
+ <height>30</height>
+ <texturefocus border="5">MenuItemFO.png</texturefocus>
+ <texturenofocus border="5">MenuItemNF.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30110]</label>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <onleft>10</onleft>
+ <onright>36</onright>
+ <onup>33</onup>
+ <ondown>35</ondown>
+ </control>
+ <control type="button" id="35">
+ <description>save</description>
+ <left>50</left>
+ <top>250</top>
+ <width>250</width>
+ <height>30</height>
+ <texturefocus border="5">MenuItemFO.png</texturefocus>
+ <texturenofocus border="5">MenuItemNF.png</texturenofocus>
+ <label>$ADDON[pvr.vdr.vnsi 30113]</label>
+ <font>font16caps</font>
+ <textcolor>grey3</textcolor>
+ <onleft>10</onleft>
+ <onright>36</onright>
+ <onup>34</onup>
+ </control>
+ <control type="image">
+ <description>background image</description>
+ <left>320</left>
+ <top>50</top>
+ <width>440</width>
+ <height>540</height>
+ <texture border="20">DialogBack2.png</texture>
+ </control>
+ <control type="list" id ="36">
+ <left>340</left>
+ <top>70</top>
+ <width>400</width>
+ <height>500</height>
+ <onleft>33</onleft>
+ <onright>37</onright>
+ <viewtype label="30106">list</viewtype>
+ <pagecontrol>37</pagecontrol>
+ <scrolltime>200</scrolltime>
+ <itemlayout height="20" width="400">
+ <control type="image">
+ <left>0</left>
+ <top>0</top>
+ <width>400</width>
+ <height>20</height>
+ <aspectratio>stretch</aspectratio>
+ <texture border="5">MenuItemNF.png</texture>
+ </control>
+ <control type="image">
+ <left>2</left>
+ <top>2</top>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>7790EE90</colordiffuse>
+ <texture>arrow-big-right.png</texture>
+ <visible>ListItem.Property(IsWhitelist)</visible>
+ </control>
+ <control type="image">
+ <left>2</left>
+ <top>2</top>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>77FF0000</colordiffuse>
+ <texture>arrow-big-right.png</texture>
+ <visible>ListItem.Property(IsBlacklist)</visible>
+ </control>
+ <control type="label">
+ <left>40</left>
+ <top>0</top>
+ <width>340</width>
+ <height>20</height>
+ <font>font10</font>
+ <align>left</align>
+ <aligny>center</aligny>
+ <textcolor>grey2</textcolor>
+ <selectedcolor>selected</selectedcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </itemlayout>
+ <focusedlayout height="20" width="400">
+ <control type="image">
+ <left>0</left>
+ <top>0</top>
+ <width>400</width>
+ <height>20</height>
+ <aspectratio>stretch</aspectratio>
+ <texture border="5">MenuItemNF.png</texture>
+ <visible>!Control.HasFocus(36)</visible>
+ <include>VisibleFadeEffect</include>
+ </control>
+ <control type="image">
+ <left>0</left>
+ <top>0</top>
+ <width>400</width>
+ <height>20</height>
+ <aspectratio>stretch</aspectratio>
+ <texture border="5">MenuItemFO.png</texture>
+ <visible>Control.HasFocus(36)</visible>
+ <include>VisibleFadeEffect</include>
+ </control>
+ <control type="image">
+ <left>2</left>
+ <top>2</top>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>7790EE90</colordiffuse>
+ <texture>arrow-big-right.png</texture>
+ <visible>ListItem.Property(IsWhitelist)</visible>
+ </control>
+ <control type="image">
+ <left>2</left>
+ <top>2</top>
+ <width>18</width>
+ <height>18</height>
+ <aspectratio>stretch</aspectratio>
+ <colordiffuse>77FF0000</colordiffuse>
+ <texture>arrow-big-right.png</texture>
+ <visible>ListItem.Property(IsBlacklist)</visible>
+ </control>
+ <control type="label">
+ <left>40</left>
+ <top>0</top>
+ <width>340</width>
+ <height>20</height>
+ <font>font10</font>
+ <align>left</align>
+ <aligny>center</aligny>
+ <textcolor>grey2</textcolor>
+ <selectedcolor>selected</selectedcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </focusedlayout>
+ </control>
+ <control type="scrollbar" id="37">
+ <left>760</left>
+ <top>50</top>
+ <width>25</width>
+ <height>540</height>
+ <texturesliderbackground border="0,14,0,14">ScrollBarV.png</texturesliderbackground>
+ <texturesliderbar border="0,14,0,14">ScrollBarV_bar.png</texturesliderbar>
+ <texturesliderbarfocus border="0,14,0,14">ScrollBarV_bar_focus.png</texturesliderbarfocus>
+ <textureslidernib>ScrollBarNib.png</textureslidernib>
+ <textureslidernibfocus>ScrollBarNib.png</textureslidernibfocus>
+ <onleft>36</onleft>
+ <showonepage>false</showonepage>
+ <orientation>vertical</orientation>
+ </control>
</control>
- </control>
</control>
- </control>
+ </control>
<include>Clock</include>
</controls>
</window>
View
379 addons/pvr.vdr.vnsi/src/VNSIAdmin.cpp
@@ -96,6 +96,12 @@ CVisGUIShader *vis_shader = NULL;
#define CONTROL_SPIN_TIMESHIFT_MODE 21
#define CONTROL_SPIN_TIMESHIFT_BUFFER_RAM 22
#define CONTROL_SPIN_TIMESHIFT_BUFFER_FILE 23
+#define CONTROL_LABEL_FILTERS 31
+#define CONTROL_RADIO_ISRADIO 32
+#define CONTROL_PROVIDERS_BUTTON 33
+#define CONTROL_CHANNELS_BUTTON 34
+#define CONTROL_FILTERSAVE_BUTTON 35
+#define CONTROL_ITEM_LIST 36
#define ACTION_NONE 0
#define ACTION_MOVE_LEFT 1
@@ -840,8 +846,12 @@ bool cVNSIAdmin::Open(const std::string& hostname, int port, const char* name)
m_window->CBOnFocus = OnFocusCB;
m_window->CBOnClick = OnClickCB;
m_window->CBOnAction= OnActionCB;
+
m_window->DoModal();
+ ClearListItems();
+ m_window->ClearProperties();
+
#if defined(XBMC_GUI_API_VERSION)
GUI->Control_releaseRendering(m_renderControl);
#endif
@@ -849,7 +859,9 @@ bool cVNSIAdmin::Open(const std::string& hostname, int port, const char* name)
GUI->Control_releaseSpin(m_spinTimeshiftMode);
GUI->Control_releaseSpin(m_spinTimeshiftBufferRam);
GUI->Control_releaseSpin(m_spinTimeshiftBufferFile);
+ GUI->Control_releaseRadioButton(m_ratioIsRadio);
GUI->Window_destroy(m_window);
+ StopThread();
Close();
if (m_osdRender)
@@ -901,6 +913,89 @@ bool cVNSIAdmin::OnClick(int controlId)
}
return true;
}
+ else if (controlId == CONTROL_PROVIDERS_BUTTON)
+ {
+ if(!m_channels.m_loaded || m_ratioIsRadio->IsSelected() != m_channels.m_radio)
+ {
+ ReadChannelList(m_ratioIsRadio->IsSelected());
+ ReadChannelWhitelist(m_ratioIsRadio->IsSelected());
+ ReadChannelBlacklist(m_ratioIsRadio->IsSelected());
+ m_channels.CreateProviders();
+ m_channels.LoadProviderWhitelist();
+ m_channels.LoadChannelBlacklist();
+ m_channels.m_loaded = true;
+ m_channels.m_radio = m_ratioIsRadio->IsSelected();
+ m_window->SetProperty("IsDirty", "0");
+ }
+ LoadListItemsProviders();
+ m_channels.m_mode = CVNSIChannels::PROVIDER;
+ }
+ else if (controlId == CONTROL_CHANNELS_BUTTON)
+ {
+ if(!m_channels.m_loaded || m_ratioIsRadio->IsSelected() != m_channels.m_radio)
+ {
+ ReadChannelList(m_ratioIsRadio->IsSelected());
+ ReadChannelWhitelist(m_ratioIsRadio->IsSelected());
+ ReadChannelBlacklist(m_ratioIsRadio->IsSelected());
+ m_channels.CreateProviders();
+ m_channels.LoadProviderWhitelist();
+ m_channels.LoadChannelBlacklist();
+ m_channels.m_loaded = true;
+ m_channels.m_radio = m_ratioIsRadio->IsSelected();
+ m_window->SetProperty("IsDirty", "0");
+ }
+ LoadListItemsChannels();
+ m_channels.m_mode = CVNSIChannels::CHANNEL;
+ }
+ else if (controlId == CONTROL_FILTERSAVE_BUTTON)
+ {
+ if(m_channels.m_loaded)
+ {
+ SaveChannelWhitelist(m_ratioIsRadio->IsSelected());
+ SaveChannelBlacklist(m_ratioIsRadio->IsSelected());
+ m_window->SetProperty("IsDirty", "0");
+ }
+ }
+ else if (controlId == CONTROL_ITEM_LIST)
+ {
+ if(m_channels.m_mode == CVNSIChannels::PROVIDER)
+ {
+ int pos = m_window->GetCurrentListPosition();
+ GUIHANDLE hdl = m_window->GetListItem(pos);
+ int idx = m_listItemsMap[hdl];
+ CAddonListItem *item = m_listItems[idx];
+ if (m_channels.m_providers[idx].m_whitelist)
+ {
+ item->SetProperty("IsWhitelist", "false");
+ m_channels.m_providers[idx].m_whitelist = false;
+ }
+ else
+ {
+ item->SetProperty("IsWhitelist", "true");
+ m_channels.m_providers[idx].m_whitelist = true;
+ }
+ m_window->SetProperty("IsDirty", "1");
+ }
+ else if(m_channels.m_mode == CVNSIChannels::CHANNEL)
+ {
+ int pos = m_window->GetCurrentListPosition();
+ GUIHANDLE hdl = m_window->GetListItem(pos);
+ int idx = m_listItemsMap[hdl];
+ CAddonListItem *item = m_listItems[idx];
+ int channelidx = m_listItemsChannelsMap[hdl];
+ if (m_channels.m_channels[channelidx].m_blacklist)
+ {
+ item->SetProperty("IsBlacklist", "false");
+ m_channels.m_channels[channelidx].m_blacklist = false;
+ }
+ else
+ {
+ item->SetProperty("IsBlacklist", "true");
+ m_channels.m_channels[channelidx].m_blacklist = true;
+ }
+ m_window->SetProperty("IsDirty", "1");
+ }
+ }
return false;
}
@@ -1022,6 +1117,10 @@ bool cVNSIAdmin::OnInit()
m_spinTimeshiftBufferFile->SetValue(mode);
delete resp;
}
+
+ // channel filters
+ m_ratioIsRadio = GUI->Control_getRadioButton(m_window, CONTROL_RADIO_ISRADIO);
+
return true;
}
@@ -1067,10 +1166,11 @@ bool cVNSIAdmin::OnAction(int actionId)
if (actionId == ACTION_SELECT_ITEM)
{
- int controlID = m_window->GetFocusId();
- if (controlID == CONTROL_MENU)
+ if (m_window->GetFocusId() == CONTROL_MENU)
{
- if (strncmp(m_window->GetProperty("menu"), "osd", 3) == 0)
+ const char *tmp = m_window->GetProperty("menu");
+ //if (strncmp(m_window->GetProperty("menu"), "osd", 3) == 0)
+ if (strncmp(tmp, "osd", 3) == 0)
{
#if defined(XBMC_GUI_API_VERSION)
m_window->MarkDirtyRegion();
@@ -1289,3 +1389,276 @@ bool cVNSIAdmin::ConnectOSD()
return true;
}
+
+bool cVNSIAdmin::ReadChannelList(bool radio)
+{
+ cRequestPacket vrp;
+ if (!vrp.init(VNSI_CHANNELS_GETCHANNELS))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't init cRequestPacket", __FUNCTION__);
+ return false;
+ }
+ if (!vrp.add_U32(radio))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
+ return false;
+ }
+ if (!vrp.add_U8(0)) // apply no filter
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
+ return false;
+ }
+
+ cResponsePacket* vresp = ReadResult(&vrp);
+ if (!vresp)
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't get response packed", __FUNCTION__);
+ return false;
+ }
+
+ m_channels.m_channels.clear();
+ m_channels.m_channelsMap.clear();
+ while (!vresp->end())
+ {
+ CChannel channel;
+ channel.m_blacklist = false;
+
+ channel.m_number = vresp->extract_U32();
+ char *strChannelName = vresp->extract_String();
+ channel.m_name = strChannelName;
+ char *strProviderName = vresp->extract_String();
+ channel.m_provider = strProviderName;
+ channel.m_id = vresp->extract_U32();
+ vresp->extract_U32(); // first caid
+ char *strCaids = vresp->extract_String();
+ channel.SetCaids(strCaids);
+ channel.m_radio = radio;
+
+ delete[] strChannelName;
+ delete[] strProviderName;
+ delete[] strCaids;
+ m_channels.m_channels.push_back(channel);
+ m_channels.m_channelsMap[channel.m_id] = m_channels.m_channels.size() - 1;
+ }
+ delete vresp;
+
+ return true;
+}
+
+bool cVNSIAdmin::ReadChannelWhitelist(bool radio)
+{
+ cRequestPacket vrp;
+ if (!vrp.init(VNSI_CHANNELS_GETWHITELIST))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't init cRequestPacket", __FUNCTION__);
+ return false;
+ }
+ if (!vrp.add_U8(radio))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
+ return false;
+ }
+
+ cResponsePacket* vresp = ReadResult(&vrp);
+ if (!vresp)
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't get response packed", __FUNCTION__);
+ return false;
+ }
+
+ m_channels.m_providerWhitelist.clear();
+ CProvider provider;
+ while (!vresp->end())
+ {
+ char *strProviderName = vresp->extract_String();
+ provider.m_name = strProviderName;
+ provider.m_caid = vresp->extract_U32();
+ m_channels.m_providerWhitelist.push_back(provider);
+ delete [] strProviderName;
+ }
+ delete vresp;
+
+ return true;
+}
+
+bool cVNSIAdmin::SaveChannelWhitelist(bool radio)
+{
+ m_channels.ExtractProviderWhitelist();
+
+ cRequestPacket vrp;
+ if (!vrp.init(VNSI_CHANNELS_SETWHITELIST))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't init cRequestPacket", __FUNCTION__);
+ return false;
+ }
+ if (!vrp.add_U8(radio))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
+ return false;
+ }
+
+ for(unsigned int i=0; i<m_channels.m_providerWhitelist.size(); i++)
+ {
+ vrp.add_String(m_channels.m_providerWhitelist[i].m_name.c_str());
+ vrp.add_S32(m_channels.m_providerWhitelist[i].m_caid);
+ }
+
+ cResponsePacket* vresp = ReadResult(&vrp);
+ if (!vresp)
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't get response packed", __FUNCTION__);
+ return false;
+ }
+
+ return true;
+}
+
+bool cVNSIAdmin::ReadChannelBlacklist(bool radio)
+{
+ cRequestPacket vrp;
+ if (!vrp.init(VNSI_CHANNELS_GETBLACKLIST))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't init cRequestPacket", __FUNCTION__);
+ return false;
+ }
+ if (!vrp.add_U8(radio))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
+ return false;
+ }
+
+ cResponsePacket* vresp = ReadResult(&vrp);
+ if (!vresp)
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't get response packed", __FUNCTION__);
+ return false;
+ }
+
+ m_channels.m_channelBlacklist.clear();
+ while (!vresp->end())
+ {
+ int id = vresp->extract_U32();
+ m_channels.m_channelBlacklist.push_back(id);
+ }
+ delete vresp;
+
+ return true;
+}
+
+bool cVNSIAdmin::SaveChannelBlacklist(bool radio)
+{
+ m_channels.ExtractChannelBlacklist();
+
+ cRequestPacket vrp;
+ if (!vrp.init(VNSI_CHANNELS_SETBLACKLIST))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't init cRequestPacket", __FUNCTION__);
+ return false;
+ }
+ if (!vrp.add_U8(radio))
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
+ return false;
+ }
+
+ for(unsigned int i=0; i<m_channels.m_channelBlacklist.size(); i++)
+ {
+ vrp.add_S32(m_channels.m_channelBlacklist[i]);
+ }
+
+ cResponsePacket* vresp = ReadResult(&vrp);
+ if (!vresp)
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't get response packed", __FUNCTION__);
+ return false;
+ }
+
+ return true;
+}
+
+void cVNSIAdmin::ClearListItems()
+{
+ m_window->ClearList();
+ std::vector<CAddonListItem*>::iterator it;
+ for(it=m_listItems.begin(); it!=m_listItems.end(); ++it)
+ {
+ GUI->ListItem_destroy(*it);
+ }
+ m_listItems.clear();
+ m_listItemsMap.clear();
+ m_listItemsChannelsMap.clear();
+}
+
+void cVNSIAdmin::LoadListItemsProviders()
+{
+ ClearListItems();
+
+ std::vector<CProvider>::iterator it;
+ int count = 0;
+ for(it=m_channels.m_providers.begin(); it!=m_channels.m_providers.end(); ++it)
+ {
+ std::string tmp;
+ if(!it->m_name.empty())
+ tmp = it->m_name;
+ else
+ tmp = XBMC->GetLocalizedString(30114);
+ if (it->m_caid == 0)
+ {
+ tmp += " - FTA";
+ }
+ else
+ {
+ tmp += " - CAID: ";
+ char buf[16];
+ sprintf(buf, "%04x", it->m_caid);
+ tmp += buf;
+ }
+
+ CAddonListItem *item = GUI->ListItem_create(tmp.c_str(), NULL, NULL, NULL, NULL);
+ m_window->AddItem(item, count);
+ GUIHANDLE hdl = m_window->GetListItem(count);
+ m_listItems.push_back(item);
+ m_listItemsMap[hdl] = count;
+
+ if (it->m_whitelist)
+ item->SetProperty("IsWhitelist", "true");
+ else
+ item->SetProperty("IsWhitelist", "false");
+
+ count++;
+ }
+}
+
+void cVNSIAdmin::LoadListItemsChannels()
+{
+ ClearListItems();
+
+ int count = 0;
+ std::string tmp;
+ for(unsigned int i=0; i<m_channels.m_channels.size(); i++)
+ {
+ if(!m_channels.IsWhitelist(m_channels.m_channels[i]))
+ continue;
+
+ tmp = m_channels.m_channels[i].m_name;
+ tmp += " (";
+ if(!m_channels.m_channels[i].m_provider.empty())
+ tmp += m_channels.m_channels[i].m_provider;
+ else
+ tmp += XBMC->GetLocalizedString(30114);
+ tmp += ")";
+ CAddonListItem *item = GUI->ListItem_create(tmp.c_str(), NULL, NULL, NULL, NULL);
+ m_window->AddItem(item, count);
+ GUIHANDLE hdl = m_window->GetListItem(count);
+ m_listItems.push_back(item);
+ m_listItemsMap[hdl] = count;
+ m_listItemsChannelsMap[hdl] = i;
+
+ if (m_channels.m_channels[i].m_blacklist)
+ item->SetProperty("IsBlacklist", "true");
+ else
+ item->SetProperty("IsBlacklist", "false");
+
+ count++;
+ }
+}
View
14 addons/pvr.vdr.vnsi/src/VNSIAdmin.h
@@ -21,6 +21,7 @@
*/
#include "VNSIData.h"
+#include "VNSIChannels.h"
#include "client.h"
class cOSDRender;
@@ -60,6 +61,14 @@ class cVNSIAdmin : public cVNSIData
virtual void OnReconnect() {};
bool ConnectOSD();
bool IsVdrAction(int action);
+ bool ReadChannelList(bool radio);
+ bool ReadChannelWhitelist(bool radio);
+ bool ReadChannelBlacklist(bool radio);
+ bool SaveChannelWhitelist(bool radio);
+ bool SaveChannelBlacklist(bool radio);
+ void ClearListItems();
+ void LoadListItemsProviders();
+ void LoadListItemsChannels();
private:
@@ -70,6 +79,11 @@ class cVNSIAdmin : public cVNSIData
CAddonGUISpinControl *m_spinTimeshiftMode;
CAddonGUISpinControl *m_spinTimeshiftBufferRam;
CAddonGUISpinControl *m_spinTimeshiftBufferFile;
+ CAddonGUIRadioButton *m_ratioIsRadio;
+ std::vector<CAddonListItem*> m_listItems;
+ std::map<GUIHANDLE, int> m_listItemsMap;
+ std::map<GUIHANDLE, int> m_listItemsChannelsMap;
+ CVNSIChannels m_channels;
bool m_bIsOsdControl;
bool m_bIsOsdDirty;
int m_width, m_height;
View
195 addons/pvr.vdr.vnsi/src/VNSIChannels.cpp
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2005-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * 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 XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "VNSIChannels.h"
+#include <algorithm>
+
+CProvider::CProvider()
+ :m_name(""), m_caid(0), m_whitelist(false)
+{
+
+}
+
+CProvider::CProvider(std::string name, int caid)
+ :m_name(name), m_caid(caid), m_whitelist(false)
+{
+};
+
+bool CProvider::operator==(const CProvider &rhs)
+{
+ if (rhs.m_caid != m_caid)
+ return false;
+ if (rhs.m_name.compare(m_name) != 0)
+ return false;
+ return true;
+}
+
+void CChannel::SetCaids(char *caids)
+{
+ m_caids.clear();
+ std::string strCaids = caids;
+ size_t pos = strCaids.find("caids:");
+ if(pos == strCaids.npos)
+ return;
+
+ strCaids.erase(0,6);
+ std::string token;
+ int caid;
+ char *pend;
+ while ((pos = strCaids.find(";")) != strCaids.npos)
+ {
+ token = strCaids.substr(0, pos);
+ caid = strtol(token.c_str(), &pend, 10);
+ m_caids.push_back(caid);
+ strCaids.erase(0, pos+1);
+ }
+ if (strCaids.length() > 1)
+ {
+ caid = strtol(strCaids.c_str(), &pend, 10);
+ m_caids.push_back(caid);
+ }
+}
+
+CVNSIChannels::CVNSIChannels()
+{
+ m_loaded = false;
+ m_mode = NONE;
+ m_radio = false;
+}
+
+void CVNSIChannels::CreateProviders()
+{
+ std::vector<CChannel>::iterator c_it;
+ std::vector<CProvider>::iterator p_it;
+ CProvider provider;
+ m_providers.clear();
+ for (c_it=m_channels.begin(); c_it!=m_channels.end(); ++c_it)
+ {
+ provider.m_name = c_it->m_provider;
+ for(unsigned int i=0; i<c_it->m_caids.size(); i++)
+ {
+ provider.m_caid = c_it->m_caids[i];
+ p_it = std::find(m_providers.begin(), m_providers.end(), provider);
+ if (p_it == m_providers.end())
+ {
+ m_providers.push_back(provider);
+ }
+ }
+ if (c_it->m_caids.size() == 0)
+ {
+ provider.m_caid = 0;
+ p_it = std::find(m_providers.begin(), m_providers.end(), provider);
+ if (p_it == m_providers.end())
+ {
+ m_providers.push_back(provider);
+ }
+ }
+ }
+}
+
+void CVNSIChannels::LoadProviderWhitelist()
+{
+ std::vector<CProvider>::iterator p_it;
+
+ bool select = m_providerWhitelist.empty();
+ for(p_it=m_providers.begin(); p_it!=m_providers.end(); ++p_it)
+ {
+ p_it->m_whitelist = select;
+ }
+
+ std::vector<CProvider>::iterator w_it;
+ for(w_it=m_providerWhitelist.begin(); w_it!=m_providerWhitelist.end(); ++w_it)
+ {
+ p_it = std::find(m_providers.begin(), m_providers.end(), *w_it);
+ if(p_it != m_providers.end())
+ {
+ p_it->m_whitelist = true;
+ }
+ }
+}
+
+void CVNSIChannels::LoadChannelBlacklist()
+{
+ std::map<int, int>::iterator it;
+ for(unsigned int i=0; i<m_channelBlacklist.size(); i++)
+ {
+ it = m_channelsMap.find(m_channelBlacklist[i]);
+ if(it!=m_channelsMap.end())
+ {
+ int idx = it->second;
+ m_channels[idx].m_blacklist = true;
+ }
+ }
+}
+
+void CVNSIChannels::ExtractProviderWhitelist()
+{
+ std::vector<CProvider>::iterator it;
+ m_providerWhitelist.clear();
+ for(it=m_providers.begin(); it!=m_providers.end(); ++it)
+ {
+ if(it->m_whitelist)
+ m_providerWhitelist.push_back(*it);
+ }
+ if(m_providerWhitelist.size() == m_providers.size())
+ {
+ m_providerWhitelist.clear();
+ }
+ else if (m_providerWhitelist.size() == 0)
+ {
+ m_providerWhitelist.clear();
+ CProvider provider;
+ provider.m_name = "no whitelist";
+ provider.m_caid = 0;
+ m_providerWhitelist.push_back(provider);
+ }
+}
+
+void CVNSIChannels::ExtractChannelBlacklist()
+{
+ m_channelBlacklist.clear();
+ for(unsigned int i=0; i<m_channels.size(); i++)
+ {
+ if(m_channels[i].m_blacklist)
+ m_channelBlacklist.push_back(m_channels[i].m_id);
+ }
+}
+
+bool CVNSIChannels::IsWhitelist(CChannel &channel)
+{
+ CProvider provider;
+ std::vector<CProvider>::iterator p_it;
+ provider.m_name = channel.m_provider;
+ if (channel.m_caids.empty())
+ {
+ provider.m_caid = 0;
+ p_it = std::find(m_providers.begin(), m_providers.end(), provider);
+ if(p_it!=m_providers.end() && p_it->m_whitelist)
+ return true;
+ }
+ for(unsigned int i=0; i<channel.m_caids.size(); i++)
+ {
+ provider.m_caid = channel.m_caids[i];
+ p_it = std::find(m_providers.begin(), m_providers.end(), provider);
+ if(p_it!=m_providers.end() && p_it->m_whitelist)
+ return true;
+ }
+ return false;
+}
View
73 addons/pvr.vdr.vnsi/src/VNSIChannels.h
@@ -0,0 +1,73 @@
+#pragma once
+
+/*
+ * Copyright (C) 2005-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * 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 XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "VNSIData.h"
+
+class CProvider
+{
+public:
+ CProvider();
+ CProvider(std::string name, int caid);
+ bool operator==(const CProvider &rhs);
+ std::string m_name;
+ int m_caid;
+ bool m_whitelist;
+};
+
+class CChannel
+{
+public:
+ void SetCaids(char *caids);
+ unsigned int m_id;
+ unsigned int m_number;
+ std::string m_name;
+ std::string m_provider;
+ bool m_radio;
+ std::vector<int> m_caids;
+ bool m_blacklist;
+};
+
+class CVNSIChannels
+{
+public:
+ CVNSIChannels();
+ void CreateProviders();
+ void LoadProviderWhitelist();
+ void LoadChannelBlacklist();
+ void ExtractProviderWhitelist();
+ void ExtractChannelBlacklist();
+ bool IsWhitelist(CChannel &channel);
+ std::vector<CChannel> m_channels;
+ std::map<int, int> m_channelsMap;
+ std::vector<CProvider> m_providers;
+ std::vector<CProvider> m_providerWhitelist;
+ std::vector<int> m_channelBlacklist;
+ bool m_loaded;
+ bool m_radio;
+
+ enum
+ {
+ NONE,
+ PROVIDER,
+ CHANNEL
+ }m_mode;
+};
View
14 addons/pvr.vdr.vnsi/src/VNSIData.cpp
@@ -210,6 +210,11 @@ bool cVNSIData::GetChannelsList(ADDON_HANDLE handle, bool radio)
XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
return false;
}
+ if (!vrp.add_U8(1)) // apply filter
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't add parameter to cRequestPacket", __FUNCTION__);
+ return false;
+ }
cResponsePacket* vresp = ReadResult(&vrp);
if (!vresp)
@@ -224,16 +229,18 @@ bool cVNSIData::GetChannelsList(ADDON_HANDLE handle, bool radio)
memset(&tag, 0 , sizeof(tag));
tag.iChannelNumber = vresp->extract_U32();
- char *strChannelName = vresp->extract_String();
+ char *strChannelName = vresp->extract_String();
strncpy(tag.strChannelName, strChannelName, sizeof(tag.strChannelName) - 1);
+ char *strProviderName = vresp->extract_String();
tag.iUniqueId = vresp->extract_U32();
- vresp->extract_U32(); // still here for compatibility
tag.iEncryptionSystem = vresp->extract_U32();
- vresp->extract_U32(); // uint32_t vtype - currently unused
+ char *strCaids = vresp->extract_String();
tag.bIsRadio = radio;
PVR->TransferChannelEntry(handle, &tag);
delete[] strChannelName;
+ delete[] strProviderName;
+ delete[] strCaids;
}
delete vresp;
@@ -967,6 +974,7 @@ bool cVNSIData::GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GR
vrp.add_String(group.strGroupName);
vrp.add_U8(group.bIsRadio);
+ vrp.add_U8(1); // filter channels
cResponsePacket* vresp = ReadResult(&vrp);
if (vresp == NULL || vresp->noResponse())
View
5 addons/pvr.vdr.vnsi/src/vnsicommand.h
@@ -68,6 +68,11 @@
#define VNSI_CHANNELGROUP_GETCOUNT 65
#define VNSI_CHANNELGROUP_LIST 66
#define VNSI_CHANNELGROUP_MEMBERS 67
+#define VNSI_CHANNELS_GETCAIDS 68
+#define VNSI_CHANNELS_GETWHITELIST 69
+#define VNSI_CHANNELS_GETBLACKLIST 70
+#define VNSI_CHANNELS_SETWHITELIST 71
+#define VNSI_CHANNELS_SETBLACKLIST 72
/* OPCODE 80 - 99: VNSI network functions for timer access */
#define VNSI_TIMER_GETCOUNT 80
Please sign in to comment.
Something went wrong with that request. Please try again.