Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #60 from fetzerch/release-0.4

New addon: pvr.mythtv.cmyth
  • Loading branch information...
commit 8baca1ef56f5c138c62cdbf45433c62e68dff2ac 2 parents 77a3897 + 5f1d77c
@opdenkamp authored
Showing with 29,423 additions and 17 deletions.
  1. +2 −0  .dummy.am
  2. +5 −0 .gitignore
  3. +1 −0  addons/Makefile.am
  4. +34 −0 addons/pvr.mythtv.cmyth/Makefile.am
  5. +22 −0 addons/pvr.mythtv.cmyth/addon/addon.xml
  6. +15 −0 addons/pvr.mythtv.cmyth/addon/changelog.txt
  7. BIN  addons/pvr.mythtv.cmyth/addon/icon.png
  8. +68 −0 addons/pvr.mythtv.cmyth/addon/resources/language/English/strings.po
  9. +69 −0 addons/pvr.mythtv.cmyth/addon/resources/language/German/strings.po
  10. +11 −0 addons/pvr.mythtv.cmyth/addon/resources/settings.xml
  11. +167 −0 addons/pvr.mythtv.cmyth/project/VS2010Express/pvr.mythtv.cmyth.vcxproj
  12. +102 −0 addons/pvr.mythtv.cmyth/project/VS2010Express/pvr.mythtv.cmyth.vcxproj.filters
  13. +213 −0 addons/pvr.mythtv.cmyth/src/categories.cpp
  14. +42 −0 addons/pvr.mythtv.cmyth/src/categories.h
  15. +797 −0 addons/pvr.mythtv.cmyth/src/client.cpp
  16. +77 −0 addons/pvr.mythtv.cmyth/src/client.h
  17. +12 −0 addons/pvr.mythtv.cmyth/src/cppmyth.h
  18. +102 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythChannel.cpp
  19. +54 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythChannel.h
  20. +373 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythConnection.cpp
  21. +98 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythConnection.h
  22. +306 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythDatabase.cpp
  23. +87 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythDatabase.h
  24. +397 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythEventHandler.cpp
  25. +59 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythEventHandler.h
  26. +92 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythFile.cpp
  27. +48 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythFile.h
  28. +73 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythPointer.h
  29. +193 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythProgramInfo.cpp
  30. +69 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythProgramInfo.h
  31. +325 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythRecorder.cpp
  32. +68 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythRecorder.h
  33. +61 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythSignal.cpp
  34. +45 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythSignal.h
  35. +60 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythStorageGroupFile.cpp
  36. +46 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythStorageGroupFile.h
  37. +419 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythTimer.cpp
  38. +190 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythTimer.h
  39. +96 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythTimestamp.cpp
  40. +56 −0 addons/pvr.mythtv.cmyth/src/cppmyth/MythTimestamp.h
  41. +403 −0 addons/pvr.mythtv.cmyth/src/fileOps.cpp
  42. +129 −0 addons/pvr.mythtv.cmyth/src/fileOps.h
  43. +1,433 −0 addons/pvr.mythtv.cmyth/src/pvrclient-mythtv.cpp
  44. +156 −0 addons/pvr.mythtv.cmyth/src/pvrclient-mythtv.h
  45. +39 −0 addons/pvr.mythtv.cmyth/src/tools.h
  46. +67 −16 configure.ac
  47. +1 −1  lib/Makefile.am
  48. +504 −0 lib/cmyth/COPYING
  49. +11 −0 lib/cmyth/Makefile.am
  50. +1 −0  lib/cmyth/Win32/gensymbols.bat
  51. +308 −0 lib/cmyth/Win32/include/inttypes.h
  52. +293 −0 lib/cmyth/Win32/libcmyth.def
  53. +21 −0 lib/cmyth/Win32/libcmyth.sln
  54. +298 −0 lib/cmyth/Win32/libcmyth.vcproj
  55. +185 −0 lib/cmyth/Win32/libcmyth.vcxproj
  56. +100 −0 lib/cmyth/Win32/libcmyth.vcxproj.filters
  57. +1,341 −0 lib/cmyth/include/cmyth/cmyth.h
  58. +69 −0 lib/cmyth/include/debug.h
  59. +168 −0 lib/cmyth/include/refmem/atomic.h
  60. +98 −0 lib/cmyth/include/refmem/refmem.h
  61. +32 −0 lib/cmyth/libcmyth/Makefile.am
  62. +122 −0 lib/cmyth/libcmyth/bookmark.c
  63. +526 −0 lib/cmyth/libcmyth/cmyth_local.h
  64. +85 −0 lib/cmyth/libcmyth/cmyth_msc.h
  65. +305 −0 lib/cmyth/libcmyth/commbreak.c
  66. +1,877 −0 lib/cmyth/libcmyth/connection.c
  67. +122 −0 lib/cmyth/libcmyth/debug.c
  68. +200 −0 lib/cmyth/libcmyth/event.c
  69. +1,052 −0 lib/cmyth/libcmyth/file.c
  70. +53 −0 lib/cmyth/libcmyth/freespace.c
  71. +235 −0 lib/cmyth/libcmyth/input.c
  72. +132 −0 lib/cmyth/libcmyth/keyframe.c
  73. +1,384 −0 lib/cmyth/libcmyth/livetv.c
  74. +419 −0 lib/cmyth/libcmyth/mysql_query.c
  75. +2,452 −0 lib/cmyth/libcmyth/mythtv_mysql.c
  76. +94 −0 lib/cmyth/libcmyth/posmap.c
  77. +1,869 −0 lib/cmyth/libcmyth/proginfo.c
  78. +978 −0 lib/cmyth/libcmyth/proglist.c
  79. +227 −0 lib/cmyth/libcmyth/rec_num.c
  80. +1,595 −0 lib/cmyth/libcmyth/recorder.c
  81. +590 −0 lib/cmyth/libcmyth/ringbuf.c
  82. +49 −0 lib/cmyth/libcmyth/safe_string.h
  83. +3,061 −0 lib/cmyth/libcmyth/socket.c
  84. +546 −0 lib/cmyth/libcmyth/timestamp.c
  85. +162 −0 lib/cmyth/libcmyth/utf8tolatin1.c
  86. +11 −0 lib/cmyth/librefmem/Makefile.am
  87. +485 −0 lib/cmyth/librefmem/alloc.c
  88. +118 −0 lib/cmyth/librefmem/debug_refmem.c
  89. +20 −0 lib/cmyth/librefmem/refmem_local.h
  90. +12 −0 project/BuildDependencies/scripts/boost_d.bat
  91. +2 −0  project/BuildDependencies/scripts/boost_d.txt
  92. +13 −0 project/BuildDependencies/scripts/mysqlclient_d.bat
  93. +2 −0  project/BuildDependencies/scripts/mysqlclient_d.txt
  94. +14 −0 project/VS2010Express/xbmc-pvr-addons.sln
View
2  .dummy.am
@@ -0,0 +1,2 @@
+# Does nothing intentionally.
+# This exists solely so we can use AM_INIT_AUTOMAKE in configure.in
View
5 .gitignore
@@ -4,6 +4,8 @@
.libs
.project
+.dummy
+.dummy.in
aclocal.m4
autom4te.cache
config.log
@@ -42,6 +44,8 @@ missing
*.vcxproj.user
project/VS2010Express/objs
+project/VS2010Express/ipch
+project/VS2010Express/libs
project/VS2010Express/platform/Debug
project/VS2010Express/platform/Release
project/VS2010Express/tinyxml/Debug
@@ -53,3 +57,4 @@ addons/*/project/VS2010Express/Debug
addons/*/project/VS2010Express/Release
lib/jsoncpp/project/VS2010Express/Debug
lib/jsoncpp/project/VS2010Express/Release
+addons/*/addon/*.so
View
1  addons/Makefile.am
@@ -1,6 +1,7 @@
SUBDIRS = pvr.demo \
pvr.hts \
pvr.mediaportal.tvserver \
+ pvr.mythtv.cmyth \
pvr.nextpvr \
pvr.vdr.vnsi \
pvr.njoy \
View
34 addons/pvr.mythtv.cmyth/Makefile.am
@@ -0,0 +1,34 @@
+#
+# Makefile for the MythTV (using libcmyth) add-on for XBMC PVR
+#
+# See the README for copyright information and
+# how to reach the author.
+#
+
+ADDONBINNAME = XBMC_MythTV_cmyth
+ADDONNAME = pvr.mythtv.cmyth
+LIBNAME = libmythtvcmyth-addon
+lib_LTLIBRARIES = libmythtvcmyth-addon.la
+
+LIBS = @abs_top_srcdir@/lib/cmyth/libcmyth.la
+
+AM_CPPFLAGS = -I$(abs_top_srcdir)/lib/cmyth/include
+
+include ../Makefile.include.am
+
+libmythtvcmyth_addon_la_SOURCES = src/client.cpp \
+ src/fileOps.cpp \
+ src/categories.cpp \
+ src/pvrclient-mythtv.cpp \
+ src/cppmyth/MythChannel.cpp \
+ src/cppmyth/MythConnection.cpp \
+ src/cppmyth/MythDatabase.cpp \
+ src/cppmyth/MythEventHandler.cpp \
+ src/cppmyth/MythFile.cpp \
+ src/cppmyth/MythProgramInfo.cpp \
+ src/cppmyth/MythRecorder.cpp \
+ src/cppmyth/MythStorageGroupFile.cpp \
+ src/cppmyth/MythSignal.cpp \
+ src/cppmyth/MythTimer.cpp \
+ src/cppmyth/MythTimestamp.cpp
+
View
22 addons/pvr.mythtv.cmyth/addon/addon.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<addon
+ id="pvr.mythtv.cmyth"
+ version="0.4.0"
+ name="MythTV cmyth PVR Client"
+ provider-name="Christian Fetzer, Jean-Luc Barrière, Tonny Petersen">
+ <requires>
+ <c-pluff version="0.1"/>
+ </requires>
+ <extension
+ point="xbmc.pvrclient"
+ library_linux="XBMC_MythTV_cmyth.pvr"
+ library_osx="XBMC_MythTV_cmyth.pvr"
+ library_wingl="XBMC_MythTV_cmyth_win32.pvr"
+ library_windx="XBMC_MythTV_cmyth_win32.pvr"/>
+ <extension point="xbmc.addon.metadata">
+ <summary>XBMC frontend for MythTV (using libcmyth)</summary>
+ <description>MythTV frontend (up to MythTV 0.25). Supports streaming of Live TV &amp; Recordings, listening to Radio channels, EPG and Timers.</description>
+ <disclaimer>This is unstable software! The authors are in no way responsible for failed recordings, incorrect timers, wasted hours, or any other undesirable effects.</disclaimer>
+ <platform>all</platform>
+ </extension>
+</addon>
View
15 addons/pvr.mythtv.cmyth/addon/changelog.txt
@@ -0,0 +1,15 @@
+v0.4.0
+- OSX support
+
+v0.3.0
+- Transifex localizations (https://www.transifex.com/projects/p/pvrmythtvcmyth)
+- Support for recording images (icon, thumbnail, fanart)
+- Fixed: Preview images of new recordings were not cached
+
+v0.2.0
+- Added setting to enable / disable Live TV support (disbale to use the addon only for watching recordings)
+
+v0.1.0
+- Initial version based on Tonny Pettersen's work
+- Supports Live TV &amp; Recordings, listening to Radio channels, EPG and Timer
+- Supports setting / reading resume bookmarks and watched state on MythTV backend
View
BIN  addons/pvr.mythtv.cmyth/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
68 addons/pvr.mythtv.cmyth/addon/resources/language/English/strings.po
@@ -0,0 +1,68 @@
+# XBMC Media Center language file
+# Addon Name: XBMC PVR addon for MythTV (using libcmyth)
+# Addon id: pvr.mythtv.cmyth
+# Addon Provider: Christian Fetzer
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: xbmc_pvr.mythtv.cmyth\n"
+"Report-Msgid-Bugs-To: fetzer.ch@googlemail.com\n"
+"POT-Creation-Date: 2012-10-07 16:35+0200\n"
+"PO-Revision-Date: 2012-10-07 17:01+0000\n"
+"Last-Translator: fetzerch <fetzer.ch@googlemail.com>\n"
+"Language-Team: English (http://www.transifex.com/projects/p/pvrmythtvcmyth/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"
+
+msgctxt "Addon Summary"
+msgid "XBMC PVR addon for MythTV (using libcmyth)"
+msgstr "XBMC PVR addon for MythTV (using libcmyth)"
+
+msgctxt "Addon Description"
+msgid ""
+"MythTV frontend (up to MythTV 0.25). Supports streaming of Live TV &amp; "
+"Recordings, listening to Radio channels, EPG and Timers."
+msgstr "MythTV frontend (up to MythTV 0.25). Supports streaming of Live TV &amp; Recordings, listening to Radio channels, EPG and Timers."
+
+msgctxt "Addon Disclaimer"
+msgid ""
+"This is unstable software! The authors are in no way responsible for failed "
+"recordings, incorrect timers, wasted hours, or any other undesirable "
+"effects."
+msgstr "This is unstable software! The authors are in no way responsible for failed recordings, incorrect timers, wasted hours, or any other undesirable effects."
+
+# Settings labels
+msgctxt "#30000"
+msgid "MythTV Backend Hostname or IP"
+msgstr "MythTV Backend Hostname or IP"
+
+msgctxt "#30001"
+msgid "MythTV Backend Port"
+msgstr "MythTV Backend Port"
+
+msgctxt "#30002"
+msgid "MythTV Database Username"
+msgstr "MythTV Database Username"
+
+msgctxt "#30003"
+msgid "MythTV Database Password"
+msgstr "MythTV Database Password"
+
+msgctxt "#30004"
+msgid "MythTV Database Databasename"
+msgstr "MythTV Database Databasename"
+
+msgctxt "#30005"
+msgid "Include more debug information in the log file"
+msgstr "Include more debug information in the log file"
+
+msgctxt "#30006"
+msgid "Enable Live TV"
+msgstr "Enable Live TV"
+
+msgctxt "#30007"
+msgid "Allow Live TV to move scheduled shows"
+msgstr "Allow Live TV to move scheduled shows"
View
69 addons/pvr.mythtv.cmyth/addon/resources/language/German/strings.po
@@ -0,0 +1,69 @@
+# XBMC Media Center language file
+# Addon Name: XBMC PVR addon for MythTV (using libcmyth)
+# Addon id: pvr.mythtv.cmyth
+# Addon Provider: Christian Fetzer
+# Translators:
+# <fetzer.ch@googlemail.com>, 2012.
+msgid ""
+msgstr ""
+"Project-Id-Version: xbmc_pvr.mythtv.cmyth\n"
+"Report-Msgid-Bugs-To: fetzer.ch@googlemail.com\n"
+"POT-Creation-Date: 2012-10-07 16:35+0200\n"
+"PO-Revision-Date: 2012-10-07 17:05+0000\n"
+"Last-Translator: fetzerch <fetzer.ch@googlemail.com>\n"
+"Language-Team: German (http://www.transifex.com/projects/p/pvrmythtvcmyth/language/de/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: de\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgctxt "Addon Summary"
+msgid "XBMC PVR addon for MythTV (using libcmyth)"
+msgstr "XBMC PVR addon for MythTV (using libcmyth)"
+
+msgctxt "Addon Description"
+msgid ""
+"MythTV frontend (up to MythTV 0.25). Supports streaming of Live TV &amp; "
+"Recordings, listening to Radio channels, EPG and Timers."
+msgstr "MythTV frontend (up to MythTV 0.25). Supports streaming of Live TV &amp; Recordings, listening to Radio channels, EPG and Timers."
+
+msgctxt "Addon Disclaimer"
+msgid ""
+"This is unstable software! The authors are in no way responsible for failed "
+"recordings, incorrect timers, wasted hours, or any other undesirable "
+"effects."
+msgstr "MythTV frontend (up to MythTV 0.25). Supports streaming of Live TV &amp; Recordings, listening to Radio channels, EPG and Timers."
+
+# Settings labels
+msgctxt "#30000"
+msgid "MythTV Backend Hostname or IP"
+msgstr "MythTV Backend Hostname oder IP"
+
+msgctxt "#30001"
+msgid "MythTV Backend Port"
+msgstr "MythTV Backend Port"
+
+msgctxt "#30002"
+msgid "MythTV Database Username"
+msgstr "MythTV Datenbank Benutzername"
+
+msgctxt "#30003"
+msgid "MythTV Database Password"
+msgstr "MythTV Datenbank Passwort"
+
+msgctxt "#30004"
+msgid "MythTV Database Databasename"
+msgstr "MythTV Datenbank Datenbankname"
+
+msgctxt "#30005"
+msgid "Include more debug information in the log file"
+msgstr "Schreibe ausführliche Debug-Informationen in die Logdatei"
+
+msgctxt "#30006"
+msgid "Enable Live TV"
+msgstr "Aktiviere Live TV"
+
+msgctxt "#30007"
+msgid "Allow Live TV to move scheduled shows"
+msgstr "Erlaube Live TV geplante Aufnahmen zu verschieben"
View
11 addons/pvr.mythtv.cmyth/addon/resources/settings.xml
@@ -0,0 +1,11 @@
+<?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="30001" default="6543" />
+ <setting id="db_user" type="text" label="30002" default="mythtv" />
+ <setting id="db_password" type="text" label="30003" default="mythtv" />
+ <setting id="db_name" type="text" label="30004" default="mythconverg" />
+ <setting id="extradebug" type="bool" label="30005" default="false" />
+ <setting id="livetv" type="bool" label="30006" default="true" />
+ <setting id="livetv_priority" type="bool" label="30007" default="false" />
+</settings>
View
167 addons/pvr.mythtv.cmyth/project/VS2010Express/pvr.mythtv.cmyth.vcxproj
@@ -0,0 +1,167 @@
+<?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>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\categories.cpp" />
+ <ClCompile Include="..\..\src\client.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythChannel.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythConnection.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythDatabase.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythEventHandler.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythFile.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythProgramInfo.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythRecorder.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythStorageGroupFile.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythSignal.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythTimer.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythTimestamp.cpp" />
+ <ClCompile Include="..\..\src\fileOps.cpp" />
+ <ClCompile Include="..\..\src\pvrclient-mythtv.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\categories.h" />
+ <ClInclude Include="..\..\src\client.h" />
+ <ClInclude Include="..\..\src\cppmyth.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythChannel.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythConnection.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythDatabase.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythEventHandler.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythFile.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythPointer.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythProgramInfo.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythRecorder.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythStorageGroupFile.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythSignal.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythTimer.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythTimestamp.h" />
+ <ClInclude Include="..\..\src\fileOps.h" />
+ <ClInclude Include="..\..\src\pvrclient-mythtv.h" />
+ <ClInclude Include="..\..\src\tools.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\lib\cmyth\Win32\libcmyth.vcxproj">
+ <Project>{f9e6874d-60a8-49ba-9393-a2105e63abcf}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\project\VS2010Express\platform\platform.vcxproj">
+ <Project>{fe4573f6-a794-4ad3-b37f-49e51f1140e6}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\addon\addon.xml" />
+ <None Include="..\..\addon\changelog.txt" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{A55ACC6B-837D-4784-8E41-66947B1D9B8C}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>XBMC_mythtv_cmyth</RootNamespace>
+ <ProjectName>pvr.mythtv.cmyth</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'">
+ <TargetExt>.pvr</TargetExt>
+ <TargetName>XBMC_mythtv_cmyth_win32</TargetName>
+ <OutDir>..\..\addon\</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetExt>.pvr</TargetExt>
+ <TargetName>XBMC_mythtv_cmyth_win32</TargetName>
+ <OutDir>..\..\addon\</OutDir>
+ <CustomBuildAfterTargets>
+ </CustomBuildAfterTargets>
+ <CustomBuildBeforeTargets />
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetName>XBMC_MythTV_cmyth_win32</TargetName>
+ <CustomBuildAfterTargets>
+ </CustomBuildAfterTargets>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;USE_DEMUX;__STDC_CONSTANT_MACROS;__WINDOWS__;TARGET_WINDOWS;_WINDOWS;_MSVC;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\..\..\project\BuildDependencies\include;..\..\..\..\xbmc;..\..\..\..\lib;..\..\..\..\lib\platform\windows;..\..\..\..\lib\cmyth\include</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreSpecificDefaultLibraries>libcmtd;libboost_system-vc100-mt-gd-1_46_1;libboost_regex-vc100-mt-gd-1_46_1;libcmt;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalLibraryDirectories>..\..\..\..\project\BuildDependencies\lib</AdditionalLibraryDirectories>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ </Link>
+ <CustomBuildStep>
+ <Command>
+ </Command>
+ <Inputs>
+ </Inputs>
+ <Outputs>
+ </Outputs>
+ <Message>
+ </Message>
+ </CustomBuildStep>
+ </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;..\..\..\..\project\BuildDependencies\include;..\..\..\..\lib\cmyth\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;USE_DEMUX;__STDC_CONSTANT_MACROS;__WINDOWS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreSpecificDefaultLibraries>libcmt;libboost_system-vc100-mt-1_46_1;libboost_regex-vc100-mt-1_46_1</IgnoreSpecificDefaultLibraries>
+ <AdditionalLibraryDirectories>..\..\..\..\project\BuildDependencies\lib</AdditionalLibraryDirectories>
+ </Link>
+ <CustomBuildStep>
+ <Command>
+ </Command>
+ </CustomBuildStep>
+ <CustomBuildStep>
+ <Outputs>
+ </Outputs>
+ <Inputs>
+ </Inputs>
+ <Message>
+ </Message>
+ </CustomBuildStep>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
View
102 addons/pvr.mythtv.cmyth/project/VS2010Express/pvr.mythtv.cmyth.vcxproj.filters
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClCompile Include="..\..\src\client.cpp" />
+ <ClCompile Include="..\..\src\fileOps.cpp" />
+ <ClCompile Include="..\..\src\pvrclient-mythtv.cpp" />
+ <ClCompile Include="..\..\src\cppmyth\MythChannel.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythConnection.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythDatabase.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythEventHandler.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythFile.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythProgramInfo.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythRecorder.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythSignal.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythTimer.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythTimestamp.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cppmyth\MythStorageGroupFile.cpp">
+ <Filter>cppmyth</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\categories.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\client.h" />
+ <ClInclude Include="..\..\src\cppmyth.h" />
+ <ClInclude Include="..\..\src\fileOps.h" />
+ <ClInclude Include="..\..\src\pvrclient-mythtv.h" />
+ <ClInclude Include="..\..\src\tools.h" />
+ <ClInclude Include="..\..\src\cppmyth\MythTimestamp.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythChannel.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythConnection.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythDatabase.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythEventHandler.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythFile.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythPointer.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythProgramInfo.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythRecorder.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythSignal.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythTimer.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\cppmyth\MythStorageGroupFile.h">
+ <Filter>cppmyth</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\categories.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="cppmyth">
+ <UniqueIdentifier>{4070db56-7473-4105-a341-fadd71cb2c4e}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="addon">
+ <UniqueIdentifier>{a9c2652d-c1dd-4836-a42d-bc5e6db7b5a0}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\addon\addon.xml">
+ <Filter>addon</Filter>
+ </None>
+ <None Include="..\..\addon\changelog.txt">
+ <Filter>addon</Filter>
+ </None>
+ </ItemGroup>
+</Project>
View
213 addons/pvr.mythtv.cmyth/src/categories.cpp
@@ -0,0 +1,213 @@
+/*
+ * 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 "categories.h"
+
+Categories::Categories()
+ : m_categoriesById(DefaultEITCategories())
+{
+ // Copy over
+ CategoryByIdMap::const_iterator it;
+ for (it = m_categoriesById.begin(); it != m_categoriesById.end(); ++it)
+ {
+ m_categoriesByName.insert(CategoryByNameMap::value_type(it->second, it->first));
+ }
+}
+
+std::string Categories::Category(int category) const
+{
+ CategoryByIdMap::const_iterator it = m_categoriesById.find(category);
+ if (it != m_categoriesById.end())
+ return it->second;
+ return "";
+}
+
+int Categories::Category(const std::string &category) const
+{
+ CategoryByNameMap::const_iterator it = m_categoriesByName.find(category);
+ if (it != m_categoriesByName.end())
+ return it->second;
+ return 0;
+}
+
+CategoryByIdMap Categories::DefaultEITCategories() const
+{
+ CategoryByIdMap categoryMap;
+ categoryMap.insert(std::pair<int, std::string>(0x10, "Movie"));
+ categoryMap.insert(std::pair<int, std::string>(0x11, "Movie - Detective/Thriller"));
+ categoryMap.insert(std::pair<int, std::string>(0x12, "Movie - Adventure/Western/War"));
+ categoryMap.insert(std::pair<int, std::string>(0x13, "Movie - Science Fiction/Fantasy/Horror"));
+ categoryMap.insert(std::pair<int, std::string>(0x14, "Movie - Comedy"));
+ categoryMap.insert(std::pair<int, std::string>(0x15, "Movie - Soap/melodrama/folkloric"));
+ categoryMap.insert(std::pair<int, std::string>(0x16, "Movie - Romance"));
+ categoryMap.insert(std::pair<int, std::string>(0x17, "Movie - Serious/Classical/Religious/Historical Movie/Drama"));
+ categoryMap.insert(std::pair<int, std::string>(0x18, "Movie - Adult "));
+ categoryMap.insert(std::pair<int, std::string>(0x1F, "Drama")); // MythTV use 0xF0 but xbmc doesn't implement this.
+ categoryMap.insert(std::pair<int, std::string>(0x20, "News"));
+ categoryMap.insert(std::pair<int, std::string>(0x21, "News/weather report"));
+ categoryMap.insert(std::pair<int, std::string>(0x22, "News magazine"));
+ categoryMap.insert(std::pair<int, std::string>(0x23, "Documentary"));
+ categoryMap.insert(std::pair<int, std::string>(0x24, "Intelligent Programmes"));
+ categoryMap.insert(std::pair<int, std::string>(0x30, "Entertainment"));
+ categoryMap.insert(std::pair<int, std::string>(0x31, "Game Show"));
+ categoryMap.insert(std::pair<int, std::string>(0x32, "Variety Show"));
+ categoryMap.insert(std::pair<int, std::string>(0x33, "Talk Show"));
+ categoryMap.insert(std::pair<int, std::string>(0x40, "Sports"));
+ categoryMap.insert(std::pair<int, std::string>(0x41, "Special Events (World Cup, World Series, etc)"));
+ categoryMap.insert(std::pair<int, std::string>(0x42, "Sports Magazines"));
+ categoryMap.insert(std::pair<int, std::string>(0x43, "Football (Soccer)"));
+ categoryMap.insert(std::pair<int, std::string>(0x44, "Tennis/Squash"));
+ categoryMap.insert(std::pair<int, std::string>(0x45, "Misc. Team Sports"));
+ categoryMap.insert(std::pair<int, std::string>(0x46, "Athletics"));
+ categoryMap.insert(std::pair<int, std::string>(0x47, "Motor Sport"));
+ categoryMap.insert(std::pair<int, std::string>(0x48, "Water Sport"));
+ categoryMap.insert(std::pair<int, std::string>(0x49, "Winter Sports"));
+ categoryMap.insert(std::pair<int, std::string>(0x4A, "Equestrian"));
+ categoryMap.insert(std::pair<int, std::string>(0x4B, "Martial Sports"));
+ categoryMap.insert(std::pair<int, std::string>(0x50, "Kids"));
+ categoryMap.insert(std::pair<int, std::string>(0x51, "Pre-School Children's Programmes"));
+ categoryMap.insert(std::pair<int, std::string>(0x52, "Entertainment Programmes for 6 to 14"));
+ categoryMap.insert(std::pair<int, std::string>(0x53, "Entertainment Programmes for 10 to 16"));
+ categoryMap.insert(std::pair<int, std::string>(0x54, "Informational/Educational"));
+ categoryMap.insert(std::pair<int, std::string>(0x55, "Cartoons/Puppets"));
+ categoryMap.insert(std::pair<int, std::string>(0x60, "Music/Ballet/Dance"));
+ categoryMap.insert(std::pair<int, std::string>(0x61, "Rock/Pop"));
+ categoryMap.insert(std::pair<int, std::string>(0x62, "Classical Music"));
+ categoryMap.insert(std::pair<int, std::string>(0x63, "Folk Music"));
+ categoryMap.insert(std::pair<int, std::string>(0x64, "Jazz"));
+ categoryMap.insert(std::pair<int, std::string>(0x65, "Musical/Opera"));
+ categoryMap.insert(std::pair<int, std::string>(0x66, "Ballet"));
+ categoryMap.insert(std::pair<int, std::string>(0x70, "Arts/Culture"));
+ categoryMap.insert(std::pair<int, std::string>(0x71, "Performing Arts"));
+ categoryMap.insert(std::pair<int, std::string>(0x72, "Fine Arts"));
+ categoryMap.insert(std::pair<int, std::string>(0x73, "Religion"));
+ categoryMap.insert(std::pair<int, std::string>(0x74, "Popular Culture/Traditional Arts"));
+ categoryMap.insert(std::pair<int, std::string>(0x75, "Literature"));
+ categoryMap.insert(std::pair<int, std::string>(0x76, "Film/Cinema"));
+ categoryMap.insert(std::pair<int, std::string>(0x77, "Experimental Film/Video"));
+ categoryMap.insert(std::pair<int, std::string>(0x78, "Broadcasting/Press"));
+ categoryMap.insert(std::pair<int, std::string>(0x79, "New Media"));
+ categoryMap.insert(std::pair<int, std::string>(0x7A, "Arts/Culture Magazines"));
+ categoryMap.insert(std::pair<int, std::string>(0x7B, "Fashion"));
+ categoryMap.insert(std::pair<int, std::string>(0x80, "Social/Policical/Economics"));
+ categoryMap.insert(std::pair<int, std::string>(0x81, "Magazines/Reports/Documentary"));
+ categoryMap.insert(std::pair<int, std::string>(0x82, "Economics/Social Advisory"));
+ categoryMap.insert(std::pair<int, std::string>(0x83, "Remarkable People"));
+ categoryMap.insert(std::pair<int, std::string>(0x90, "Education/Science/Factual"));
+ categoryMap.insert(std::pair<int, std::string>(0x91, "Nature/animals/Environment"));
+ categoryMap.insert(std::pair<int, std::string>(0x92, "Technology/Natural Sciences"));
+ categoryMap.insert(std::pair<int, std::string>(0x93, "Medicine/Physiology/Psychology"));
+ categoryMap.insert(std::pair<int, std::string>(0x94, "Foreign Countries/Expeditions"));
+ categoryMap.insert(std::pair<int, std::string>(0x95, "Social/Spiritual Sciences"));
+ categoryMap.insert(std::pair<int, std::string>(0x96, "Further Education"));
+ categoryMap.insert(std::pair<int, std::string>(0x97, "Languages"));
+ categoryMap.insert(std::pair<int, std::string>(0xA0, "Leisure/Hobbies"));
+ categoryMap.insert(std::pair<int, std::string>(0xA1, "Tourism/Travel"));
+ categoryMap.insert(std::pair<int, std::string>(0xA2, "Handicraft"));
+ categoryMap.insert(std::pair<int, std::string>(0xA3, "Motoring"));
+ categoryMap.insert(std::pair<int, std::string>(0xA4, "Fitness & Health"));
+ categoryMap.insert(std::pair<int, std::string>(0xA5, "Cooking"));
+ categoryMap.insert(std::pair<int, std::string>(0xA6, "Advertizement/Shopping"));
+ categoryMap.insert(std::pair<int, std::string>(0xA7, "Gardening"));
+ categoryMap.insert(std::pair<int, std::string>(0xB0, "Original Language"));
+ categoryMap.insert(std::pair<int, std::string>(0xB1, "Black & White"));
+ categoryMap.insert(std::pair<int, std::string>(0xB2, "\"Unpublished\" Programmes"));
+ categoryMap.insert(std::pair<int, std::string>(0xB3, "Live Broadcast"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Community"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Fundraiser"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Bus./financial"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Variety"));
+ categoryMap.insert(std::pair<int, std::string>(0xC6, "Romance-comedy"));
+ categoryMap.insert(std::pair<int, std::string>(0x40, "Sports event"));
+ categoryMap.insert(std::pair<int, std::string>(0x40, "Sports talk"));
+ categoryMap.insert(std::pair<int, std::string>(0x92, "Computers"));
+ categoryMap.insert(std::pair<int, std::string>(0xA2, "How-to"));
+ categoryMap.insert(std::pair<int, std::string>(0x73, "Religious"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Parenting"));
+ categoryMap.insert(std::pair<int, std::string>(0x70, "Art"));
+ categoryMap.insert(std::pair<int, std::string>(0x64, "Musical comedy"));
+ categoryMap.insert(std::pair<int, std::string>(0x91, "Environment"));
+ categoryMap.insert(std::pair<int, std::string>(0x80, "Politics"));
+ categoryMap.insert(std::pair<int, std::string>(0x55, "Animated"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Gaming"));
+ categoryMap.insert(std::pair<int, std::string>(0x24, "Interview"));
+ categoryMap.insert(std::pair<int, std::string>(0xC7, "Historical drama"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Biography"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Home improvement"));
+ categoryMap.insert(std::pair<int, std::string>(0xA0, "Hunting"));
+ categoryMap.insert(std::pair<int, std::string>(0xA0, "Outdoors"));
+ categoryMap.insert(std::pair<int, std::string>(0x47, "Auto"));
+ categoryMap.insert(std::pair<int, std::string>(0x47, "Auto racing"));
+ categoryMap.insert(std::pair<int, std::string>(0xC4, "Horror"));
+ categoryMap.insert(std::pair<int, std::string>(0x93, "Medical"));
+ categoryMap.insert(std::pair<int, std::string>(0xC6, "Romance"));
+ categoryMap.insert(std::pair<int, std::string>(0x97, "Spanish"));
+ categoryMap.insert(std::pair<int, std::string>(0xC8, "Adults only"));
+ categoryMap.insert(std::pair<int, std::string>(0x64, "Musical"));
+ categoryMap.insert(std::pair<int, std::string>(0xA0, "Self improvement"));
+ categoryMap.insert(std::pair<int, std::string>(0x40, "Pro wrestling"));
+ categoryMap.insert(std::pair<int, std::string>(0x40, "Wrestling"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Fishing"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Agriculture"));
+ categoryMap.insert(std::pair<int, std::string>(0x70, "Arts/crafts"));
+ categoryMap.insert(std::pair<int, std::string>(0x92, "Technology"));
+ categoryMap.insert(std::pair<int, std::string>(0xC0, "Docudrama"));
+ categoryMap.insert(std::pair<int, std::string>(0xC3, "Science fiction"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Paranormal"));
+ categoryMap.insert(std::pair<int, std::string>(0xC4, "Comedy"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Science"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Travel"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Adventure"));
+ categoryMap.insert(std::pair<int, std::string>(0xC1, "Suspense"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "History"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Collectibles"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Crime"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "French"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "House/garden"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Action"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Fantasy"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Mystery"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Health"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Comedy-drama"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Special"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Holiday"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Weather"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Western"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Children"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Nature"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Animals"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Public affairs"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Educational"));
+ categoryMap.insert(std::pair<int, std::string>(0xA6, "Shopping"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Consumer"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Soap"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Newsmagazine"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Exercise"));
+ categoryMap.insert(std::pair<int, std::string>(0x60, "Music"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Game show"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Sitcom"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Talk"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Crime drama"));
+ categoryMap.insert(std::pair<int, std::string>(0x40, "Sports non-event"));
+ categoryMap.insert(std::pair<int, std::string>(0x00, "Reality"));
+
+ return categoryMap;
+}
View
42 addons/pvr.mythtv.cmyth/src/categories.h
@@ -0,0 +1,42 @@
+#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 <string>
+#include <map>
+
+typedef std::multimap<int, std::string> CategoryByIdMap;
+typedef std::multimap<std::string, int> CategoryByNameMap;
+
+class Categories
+{
+public:
+ Categories();
+
+ std::string Category(int category) const;
+ int Category(const std::string &category) const;
+
+private:
+ CategoryByIdMap DefaultEITCategories() const;
+
+ CategoryByIdMap m_categoriesById;
+ CategoryByNameMap m_categoriesByName;
+};
View
797 addons/pvr.mythtv.cmyth/src/client.cpp
@@ -0,0 +1,797 @@
+/*
+ * Copyright (C) 2005-2012 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 "client.h"
+#include "pvrclient-mythtv.h"
+
+#include <xbmc_pvr_dll.h>
+
+using namespace std;
+using namespace ADDON;
+
+#define SEEK_POSSIBLE 0x10 // Flag used to check if protocol allows seeks
+
+/* User adjustable settings are saved here.
+ * Default values are defined inside client.h
+ * and exported to the other source files.
+ */
+CStdString g_szHostname = DEFAULT_HOST; ///< The Host name or IP of the mythtv server
+int g_iMythPort = DEFAULT_PORT; ///< The mythtv Port (default is 6543)
+CStdString g_szMythDBuser = DEFAULT_DB_USER; ///< The mythtv sql username (default is mythtv)
+CStdString g_szMythDBpassword = DEFAULT_DB_PASSWORD; ///< The mythtv sql password (default is mythtv)
+CStdString g_szMythDBname = DEFAULT_DB_NAME; ///< The mythtv sql database name (default is mythconverg)
+bool g_bExtraDebug = DEFAULT_EXTRA_DEBUG; ///< Output extensive debug information to the log
+bool g_bLiveTV = DEFAULT_LIVETV; ///< LiveTV support (or recordings only)
+bool g_bLiveTVPriority = DEFAULT_LIVETV_PRIORITY; ///< MythTV Backend setting to allow live TV to move scheduled shows
+
+///* Client member variables */
+bool m_recordingFirstRead;
+char m_noSignalStreamData[6 + 0xffff];
+long m_noSignalStreamSize = 0;
+long m_noSignalStreamReadPos = 0;
+bool m_bPlayingNoSignal = false;
+int m_iCurrentChannel = 1;
+ADDON_STATUS m_CurStatus = ADDON_STATUS_UNKNOWN;
+bool g_bCreated = false;
+int g_iClientID = -1;
+CStdString g_szUserPath = "";
+CStdString g_szClientPath = "";
+
+PVRClientMythTV *g_client = NULL;
+
+CHelper_libXBMC_addon *XBMC = NULL;
+CHelper_libXBMC_pvr *PVR = NULL;
+CHelper_libXBMC_gui *GUI = NULL;
+
+extern "C" {
+
+/***********************************************************
+ * Standard AddOn related public library functions
+ ***********************************************************/
+
+ADDON_STATUS ADDON_Create(void *hdl, void *props)
+{
+ if (!hdl)
+ return ADDON_STATUS_PERMANENT_FAILURE;
+
+ // Register handles
+ XBMC = new CHelper_libXBMC_addon;
+
+ if (!XBMC->RegisterMe(hdl))
+ return ADDON_STATUS_PERMANENT_FAILURE;
+
+ XBMC->Log(LOG_DEBUG, "Creating MythTV cmyth PVR-Client");
+
+ XBMC->Log(LOG_DEBUG, "Register handle @ libXBMC_addon...done");
+
+ XBMC->Log(LOG_DEBUG, "Checking props...");
+ if (!props)
+ {
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
+ XBMC->Log(LOG_DEBUG, "Checking props...done");
+ PVR_PROPERTIES* pvrprops = (PVR_PROPERTIES*)props;
+
+ XBMC->Log(LOG_DEBUG, "Register handle @ libXBMC_pvr...");
+ PVR = new CHelper_libXBMC_pvr;
+ if (!PVR->RegisterMe(hdl))
+ {
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
+ XBMC->Log(LOG_DEBUG, "Register handle @ libXBMC_addon...done");
+
+ XBMC->Log(LOG_DEBUG, "Register handle @ libXBMC_gui...");
+ GUI = new CHelper_libXBMC_gui;
+ if (!GUI->RegisterMe(hdl))
+ {
+ SAFE_DELETE(PVR);
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
+ XBMC->Log(LOG_DEBUG, "Register handle @ libXBMC_gui...done");
+
+ m_CurStatus = ADDON_STATUS_UNKNOWN;
+ g_szUserPath = pvrprops->strUserPath;
+ g_szClientPath = pvrprops->strClientPath;
+
+ // Read settings
+ char *buffer;
+ buffer = (char*)malloc(1024);
+ buffer[0] = 0; /* Set the end of string */
+
+ /* Read setting "host" from settings.xml */
+ if (XBMC->GetSetting("host", buffer))
+ g_szHostname = buffer;
+ else
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'host' setting, falling back to '%s' as default", DEFAULT_HOST);
+ g_szHostname = DEFAULT_HOST;
+ }
+ buffer[0] = 0;
+
+ /* Read setting "port" from settings.xml */
+ if (!XBMC->GetSetting("port", &g_iMythPort))
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'port' setting, falling back to '%i' as default", DEFAULT_PORT);
+ g_iMythPort = DEFAULT_PORT;
+ }
+
+ /* Read setting "extradebug" from settings.xml */
+ if (!XBMC->GetSetting("extradebug", &g_bExtraDebug))
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'extradebug' setting, falling back to '%b' as default", DEFAULT_EXTRA_DEBUG);
+ g_bExtraDebug = DEFAULT_EXTRA_DEBUG;
+ }
+
+ /* Read setting "db_username" from settings.xml */
+ if (XBMC->GetSetting("db_user", buffer))
+ g_szMythDBuser = buffer;
+ else
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'db_user' setting, falling back to '%s' as default", DEFAULT_DB_USER);
+ g_szMythDBuser = DEFAULT_DB_USER;
+ }
+ buffer[0] = 0;
+
+ /* Read setting "db_password" from settings.xml */
+ if (XBMC->GetSetting("db_password", buffer))
+ g_szMythDBpassword = buffer;
+ else
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'db_password' setting, falling back to '%s' as default", DEFAULT_DB_PASSWORD);
+ g_szMythDBpassword = DEFAULT_DB_PASSWORD;
+ }
+ buffer[0] = 0;
+
+ /* Read setting "db_name" from settings.xml */
+ if (XBMC->GetSetting("db_name", buffer))
+ g_szMythDBname = buffer;
+ else
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'db_name' setting, falling back to '%s' as default", DEFAULT_DB_NAME);
+ g_szMythDBname = DEFAULT_DB_NAME;
+ }
+ buffer[0] = 0;
+
+ /* Read setting "LiveTV" from settings.xml */
+ if (!XBMC->GetSetting("livetv", &g_bLiveTV))
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'livetv' setting, falling back to '%b' as default", DEFAULT_LIVETV);
+ g_bLiveTV = DEFAULT_LIVETV;
+ }
+
+ free (buffer);
+
+ // Create our addon
+ XBMC->Log(LOG_DEBUG,"Creating PVRClientMythTV...");
+ g_client = new PVRClientMythTV();
+ if (!g_client->Connect())
+ {
+ XBMC->Log(LOG_ERROR, "Failed to connect to backend");
+ SAFE_DELETE(g_client);
+ SAFE_DELETE(GUI);
+ SAFE_DELETE(PVR);
+ SAFE_DELETE(XBMC);
+ m_CurStatus = ADDON_STATUS_NEED_SETTINGS;
+ return m_CurStatus;
+ }
+ XBMC->Log(LOG_DEBUG,"Creating PVRClientMythTV...done");
+
+ /* Read setting "LiveTV Priority" from backend database */
+ bool savedLiveTVPriority;
+ if (!XBMC->GetSetting("livetv_priority", &savedLiveTVPriority))
+ savedLiveTVPriority = DEFAULT_LIVETV_PRIORITY;
+ g_bLiveTVPriority = g_client->GetLiveTVPriority();
+ if (g_bLiveTVPriority != savedLiveTVPriority)
+ {
+ g_client->SetLiveTVPriority(savedLiveTVPriority);
+ }
+
+ XBMC->Log(LOG_DEBUG, "MythTV cmyth PVR-Client successfully created");
+ m_CurStatus = ADDON_STATUS_OK;
+ g_bCreated = true;
+ return m_CurStatus;
+}
+
+void ADDON_Destroy()
+{
+ if (g_bCreated)
+ {
+ delete g_client;
+ g_client = NULL;
+ g_bCreated = false;
+ }
+
+ if (PVR)
+ {
+ delete(PVR);
+ PVR = NULL;
+ }
+
+ if (XBMC)
+ {
+ delete(XBMC);
+ XBMC = NULL;
+ }
+
+ if (GUI)
+ {
+ delete(GUI);
+ GUI = NULL;
+ }
+
+ m_CurStatus = ADDON_STATUS_UNKNOWN;
+}
+
+ADDON_STATUS ADDON_GetStatus()
+{
+ return m_CurStatus;
+}
+
+bool ADDON_HasSettings()
+{
+ return true;
+}
+
+unsigned int ADDON_GetSettings(ADDON_StructSetting ***sSet)
+{
+ (void)sSet;
+ return 0;
+}
+
+ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue)
+{
+ string str = settingName;
+ if (!g_bCreated)
+ return ADDON_STATUS_OK;
+
+ if (str == "host")
+ {
+ string tmp_sHostname;
+ XBMC->Log(LOG_INFO, "Changed Setting 'host' from %s to %s", g_szHostname.c_str(), (const char*)settingValue);
+ tmp_sHostname = g_szHostname;
+ g_szHostname = (const char*)settingValue;
+ if (tmp_sHostname != g_szHostname)
+ return ADDON_STATUS_NEED_RESTART;
+ }
+ else if (str == "port")
+ {
+ XBMC->Log(LOG_INFO, "Changed Setting 'port' from %u to %u", g_iMythPort, *(int*)settingValue);
+ if (g_iMythPort != *(int*)settingValue)
+ {
+ g_iMythPort = *(int*)settingValue;
+ return ADDON_STATUS_NEED_RESTART;
+ }
+ }
+ else if (str == "db_user")
+ {
+ string tmp_sMythDBuser;
+ XBMC->Log(LOG_INFO, "Changed Setting 'db_user' from %s to %s", g_szMythDBuser.c_str(), (const char*)settingValue);
+ tmp_sMythDBuser = g_szMythDBuser;
+ g_szMythDBuser = (const char*)settingValue;
+ if (tmp_sMythDBuser != g_szMythDBuser)
+ return ADDON_STATUS_NEED_RESTART;
+ }
+ else if (str == "db_password")
+ {
+ string tmp_sMythDBpassword;
+ XBMC->Log(LOG_INFO, "Changed Setting 'db_password' from %s to %s", g_szMythDBpassword.c_str(), (const char*)settingValue);
+ tmp_sMythDBpassword = g_szMythDBpassword;
+ g_szMythDBpassword = (const char*)settingValue;
+ if (tmp_sMythDBpassword != g_szMythDBpassword)
+ return ADDON_STATUS_NEED_RESTART;
+ }
+ else if (str == "db_name")
+ {
+ string tmp_sMythDBname;
+ XBMC->Log(LOG_INFO, "Changed Setting 'db_name' from %s to %s", g_szMythDBname.c_str(), (const char*)settingValue);
+ tmp_sMythDBname = g_szMythDBname;
+ g_szMythDBname = (const char*)settingValue;
+ if (tmp_sMythDBname != g_szMythDBname)
+ return ADDON_STATUS_NEED_RESTART;
+ }
+ else if (str == "extradebug")
+ {
+ XBMC->Log(LOG_INFO, "Changed Setting 'extra debug' from %u to %u", g_bExtraDebug, *(bool*)settingValue);
+ if (g_bExtraDebug != *(bool*)settingValue)
+ {
+ g_bExtraDebug = *(bool*)settingValue;
+ return ADDON_STATUS_OK;
+ }
+ }
+ else if (str == "livetv")
+ {
+ XBMC->Log(LOG_INFO, "Changed Setting 'livetv' from %u to %u", g_bLiveTV, *(bool*)settingValue);
+ if (g_bLiveTV != *(bool*)settingValue)
+ {
+ g_bLiveTV = *(bool*)settingValue;
+ return ADDON_STATUS_OK;
+ }
+ }
+ else if (str == "livetv_priority")
+ {
+ XBMC->Log(LOG_INFO, "Changed Setting 'extra debug' from %u to %u", g_bLiveTVPriority, *(bool*)settingValue);
+ if (g_bLiveTVPriority != *(bool*) settingValue && m_CurStatus != ADDON_STATUS_LOST_CONNECTION)
+ {
+ g_bLiveTVPriority = *(bool*)settingValue;
+ g_client->SetLiveTVPriority(g_bLiveTVPriority);
+ return ADDON_STATUS_OK;
+ }
+ }
+ return ADDON_STATUS_OK;
+}
+
+void ADDON_Stop()
+{
+ //ADDON_Destroy();
+}
+
+void ADDON_FreeSettings()
+{
+ return;
+}
+
+
+/***********************************************************
+ * PVR Client AddOn specific public library functions
+ ***********************************************************/
+
+const char* GetPVRAPIVersion(void)
+{
+ static const char *strApiVersion = XBMC_PVR_API_VERSION;
+ return strApiVersion;
+}
+
+const char* GetMininumPVRAPIVersion(void)
+{
+ static const char *strMinApiVersion = XBMC_PVR_MIN_API_VERSION;
+ return strMinApiVersion;
+}
+
+PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES *pCapabilities)
+{
+ if (g_client != NULL)
+ {
+ pCapabilities->bSupportsTV = g_bLiveTV;
+ pCapabilities->bSupportsRadio = g_bLiveTV;
+ //pCapabilities->bSupportsChannelSettings = false;
+ pCapabilities->bSupportsChannelGroups = true;
+ pCapabilities->bSupportsChannelScan = false;
+ //pCapabilities->bSupportsTimeshift = g_bLiveTV;
+ pCapabilities->bSupportsEPG = true;
+ pCapabilities->bSupportsTimers = true;
+
+ pCapabilities->bHandlesInputStream = true;
+ pCapabilities->bHandlesDemuxing = false;
+
+ pCapabilities->bSupportsRecordings = true;
+ pCapabilities->bSupportsRecordingPlayCount = true;
+ pCapabilities->bSupportsLastPlayedPosition = true;
+ return PVR_ERROR_NO_ERROR;
+ }
+ else
+ {
+ return PVR_ERROR_FAILED;
+ }
+}
+
+PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES* props)
+{
+ (void)props;
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
+const char *GetBackendName()
+{
+ return g_client->GetBackendName();
+}
+
+const char *GetBackendVersion()
+{
+ return g_client->GetBackendVersion();
+}
+
+const char *GetConnectionString()
+{
+ return g_client->GetConnectionString();
+}
+
+PVR_ERROR GetDriveSpace(long long *iTotal, long long *iUsed)
+{
+ return g_client->GetDriveSpace(iTotal,iUsed) ? PVR_ERROR_NO_ERROR : PVR_ERROR_UNKNOWN;
+}
+
+PVR_ERROR DialogChannelScan()
+{
+ return PVR_ERROR_FAILED;
+}
+
+PVR_ERROR CallMenuHook(const PVR_MENUHOOK &menuhook)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->CallMenuHook(menuhook);
+}
+
+/*******************************************/
+/** PVR EPG Functions **/
+
+PVR_ERROR GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL &channel, time_t iStart, time_t iEnd)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetEPGForChannel(handle, channel, iStart, iEnd);
+}
+
+/*******************************************/
+/** PVR Channel Functions **/
+
+unsigned int GetChannelSwitchDelay(void)
+{
+ return 0;
+}
+
+int GetChannelsAmount()
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetNumChannels();
+}
+
+PVR_ERROR GetChannels(ADDON_HANDLE handle, bool bRadio)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetChannels(handle, bRadio);
+}
+
+PVR_ERROR DeleteChannel(const PVR_CHANNEL &channel)
+{
+ (void)channel;
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
+PVR_ERROR RenameChannel(const PVR_CHANNEL &channel)
+{
+ (void)channel;
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
+PVR_ERROR MoveChannel(const PVR_CHANNEL &channel)
+{
+ (void)channel;
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
+PVR_ERROR DialogChannelSettings(const PVR_CHANNEL &channel)
+{
+ (void)channel;
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
+PVR_ERROR DialogAddChannel(const PVR_CHANNEL &channel)
+{
+ (void)channel;
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
+int GetChannelGroupsAmount(void)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->GetChannelGroupsAmount();
+}
+
+PVR_ERROR GetChannelGroups(ADDON_HANDLE handle, bool bRadio)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetChannelGroups(handle, bRadio);
+}
+
+PVR_ERROR GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP &group){
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetChannelGroupMembers(handle, group);
+}
+
+
+/*******************************************/
+/** PVR Recording Functions **/
+
+int GetRecordingsAmount(void)
+{
+ if (g_client == NULL)
+ return 0;
+
+ return g_client->GetRecordingsAmount();
+}
+
+PVR_ERROR GetRecordings(ADDON_HANDLE handle)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetRecordings(handle);
+}
+
+PVR_ERROR DeleteRecording(const PVR_RECORDING &recording)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->DeleteRecording(recording);
+}
+
+PVR_ERROR RenameRecording(const PVR_RECORDING &recording)
+{
+ (void)recording;
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
+PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->SetRecordingPlayCount(recording, count);
+}
+
+PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->SetRecordingLastPlayedPosition(recording, lastplayedposition);
+}
+
+int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetRecordingLastPlayedPosition(recording);
+}
+
+
+/*******************************************/
+/** PVR Timer Functions **/
+
+int GetTimersAmount(void)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetTimersAmount();
+}
+
+PVR_ERROR GetTimers(ADDON_HANDLE handle)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetTimers(handle);
+}
+
+PVR_ERROR AddTimer(const PVR_TIMER &timer)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->AddTimer(timer);
+}
+
+PVR_ERROR DeleteTimer(const PVR_TIMER &timer, bool bForceDelete)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->DeleteTimer(timer,bForceDelete);
+}
+
+PVR_ERROR UpdateTimer(const PVR_TIMER &timer)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->UpdateTimer(timer);
+}
+
+
+/*******************************************/
+/** PVR Live Stream Functions **/
+
+bool OpenLiveStream(const PVR_CHANNEL &channel)
+{
+ if (g_client == NULL)
+ return false;
+
+ return g_client->OpenLiveStream(channel);
+}
+
+void CloseLiveStream(void)
+{
+ if (g_client == NULL)
+ return;
+
+ g_client->CloseLiveStream();
+}
+
+int ReadLiveStream(unsigned char *pBuffer, unsigned int iBufferSize)
+{
+ if (g_client == NULL)
+ return -1;
+
+ int dataread = g_client->ReadLiveStream(pBuffer, iBufferSize);
+ if (dataread < 0)
+ {
+ XBMC->Log(LOG_ERROR,"%s: Failed to read liveStream. Errorcode: %i!", __FUNCTION__, dataread);
+ }
+ return dataread;
+}
+
+int GetCurrentClientChannel()
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->GetCurrentClientChannel();
+}
+
+bool SwitchChannel(const PVR_CHANNEL &channelinfo)
+{
+ if (g_client == NULL)
+ return false;
+
+ if (g_client->SwitchChannel(channelinfo))
+ return true;
+ else
+ XBMC->QueueNotification(QUEUE_WARNING, "Failed to change channel. No free tuners?");
+
+ return false;
+}
+
+PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS &signalStatus)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->SignalStatus(signalStatus);
+}
+
+void PauseStream(bool bPaused)
+{
+ (void)bPaused;
+}
+
+bool CanPauseStream(void)
+{
+ return true;
+}
+
+bool CanSeekStream(void)
+{
+ return true;
+}
+
+long long SeekLiveStream(long long iPosition, int iWhence)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->SeekLiveStream(iPosition,iWhence);
+}
+
+long long PositionLiveStream(void)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->SeekLiveStream(0,SEEK_CUR);
+}
+
+long long LengthLiveStream(void)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->LengthLiveStream();
+}
+
+
+/*******************************************/
+/** PVR Recording Stream Functions **/
+
+bool OpenRecordedStream(const PVR_RECORDING &recinfo)
+{
+ if (g_client == NULL)
+ return false;
+
+ return g_client->OpenRecordedStream(recinfo);
+}
+
+void CloseRecordedStream(void)
+{
+ if (g_client == NULL)
+ return;
+
+ g_client->CloseRecordedStream();
+}
+
+int ReadRecordedStream(unsigned char *pBuffer, unsigned int iBufferSize)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->ReadRecordedStream(pBuffer, iBufferSize);
+}
+
+long long SeekRecordedStream(long long iPosition, int iWhence)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->SeekRecordedStream(iPosition, iWhence);
+}
+
+long long PositionRecordedStream(void)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->SeekRecordedStream(0, SEEK_CUR);
+}
+
+long long LengthRecordedStream(void)
+{
+ if (g_client == NULL)
+ return -1;
+
+ return g_client->LengthRecordedStream();
+}
+
+
+/*******************************************/
+/** Unused API Functions **/
+
+DemuxPacket* DemuxRead() { return NULL; }
+void DemuxAbort() {}
+void DemuxReset() {}
+void DemuxFlush() {}
+const char * GetLiveStreamURL(const PVR_CHANNEL &) { return ""; }
+
+} //end extern "C"
View
77 addons/pvr.mythtv.cmyth/src/client.h
@@ -0,0 +1,77 @@
+#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
+ *
+ */
+
+#ifndef CLIENT_H
+#define CLIENT_H
+
+#include <platform/util/StdString.h>
+#include <libXBMC_addon.h>
+#include <libXBMC_pvr.h>
+#include <libXBMC_gui.h>
+
+extern "C" {
+#include <cmyth/cmyth.h>
+};
+
+#ifdef __WINDOWS__
+#define strdup _strdup // # strdup is POSIX, _strdup should be used instead
+#endif
+
+#define DEFAULT_HOST "127.0.0.1"
+#define DEFAULT_EXTRA_DEBUG false
+#define DEFAULT_LIVETV_PRIORITY false
+#define DEFAULT_LIVETV true
+#define DEFAULT_PORT 6543
+#define DEFAULT_DB_USER "mythtv"
+#define DEFAULT_DB_PASSWORD "mythtv"
+#define DEFAULT_DB_NAME "mythconverg"
+
+/*!
+ * @brief PVR macros for string exchange
+ */
+#define PVR_STRCPY(dest, source) do { strncpy(dest, source, sizeof(dest)-1); dest[sizeof(dest)-1] = '\0'; } while(0)
+#define PVR_STRCLR(dest) memset(dest, 0, sizeof(dest))
+
+/** Delete macros that make the pointer NULL again */
+#define SAFE_DELETE(p) do { delete (p); (p)=NULL; } while (0)
+#define SAFE_DELETE_ARRAY(p) do { delete[] (p); (p)=NULL; } while (0)
+
+extern bool g_bCreated; ///< Shows that the Create function was successfully called
+extern int g_iClientID; ///< The PVR client ID used by XBMC for this driver
+extern CStdString g_szUserPath; ///< The Path to the user directory inside user profile
+extern CStdString g_szClientPath; ///< The Path where this driver is located
+
+/* Client Settings */
+extern CStdString g_szHostname; ///< The Host name or IP of the mythtv server
+extern int g_iMythPort; ///< The mythtv Port (default is 6543)
+extern CStdString g_szMythDBuser; ///< The mythtv sql username (default is mythtv)
+extern CStdString g_szMythDBpassword; ///< The mythtv sql password (default is mythtv)
+extern CStdString g_szMythDBname; ///< The mythtv sql database name (default is mythconverg)
+extern bool g_bExtraDebug; ///< Debug logging
+extern bool g_bLiveTV; ///< LiveTV support (or recordings only)
+extern bool g_bLiveTVPriority; ///< MythTV Backend setting to allow live TV to move scheduled shows
+
+extern ADDON::CHelper_libXBMC_addon *XBMC;
+extern CHelper_libXBMC_pvr *PVR;
+extern CHelper_libXBMC_gui *GUI;
+
+#endif /* CLIENT_H */
View
12 addons/pvr.mythtv.cmyth/src/cppmyth.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "cppmyth/MythChannel.h"
+#include "cppmyth/MythConnection.h"
+#include "cppmyth/MythDatabase.h"
+#include "cppmyth/MythEventHandler.h"
+#include "cppmyth/MythFile.h"
+#include "cppmyth/MythProgramInfo.h"
+#include "cppmyth/MythRecorder.h"
+#include "cppmyth/MythSignal.h"
+#include "cppmyth/MythTimer.h"
+#include "cppmyth/MythTimestamp.h"
View
102 addons/pvr.mythtv.cmyth/src/cppmyth/MythChannel.cpp
@@ -0,0 +1,102 @@
+/*
+ * 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, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MythChannel.h"
+#include "MythPointer.h"
+
+MythChannel::MythChannel()
+ : m_channel_t()
+ , m_radio(false)
+{
+}
+
+MythChannel::MythChannel(cmyth_channel_t cmyth_channel, bool isRadio)
+ : m_channel_t(new MythPointer<cmyth_channel_t>())
+ , m_radio(isRadio)
+{
+ *m_channel_t = cmyth_channel;
+}
+
+bool MythChannel::IsNull() const
+{
+ if (m_channel_t == NULL)
+ return true;
+ return *m_channel_t == NULL;
+}
+
+int MythChannel::ID()
+{
+ return cmyth_channel_chanid(*m_channel_t);
+}
+
+CStdString MythChannel::Name()
+{
+ char* cChan = cmyth_channel_name(*m_channel_t);
+ CStdString retval(cChan);
+ ref_release(cChan);
+ return retval;
+}
+
+int MythChannel::NumberInt()
+{
+ return cmyth_channel_channum(*m_channel_t);
+}
+
+CStdString MythChannel::Number()
+{
+ // Must not be deleted
+ return CStdString(cmyth_channel_channumstr(*m_channel_t));
+}
+
+CStdString MythChannel::Callsign()
+{
+ char* cChan = cmyth_channel_callsign(*m_channel_t);
+ CStdString retval(cChan);
+ ref_release(cChan);
+ return retval;
+}
+
+CStdString MythChannel::Icon()
+{
+ char* cIcon = cmyth_channel_icon(*m_channel_t);
+ CStdString retval(cIcon);
+ ref_release(cIcon);
+ return retval;
+}
+
+bool MythChannel::Visible()
+{
+ return cmyth_channel_visible(*m_channel_t) > 0;
+}
+
+bool MythChannel::IsRadio() const
+{
+ return m_radio;
+}
+
+int MythChannel::SourceID()
+{
+ return cmyth_channel_sourceid(*m_channel_t);
+}
+
+int MythChannel::MultiplexID()
+{
+ return cmyth_channel_multiplex(*m_channel_t);
+}
View
54 addons/pvr.mythtv.cmyth/src/cppmyth/MythChannel.h
@@ -0,0 +1,54 @@
+#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, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "platform/util/StdString.h"
+
+#include <boost/shared_ptr.hpp>
+
+extern "C" {
+#include <cmyth/cmyth.h>
+};
+
+template <class T> class MythPointer;
+
+class MythChannel
+{
+public:
+ MythChannel();
+ MythChannel(cmyth_channel_t cmyth_channel, bool isRadio);
+
+ bool IsNull() const;
+
+ int ID();
+ CStdString Name();
+ int NumberInt();
+ CStdString Number();
+ CStdString Callsign();
+ CStdString Icon();
+ bool Visible();
+ bool IsRadio() const;
+ int SourceID();
+ int MultiplexID();
+
+private:
+ boost::shared_ptr<MythPointer<cmyth_channel_t> > m_channel_t;
+ bool m_radio;
+};
View
373 addons/pvr.mythtv.cmyth/src/cppmyth/MythConnection.cpp
@@ -0,0 +1,373 @@
+/*
+ * 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, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MythConnection.h"
+#include "MythRecorder.h"
+#include "MythFile.h"
+#include "MythStorageGroupFile.h"
+#include "MythProgramInfo.h"
+#include "MythEventHandler.h"
+#include "MythTimer.h"
+#include "MythPointer.h"
+#include "../client.h"
+
+using namespace ADDON;
+
+/* Call 'call', then if 'cond' condition is true see if we're still
+ * connected to the control socket and try to re-connect if not.
+ * If reconnection is ok, call 'call' again. */
+#define CMYTH_CONN_CALL(var, cond, call) Lock(); \
+ var = call; \
+ Unlock(); \
+ if (cond) \
+ { \
+ if (!IsConnected() && TryReconnect()) \
+ { \
+ Lock(); \
+ var = call; \
+ Unlock(); \
+ } \
+ } \
+
+/* Similar to CMYTH_CONN_CALL, but it will release 'var' if it was not NULL
+ * right before calling 'call' again. */
+#define CMYTH_CONN_CALL_REF(var, cond, call) Lock(); \
+ var = call; \
+ Unlock(); \
+ if (cond) \
+ { \
+ if (!IsConnected() && TryReconnect()) \
+ { \
+ Lock(); \
+ if (var != NULL) \
+ ref_release( var ); \
+ var = call; \
+ Unlock(); \
+ } \
+ } \
+
+MythConnection::MythConnection()
+ : m_conn_t(new MythPointerThreadSafe<cmyth_conn_t>())
+ , m_server("")
+ , m_port(0)
+ , m_retryCount(0)
+ , m_pEventHandler(NULL)
+{
+}
+
+MythConnection::MythConnection(const CStdString &server, unsigned short port)
+ : m_conn_t(new MythPointerThreadSafe<cmyth_conn_t>)
+ , m_server(server)
+ , m_port(port)
+ , m_retryCount(0)
+ , m_pEventHandler(NULL)
+{
+ cmyth_conn_t connection = cmyth_conn_connect_ctrl(const_cast<char*>(server.c_str()), port, 64 * 1024, 16 * 1024);
+ *m_conn_t = connection;
+}
+
+MythEventHandler *MythConnection::CreateEventHandler()
+{
+ if (m_pEventHandler)
+ {
+ delete(m_pEventHandler);
+ m_pEventHandler = NULL;
+ }
+ m_pEventHandler = new MythEventHandler(m_server, m_port);
+ return m_pEventHandler;
+}
+
+bool MythConnection::IsNull() const
+{
+ if (m_conn_t == NULL)
+ return true;
+ return *m_conn_t == NULL;
+}
+
+void MythConnection::Lock()
+{
+ if (g_bExtraDebug)
+ XBMC->Log(LOG_DEBUG, "Lock %i", m_conn_t.get());
+ m_conn_t->Lock();
+ if (g_bExtraDebug)
+ XBMC->Log(LOG_DEBUG, "Lock acquired %i", m_conn_t.get());
+}
+
+void MythConnection::Unlock()
+{
+ if (g_bExtraDebug)
+ XBMC->Log(LOG_DEBUG, "Unlock %i", m_conn_t.get());
+ m_conn_t->Unlock();
+}
+
+bool MythConnection::IsConnected()
+{
+ Lock();
+ bool connected = *m_conn_t != 0 && !cmyth_conn_hung(*m_conn_t);
+ Unlock();
+ if (g_bExtraDebug)
+ XBMC->Log(LOG_DEBUG, "%s - %i", __FUNCTION__, connected);
+ return connected;
+}
+
+bool MythConnection::TryReconnect()
+{
+ int retval = false;
+ if (m_retryCount < 10)
+ {
+ m_retryCount++;
+
+ Lock();
+ retval = cmyth_conn_reconnect_ctrl(*m_conn_t);
+ Unlock();
+
+ if (retval == 1)
+ {
+ m_retryCount = 0;
+ if (m_pEventHandler && !m_pEventHandler->TryReconnect())
+ {
+ XBMC->Log(LOG_ERROR, "%s - Unable to reconnect event handler", __FUNCTION__);
+ }
+ }
+ }
+ if (g_bExtraDebug && retval == 0)
+ XBMC->Log(LOG_DEBUG, "%s - Unable to reconnect (retry count: %d)", __FUNCTION__, m_retryCount);
+ return retval == 1;
+}
+
+CStdString MythConnection::GetBackendName() const
+{
+ return m_server;
+}
+
+CStdString MythConnection::GetHostname()
+{
+ char *hostname = NULL;
+ CMYTH_CONN_CALL_REF(hostname, hostname == NULL, cmyth_conn_get_client_hostname(*m_conn_t));
+ CStdString retval(hostname);
+ ref_release(hostname);
+ return retval;
+}
+
+CStdString MythConnection::GetBackendHostname()
+{
+ char *hostname = NULL;
+ CMYTH_CONN_CALL_REF(hostname, hostname == NULL, cmyth_conn_get_backend_hostname(*m_conn_t));
+ CStdString retval(hostname);
+ ref_release(hostname);
+ return retval;
+}
+
+int MythConnection::GetProtocolVersion()
+{
+ int retval = 0;
+ CMYTH_CONN_CALL(retval, retval < 0, cmyth_conn_get_protocol_version(*m_conn_t));
+ return retval;
+}
+
+bool MythConnection::GetDriveSpace(long long &total, long long &used)
+{
+ int retval = 0;
+ CMYTH_CONN_CALL(retval, retval != 0, cmyth_conn_get_freespace(*m_conn_t, &total, &used));
+ return retval == 0;
+}
+
+CStdString MythConnection::GetSetting(const CStdString &hostname, const CStdString &setting)
+{
+ char *value = NULL;
+ CMYTH_CONN_CALL_REF(value, value == NULL, cmyth_conn_get_setting(*m_conn_t, const_cast<char*>(hostname.c_str()), const_cast<char*>(setting.c_str())));
+ CStdString retval(value);
+ ref_release(value);
+ return retval;
+}
+
+bool MythConnection::SetSetting(const CStdString &hostname, const CStdString &setting, const CStdString &value)
+{
+ int retval = 0;
+ CMYTH_CONN_CALL(retval, retval < 0, cmyth_conn_set_setting(*m_conn_t, const_cast<char*>(hostname.c_str()), const_cast<char*>(setting.c_str()), const_cast<char*>(value.c_str())));
+ return retval >= 0;
+}
+
+MythRecorder MythConnection::GetFreeRecorder()
+{
+ cmyth_recorder_t rec = NULL;
+ CMYTH_CONN_CALL_REF(rec, rec == NULL, cmyth_conn_get_free_recorder(*m_conn_t));
+ MythRecorder retval = MythRecorder(rec, *this);
+ return retval;
+}
+
+MythRecorder MythConnection::GetRecorder(int n)
+{
+ cmyth_recorder_t rec = NULL;
+ CMYTH_CONN_CALL_REF(rec, rec == NULL, cmyth_conn_get_recorder_from_num(*m_conn_t, n));
+ MythRecorder retval = MythRecorder(rec, *this);
+ return retval;
+}
+
+bool MythConnection::DeleteRecording(MythProgramInfo &recording)
+{
+ int retval = 0;
+ CMYTH_CONN_CALL(retval, retval != 0, cmyth_proginfo_delete_recording(*m_conn_t, *recording.m_proginfo_t));
+ return retval == 0;
+}
+
+ProgramInfoMap MythConnection::GetRecordedPrograms()
+{
+ Lock();
+
+ ProgramInfoMap retval;
+ cmyth_proglist_t proglist = NULL;
+ CMYTH_CONN_CALL_REF(proglist, proglist == NULL, cmyth_proglist_get_all_recorded(*m_conn_t));
+ int len = cmyth_proglist_get_count(proglist);
+ for (int i = 0; i < len; i++)
+ {
+ cmyth_proginfo_t cmprog = cmyth_proglist_get_item(proglist, i);
+ MythProgramInfo prog = cmyth_proginfo_get_detail(*m_conn_t, cmprog);
+ if (!prog.IsNull()) {
+ retval.insert(std::pair<CStdString, MythProgramInfo>(prog.StrUID().c_str(), prog));
+ }
+ }
+ ref_release(proglist);
+
+ Unlock();
+
+ return retval;
+}
+
+ProgramInfoMap MythConnection::GetPendingPrograms()
+{
+ Lock();
+
+ ProgramInfoMap retval;
+ cmyth_proglist_t proglist = NULL;
+ CMYTH_CONN_CALL_REF(proglist, proglist == NULL, cmyth_proglist_get_all_pending(*m_conn_t));
+ int len = cmyth_proglist_get_count(proglist);
+ for (int i = 0; i < len; i++)
+ {
+ MythProgramInfo prog = cmyth_proglist_get_item(proglist, i);
+ if (!prog.IsNull()) {
+ retval.insert(std::pair<CStdString, MythProgramInfo>(prog.StrUID().c_str(), prog));
+ }
+ }
+ ref_release(proglist);
+
+ Unlock();
+
+ return retval;
+}
+
+ProgramInfoMap MythConnection::GetScheduledPrograms()
+{
+ Lock();
+
+ ProgramInfoMap retval;
+ cmyth_proglist_t proglist = NULL;
+ CMYTH_CONN_CALL_REF(proglist, proglist == NULL, cmyth_proglist_get_all_scheduled(*m_conn_t));
+ int len = cmyth_proglist_get_count(proglist);
+ for (int i = 0; i < len; i++)
+ {
+ cmyth_proginfo_t cmprog = cmyth_proglist_get_item(proglist, i);
+ MythProgramInfo prog = cmyth_proginfo_get_detail(*m_conn_t, cmprog);
+ if (!prog.IsNull()) {
+ retval.insert(std::pair<CStdString, MythProgramInfo>(prog.StrUID().c_str(), prog));
+ }
+ }
+ ref_release(proglist);
+
+ Unlock();
+
+ return retval;
+}
+
+bool MythConnection::UpdateSchedules(int id)
+{
+ CStdString cmd;
+ cmd.Format("RESCHEDULE_RECORDINGS %i", id);
+ int retval = 0;
+ CMYTH_CONN_CALL(retval, retval < 0, cmyth_schedule_recording(*m_conn_t, cmd.Buffer()));
+ return retval >= 0;
+}
+
+void MythConnection::DefaultTimer(MythTimer &timer)
+{
+ timer.SetAutoTranscode(atoi(GetSetting("NULL", "AutoTranscode").c_str()) > 0);
+ timer.SetUserJob(1, atoi(GetSetting("NULL", "AutoRunUserJob1").c_str()) > 0);
+ timer.SetUserJob(2, atoi(GetSetting("NULL", "AutoRunUserJob2").c_str()) > 0);
+ timer.SetUserJob(3, atoi(GetSetting("NULL", "AutoRunUserJob3").c_str()) > 0);
+ timer.SetUserJob(4, atoi(GetSetting("NULL", "AutoRunUserJob4").c_str()) > 0);
+ timer.SetAutoCommFlag(atoi(GetSetting("NULL", "AutoCommercialFlag").c_str()) > 0);
+ timer.SetAutoExpire(atoi(GetSetting("NULL", "AutoExpireDefault").c_str()) > 0);
+ timer.SetTranscoder(atoi(GetSetting("NULL", "DefaultTranscoder").c_str()));
+ timer.SetStartOffset(atoi(GetSetting("NULL", "DefaultStartOffset").c_str()));
+ timer.SetStartOffset(atoi(GetSetting("NULL", "DefaultEndOffset").c_str()));
+}
+
+StorageGroupFileList MythConnection::GetStorageGroupFileList(const CStdString &storageGroup)
+{
+ cmyth_storagegroup_filelist_t filelist = NULL;
+ CMYTH_CONN_CALL_REF(filelist, filelist == NULL, cmyth_storagegroup_get_filelist(*m_conn_t, const_cast<char*>(storageGroup.c_str()), const_cast<char*>(GetBackendHostname().c_str())));
+
+ Lock();
+
+ int len = cmyth_storagegroup_filelist_count(filelist);
+ StorageGroupFileList retval;
+ retval.reserve(len);
+ for (int i = 0; i < len; i++)
+ {
+ cmyth_storagegroup_file_t file = cmyth_storagegroup_filelist_get_item(filelist, i);
+ retval.push_back(MythStorageGroupFile(file));
+ }
+ ref_release(filelist);
+
+ Unlock();
+
+ return retval;
+}
+
+MythFile MythConnection::ConnectFile(MythProgramInfo &recording)
+{
+ // When file is not NULL doesn't need to mean there is no more connection,
+ // so always check after calling cmyth_conn_connect_file if still connected to control socket.
+ cmyth_file_t file = NULL;
+ CMYTH_CONN_CALL_REF(file, true, cmyth_conn_connect_file(*recording.m_proginfo_t, *m_conn_t, 64 * 1024, 16 * 1024));
+ MythFile retval = MythFile(file, *this);
+ return retval;
+}
+
+MythFile MythConnection::ConnectPath(const CStdString &filename, const CStdString &storageGroup)
+{
+ cmyth_file_t file = NULL;
+ CMYTH_CONN_CALL_REF(file, file == NULL, cmyth_conn_connect_path(const_cast<char*>(filename.c_str()), *m_conn_t, 64 * 1024, 16 * 1024, const_cast<char*>(storageGroup.c_str())));
+ return MythFile(file, *this);
+}
+
+int MythConnection::SetBookmark(MythProgramInfo &recording, long long bookmark)
+{
+ int retval;
+ CMYTH_CONN_CALL(retval, retval < 0, cmyth_set_bookmark(*m_conn_t, *recording.m_proginfo_t, bookmark));
+ return retval;
+}