Permalink
Browse files

Merge pull request #247 from krustyreturns/pvr.wmc_squash

Resubmit pvr.wmc addon to official pvr addons repo (squashed)
  • Loading branch information...
2 parents 076f14c + 36ed5d9 commit a32a0bd3bb1994e42c094cae2e44adfb492681e8 @opdenkamp committed Dec 18, 2013
View
4 .gitignore
@@ -33,6 +33,10 @@ missing
*.pvr
*.zip
+*.idb
+*.tlog
+*.lastbuildstate
+
# Windows specific generated files
*.exp
*.lib
View
1 addons/Makefile.am
@@ -15,6 +15,7 @@ SUBDIRS = pvr.demo \
pvr.vuplus \
pvr.argustv \
pvr.dvblink \
+ pvr.wmc \
$(ADDON_MYTHTV_SUBDIRS) \
$(ADDON_IPTVSIMPLE_SUBDIRS)
View
59 addons/pvr.wmc/.gitignore
@@ -0,0 +1,59 @@
+syntax: glob
+src/sav/**
+addon/addon.xml
+
+addon/XBMC_WMC.pvr
+addon/XBMC_WMC_win32.dll
+addon/XBMC_WMC_win32.exp
+addon/libXBMC_WMC.so
+
+.deps/**
+.libs/**
+libpvrwmc-addon.la
+Makefile
+Makefile.in
+*.tmp
+*.obj
+*.pdb
+*.user
+*.aps
+*.pch
+*.vspscc
+*.vssscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.sdf
+*.tlb
+*.tlh
+*.bak
+*.[Cc]ache
+*.ilk
+*.log
+*.lib
+*.sbr
+*.scc
+*.DotSettings
+*.lo
+*.o
+*.tlog
+*.idb
+*.lastbuildstate
+*.intermediate.manifest
+[Bb]in
+[Dd]ebug*/**
+obj/
+[Rr]elease*/**
+_ReSharper*/**
+NDependOut/**
+packages/**
+[Tt]humbs.db
+[Tt]est[Rr]esult*
+[Bb]uild[Ll]og.*
+*.[Pp]ublish.xml
+ipch/**
+*.resharper
+*.ncrunch*
+*.ndproj
+*.csproj.user
View
24 addons/pvr.wmc/Makefile.am
@@ -0,0 +1,24 @@
+#
+# Makefile for the PVR Windows Media Center add-on for XBMC PVR
+#
+# See the README for copyright information and
+# how to reach the author.
+#
+
+ADDONBINNAME = XBMC_WMC
+ADDONNAME = pvr.wmc
+LIBNAME = libpvrwmc-addon
+lib_LTLIBRARIES = libpvrwmc-addon.la
+
+LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la
+
+include ../Makefile.include.am
+
+libpvrwmc_addon_la_SOURCES = src/DialogDeleteTimer.cpp \
+ src/DialogRecordPref.cpp \
+ src/client.cpp \
+ src/pvr2wmc.cpp \
+ src/Socket.cpp \
+ src/utilities.cpp
+libpvrwmc_addon_la_LDFLAGS = @TARGET_LDFLAGS@
+
View
24 addons/pvr.wmc/addon/addon.xml.in
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<addon
+ id="pvr.wmc-@OS@-@ARCHITECTURE@"
+ version="0.2.92"
+ name="Windows Media Center Client - @OS@ @ARCHITECTURE@ Edition"
+ provider-name="KrustyReturns">
+ <requires>
+ <c-pluff version="0.1"/>
+ <import addon="xbmc.pvr" version="1.9.0"/>
+ </requires>
+ <extension
+ point="xbmc.pvrclient"
+ library_linux="XBMC_WMC.pvr"
+ library_wingl="XBMC_WMC_win32.dll"
+ library_osx="XBMC_WMC.pvr"
+ library_windx="XBMC_WMC_win32.dll"
+ library_android="libXBMC_WMC.so" />
+ <extension point="xbmc.addon.metadata">
+ <summary lang="en">WMC PVR Client</summary>
+ <description lang="en">An xbmc client to interface to Windows Media Center's record and EPG service. Thanks to JeffreyF, Tomba73, Riztnack, Staknhalo, Scarecrow420, Hoopsdavis, TheImmortal. Special thanks to DBurckh.</description>
+ <disclaimer lang="en">This is experimental software. Use at your own risk.</disclaimer>
+ <platform>@OS@</platform>
+ </extension>
+</addon>
View
BIN addons/pvr.wmc/addon/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
166 addons/pvr.wmc/addon/resources/language/English/strings.po
@@ -0,0 +1,166 @@
+# XBMC Media Center language file
+# Addon Name: WMC PVR Client
+# Addon id: pvr.wmc
+# Addon version: 1.0.0
+# Addon Provider: V. Da Costa
+msgid ""
+msgstr ""
+"Project-Id-Version: XBMC Main Translation Project (Frodo)\n"
+"Report-Msgid-Bugs-To: http://trac.xbmc.org/\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: XBMC Translation Team\n"
+"Language-Team: English (http://www.transifex.com/projects/p/XBMC-Main-Frodo/language/en/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+# Settings labels
+
+msgctxt "#30000"
+msgid "Server Hostname or IP"
+msgstr ""
+
+msgctxt "#30001"
+msgid "Keep IP address to 127.0.0.1, if server is running on this same system"
+msgstr ""
+
+msgctxt "#30002"
+msgid "Port Number"
+msgstr ""
+
+msgctxt "#30003"
+msgid "Stream timeout, unknown problem"
+msgstr ""
+
+msgctxt "#30004"
+msgid "No video data found on this channel"
+msgstr ""
+
+msgctxt "#30005"
+msgid "Tuner is needed for recording"
+msgstr ""
+
+
+msgctxt "#30006"
+msgid "Recording delete failed, file in use or write protected"
+msgstr ""
+
+msgctxt "#30007"
+msgid "Recording delete failed, recorded file doesn't exist"
+msgstr ""
+
+msgctxt "#30008"
+msgid "Recording file not found"
+msgstr ""
+
+msgctxt "#30009"
+msgid "Alternate channel chosen: "
+msgstr ""
+
+msgctxt "#30010"
+msgid "Alternate time chosen: "
+msgstr ""
+
+msgctxt "#30011"
+msgid "Can't start, tuner is no longer available"
+msgstr ""
+
+msgctxt "#30012"
+msgid "Channel content is protected"
+msgstr ""
+
+msgctxt "#30013"
+msgid "End time increased by "
+msgstr ""
+
+msgctxt "#30014"
+msgid "Enable SignalStatus calls"
+msgstr ""
+
+msgctxt "#30015"
+msgid "Refresh SignalStatus Interval (sec)"
+msgstr ""
+
+msgctxt "#30016"
+msgid "Store viewing resume times on server"
+msgstr ""
+
+msgctxt "#30020"
+msgid "All tuners for this channel are busy"
+msgstr ""
+
+msgctxt "#30021"
+msgid "LiveTV timed-out"
+msgstr ""
+
+msgctxt "#30022"
+msgid "LiveTV error, exited early"
+msgstr ""
+
+msgctxt "#30023"
+msgid "Recording stream timed-out"
+msgstr ""
+
+msgctxt "#30024"
+msgid "Recording stream exited early"
+msgstr ""
+
+msgctxt "#30100"
+msgid "Recording Preference"
+msgstr ""
+
+msgctxt "#30101"
+msgid "Record this episode only"
+msgstr ""
+
+msgctxt "#30102"
+msgid "Record the series"
+msgstr ""
+
+msgctxt "#30103"
+msgid "Show type:"
+msgstr ""
+
+msgctxt "#30104"
+msgid "New and rerun"
+msgstr ""
+
+msgctxt "#30105"
+msgid "New only"
+msgstr ""
+
+msgctxt "#30106"
+msgid "Live only"
+msgstr ""
+
+msgctxt "#30107"
+msgid "Channel:"
+msgstr ""
+
+msgctxt "#30108"
+msgid "Any Channel"
+msgstr ""
+
+msgctxt "#30110"
+msgid "Airtime:"
+msgstr ""
+
+msgctxt "#30111"
+msgid "Anytime"
+msgstr ""
+
+
+msgctxt "#30120"
+msgid "Delete Timer"
+msgstr ""
+
+msgctxt "#30121"
+msgid "Delete this episode timer only"
+msgstr ""
+
+msgctxt "#30122"
+msgid "Delete the entire series"
+msgstr ""
View
8 addons/pvr.wmc/addon/resources/settings.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<settings>
+ <setting id="host" type="text" label="30000" default="127.0.0.1" />
+ <setting id="port" type="number" label="30002" default="9080" />
+ <setting id="multiResume" type="bool" label="30016" default="true" />
+ <setting id="signal" type="bool" label="30014" default="false" />
+ <setting id="signal_throttle" type="number" label="30015" default="10" />
+</settings>
View
153 addons/pvr.wmc/addon/resources/skins/skin.confluence/720p/DeleteTimer.xml
@@ -0,0 +1,153 @@
+<window>
+ <defaultcontrol always="true">10</defaultcontrol>
+ <coordinates>
+ <system>1</system>
+ <posx>240</posx>
+ <posy>100</posy>
+ </coordinates>
+ <include>dialogeffect</include>
+ <controls>
+ <control type="image">
+ <description>background image</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>800</width>
+ <height>300</height>
+ <texture border="40">DialogBack.png</texture>
+ </control>
+ <control type="image">
+ <description>Dialog Header image</description>
+ <posx>40</posx>
+ <posy>16</posy>
+ <width>720</width>
+ <height>40</height>
+ <texture>dialogheader.png</texture>
+ </control>
+ <control type="label">
+ <description>header label</description>
+ <posx>40</posx>
+ <posy>20</posy>
+ <width>720</width>
+ <height>30</height>
+ <font>font13_title</font>
+ <label>$ADDON[pvr.wmc 30120]</label>
+ <align>center</align>
+ <aligny>center</aligny>
+ <textcolor>selected</textcolor>
+ <shadowcolor>black</shadowcolor>
+ </control>
+ <control type="button" id="22">
+ <description>Close Window button</description>
+ <posx>710</posx>
+ <posy>15</posy>
+ <width>64</width>
+ <height>32</height>
+ <label>-</label>
+ <font>-</font>
+ <!--<onclick>PreviousMenu</onclick>-->
+ <texturefocus>DialogCloseButton-focus.png</texturefocus>
+ <texturenofocus>DialogCloseButton.png</texturenofocus>
+ <onleft>10</onleft>
+ <onright>10</onright>
+ <onup>10</onup>
+ <ondown>10</ondown>
+ <visible>system.getbool(input.enablemouse)</visible>
+ </control>
+
+
+ <control type="label" description="program title" id = "20">
+ <posx>40</posx>
+ <posy>60</posy>
+ <width>720</width>
+ <height>30</height>
+ <font>font13_title</font>
+ <!--<label>filled in by code</label>-->
+ <align>left</align>
+ <aligny>center</aligny>
+ <textcolor>white</textcolor>
+ <!--<shadowcolor>black</shadowcolor>-->
+ </control>
+
+ <control type="group" description ="radio buttons">
+ <posx>40</posx>
+ <posy>100</posy>
+ <width>720</width>
+ <height>100</height>
+ <control type="radiobutton" id="10">
+ <description>episode recording</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <height>40</height>
+ <width>720</width>
+ <label>$ADDON[pvr.wmc 30121]</label>
+ <font>font13</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <onright>10</onright>
+ <onleft>10</onleft>
+ <onup>1</onup>
+ <ondown>11</ondown>
+ </control>
+
+ <control type="radiobutton" id="11">
+ <description>series recording</description>
+ <posx>0</posx>
+ <posy>45</posy>
+ <height>40</height>
+ <width>720</width>
+ <label>$ADDON[pvr.wmc 30122]</label>
+ <font>font13</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <onright>11</onright>
+ <onleft>11</onleft>
+ <onup>10</onup>
+ <ondown>2</ondown>
+ </control>
+ </control>
+
+ <control type="group" id="9001">
+ <posx>190</posx>
+ <posy>235</posy>
+ <control type="button" id="1">
+ <description>Ok Button</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>200</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus.png</texturefocus>
+ <label>186</label>
+ <font>font12_title</font>
+ <onup>11</onup>
+ <onleft>2</onleft>
+ <onright>2</onright>
+ <ondown>10</ondown>
+ </control>
+ <control type="button" id="2">
+ <description>Cancel Button</description>
+ <posx>210</posx>
+ <posy>0</posy>
+ <width>200</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus.png</texturefocus>
+ <label>222</label>
+ <font>font12_title</font>
+ <onup>11</onup>
+ <onleft>1</onleft>
+ <onright>1</onright>
+ <ondown>10</ondown>
+ </control>
+ </control>
+
+ </controls>
+</window>
View
213 addons/pvr.wmc/addon/resources/skins/skin.confluence/720p/RecordPrefs.xml
@@ -0,0 +1,213 @@
+<window>
+ <defaultcontrol always="true">10</defaultcontrol>
+ <coordinates>
+ <system>1</system>
+ <posx>240</posx>
+ <posy>100</posy>
+ </coordinates>
+ <include>dialogeffect</include>
+ <controls>
+ <control type="image">
+ <description>background image</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>800</width>
+ <height>500</height>
+ <texture border="40">DialogBack.png</texture>
+ </control>
+ <control type="image">
+ <description>Dialog Header image</description>
+ <posx>40</posx>
+ <posy>16</posy>
+ <width>720</width>
+ <height>40</height>
+ <texture>dialogheader.png</texture>
+ </control>
+ <control type="label">
+ <description>header label</description>
+ <posx>40</posx>
+ <posy>20</posy>
+ <width>720</width>
+ <height>30</height>
+ <font>font13_title</font>
+ <label>$ADDON[pvr.wmc 30100]</label>
+ <align>center</align>
+ <aligny>center</aligny>
+ <textcolor>selected</textcolor>
+ <shadowcolor>black</shadowcolor>
+ </control>
+ <control type="button" id="22">
+ <description>Close Window button</description>
+ <posx>710</posx>
+ <posy>15</posy>
+ <width>64</width>
+ <height>32</height>
+ <label>-</label>
+ <font>-</font>
+ <!--<onclick>PreviousMenu</onclick>-->
+ <texturefocus>DialogCloseButton-focus.png</texturefocus>
+ <texturenofocus>DialogCloseButton.png</texturenofocus>
+ <onleft>10</onleft>
+ <onright>10</onright>
+ <onup>10</onup>
+ <ondown>10</ondown>
+ <visible>system.getbool(input.enablemouse)</visible>
+ </control>
+
+
+ <control type="label" description="program title" id = "20">
+ <posx>40</posx>
+ <posy>60</posy>
+ <width>720</width>
+ <height>30</height>
+ <font>font13_title</font>
+ <!--<label>filled in by code</label>-->
+ <align>left</align>
+ <aligny>center</aligny>
+ <textcolor>white</textcolor>
+ <!--<shadowcolor>black</shadowcolor>-->
+ </control>
+
+ <control type="group" description ="radio buttons">
+ <posx>40</posx>
+ <posy>100</posy>
+ <width>720</width>
+ <height>100</height>
+ <control type="radiobutton" id="10">
+ <description>episode recording</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <height>40</height>
+ <width>720</width>
+ <label>$ADDON[pvr.wmc 30101]</label>
+ <font>font13</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <onright>10</onright>
+ <onleft>10</onleft>
+ <onup>1</onup>
+ <ondown>11</ondown>
+ </control>
+
+ <control type="radiobutton" id="11">
+ <description>series recording</description>
+ <posx>0</posx>
+ <posy>45</posy>
+ <height>40</height>
+ <width>720</width>
+ <label>$ADDON[pvr.wmc 30102]</label>
+ <font>font13</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <onright>11</onright>
+ <onleft>11</onleft>
+ <onup>10</onup>
+ <ondown>12</ondown>
+ </control>
+ </control>
+
+ <control type="group" descripton="series spinners">
+ <posx>340</posx>
+ <posy>190</posy>
+ <width>420</width>
+ <height>150</height>
+ <control type="spincontrolex" id="12">
+ <description>series runtype</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>420</width>
+ <height>40</height>
+ <font>font13</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <label>$ADDON[pvr.wmc 30103]</label>
+ <onright>12</onright>
+ <onleft>12</onleft>
+ <onup>10</onup>
+ <ondown>13</ondown>
+ </control>
+
+ <control type="spincontrolex" id="13">
+ <description>channel series choice</description>
+ <posx>0</posx>
+ <posy>45</posy>
+ <width>420</width>
+ <height>40</height>
+ <font>font13</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <label>$ADDON[pvr.wmc 30107]</label>
+ <onright>13</onright>
+ <onleft>13</onleft>
+ <onup>12</onup>
+ <ondown>14</ondown>
+ </control>
+
+ <control type="spincontrolex" id="14">
+ <description>airtime series choice</description>
+ <posx>0</posx>
+ <posy>90</posy>
+ <width>420</width>
+ <height>40</height>
+ <font>font13</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <label>$ADDON[pvr.wmc 30110]</label>
+ <onright>14</onright>
+ <onleft>14</onleft>
+ <onup>13</onup>
+ <ondown>1</ondown>
+ </control>
+ </control>
+
+ <control type="group" id="9001">
+ <posx>190</posx>
+ <posy>435</posy>
+ <control type="button" id="1">
+ <description>Ok Button</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>200</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus.png</texturefocus>
+ <label>186</label>
+ <font>font12_title</font>
+ <onup>14</onup>
+ <onleft>2</onleft>
+ <onright>2</onright>
+ <ondown>10</ondown>
+ </control>
+ <control type="button" id="2">
+ <description>Cancel Button</description>
+ <posx>210</posx>
+ <posy>0</posy>
+ <width>200</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <texturefocus border="5">button-focus.png</texturefocus>
+ <label>222</label>
+ <font>font12_title</font>
+ <onup>14</onup>
+ <onleft>1</onleft>
+ <onright>1</onright>
+ <ondown>10</ondown>
+ </control>
+ </control>
+
+ </controls>
+</window>
View
134 addons/pvr.wmc/project/VS2010Express/pvrclient_wmc.vcxproj
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{6834B003-2511-4745-818D-F418E87DD941}</ProjectGuid>
+ <RootNamespace>pvrclient_demo</RootNamespace>
+ <ProjectName>pvr.wmc</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>..\..\addon\</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetExt>.dll</TargetExt>
+ <TargetName>XBMC_WMC_win32</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>..\..\addon\</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetExt>.pvr</TargetExt>
+ <TargetName>XBMC_Demo_win32</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\..\..\xbmc;..\..\..\..\lib;..\..\..\..\lib\platform\windows</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_WINDLL;TARGET_WINDOWS;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <ShowProgress>LinkVerbose</ShowProgress>
+ </Link>
+ <PostBuildEvent>
+ <Command>if "$(ComputerName)" == "MORBO" robocopy $(TargetDir) "\\mediaserver\VDsoftware\pvr.wmc (gotham)\pvr.wmc" /s /NP
+if "$(ComputerName)" == "SCARECROW" robocopy $(TargetDir) d:\0\dev\repos\gotham\scarecrow420_xbmc\addons\pvr.wmc /s /NP
+if errorlevel 1 exit 0 else exit %errorlevel%</Command>
+ </PostBuildEvent>
+ <PreBuildEvent>
+ <Command>"$(SolutionDir)\ConfigureAddonXML.bat"</Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>..\..\..\..\xbmc;..\..\..\..\lib;..\..\..\..\lib\platform\windows</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\client.cpp" />
+ <ClCompile Include="..\..\src\DialogDeleteTimer.cpp" />
+ <ClCompile Include="..\..\src\DialogRecordPref.cpp" />
+ <ClCompile Include="..\..\src\pvr2wmc.cpp" />
+ <ClCompile Include="..\..\src\Socket.cpp" />
+ <ClCompile Include="..\..\src\utilities.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\client.h" />
+ <ClInclude Include="..\..\src\clientversion.h" />
+ <ClInclude Include="..\..\src\DialogDeleteTimer.h" />
+ <ClInclude Include="..\..\src\DialogRecordPref.h" />
+ <ClInclude Include="..\..\src\pvr2wmc.h" />
+ <ClInclude Include="..\..\src\Socket.h" />
+ <ClInclude Include="..\..\src\utilities.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\project\VS2010Express\platform\platform.vcxproj">
+ <Project>{fe4573f6-a794-4ad3-b37f-49e51f1140e6}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\project\VS2010Express\tinyxml\tinyxml.vcxproj">
+ <Project>{bdc7d21d-9fd9-41aa-bec8-8b70e1448c50}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\addon\addon.xml.in">
+ <SubType>Designer</SubType>
+ </None>
+ <None Include="..\..\addon\resources\language\English\strings.po" />
+ <None Include="..\..\addon\resources\settings.xml" />
+ <None Include="..\..\addon\resources\skins\skin.confluence\720p\DeleteTimer.xml">
+ <SubType>Designer</SubType>
+ </None>
+ <None Include="..\..\addon\resources\skins\skin.confluence\720p\RecordPrefs.xml">
+ <SubType>Designer</SubType>
+ </None>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
View
67 addons/pvr.wmc/project/VS2010Express/pvrclient_wmc.vcxproj.filters
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\client.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\pvr2wmc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\DialogRecordPref.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\DialogDeleteTimer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\utilities.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\Socket.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\client.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\pvr2wmc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\utilities.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\DialogRecordPref.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\DialogDeleteTimer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\Socket.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\clientversion.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\addon\resources\language\English\strings.po" />
+ <None Include="..\..\addon\resources\settings.xml" />
+ <None Include="..\..\addon\addon.xml.in" />
+ <None Include="..\..\addon\resources\skins\skin.confluence\720p\DeleteTimer.xml" />
+ <None Include="..\..\addon\resources\skins\skin.confluence\720p\RecordPrefs.xml" />
+ </ItemGroup>
+</Project>
View
158 addons/pvr.wmc/src/DialogDeleteTimer.cpp
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2005-2011 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, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "DialogDeleteTimer.h"
+#include "libXBMC_gui.h"
+
+#define BUTTON_OK 1
+#define BUTTON_CANCEL 2
+#define BUTTON_CLOSE 22
+
+#define RADIO_BUTTON_EPISODE 10
+#define RADIO_BUTTON_SERIES 11
+#define LABEL_SHOWNAME 20
+
+
+CDialogDeleteTimer::CDialogDeleteTimer( bool delSeries, std::string showName)
+{
+ DeleteSeries = delSeries;
+ _showName = showName;
+
+ // specify the xml of the window here
+ _confirmed = -1;
+ _window = GUI->Window_create("DeleteTimer.xml", "Confluence", false, true);
+
+ // needed for every dialog
+ _window->m_cbhdl = this;
+ _window->CBOnInit = OnInitCB;
+ _window->CBOnFocus = OnFocusCB;
+ _window->CBOnClick = OnClickCB;
+ _window->CBOnAction = OnActionCB;
+}
+
+CDialogDeleteTimer::~CDialogDeleteTimer()
+{
+ GUI->Window_destroy(_window);
+}
+
+bool CDialogDeleteTimer::OnInit()
+{
+ // display the show name in the window
+ _window->SetControlLabel(LABEL_SHOWNAME, _showName.c_str());
+
+ // init radio buttons
+ _radioDelEpisode = GUI->Control_getRadioButton(_window, RADIO_BUTTON_EPISODE);
+ _radioDelSeries = GUI->Control_getRadioButton(_window, RADIO_BUTTON_SERIES);
+ _radioDelEpisode->SetText(XBMC->GetLocalizedString(30121));
+ _radioDelSeries->SetText(XBMC->GetLocalizedString(30122));
+ _radioDelEpisode->SetSelected(!DeleteSeries);
+ _radioDelSeries->SetSelected(DeleteSeries);
+
+ return true;
+}
+
+bool CDialogDeleteTimer::OnClick(int controlId)
+{
+ switch(controlId)
+ {
+ case BUTTON_OK: // save value from GUI, then FALLS THROUGH TO CANCEL
+ DeleteSeries = _radioDelSeries->IsSelected();
+ case BUTTON_CANCEL: // handle releasing of objects
+ case BUTTON_CLOSE:
+ if (_confirmed == -1) // if not previously confirmed, set to cancel value
+ _confirmed = 0;
+ _window->Close();
+ GUI->Control_releaseRadioButton(_radioDelEpisode);
+ GUI->Control_releaseRadioButton(_radioDelSeries);
+ break;
+ case RADIO_BUTTON_EPISODE:
+ DeleteSeries = !_radioDelEpisode->IsSelected();
+ _radioDelSeries->SetSelected(DeleteSeries);
+ break;
+ case RADIO_BUTTON_SERIES:
+ DeleteSeries = _radioDelSeries->IsSelected();
+ _radioDelEpisode->SetSelected(!DeleteSeries);
+ break;
+ }
+
+ return true;
+}
+
+bool CDialogDeleteTimer::OnInitCB(GUIHANDLE cbhdl)
+{
+ CDialogDeleteTimer* dialog = static_cast<CDialogDeleteTimer*>(cbhdl);
+ return dialog->OnInit();
+}
+
+bool CDialogDeleteTimer::OnClickCB(GUIHANDLE cbhdl, int controlId)
+{
+ CDialogDeleteTimer* dialog = static_cast<CDialogDeleteTimer*>(cbhdl);
+ if (controlId == BUTTON_OK)
+ dialog->_confirmed = 1;
+ //dialog->_confirmed = (controlId == BUTTON_OK);
+ return dialog->OnClick(controlId);
+}
+
+bool CDialogDeleteTimer::OnFocusCB(GUIHANDLE cbhdl, int controlId)
+{
+ CDialogDeleteTimer* dialog = static_cast<CDialogDeleteTimer*>(cbhdl);
+ return dialog->OnFocus(controlId);
+}
+
+bool CDialogDeleteTimer::OnActionCB(GUIHANDLE cbhdl, int actionId)
+{
+ CDialogDeleteTimer* dialog = static_cast<CDialogDeleteTimer*>(cbhdl);
+ return dialog->OnAction(actionId);
+}
+
+bool CDialogDeleteTimer::Show()
+{
+ if (_window)
+ return _window->Show();
+
+ return false;
+}
+
+void CDialogDeleteTimer::Close()
+{
+ if (_window)
+ _window->Close();
+}
+
+int CDialogDeleteTimer::DoModal()
+{
+ if (_window)
+ _window->DoModal();
+ return _confirmed; // return true if user didn't cancel dialog
+}
+
+bool CDialogDeleteTimer::OnFocus(int controlId)
+{
+ return true;
+}
+
+bool CDialogDeleteTimer::OnAction(int actionId)
+{
+ if (actionId == ADDON_ACTION_CLOSE_DIALOG || actionId == ADDON_ACTION_PREVIOUS_MENU || actionId == 92/*back*/)
+ return OnClick(BUTTON_CANCEL);
+ else
+ return false;
+}
View
76 addons/pvr.wmc/src/DialogDeleteTimer.h
@@ -0,0 +1,76 @@
+#pragma once
+
+/*
+ * Copyright (C) 2005-2012 Team XBMC
+ * http://www.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, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "client.h"
+#include "pvr2wmc.h"
+
+//struct TimerInfo
+//{
+// bool isSeries;
+// int runType;
+// bool anyChannel;
+// bool anyTime;
+// std::string currentChannelName;
+// std::string currentAirTime;
+// std::string showName;
+//}
+
+class CDialogDeleteTimer
+{
+
+public:
+ CDialogDeleteTimer(bool recSeries, std::string showName);
+ virtual ~CDialogDeleteTimer();
+
+ bool Show();
+ void Close();
+ int DoModal(); //-1=>dialog load failed, 0=>canceled, 1=>confirmed
+
+ // dialog specific return params
+ bool DeleteSeries; // values returned
+
+
+private:
+ CAddonGUIRadioButton *_radioDelEpisode;
+ CAddonGUIRadioButton *_radioDelSeries;
+
+ std::string _showName;
+
+ // following is needed for every dialog
+private:
+ CAddonGUIWindow *_window;
+ int _confirmed; //-1=>dialog load failed, 0=>canceled, 1=>confirmed
+
+ bool OnClick(int controlId);
+ bool OnFocus(int controlId);
+ bool OnInit();
+ bool OnAction(int actionId);
+
+ static bool OnClickCB(GUIHANDLE cbhdl, int controlId);
+ static bool OnFocusCB(GUIHANDLE cbhdl, int controlId);
+ static bool OnInitCB(GUIHANDLE cbhdl);
+ static bool OnActionCB(GUIHANDLE cbhdl, int actionId);
+
+
+};
+
View
199 addons/pvr.wmc/src/DialogRecordPref.cpp
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2005-2011 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, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "DialogRecordPref.h"
+#include "libXBMC_gui.h"
+
+#define BUTTON_OK 1
+#define BUTTON_CANCEL 2
+#define BUTTON_CLOSE 22
+
+#define RADIO_BUTTON_EPISODE 10
+#define RADIO_BUTTON_SERIES 11
+#define SPIN_CONTROLRunType 12
+#define SPIN_CONTROL_CHANNEL 13
+#define SPIN_CONTROL_AIRTIME 14
+#define LABEL_SHOWNAME 20
+
+CDialogRecordPref::CDialogRecordPref( bool recSeries, int runtype, bool anyChannel, bool anyTime,
+ std::string currentChannelName, std::string currentAirTime, std::string showName)
+{
+ RecSeries = recSeries;
+ RunType = runtype;
+ AnyChannel = anyChannel;
+ AnyTime = anyTime;
+ _currentChannel = currentChannelName;
+ _currentAirTime = currentAirTime;
+ _showName = showName;
+
+ // needed for every dialog
+ _confirmed = -1; // init to failed load value (due to xml file not being found)
+ _window = GUI->Window_create("RecordPrefs.xml", "Confluence", false, true);
+ _window->m_cbhdl = this;
+ _window->CBOnInit = OnInitCB;
+ _window->CBOnFocus = OnFocusCB;
+ _window->CBOnClick = OnClickCB;
+ _window->CBOnAction = OnActionCB;
+}
+
+CDialogRecordPref::~CDialogRecordPref()
+{
+ GUI->Window_destroy(_window);
+}
+
+bool CDialogRecordPref::OnInit()
+{
+ // display the show name in the window
+ _window->SetControlLabel(LABEL_SHOWNAME, _showName.c_str());
+
+ // init radio buttons
+ _radioRecEpisode = GUI->Control_getRadioButton(_window, RADIO_BUTTON_EPISODE);
+ _radioRecSeries = GUI->Control_getRadioButton(_window, RADIO_BUTTON_SERIES);
+ _radioRecEpisode->SetText(XBMC->GetLocalizedString(30101));
+ _radioRecSeries->SetText(XBMC->GetLocalizedString(30102));
+ _radioRecEpisode->SetSelected(!RecSeries);
+ _radioRecSeries->SetSelected(RecSeries);
+
+ // init runtype spin control
+ _spinRunType = GUI->Control_getSpin(_window, SPIN_CONTROLRunType);
+ _spinRunType->AddLabel(XBMC->GetLocalizedString(30104), 0); // any show type
+ _spinRunType->AddLabel(XBMC->GetLocalizedString(30105), 1); // first run only
+ _spinRunType->AddLabel(XBMC->GetLocalizedString(30106), 2); // live only
+ _spinRunType->SetValue(RunType);
+
+ // init channel spin control
+ _spinChannel = GUI->Control_getSpin(_window, SPIN_CONTROL_CHANNEL);
+ _spinChannel->AddLabel(_currentChannel.c_str(), 0); // add current channel
+ _spinChannel->AddLabel(XBMC->GetLocalizedString(30108), 1); // add "Any channel"
+ _spinChannel->SetValue(AnyChannel ? 1:0);
+
+ // init airtime spin control
+ _spinAirTime = GUI->Control_getSpin(_window, SPIN_CONTROL_AIRTIME);
+ _spinAirTime->AddLabel(_currentAirTime.c_str(), 0); // current air time
+ _spinAirTime->AddLabel(XBMC->GetLocalizedString(30111), 1); // "Anytime"
+ _spinAirTime->SetValue(AnyTime ? 1:0);
+
+ // set visibility of spin controls based on whether dialog is set to rec a series
+ _spinRunType->SetVisible(RecSeries);
+ _spinChannel->SetVisible(RecSeries);
+ _spinAirTime->SetVisible(RecSeries);
+
+ return true;
+}
+
+bool CDialogRecordPref::OnClick(int controlId)
+{
+ switch(controlId)
+ {
+ case BUTTON_OK: // save value from GUI, then FALLS THROUGH TO CANCEL
+ RecSeries = _radioRecSeries->IsSelected();
+ RunType = _spinRunType->GetValue();
+ AnyChannel = _spinChannel->GetValue() == 1;
+ AnyTime = _spinAirTime->GetValue() == 1;
+ case BUTTON_CANCEL:
+ case BUTTON_CLOSE:
+ if (_confirmed == -1) // if not previously confirmed, set to cancel value
+ _confirmed = 0;
+ _window->Close();
+ GUI->Control_releaseRadioButton(_radioRecEpisode);
+ GUI->Control_releaseRadioButton(_radioRecSeries);
+ GUI->Control_releaseSpin(_spinRunType);
+ GUI->Control_releaseSpin(_spinChannel);
+ GUI->Control_releaseSpin(_spinAirTime);
+ break;
+ case RADIO_BUTTON_EPISODE:
+ RecSeries = !_radioRecEpisode->IsSelected();
+ _radioRecSeries->SetSelected(RecSeries);
+ _spinRunType->SetVisible(RecSeries);
+ _spinChannel->SetVisible(RecSeries);
+ _spinAirTime->SetVisible(RecSeries);
+ break;
+ case RADIO_BUTTON_SERIES:
+ RecSeries = _radioRecSeries->IsSelected();
+ _radioRecEpisode->SetSelected(!RecSeries);
+ _spinRunType->SetVisible(RecSeries);
+ _spinChannel->SetVisible(RecSeries);
+ _spinAirTime->SetVisible(RecSeries);
+ break;
+ }
+
+ return true;
+}
+
+bool CDialogRecordPref::OnInitCB(GUIHANDLE cbhdl)
+{
+ CDialogRecordPref* dialog = static_cast<CDialogRecordPref*>(cbhdl);
+ return dialog->OnInit();
+}
+
+bool CDialogRecordPref::OnClickCB(GUIHANDLE cbhdl, int controlId)
+{
+ CDialogRecordPref* dialog = static_cast<CDialogRecordPref*>(cbhdl);
+ if (controlId == BUTTON_OK)
+ dialog->_confirmed = 1;
+ return dialog->OnClick(controlId);
+}
+
+bool CDialogRecordPref::OnFocusCB(GUIHANDLE cbhdl, int controlId)
+{
+ CDialogRecordPref* dialog = static_cast<CDialogRecordPref*>(cbhdl);
+ return dialog->OnFocus(controlId);
+}
+
+bool CDialogRecordPref::OnActionCB(GUIHANDLE cbhdl, int actionId)
+{
+ CDialogRecordPref* dialog = static_cast<CDialogRecordPref*>(cbhdl);
+ return dialog->OnAction(actionId);
+}
+
+bool CDialogRecordPref::Show()
+{
+ if (_window)
+ return _window->Show();
+
+ return false;
+}
+
+void CDialogRecordPref::Close()
+{
+ if (_window)
+ _window->Close();
+}
+
+int CDialogRecordPref::DoModal()
+{
+ if (_window)
+ _window->DoModal();
+ return _confirmed; // return true if user didn't cancel dialog
+}
+
+bool CDialogRecordPref::OnFocus(int controlId)
+{
+ return true;
+}
+
+bool CDialogRecordPref::OnAction(int actionId)
+{
+ if (actionId == ADDON_ACTION_CLOSE_DIALOG || actionId == ADDON_ACTION_PREVIOUS_MENU || actionId == 92/*back*/)
+ return OnClick(BUTTON_CANCEL);
+ else
+ return false;
+}
View
85 addons/pvr.wmc/src/DialogRecordPref.h
@@ -0,0 +1,85 @@
+#pragma once
+
+/*
+ * Copyright (C) 2005-2012 Team XBMC
+ * http://www.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, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "client.h"
+#include "pvr2wmc.h"
+
+//struct TimerInfo
+//{
+// bool isSeries;
+// int runType;
+// bool anyChannel;
+// bool anyTime;
+// std::string currentChannelName;
+// std::string currentAirTime;
+// std::string showName;
+//}
+
+class CDialogRecordPref
+{
+
+public:
+ CDialogRecordPref(bool recSeries, int runtype, bool anyChannel, bool anyTime,
+ std::string currentChannelName, std::string currentAirTime, std::string showName);
+ virtual ~CDialogRecordPref();
+
+ bool Show();
+ void Close();
+ int DoModal(); // returns -1=> load failed, 0=>canceled, 1=>confirmed
+ //bool LoadFailed();
+
+ // dialog specific params
+ bool RecSeries; // values returned
+ int RunType;
+ bool AnyChannel;
+ bool AnyTime;
+private:
+ std::string _currentChannel; // these are just used for dialog display
+ std::string _currentAirTime;
+ std::string _showName;
+
+private:
+ CAddonGUIRadioButton *_radioRecEpisode;
+ CAddonGUIRadioButton *_radioRecSeries;
+ CAddonGUISpinControl *_spinRunType;
+ CAddonGUISpinControl *_spinChannel;
+ CAddonGUISpinControl *_spinAirTime;
+
+ // following is needed for every dialog
+private:
+ CAddonGUIWindow *_window;
+ int _confirmed; //-1=> load failed, 0=>canceled, 1=>confirmed
+
+ bool OnClick(int controlId);
+ bool OnFocus(int controlId);
+ bool OnInit();
+ bool OnAction(int actionId);
+
+ static bool OnClickCB(GUIHANDLE cbhdl, int controlId);
+ static bool OnFocusCB(GUIHANDLE cbhdl, int controlId);
+ static bool OnInitCB(GUIHANDLE cbhdl);
+ static bool OnActionCB(GUIHANDLE cbhdl, int actionId);
+
+
+};
+
View
662 addons/pvr.wmc/src/Socket.cpp
@@ -0,0 +1,662 @@
+/*
+* Copyright (C) 2005-2011 Team XBMC
+* http://www.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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+#include "libXBMC_addon.h"
+#include <string>
+#include "platform/os.h"
+#include "client.h"
+#include "Socket.h"
+
+#include "utilities.h"
+#include "platform/util/timeutils.h"
+#include "platform/threads/mutex.h"
+
+using namespace std;
+using namespace ADDON;
+
+PLATFORM::CMutex m_mutex;
+
+/* Master defines for client control */
+//#define RECEIVE_TIMEOUT 6 //sec
+
+Socket::Socket(const enum SocketFamily family, const enum SocketDomain domain, const enum SocketType type, const enum SocketProtocol protocol)
+{
+ _sd = INVALID_SOCKET;
+ _family = family;
+ _domain = domain;
+ _type = type;
+ _protocol = protocol;
+ memset (&_sockaddr, 0, sizeof( _sockaddr ) );
+ //set_non_blocking(1);
+}
+
+Socket::Socket()
+{
+ // Default constructor, default settings
+ _sd = INVALID_SOCKET;
+ _family = af_inet;
+ _domain = pf_inet;
+ _type = sock_stream;
+ _protocol = tcp;
+ memset (&_sockaddr, 0, sizeof( _sockaddr ) );
+}
+
+Socket::~Socket()
+{
+ close();
+}
+
+bool Socket::setHostname ( const CStdString& host )
+{
+ if (isalpha(host.c_str()[0]))
+ {
+ // host address is a name
+ struct hostent *he = NULL;
+ if ((he = gethostbyname( host.c_str() )) == 0)
+ {
+ errormessage( getLastError(), "Socket::setHostname");
+ return false;
+ }
+
+ _sockaddr.sin_addr = *((in_addr *) he->h_addr);
+ }
+ else
+ {
+ _sockaddr.sin_addr.s_addr = inet_addr(host.c_str());
+ }
+ return true;
+}
+
+bool Socket::close()
+{
+ if (is_valid())
+ {
+ if (_sd != SOCKET_ERROR)
+#ifdef TARGET_WINDOWS
+ closesocket(_sd);
+#else
+ ::close(_sd);
+#endif
+ _sd = INVALID_SOCKET;
+ osCleanup();
+ return true;
+ }
+ return false;
+}
+
+int _timeout = 0;
+
+bool Socket::create()
+{
+ if( is_valid() )
+ {
+ close();
+ }
+
+ if(!osInit())
+ {
+ return false;
+ }
+
+ _sd = socket(_family, _type, _protocol );
+ //0 indicates that the default protocol for the type selected is to be used.
+ //For example, IPPROTO_TCP is chosen for the protocol if the type was set to
+ //SOCK_STREAM and the address family is AF_INET.
+
+ if (_sd == INVALID_SOCKET)
+ {
+ errormessage( getLastError(), "Socket::create" );
+ return false;
+ }
+
+ // if requested set a timeout for receiving data
+ if (_timeout != 0)
+ {
+ struct timeval tv;
+
+ tv.tv_sec = _timeout; // set the receive timeout desired
+ tv.tv_usec = 0; // Not init'ing this can cause strange errors
+ setsockopt(_sd, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv,sizeof(struct timeval)); // set a receive timeout for this new socket
+ _timeout = 0; // reset to default state of no timeout
+ }
+
+ return true;
+}
+
+int Socket::send( const CStdString& data )
+{
+ if (!is_valid())
+ {
+ return 0;
+ }
+
+ int status = Socket::send( (const char*) data.c_str(), (const unsigned int) data.size());
+
+ return status;
+}
+
+int Socket::send ( const char* data, const unsigned int len )
+{
+ fd_set set_w, set_e;
+ struct timeval tv;
+ int result;
+
+ if (!is_valid())
+ {
+ return 0;
+ }
+
+ // fill with new data
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+
+ FD_ZERO(&set_w);
+ FD_ZERO(&set_e);
+ FD_SET(_sd, &set_w);
+ FD_SET(_sd, &set_e);
+
+ result = select(FD_SETSIZE, &set_w, NULL, &set_e, &tv);
+
+ if (result < 0)
+ {
+ XBMC->Log(LOG_ERROR, "Socket::send - select failed");
+ _sd = INVALID_SOCKET;
+ return 0;
+ }
+ if (FD_ISSET(_sd, &set_w))
+ {
+ XBMC->Log(LOG_ERROR, "Socket::send - failed to send data");
+ _sd = INVALID_SOCKET;
+ return 0;
+ }
+
+ int status = ::send(_sd, data, len, 0 );
+
+ if (status == -1)
+ {
+ errormessage( getLastError(), "Socket::send");
+ XBMC->Log(LOG_ERROR, "Socket::send - failed to send data");
+ _sd = INVALID_SOCKET;
+ }
+ return status;
+}
+
+//Receive until error or \n
+bool Socket::ReadResponses(int &code, vector<CStdString> &lines)
+{
+ int result;
+ char buffer[4096]; // this buff size has to be known in server
+ code = 0;
+
+ bool readComplete = false;
+ CStdString bigString = "";
+ int attemptCnt = 0;
+
+ do
+ {
+ result = recv(_sd, buffer, sizeof(buffer) - 1, 0);
+ if (result < 0) // if result is negative, the socket is bad
+ {
+#ifdef TARGET_WINDOWS
+ int errorCode = WSAGetLastError();
+ XBMC->Log(LOG_DEBUG, "ReadResponse ERROR - recv failed, Err: %d", errorCode);
+#else
+ XBMC->Log(LOG_DEBUG, "ReadResponse ERROR - recv failed");
+#endif
+ code = 1;
+ _sd = INVALID_SOCKET;
+ return false;
+ }
+
+ if (result > 0) // if we got data from the server in this last pass
+ {
+ buffer[result] = 0; // insert end of string marker
+ bigString.append(buffer); // accumulate all the reads
+ }
+
+ } while (result > 0); // keep reading until result returns '0', meaning server is done sending reponses
+
+ if (EndsWith(bigString, "<EOF>"))
+ {
+ readComplete = true; // all server data has benn read
+ lines = split(bigString, "<EOL>", true); // split each reponse by <EOL> delimiters
+ lines.erase(lines.end() - 1); // erase <EOF> at end
+ }
+ else
+ {
+ XBMC->Log(LOG_DEBUG, "ReadResponse ERROR - <EOF> in read reponses not found");
+ _sd = INVALID_SOCKET;
+ }
+
+
+ return readComplete;
+}
+
+bool Socket::connect ( const CStdString& host, const unsigned short port )
+{
+ if ( !is_valid() )
+ {
+ return false;
+ }
+
+ _sockaddr.sin_family = (sa_family_t) _family;
+ _sockaddr.sin_port = htons ( port );
+
+ if ( !setHostname( host ) )
+ {
+ XBMC->Log(LOG_ERROR, "Socket::setHostname(%s) failed.\n", host.c_str());
+ return false;
+ }
+
+ int status = ::connect ( _sd, reinterpret_cast<sockaddr*>(&_sockaddr), sizeof ( _sockaddr ) );
+
+ if ( status == SOCKET_ERROR )
+ {
+ XBMC->Log(LOG_ERROR, "Socket::connect %s:%u\n", host.c_str(), port);
+ errormessage( getLastError(), "Socket::connect" );
+ return false;
+ }
+
+ return true;
+}
+
+bool Socket::reconnect()
+{
+ if ( _sd != INVALID_SOCKET )
+ {
+ return true;
+ }
+
+ if( !create() )
+ return false;
+
+ int status = ::connect ( _sd, reinterpret_cast<sockaddr*>(&_sockaddr), sizeof ( _sockaddr ) );
+
+ if ( status == SOCKET_ERROR )
+ {
+ errormessage( getLastError(), "Socket::connect" );
+ return false;
+ }
+
+ return true;
+}
+
+bool Socket::is_valid() const
+{
+ return (_sd != INVALID_SOCKET);
+}
+
+#if defined(TARGET_WINDOWS)
+bool Socket::set_non_blocking ( const bool b )
+{
+ u_long iMode;
+
+ if ( b )
+ iMode = 1; // enable non_blocking
+ else
+ iMode = 0; // disable non_blocking
+
+ if (ioctlsocket(_sd, FIONBIO, &iMode) == -1)
+ {
+ XBMC->Log(LOG_ERROR, "Socket::set_non_blocking - Can't set socket condition to: %i", iMode);
+ return false;
+ }
+
+ return true;
+}
+
+void Socket::errormessage( int errnum, const char* functionname) const
+{
+ const char* errmsg = NULL;
+
+ switch (errnum)
+ {
+ case WSANOTINITIALISED:
+ errmsg = "A successful WSAStartup call must occur before using this function.";
+ break;
+ case WSAENETDOWN:
+ errmsg = "The network subsystem or the associated service provider has failed";
+ break;
+ case WSA_NOT_ENOUGH_MEMORY:
+ errmsg = "Insufficient memory available";
+ break;
+ case WSA_INVALID_PARAMETER:
+ errmsg = "One or more parameters are invalid";
+ break;
+ case WSA_OPERATION_ABORTED:
+ errmsg = "Overlapped operation aborted";
+ break;
+ case WSAEINTR:
+ errmsg = "Interrupted function call";
+ break;
+ case WSAEBADF:
+ errmsg = "File handle is not valid";
+ break;
+ case WSAEACCES:
+ errmsg = "Permission denied";
+ break;
+ case WSAEFAULT:
+ errmsg = "Bad address";
+ break;
+ case WSAEINVAL:
+ errmsg = "Invalid argument";
+ break;
+ case WSAENOTSOCK:
+ errmsg = "Socket operation on nonsocket";
+ break;
+ case WSAEDESTADDRREQ:
+ errmsg = "Destination address required";
+ break;
+ case WSAEMSGSIZE:
+ errmsg = "Message too long";
+ break;
+ case WSAEPROTOTYPE:
+ errmsg = "Protocol wrong type for socket";
+ break;
+ case WSAENOPROTOOPT:
+ errmsg = "Bad protocol option";
+ break;
+ case WSAEPFNOSUPPORT:
+ errmsg = "Protocol family not supported";
+ break;
+ case WSAEAFNOSUPPORT:
+ errmsg = "Address family not supported by protocol family";
+ break;
+ case WSAEADDRINUSE:
+ errmsg = "Address already in use";
+ break;
+ case WSAECONNRESET:
+ errmsg = "Connection reset by peer";
+ break;
+ case WSAHOST_NOT_FOUND:
+ errmsg = "Authoritative answer host not found";
+ break;
+ case WSATRY_AGAIN:
+ errmsg = "Nonauthoritative host not found, or server failure";
+ break;
+ case WSAEISCONN:
+ errmsg = "Socket is already connected";
+ break;
+ case WSAETIMEDOUT:
+ errmsg = "Connection timed out";
+ break;
+ case WSAECONNREFUSED:
+ errmsg = "Connection refused";
+ break;
+ case WSANO_DATA:
+ errmsg = "Valid name, no data record of requested type";
+ break;
+ default:
+ errmsg = "WSA Error";
+ }
+ XBMC->Log(LOG_ERROR, "%s: (Winsock error=%i) %s\n", functionname, errnum, errmsg);
+}
+
+int Socket::getLastError() const
+{
+ return WSAGetLastError();
+}
+
+int Socket::win_usage_count = 0; //Declared static in Socket class
+
+bool Socket::osInit()
+{
+ win_usage_count++;
+ // initialize winsock:
+ if (WSAStartup(MAKEWORD(2,2),&_wsaData) != 0)
+ {
+ return false;
+ }
+
+ WORD wVersionRequested = MAKEWORD(2,2);
+
+ // check version
+ if (_wsaData.wVersion != wVersionRequested)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void Socket::osCleanup()
+{
+ win_usage_count--;
+ if(win_usage_count == 0)
+ {
+ WSACleanup();
+ }
+}
+
+#elif defined TARGET_LINUX || defined TARGET_DARWIN
+bool Socket::set_non_blocking ( const bool b )
+{
+ int opts;
+
+ opts = fcntl(_sd, F_GETFL);
+
+ if ( opts < 0 )
+ {
+ return false;
+ }
+
+ if ( b )
+ opts = ( opts | O_NONBLOCK );
+ else
+ opts = ( opts & ~O_NONBLOCK );
+
+ if(fcntl (_sd , F_SETFL, opts) == -1)
+ {
+ XBMC->Log(LOG_ERROR, "Socket::set_non_blocking - Can't set socket flags to: %i", opts);
+ return false;
+ }
+ return true;
+}
+
+void Socket::errormessage( int errnum, const char* functionname) const
+{
+ const char* errmsg = NULL;
+
+ switch ( errnum )
+ {
+ case EAGAIN: //same as EWOULDBLOCK
+ errmsg = "EAGAIN: The socket is marked non-blocking and the requested operation would block";
+ break;
+ case EBADF:
+ errmsg = "EBADF: An invalid descriptor was specified";
+ break;
+ case ECONNRESET:
+ errmsg = "ECONNRESET: Connection reset by peer";
+ break;
+ case EDESTADDRREQ:
+ errmsg = "EDESTADDRREQ: The socket is not in connection mode and no peer address is set";
+ break;
+ case EFAULT:
+ errmsg = "EFAULT: An invalid userspace address was specified for a parameter";
+ break;
+ case EINTR:
+ errmsg = "EINTR: A signal occurred before data was transmitted";
+ break;
+ case EINVAL:
+ errmsg = "EINVAL: Invalid argument passed";
+ break;
+ case ENOTSOCK:
+ errmsg = "ENOTSOCK: The argument is not a valid socket";
+ break;
+ case EMSGSIZE:
+ errmsg = "EMSGSIZE: The socket requires that message be sent atomically, and the size of the message to be sent made this impossible";
+ break;
+ case ENOBUFS:
+ errmsg = "ENOBUFS: The output queue for a network interface was full";
+ break;
+ case ENOMEM:
+ errmsg = "ENOMEM: No memory available";
+ break;
+ case EPIPE:
+ errmsg = "EPIPE: The local end has been shut down on a connection oriented socket";
+ break;
+ case EPROTONOSUPPORT:
+ errmsg = "EPROTONOSUPPORT: The protocol type or the specified protocol is not supported within this domain";
+ break;
+ case EAFNOSUPPORT:
+ errmsg = "EAFNOSUPPORT: The implementation does not support the specified address family";
+ break;
+ case ENFILE:
+ errmsg = "ENFILE: Not enough kernel memory to allocate a new socket structure";
+ break;
+ case EMFILE:
+ errmsg = "EMFILE: Process file table overflow";
+ break;
+ case EACCES:
+ errmsg = "EACCES: Permission to create a socket of the specified type and/or protocol is denied";
+ break;
+ case ECONNREFUSED:
+ errmsg = "ECONNREFUSED: A remote host refused to allow the network connection (typically because it is not running the requested service)";
+ break;
+ case ENOTCONN:
+ errmsg = "ENOTCONN: The socket is associated with a connection-oriented protocol and has not been connected";
+ break;
+ //case E:
+ // errmsg = "";
+ // break;
+ default:
+ break;
+ }
+ XBMC->Log(LOG_ERROR, "%s: (errno=%i) %s\n", functionname, errnum, errmsg);
+}
+
+int Socket::getLastError() const
+{
+ return errno;
+}
+
+bool Socket::osInit()
+{
+ // Not needed for Linux
+ return true;
+}
+
+void Socket::osCleanup()
+{
+ // Not needed for Linux
+}
+#endif //TARGET_WINDOWS || TARGET_LINUX || TARGET_DARWIN
+
+
+void Socket::SetServerName(CStdString strServerName)
+{
+ _serverName = strServerName;
+}
+
+void Socket::SetClientName(CStdString strClientName)
+{
+ _clientName = strClientName;
+}
+
+void Socket::SetServerPort(int port)
+{
+ _port = port;
+}
+
+int Socket::SendRequest(CStdString requestStr)
+{
+ CStdString sRequest;
+ sRequest.Format("%s|%s<Client Quit>", _clientName.c_str(), requestStr.c_str()); // build the request string
+ int status = send(sRequest);
+ return status;
+}
+
+// set a timeout for the next socket operation called, otherwise no timout is set
+void Socket::SetTimeOut(int tSec)
+{
+ _timeout = tSec;
+}
+
+std::vector<CStdString> Socket::GetVector(const CStdString &request)
+{
+ PLATFORM::CLockObject lock(m_mutex); // only process one request at a time
+
+ int code;
+ std::vector<CStdString> reponses;
+
+ if (!create()) // create the socket
+ {
+ XBMC->Log(LOG_ERROR, "Socket::GetVector> error could not create socket");
+ reponses.push_back("SocketError"); // set a SocketError message (not fatal)
+ }
+ else // socket created OK
+ {
+ if (!connect(_serverName, (unsigned short)_port)) // if this fails, it is likely due to server down
+ {
+ XBMC->Log(LOG_ERROR, "Socket::GetVector> Server is down");
+ reponses.push_back("ServerDown"); // set a server down error message (not fatal)
+ }
+ else // connected to server
+ {
+ int bytesSent = SendRequest(request.c_str()); // send request to server
+
+ if (bytesSent > 0) // if request was sent successfully
+ {
+ if (!ReadResponses(code, reponses))
+ {
+ XBMC->Log(LOG_ERROR, "Socket::GetVector> error getting responses");
+ reponses.clear();
+ reponses.push_back("SocketError");
+ }
+ }
+ else // error sending request
+ {
+ XBMC->Log(LOG_ERROR, "Socket::GetVector> error sending server request");
+ reponses.push_back("SocketError");
+ }
+ }
+ }
+
+ close(); // close socket
+ return reponses; // return responses
+}
+
+CStdString Socket::GetString(const CStdString &request)
+{
+ std::vector<CStdString> result = GetVector(request);
+ return result[0];
+}
+
+bool Socket::GetBool(const CStdString &request)
+{
+ return GetString(request) == "True";
+}
+
+
+int Socket::GetInt(const CStdString &request)
+{
+ CStdString valStr = GetString(request);
+ long val = strtol(valStr, 0, 10);
+ return val;
+}
+
+long long Socket::GetLL(const CStdString &request)
+{
+ CStdString valStr = GetString(request);
+#ifdef TARGET_WINDOWS
+ long long val = _strtoi64(valStr, 0, 10);
+#else
+ long long val = strtoll(valStr, NULL, 10);
+#endif
+ return val;
+}
View
275 addons/pvr.wmc/src/Socket.h
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2005-2011 Team XBMC
+ * http://www.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 this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+
+//Include platform specific datatypes, header files, defines and constants:
+#if defined TARGET_WINDOWS
+ #define WIN32_LEAN_AND_MEAN // Enable LEAN_AND_MEAN support
+ #pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition"
+ #include <winsock2.h>
+ #pragma warning(default:4005)
+ #include <windows.h>
+
+ #ifndef NI_MAXHOST
+ #define NI_MAXHOST 1025
+ #endif
+
+ #ifndef socklen_t
+ typedef int socklen_t;
+ #endif
+ #ifndef ipaddr_t
+ typedef unsigned long ipaddr_t;
+ #endif
+ #ifndef port_t
+ typedef unsigned short port_t;
+ #endif
+ #ifndef sa_family_t
+ #define sa_family_t ADDRESS_FAMILY
+ #endif
+#elif defined TARGET_LINUX || defined TARGET_DARWIN || defined TARGET_FREEBSD
+#ifdef SOCKADDR_IN
+#undef SOCKADDR_IN
+#endif
+ #include <sys/types.h> /* for socket,connect */
+ #include <sys/socket.h> /* for socket,connect */
+ #include <sys/un.h> /* for Unix socket */
+ #include <arpa/inet.h> /* for inet_pton */
+ #include <netdb.h> /* for gethostbyname */
+ #include <netinet/in.h> /* for htons */
+ #include <unistd.h> /* for read, write, close */
+ #include <errno.h>
+ #include <fcntl.h>
+
+ typedef int SOCKET;
+ typedef sockaddr SOCKADDR;
+ typedef sockaddr_in SOCKADDR_IN;
+ #ifndef INVALID_SOCKET
+ #define INVALID_SOCKET (-1)
+ #endif
+ #define SOCKET_ERROR (-1)
+#else
+ #error Platform specific socket support is not yet available on this platform!
+#endif
+
+using namespace std;
+
+#include <vector>
+
+#define MAXCONNECTIONS 1 ///< Maximum number of pending connections before "Connection refused"
+#define MAXRECV 1500 ///< Maximum packet size
+
+enum SocketFamily
+{
+ #ifdef CONFIG_SOCKET_IPV6
+ af_inet6 = AF_INET6,
+ af_unspec = AF_UNSPEC, ///< Either INET or INET6
+ #endif
+ af_inet = AF_INET
+};
+
+enum SocketDomain
+{
+ #if defined TARGET_LINUX || defined TARGET_DARWIN
+ pf_unix = PF_UNIX,
+ pf_local = PF_LOCAL,
+ #endif
+ #ifdef CONFIG_SOCKET_IPV6
+ pf_inet6 = PF_INET6,
+ pf_unspec = PF_UNSPEC, //< Either INET or INET6
+ #endif
+ pf_inet = PF_INET
+};
+
+enum SocketType
+{
+ sock_stream = SOCK_STREAM,
+ sock_dgram = SOCK_DGRAM
+};
+
+enum SocketProtocol
+{
+ tcp = IPPROTO_TCP,
+ udp = IPPROTO_UDP
+ #ifdef CONFIG_SOCKET_IPV6
+ , ipv6 = IPPROTO_IPV6
+ #endif
+};
+
+class Socket
+{
+ public:
+
+ /*!
+ * An unconnected socket may be created directly on the local
+ * machine. The socket type (SOCK_STREAM, SOCK_DGRAM) and
+ * protocol may also be specified.
+ * If the socket cannot be created, an exception is thrown.
+ *
+ * \param family Socket family (IPv4 or IPv6)
+ * \param domain The domain parameter specifies a communications domain within which communication will take place;
+ * this selects the protocol family which should be used.
+ * \param type base type and protocol family of the socket.
+ * \param protocol specific protocol to apply.
+ */
+ Socket(const enum SocketFamily family, const enum SocketDomain domain, const enum SocketType type, const enum SocketProtocol protocol = tcp);
+ Socket(void);
+ virtual ~Socket();
+
+ //Socket settings
+
+ /*!
+ * Socket setFamily
+ * \param family Can be af_inet or af_inet6. Default: af_inet
+ */
+ void setFamily(const enum SocketFamily family)
+ {
+ _family = family;
+ };
+
+ /*!
+ * Socket setDomain
+ * \param domain Can be pf_unix, pf_local, pf_inet or pf_inet6. Default: pf_inet
+ */
+ void setDomain(const enum SocketDomain domain)
+ {
+ _domain = domain;
+ };
+
+ /*!
+ * Socket setType
+ * \param type Can be sock_stream or sock_dgram. Default: sock_stream.
+ */
+ void setType(const enum SocketType type)
+ {
+ _type = type;
+ };
+
+ /*!
+ * Socket setProtocol
+ * \param protocol Can be tcp or udp. Default: tcp.
+ */
+ void setProtocol(const enum SocketProtocol protocol)
+ {
+ _protocol = protocol;
+ };
+
+ /*!
+ * Socket setPort
+ * \param port port number for socket communication
+ */
+ void setPort (const unsigned short port)
+ {
+ _sockaddr.sin_port = htons ( port );
+ };
+
+ bool setHostname ( const CStdString& host );
+
+ // Server initialization
+
+ /*!
+ * Socket create
+ * Create a new socket
+ * \return True if succesful
+ */
+ bool create();
+
+ /*!
+ * Socket close
+ * Close the socket
+ * \return True if succesful
+ */
+ bool close();
+
+ /*!
+ * Socket bind
+ */
+ //bool bind ( const unsigned short port );
+ //bool listen() const;
+ //bool accept ( Socket& socket ) const;
+
+ // Client initialization
+ bool connect ( const CStdString& host, const unsigned short port );
+
+ bool reconnect();
+
+ // Data Transmission
+
+ /*!
+ * Socket send function
+ *
+ * \param data Reference to a std::string with the data to transmit
+ * \return Number of bytes send or -1 in case of an error
+ */
+ int send ( const CStdString& data );
+
+ /*!
+ * Socket send function
+ *
+ * \param data Pointer to a character array of size 'size' with the data to transmit
+ * \param size Length of the data to transmit
+ * \return Number of bytes send or -1 in case of an error
+ */
+ int send ( const char* data, const unsigned int size );
+
+ bool set_non_blocking ( const bool );
+
+ bool ReadResponses(int &code, vector<CStdString> &lines);
+
+ bool is_valid() const;
+
+ private:
+
+ SOCKET _sd; ///< Socket Descriptor
+ SOCKADDR_IN _sockaddr; ///< Socket Address
+
+ enum SocketFamily _family; ///< Socket Address Family
+ enum SocketProtocol _protocol; ///< Socket Protocol
+ enum SocketType _type; ///< Socket Type
+ enum SocketDomain _domain; ///< Socket domain
+
+ #ifdef TARGET_WINDOWS
+ WSADATA _wsaData; ///< Windows Socket data
+ static int win_usage_count; ///< Internal Windows usage counter used to prevent a global WSACleanup when more than one Socket object is used
+ #endif
+
+ void errormessage( int errornum, const char* functionname = NULL) const;
+ int getLastError(void) const;
+ bool osInit();
+ void osCleanup();
+
+ // client interface
+ private:
+ CStdString _serverName;
+ CStdString _clientName;
+ int _port;
+ int SendRequest(CStdString requestStr);
+ public:
+ void SetServerName(CStdString strServerName);
+ void SetClientName(CStdString strClientName);
+ void SetServerPort(int port);
+ std::vector<CStdString> GetVector(const CStdString &request);
+ CStdString GetString(const CStdString &request);
+ bool GetBool(const CStdString &request);
+ int GetInt(const CStdString &request);
+ long long GetLL(const CStdString &request);
+
+ void SetTimeOut(int tSec);
+};
+
View
660 addons/pvr.wmc/src/client.cpp
@@ -0,0 +1,660 @@
+/*
+* Copyright (C) 2011 Pulse-Eight
+* http://www.pulse-eight.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 XBMC; 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
+*
+*/
+
+#include "client.h"
+#include "xbmc_pvr_dll.h"
+#include "pvr2wmc.h"
+#include "platform/util/util.h"
+
+using namespace std;
+using namespace ADDON;
+
+#ifdef TARGET_WINDOWS
+#define snprintf _snprintf
+#endif
+
+#define DEFAULT_PORT 9080
+#define DEFAULT_SIGNAL_ENABLE false
+#define DEFAULT_SIGNAL_THROTTLE 10
+#define DEFAULT_MULTI_RESUME true
+
+Pvr2Wmc* _wmc = NULL;
+bool _bCreated = false;
+ADDON_STATUS _CurStatus = ADDON_STATUS_UNKNOWN;
+bool _bIsPlaying = false;
+PVR_CHANNEL _currentChannel;
+PVR_MENUHOOK *menuHook = NULL;
+
+CStdString g_strServerName; // the name of the server to connect to
+CStdString g_strClientName; // the name of the computer running addon
+int g_port;
+bool g_bSignalEnable;
+int g_signalThrottle;
+bool g_bEnableMultiResume;
+CStdString g_clientOS; // OS of client, passed to server
+
+/* User adjustable settings are saved here.
+* Default values are defined inside client.h
+* and exported to the other source files.
+*/
+CStdString g_strUserPath = "";
+CStdString g_strClientPath = "";
+
+CHelper_libXBMC_addon *XBMC = NULL;
+CHelper_libXBMC_pvr *PVR = NULL;
+CHelper_libXBMC_gui *GUI = NULL;
+
+#define LOCALHOST "127.0.0.1"
+
+extern "C" {
+