Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into pvr-ppa

  • Loading branch information...
commit f44db35e46fc67709260d9f4b521907d28e79a37 2 parents 3513480 + 2d3b069
@opdenkamp authored
Showing with 6,660 additions and 6,204 deletions.
  1. +0 −8 addons/skin.confluence/720p/MyPVR.xml
  2. +5 −1 addons/skin.confluence/720p/includes.xml
  3. +3 −0  language/Dutch/strings.xml
  4. +3 −0  language/English/strings.xml
  5. +1 −1  lib/addons/library.xbmc.pvr/libXBMC_pvr.cpp
  6. +2 −2 project/VS2010Express/XBMC.vcxproj
  7. +7 −7 project/VS2010Express/XBMC.vcxproj.filters
  8. +1 −0  xbmc/Application.cpp
  9. +2 −0  xbmc/FileItem.cpp
  10. +28 −22 xbmc/FileItem.h
  11. +1 −1  xbmc/GUIInfoManager.cpp
  12. +1 −0  xbmc/GUIViewState.cpp
  13. +2 −1  xbmc/SortFileItem.cpp
  14. +2 −0  xbmc/addons/AddonCallbacksPVR.cpp
  15. +1 −0  xbmc/addons/AddonManager.cpp
  16. +3 −1 xbmc/addons/include/xbmc_pvr_types.h
  17. +31 −7 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp
  18. +17 −2 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.h
  19. +2 −2 xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
  20. +2 −2 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h
  21. +2 −2 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h
  22. +1 −0  xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp
  23. +2 −2 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h
  24. +0 −6 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamTV.cpp
  25. +0 −2  xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamTV.h
  26. +2 −0  xbmc/cores/dvdplayer/DVDPlayer.cpp
  27. +63 −11 xbmc/epg/Epg.cpp
  28. +288 −280 xbmc/epg/Epg.h
  29. +11 −10 xbmc/epg/EpgContainer.cpp
  30. +201 −201 xbmc/epg/EpgContainer.h
  31. +8 −15 xbmc/epg/EpgDatabase.cpp
  32. +133 −130 xbmc/epg/EpgDatabase.h
  33. +51 −31 xbmc/epg/EpgInfoTag.cpp
  34. +361 −369 xbmc/epg/EpgInfoTag.h
  35. +1 −0  xbmc/epg/EpgSearchFilter.cpp
  36. +33 −30 xbmc/epg/EpgSearchFilter.h
  37. +10 −6 xbmc/{guilib → epg}/GUIEPGGridContainer.cpp
  38. +218 −0 xbmc/epg/GUIEPGGridContainer.h
  39. +2 −1  xbmc/epg/Makefile
  40. +1 −0  xbmc/filesystem/PVRDirectory.cpp
  41. +2 −1  xbmc/filesystem/PVRFile.cpp
  42. +2 −1  xbmc/guilib/GUIControlFactory.cpp
  43. +0 −215 xbmc/guilib/GUIEPGGridContainer.h
  44. +0 −1  xbmc/guilib/Makefile.in
  45. +55 −51 xbmc/pvr/PVRDatabase.cpp
  46. +221 −207 xbmc/pvr/PVRDatabase.h
  47. +2 −0  xbmc/pvr/PVRGUIInfo.cpp
  48. +115 −112 xbmc/pvr/PVRGUIInfo.h
  49. +209 −131 xbmc/pvr/PVRManager.cpp
  50. +557 −507 xbmc/pvr/PVRManager.h
  51. +97 −111 xbmc/pvr/addons/PVRClient.cpp
  52. +466 −491 xbmc/pvr/addons/PVRClient.h
  53. +9 −8 xbmc/pvr/addons/PVRClients.cpp
  54. +328 −322 xbmc/pvr/addons/PVRClients.h
  55. +23 −14 xbmc/pvr/channels/PVRChannel.cpp
  56. +482 −479 xbmc/pvr/channels/PVRChannel.h
  57. +160 −76 xbmc/pvr/channels/PVRChannelGroup.cpp
  58. +358 −347 xbmc/pvr/channels/PVRChannelGroup.h
  59. +44 −86 xbmc/pvr/channels/PVRChannelGroupInternal.cpp
  60. +153 −148 xbmc/pvr/channels/PVRChannelGroupInternal.h
  61. +11 −15 xbmc/pvr/channels/PVRChannelGroups.cpp
  62. +174 −171 xbmc/pvr/channels/PVRChannelGroups.h
  63. +3 −1 xbmc/pvr/channels/PVRChannelGroupsContainer.cpp
  64. +171 −168 xbmc/pvr/channels/PVRChannelGroupsContainer.h
  65. +13 −9 xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp
  66. +29 −26 xbmc/pvr/dialogs/GUIDialogPVRChannelManager.h
  67. +19 −4 xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
  68. +21 −16 xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h
  69. +1 −0  xbmc/pvr/dialogs/GUIDialogPVRCutterOSD.cpp
  70. +12 −9 xbmc/pvr/dialogs/GUIDialogPVRCutterOSD.h
  71. +1 −0  xbmc/pvr/dialogs/GUIDialogPVRDirectorOSD.cpp
  72. +12 −9 xbmc/pvr/dialogs/GUIDialogPVRDirectorOSD.h
  73. +2 −1  xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp
  74. +39 −35 xbmc/pvr/dialogs/GUIDialogPVRGroupManager.h
  75. +2 −0  xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp
  76. +27 −25 xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h
  77. +1 −0  xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp
  78. +18 −15 xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.h
  79. +1 −0  xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp
  80. +21 −18 xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.h
  81. +1 −0  xbmc/pvr/dialogs/GUIDialogPVRRecordingInfo.cpp
  82. +14 −12 xbmc/pvr/dialogs/GUIDialogPVRRecordingInfo.h
  83. +2 −1  xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
  84. +27 −24 xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.h
  85. +15 −14 xbmc/pvr/epg/PVREpg.cpp
  86. +64 −61 xbmc/pvr/epg/PVREpg.h
  87. +24 −14 xbmc/pvr/epg/PVREpgContainer.cpp
  88. +87 −79 xbmc/pvr/epg/PVREpgContainer.h
  89. +16 −14 xbmc/pvr/epg/PVREpgInfoTag.cpp
  90. +64 −66 xbmc/pvr/epg/PVREpgInfoTag.h
  91. +4 −2 xbmc/pvr/epg/PVREpgSearchFilter.cpp
  92. +23 −20 xbmc/pvr/epg/PVREpgSearchFilter.h
  93. +6 −3 xbmc/pvr/recordings/PVRRecording.cpp
  94. +52 −49 xbmc/pvr/recordings/PVRRecording.h
  95. +4 −2 xbmc/pvr/recordings/PVRRecordings.cpp
  96. +36 −34 xbmc/pvr/recordings/PVRRecordings.h
  97. +6 −1 xbmc/pvr/timers/PVRTimerInfoTag.cpp
  98. +92 −88 xbmc/pvr/timers/PVRTimerInfoTag.h
  99. +13 −8 xbmc/pvr/timers/PVRTimers.cpp
  100. +168 −161 xbmc/pvr/timers/PVRTimers.h
  101. +2 −0  xbmc/pvr/windows/GUIViewStatePVR.cpp
  102. +13 −11 xbmc/pvr/windows/GUIViewStatePVR.h
  103. +11 −2 xbmc/pvr/windows/GUIWindowPVR.cpp
  104. +55 −52 xbmc/pvr/windows/GUIWindowPVR.h
  105. +7 −10 xbmc/pvr/windows/GUIWindowPVRChannels.cpp
  106. +39 −36 xbmc/pvr/windows/GUIWindowPVRChannels.h
  107. +7 −0 xbmc/pvr/windows/GUIWindowPVRCommon.cpp
  108. +109 −105 xbmc/pvr/windows/GUIWindowPVRCommon.h
  109. +23 −6 xbmc/pvr/windows/GUIWindowPVRGuide.cpp
  110. +41 −36 xbmc/pvr/windows/GUIWindowPVRGuide.h
  111. +2 −0  xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
  112. +29 −26 xbmc/pvr/windows/GUIWindowPVRRecordings.h
  113. +2 −0  xbmc/pvr/windows/GUIWindowPVRSearch.cpp
  114. +28 −25 xbmc/pvr/windows/GUIWindowPVRSearch.h
  115. +2 −0  xbmc/pvr/windows/GUIWindowPVRTimers.cpp
  116. +26 −23 xbmc/pvr/windows/GUIWindowPVRTimers.h
  117. +3 −4 xbmc/pvrclients/tvheadend/HTSPData.cpp
  118. +1 −0  xbmc/pvrclients/tvheadend/HTSPData.h
  119. +139 −165 xbmc/pvrclients/tvheadend/HTSPDemux.cpp
  120. +1 −4 xbmc/pvrclients/tvheadend/HTSPDemux.h
  121. +5 −1 xbmc/pvrclients/tvheadend/HTSPSession.cpp
  122. +2 −0  xbmc/settings/AdvancedSettings.cpp
  123. +1 −0  xbmc/settings/AdvancedSettings.h
  124. +11 −33 xbmc/settings/GUISettings.cpp
  125. +0 −2  xbmc/settings/GUISettings.h
  126. +7 −5 xbmc/settings/GUIWindowSettingsCategory.cpp
  127. +8 −18 xbmc/utils/Observer.cpp
  128. +1 −1  xbmc/utils/Observer.h
  129. +3 −3 xbmc/video/windows/GUIWindowFullScreen.cpp
  130. +1 −0  xbmc/video/windows/GUIWindowVideoBase.cpp
View
8 addons/skin.confluence/720p/MyPVR.xml
@@ -189,15 +189,7 @@
<include>ButtonCommonValues</include>
<label>137</label>
</control>
- <control type="button" id="610">
- <description>Fake Button to fix Player Controls Navigation</description>
- <visible>false</visible>
- </control>
<include>CommonNowPlaying_Controls</include>
- <control type="button" id="611">
- <description>Fake Button to fix Player Controls Navigation</description>
- <visible>false</visible>
- </control>
</control>
</control>
View
6 addons/skin.confluence/720p/includes.xml
@@ -503,9 +503,13 @@
<visible>[Player.HasAudio | Player.HasVideo]</visible>
<include>VisibleFadeEffect</include>
</control>
+ <control type="button" id="610">
+ <description>Fake Button to fix Player Controls Navigation</description>
+ <visible>false</visible>
+ </control>
<control type="group" id="9006">
<width>250</width>
- <height>39</height>
+ <height>45</height>
<visible>VideoPlayer.Content(LiveTV)</visible>
<include>VisibleFadeEffect</include>
<control type="button" id="600">
View
3  language/Dutch/strings.xml
@@ -1627,6 +1627,9 @@
<string id="19226">Opname gestart</string>
<string id="19227">Opname voltooid</string>
<string id="19228">Opname verwijderd</string>
+ <string id="19229">Sluit kanelen OSD na wijzigen kanaal</string>
+ <string id="19230">Geen EPG updates tijdens het afspelen van een TV stream</string>
+ <string id="19231">Gebruik altijd de volgorde van kanalen van backend(s)</string>
<string id="19499">Anders/Onbekend</string>
<string id="19500">Film/Drama</string>
View
3  language/English/strings.xml
@@ -1755,6 +1755,9 @@
<string id="19226">Recording started</string>
<string id="19227">Recording completed</string>
<string id="19228">Recording deleted</string>
+ <string id="19229">Close channel OSD after switching channels</string>
+ <string id="19230">Prevent EPG updates while playing a TV stream</string>
+ <string id="19231">Always use the channel order from the backend(s)</string>
<string id="19499">Other/Unknown</string>
<string id="19500">Movie/Drama</string>
View
2  lib/addons/library.xbmc.pvr/libXBMC_pvr.cpp
@@ -143,7 +143,7 @@ DLLEXPORT void PVR_trigger_recording_update()
if (m_cb == NULL)
return;
- m_cb->TriggerTimerUpdate(m_Handle->addonData);
+ m_cb->TriggerRecordingUpdate(m_Handle->addonData);
}
DLLEXPORT void PVR_free_demux_packet(DemuxPacket* pPacket)
View
4 project/VS2010Express/XBMC.vcxproj
@@ -347,6 +347,7 @@
<ClCompile Include="..\..\xbmc\epg\EpgDatabase.cpp" />
<ClCompile Include="..\..\xbmc\epg\EpgInfoTag.cpp" />
<ClCompile Include="..\..\xbmc\epg\EpgSearchFilter.cpp" />
+ <ClCompile Include="..\..\xbmc\epg\GUIEPGGridContainer.cpp" />
<ClCompile Include="..\..\xbmc\Favourites.cpp" />
<ClCompile Include="..\..\xbmc\FileItem.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\CacheCircular.cpp" />
@@ -382,7 +383,6 @@
<ClCompile Include="..\..\xbmc\guilib\GUIControlProfiler.cpp" />
<ClCompile Include="..\..\xbmc\guilib\GUIDialog.cpp" />
<ClCompile Include="..\..\xbmc\guilib\GUIEditControl.cpp" />
- <ClCompile Include="..\..\xbmc\guilib\GUIEPGGridContainer.cpp" />
<ClCompile Include="..\..\xbmc\guilib\GUIFadeLabelControl.cpp" />
<ClCompile Include="..\..\xbmc\guilib\GUIFixedListContainer.cpp" />
<ClCompile Include="..\..\xbmc\guilib\GUIFont.cpp" />
@@ -1279,6 +1279,7 @@
<ClInclude Include="..\..\xbmc\epg\EpgDatabase.h" />
<ClInclude Include="..\..\xbmc\epg\EpgInfoTag.h" />
<ClInclude Include="..\..\xbmc\epg\EpgSearchFilter.h" />
+ <ClInclude Include="..\..\xbmc\epg\GUIEPGGridContainer.h" />
<ClInclude Include="..\..\xbmc\Favourites.h" />
<ClInclude Include="..\..\xbmc\FileItem.h" />
<ClInclude Include="..\..\xbmc\filesystem\CacheCircular.h" />
@@ -1331,7 +1332,6 @@
<ClInclude Include="..\..\xbmc\guilib\GUIControlProfiler.h" />
<ClInclude Include="..\..\xbmc\guilib\GUIDialog.h" />
<ClInclude Include="..\..\xbmc\guilib\GUIEditControl.h" />
- <ClInclude Include="..\..\xbmc\guilib\GUIEPGGridContainer.h" />
<ClInclude Include="..\..\xbmc\guilib\GUIFadeLabelControl.h" />
<ClInclude Include="..\..\xbmc\guilib\GUIFixedListContainer.h" />
<ClInclude Include="..\..\xbmc\guilib\GUIFont.h" />
View
14 project/VS2010Express/XBMC.vcxproj.filters
@@ -2477,9 +2477,6 @@
<ClCompile Include="..\..\xbmc\utils\TextSearch.cpp">
<Filter>utils</Filter>
</ClCompile>
- <ClCompile Include="..\..\xbmc\guilib\GUIEPGGridContainer.cpp">
- <Filter>guilib</Filter>
- </ClCompile>
<ClCompile Include="..\..\xbmc\utils\GLUtils.cpp">
<Filter>utils</Filter>
</ClCompile>
@@ -2643,6 +2640,9 @@
<ClCompile Include="..\..\xbmc\filesystem\CacheCircular.cpp">
<Filter>filesystem</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\epg\GUIEPGGridContainer.cpp">
+ <Filter>epg</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
@@ -5095,9 +5095,6 @@
<ClInclude Include="..\..\xbmc\utils\TextSearch.h">
<Filter>utils</Filter>
</ClInclude>
- <ClInclude Include="..\..\xbmc\guilib\GUIEPGGridContainer.h">
- <Filter>guilib</Filter>
- </ClInclude>
<ClInclude Include="..\..\xbmc\utils\GLUtils.h">
<Filter>utils</Filter>
</ClInclude>
@@ -5256,6 +5253,9 @@
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\InputOperations.h">
<Filter>interfaces\json-rpc</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\epg\GUIEPGGridContainer.h">
+ <Filter>epg</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\xbmc\win32\XBMC.ico">
@@ -5272,4 +5272,4 @@
<Filter>win32</Filter>
</CustomBuild>
</ItemGroup>
-</Project>
+</Project>
View
1  xbmc/Application.cpp
@@ -304,6 +304,7 @@ using namespace DBUSSERVER;
using namespace JSONRPC;
#endif
using namespace ANNOUNCEMENT;
+using namespace PVR;
// uncomment this if you want to use release libs in the debug build.
// Atm this saves you 7 mb of memory
View
2  xbmc/FileItem.cpp
@@ -66,6 +66,8 @@ using namespace std;
using namespace XFILE;
using namespace PLAYLIST;
using namespace MUSIC_INFO;
+using namespace PVR;
+using namespace EPG;
CFileItem::CFileItem(const CSong& song)
{
View
50 xbmc/FileItem.h
@@ -42,11 +42,17 @@ namespace MUSIC_INFO
class CMusicInfoTag;
}
class CVideoInfoTag;
-class CEpgInfoTag;
-class CPVREpgInfoTag;
-class CPVRChannel;
-class CPVRRecording;
-class CPVRTimerInfoTag;
+namespace EPG
+{
+ class CEpgInfoTag;
+}
+namespace PVR
+{
+ class CPVREpgInfoTag;
+ class CPVRChannel;
+ class CPVRRecording;
+ class CPVRTimerInfoTag;
+}
class CPictureInfoTag;
class CAlbum;
@@ -79,11 +85,11 @@ class CFileItem :
CFileItem(const CArtist& artist);
CFileItem(const CGenre& genre);
CFileItem(const CVideoInfoTag& movie);
- CFileItem(const CPVREpgInfoTag& tag);
- CFileItem(const CEpgInfoTag& tag);
- CFileItem(const CPVRChannel& channel);
- CFileItem(const CPVRRecording& record);
- CFileItem(const CPVRTimerInfoTag& timer);
+ CFileItem(const PVR::CPVREpgInfoTag& tag);
+ CFileItem(const EPG::CEpgInfoTag& tag);
+ CFileItem(const PVR::CPVRChannel& channel);
+ CFileItem(const PVR::CPVRRecording& record);
+ CFileItem(const PVR::CPVRTimerInfoTag& timer);
CFileItem(const CMediaSource& share);
virtual ~CFileItem(void);
virtual CGUIListItem *Clone() const { return new CFileItem(*this); };
@@ -199,9 +205,9 @@ class CFileItem :
return m_epgInfoTag != NULL;
}
- CEpgInfoTag* GetEPGInfoTag();
+ EPG::CEpgInfoTag* GetEPGInfoTag();
- inline const CEpgInfoTag* GetEPGInfoTag() const
+ inline const EPG::CEpgInfoTag* GetEPGInfoTag() const
{
return m_epgInfoTag;
}
@@ -211,9 +217,9 @@ class CFileItem :
return m_pvrChannelInfoTag != NULL;
}
- CPVRChannel* GetPVRChannelInfoTag();
+ PVR::CPVRChannel* GetPVRChannelInfoTag();
- inline const CPVRChannel* GetPVRChannelInfoTag() const
+ inline const PVR::CPVRChannel* GetPVRChannelInfoTag() const
{
return m_pvrChannelInfoTag;
}
@@ -223,9 +229,9 @@ class CFileItem :
return m_pvrRecordingInfoTag != NULL;
}
- CPVRRecording* GetPVRRecordingInfoTag();
+ PVR::CPVRRecording* GetPVRRecordingInfoTag();
- inline const CPVRRecording* GetPVRRecordingInfoTag() const
+ inline const PVR::CPVRRecording* GetPVRRecordingInfoTag() const
{
return m_pvrRecordingInfoTag;
}
@@ -235,9 +241,9 @@ class CFileItem :
return m_pvrTimerInfoTag != NULL;
}
- CPVRTimerInfoTag* GetPVRTimerInfoTag();
+ PVR::CPVRTimerInfoTag* GetPVRTimerInfoTag();
- inline const CPVRTimerInfoTag* GetPVRTimerInfoTag() const
+ inline const PVR::CPVRTimerInfoTag* GetPVRTimerInfoTag() const
{
return m_pvrTimerInfoTag;
}
@@ -368,10 +374,10 @@ class CFileItem :
CStdString m_extrainfo;
MUSIC_INFO::CMusicInfoTag* m_musicInfoTag;
CVideoInfoTag* m_videoInfoTag;
- CEpgInfoTag* m_epgInfoTag;
- CPVRChannel* m_pvrChannelInfoTag;
- CPVRRecording* m_pvrRecordingInfoTag;
- CPVRTimerInfoTag * m_pvrTimerInfoTag;
+ EPG::CEpgInfoTag* m_epgInfoTag;
+ PVR::CPVRChannel* m_pvrChannelInfoTag;
+ PVR::CPVRRecording* m_pvrRecordingInfoTag;
+ PVR::CPVRTimerInfoTag * m_pvrTimerInfoTag;
CPictureInfoTag* m_pictureInfoTag;
bool m_bIsAlbum;
};
View
2  xbmc/GUIInfoManager.cpp
@@ -79,7 +79,6 @@
#include "pvr/channels/PVRChannelGroupsContainer.h"
#include "pvr/epg/PVREpgInfoTag.h"
#include "pvr/timers/PVRTimers.h"
-#include "pvr/timers/PVRTimerInfoTag.h"
#include "pvr/recordings/PVRRecording.h"
#include "addons/AddonManager.h"
@@ -90,6 +89,7 @@ using namespace std;
using namespace XFILE;
using namespace MUSIC_INFO;
using namespace ADDON;
+using namespace PVR;
CGUIInfoManager::CCombinedValue& CGUIInfoManager::CCombinedValue::operator =(const CGUIInfoManager::CCombinedValue& mSrc)
{
View
1  xbmc/GUIViewState.cpp
@@ -48,6 +48,7 @@
using namespace std;
using namespace ADDON;
+using namespace PVR;
CStdString CGUIViewState::m_strPlaylistDirectory;
VECSOURCES CGUIViewState::m_sources;
View
3  xbmc/SortFileItem.cpp
@@ -23,7 +23,6 @@
#include "video/VideoInfoTag.h"
#include "pvr/channels/PVRChannel.h"
#include "pvr/epg/PVREpg.h"
-#include "pvr/epg/PVREpgInfoTag.h"
#include "pvr/timers/PVRTimerInfoTag.h"
#include "settings/AdvancedSettings.h"
#include "utils/StringUtils.h"
@@ -33,6 +32,8 @@
#include "utils/log.h"
#include "video/VideoInfoTag.h"
+using namespace PVR;
+
#define RETURN_IF_NULL(x,y) if ((x) == NULL) { CLog::Log(LOGWARNING, "%s, sort item is null", __FUNCTION__); return y; }
CStdString SSortFileItem::RemoveArticles(const CStdString &label)
View
2  xbmc/addons/AddonCallbacksPVR.cpp
@@ -33,6 +33,8 @@
#include "pvr/timers/PVRTimers.h"
#include "pvr/timers/PVRTimerInfoTag.h"
+using namespace PVR;
+
namespace ADDON
{
View
1  xbmc/addons/AddonManager.cpp
@@ -50,6 +50,7 @@
#include "Service.h"
using namespace std;
+using namespace PVR;
namespace ADDON
{
View
4 xbmc/addons/include/xbmc_pvr_types.h
@@ -77,7 +77,9 @@ struct DemuxPacket;
#define EPG_EVENT_CONTENTMASK_USERDEFINED 0xF0
//@}
-#define PVR_STREAM_MAX_STREAMS 16
+
+/* using the default avformat's MAX_STREAMS value to be safe */
+#define PVR_STREAM_MAX_STREAMS 20
#ifdef __cplusplus
extern "C" {
View
38 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp
@@ -25,12 +25,22 @@
#include "utils/log.h"
#include "pvr/PVRManager.h"
#include "pvr/addons/PVRClients.h"
-#ifdef _WIN32
-#include <libavcodec/avcodec.h>
-#endif
+
+using namespace PVR;
void CDemuxStreamVideoPVRClient::GetStreamInfo(std::string& strInfo)
{
+ switch (codec)
+ {
+ case CODEC_ID_MPEG2VIDEO:
+ strInfo = "MPEG2VIDEO";
+ break;
+ case CODEC_ID_H264:
+ strInfo = "H264";
+ break;
+ default:
+ break;
+ }
}
void CDemuxStreamAudioPVRClient::GetStreamInfo(std::string& strInfo)
@@ -40,6 +50,18 @@ void CDemuxStreamAudioPVRClient::GetStreamInfo(std::string& strInfo)
case CODEC_ID_AC3:
strInfo = "AC3";
break;
+ case CODEC_ID_EAC3:
+ strInfo = "EAC3";
+ break;
+ case CODEC_ID_MP2:
+ strInfo = "MPEG2AUDIO";
+ break;
+ case CODEC_ID_AAC:
+ strInfo = "AAC";
+ break;
+ case CODEC_ID_DTS:
+ strInfo = "DTS";
+ break;
default:
break;
}
@@ -52,7 +74,7 @@ void CDemuxStreamSubtitlePVRClient::GetStreamInfo(std::string& strInfo)
CDVDDemuxPVRClient::CDVDDemuxPVRClient() : CDVDDemux()
{
m_pInput = NULL;
- for (int i = 0; i < MAX_PVR_STREAMS; i++) m_streams[i] = NULL;
+ for (int i = 0; i < MAX_STREAMS; i++) m_streams[i] = NULL;
}
CDVDDemuxPVRClient::~CDVDDemuxPVRClient()
@@ -70,7 +92,7 @@ bool CDVDDemuxPVRClient::Open(CDVDInputStream* pInput)
void CDVDDemuxPVRClient::Dispose()
{
- for (int i = 0; i < MAX_PVR_STREAMS; i++)
+ for (int i = 0; i < MAX_STREAMS; i++)
{
if (m_streams[i])
{
@@ -129,7 +151,7 @@ DemuxPacket* CDVDDemuxPVRClient::Read()
CDemuxStream* CDVDDemuxPVRClient::GetStream(int iStreamId)
{
- if (iStreamId < 0 || iStreamId >= MAX_PVR_STREAMS) return NULL;
+ if (iStreamId < 0 || iStreamId >= MAX_STREAMS) return NULL;
return m_streams[iStreamId];
}
@@ -237,7 +259,7 @@ void CDVDDemuxPVRClient::UpdateStreams(PVR_STREAM_PROPERTIES *props)
int CDVDDemuxPVRClient::GetNrOfStreams()
{
int i = 0;
- while (i < MAX_PVR_STREAMS && m_streams[i]) i++;
+ while (i < MAX_STREAMS && m_streams[i]) i++;
return i;
}
@@ -266,5 +288,7 @@ void CDVDDemuxPVRClient::GetStreamCodecName(int iStreamId, CStdString &strName)
strName = "mpeg2video";
else if (stream->codec == CODEC_ID_H264)
strName = "h264";
+ else if (stream->codec == CODEC_ID_EAC3)
+ strName = "eac3";
}
}
View
19 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.h
@@ -23,6 +23,22 @@
#include "DVDDemux.h"
#include <map>
+#ifndef _LINUX
+#include <libavformat/avformat.h>
+#else
+extern "C" {
+#if (defined USE_EXTERNAL_FFMPEG)
+ #if (defined HAVE_LIBAVFORMAT_AVFORMAT_H)
+ #include <libavformat/avformat.h>
+ #elif (defined HAVE_FFMPEG_AVFORMAT_H)
+ #include <ffmpeg/avformat.h>
+ #endif
+#else
+ #include "libavformat/avformat.h"
+#endif
+}
+#endif
+
class CDVDDemuxPVRClient;
struct PVR_STREAM_PROPERTIES;
@@ -81,8 +97,7 @@ class CDVDDemuxPVRClient : public CDVDDemux
protected:
CDVDInputStream* m_pInput;
- #define MAX_PVR_STREAMS 42
- CDemuxStream* m_streams[MAX_PVR_STREAMS]; // maximum number of streams that ffmpeg can handle
+ CDemuxStream* m_streams[MAX_STREAMS]; // maximum number of streams that ffmpeg can handle
private:
void RequestStreams();
View
4 xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
@@ -33,9 +33,9 @@
#endif
#include "DVDDemuxPVRClient.h"
#include "pvr/PVRManager.h"
-#include "pvr/addons/PVRClients.h"
using namespace std;
+using namespace PVR;
CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream)
{
@@ -87,7 +87,7 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream)
/* Use PVR demuxer only for live streams */
if (filename.substr(0, 14) == "pvr://channels")
{
- PVR_ADDON_CAPABILITIES *pProps = g_PVRClients->GetCurrentClientProperties();
+ PVR_ADDON_CAPABILITIES *pProps = g_PVRManager.GetCurrentClientProperties();
if (pProps && pProps->bHandlesDemuxing)
{
auto_ptr<CDVDDemuxPVRClient> demuxer(new CDVDDemuxPVRClient());
View
4 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h
@@ -55,8 +55,8 @@ class CDVDInputStream
virtual bool NextChannel(bool preview = false) = 0;
virtual bool PrevChannel(bool preview = false) = 0;
virtual bool SelectChannelByNumber(unsigned int channel) = 0;
- virtual bool SelectChannel(const CPVRChannel &channel) = 0;
- virtual bool GetSelectedChannel(CPVRChannel *) = 0;
+ virtual bool SelectChannel(const PVR::CPVRChannel &channel) { return false; };
+ virtual bool GetSelectedChannel(PVR::CPVRChannel *) { return false; };
virtual int GetTotalTime() = 0;
virtual int GetStartTime() = 0;
virtual bool UpdateItem(CFileItem& item) = 0;
View
4 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h
@@ -45,8 +45,8 @@ class CDVDInputStreamHTSP
bool NextChannel(bool preview = false);
bool PrevChannel(bool preview = false);
bool SelectChannelByNumber(unsigned int channel);
- bool SelectChannel(const CPVRChannel &channel) { return false; }
- bool GetSelectedChannel(CPVRChannel *channel) {return false; }
+ bool SelectChannel(const PVR::CPVRChannel &channel) { return false; }
+ bool GetSelectedChannel(PVR::CPVRChannel *channel) {return false; }
bool UpdateItem(CFileItem& item);
bool CanRecord() { return false; }
View
1  xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp
@@ -29,6 +29,7 @@
#include "pvr/addons/PVRClients.h"
using namespace XFILE;
+using namespace PVR;
/************************************************************************
* Description: Class constructor, initialize member variables
View
4 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h
@@ -54,10 +54,10 @@ class CDVDInputStreamPVRManager
virtual bool NextStream();
bool SelectChannelByNumber(unsigned int iChannel);
- bool SelectChannel(const CPVRChannel &channel);
+ bool SelectChannel(const PVR::CPVRChannel &channel);
bool NextChannel(bool preview = false);
bool PrevChannel(bool preview = false);
- bool GetSelectedChannel(CPVRChannel *channel);
+ bool GetSelectedChannel(PVR::CPVRChannel *channel);
int GetTotalTime();
int GetStartTime();
View
6 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamTV.cpp
@@ -149,12 +149,6 @@ bool CDVDInputStreamTV::SelectChannelByNumber(unsigned int channel)
return m_pLiveTV->SelectChannel(channel);
}
-bool CDVDInputStreamTV::SelectChannel(const CPVRChannel &channel)
-{
- if(!m_pLiveTV) return false;
- return m_pLiveTV->SelectChannel(channel.ChannelNumber());
-}
-
bool CDVDInputStreamTV::UpdateItem(CFileItem& item)
{
if(m_pLiveTV)
View
2  xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamTV.h
@@ -50,8 +50,6 @@ class CDVDInputStreamTV
bool NextChannel(bool preview = false);
bool PrevChannel(bool preview = false);
bool SelectChannelByNumber(unsigned int channel);
- bool SelectChannel(const CPVRChannel &channel);
- bool GetSelectedChannel(CPVRChannel *channel) {return false; }
int GetTotalTime();
int GetStartTime();
View
2  xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -74,6 +74,7 @@
#include "Util.h"
using namespace std;
+using namespace PVR;
void CSelectionStreams::Clear(StreamType type, StreamSource source)
{
@@ -1002,6 +1003,7 @@ void CDVDPlayer::Process()
{
FlushBuffers(false);
SAFE_DELETE(m_pDemuxer);
+ SetCaching(CACHESTATE_INIT);
continue;
}
else
View
74 xbmc/epg/Epg.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "guilib/LocalizeStrings.h"
#include "settings/AdvancedSettings.h"
#include "settings/GUISettings.h"
#include "threads/SingleLock.h"
@@ -28,6 +29,10 @@
#include "EpgDatabase.h"
#include "EpgContainer.h"
+#include "../addons/include/xbmc_pvr_types.h" // TODO extract the epg specific stuff
+
+using namespace EPG;
+
struct sortEPGbyDate
{
bool operator()(CEpgInfoTag* strItem1, CEpgInfoTag* strItem2)
@@ -39,15 +44,14 @@ struct sortEPGbyDate
}
};
-CEpg::CEpg(int iEpgID, const CStdString &strName /* = "" */, const CStdString &strScraperName /* = "" */)
+CEpg::CEpg(int iEpgID, const CStdString &strName /* = "" */, const CStdString &strScraperName /* = "" */) :
+ m_bInhibitSorting(false),
+ m_iEpgID(iEpgID),
+ m_strName(strName),
+ m_strScraperName(strScraperName),
+ m_nowActive(NULL),
+ m_Channel(NULL)
{
- m_iEpgID = iEpgID;
- m_strName = strName;
- m_strScraperName = strScraperName;
- m_nowActive = NULL;
- m_Channel = NULL;
- m_bInhibitSorting = false;
- m_bHasChannel = false;
m_lastScanTime.SetValid(false);
m_firstDate.SetValid(false);
m_lastDate.SetValid(false);
@@ -67,7 +71,7 @@ bool CEpg::HasValidEntries(void) const
return (m_iEpgID > 0 && /* valid EPG ID */
size() > 0 && /* contains at least 1 tag */
- at(size()-1)->m_endTime >= CDateTime::GetCurrentDateTime().GetAsUTCDateTime()); /* the last end time hasn't passed yet */
+ at(size()-1)->EndAsUTC() >= CDateTime::GetCurrentDateTime().GetAsUTCDateTime()); /* the last end time hasn't passed yet */
}
bool CEpg::DeleteInfoTag(CEpgInfoTag *tag)
@@ -75,7 +79,7 @@ bool CEpg::DeleteInfoTag(CEpgInfoTag *tag)
bool bReturn = false;
/* check if we're the "owner" of this tag */
- if (tag->m_Epg != this)
+ if (*tag->m_Epg != *this)
return bReturn;
CSingleLock lock(m_critSection);
@@ -393,7 +397,7 @@ bool CEpg::Load(void)
return bReturn;
}
- int iEntriesLoaded = database->Get(this);
+ int iEntriesLoaded = database->Get(*this);
if (iEntriesLoaded <= 0)
{
CLog::Log(LOGNOTICE, "Epg - %s - no database entries found for table '%s'.",
@@ -767,3 +771,51 @@ CEpgInfoTag *CEpg::CreateTag(void)
}
//@}
+
+const CStdString &CEpg::ConvertGenreIdToString(int iID, int iSubID)
+{
+ unsigned int iLabelId = 19499;
+ switch (iID)
+ {
+ case EPG_EVENT_CONTENTMASK_MOVIEDRAMA:
+ iLabelId = (iSubID <= 8) ? 19500 + iSubID : 19500;
+ break;
+ case EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS:
+ iLabelId = (iSubID <= 4) ? 19516 + iSubID : 19516;
+ break;
+ case EPG_EVENT_CONTENTMASK_SHOW:
+ iLabelId = (iSubID <= 3) ? 19532 + iSubID : 19532;
+ break;
+ case EPG_EVENT_CONTENTMASK_SPORTS:
+ iLabelId = (iSubID <= 11) ? 19548 + iSubID : 19548;
+ break;
+ case EPG_EVENT_CONTENTMASK_CHILDRENYOUTH:
+ iLabelId = (iSubID <= 5) ? 19564 + iSubID : 19564;
+ break;
+ case EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE:
+ iLabelId = (iSubID <= 6) ? 19580 + iSubID : 19580;
+ break;
+ case EPG_EVENT_CONTENTMASK_ARTSCULTURE:
+ iLabelId = (iSubID <= 11) ? 19596 + iSubID : 19596;
+ break;
+ case EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS:
+ iLabelId = (iSubID <= 3) ? 19612 + iSubID : 19612;
+ break;
+ case EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE:
+ iLabelId = (iSubID <= 7) ? 19628 + iSubID : 19628;
+ break;
+ case EPG_EVENT_CONTENTMASK_LEISUREHOBBIES:
+ iLabelId = (iSubID <= 7) ? 19644 + iSubID : 19644;
+ break;
+ case EPG_EVENT_CONTENTMASK_SPECIAL:
+ iLabelId = (iSubID <= 3) ? 19660 + iSubID : 19660;
+ break;
+ case EPG_EVENT_CONTENTMASK_USERDEFINED:
+ iLabelId = (iSubID <= 3) ? 19676 + iSubID : 19676;
+ break;
+ default:
+ break;
+ }
+
+ return g_localizeStrings.Get(iLabelId);
+}
View
568 xbmc/epg/Epg.h
@@ -28,285 +28,293 @@
#include "EpgInfoTag.h"
#include "EpgSearchFilter.h"
-class CEpgContainer;
-class CPVREpgContainer;
-class CPVREpg;
-
/** EPG container for CEpgInfoTag instances */
-
-class CEpg : public std::vector<CEpgInfoTag*>
+namespace EPG
{
- friend class CEpgDatabase;
- friend class CPVREpgContainer;
- friend class CEpgContainer;
- friend class CPVREpg;
-
-private:
- CStdString m_strName; /*!< the name of this table */
- CStdString m_strScraperName; /*!< the name of the scraper to use */
- int m_iEpgID; /*!< the database ID of this table */
- CDateTime m_lastScanTime; /*!< the last time the EPG has been updated */
- bool m_bInhibitSorting; /*!< don't sort the table if this is true */
- mutable const CEpgInfoTag *m_nowActive; /*!< the tag that is currently active */
-
- mutable CCriticalSection m_critSection; /*!< critical section for changes in this table */
-
- CPVRChannel * m_Channel; /*!< the channel this EPG belongs to */
- bool m_bHasChannel; /*!< true if this table has a channel tag set, false otherwise */
- CDateTime m_firstDate; /*!< start time of the first epg event in this table */
- CDateTime m_lastDate; /*!< end time of the last epg event in this table */
-
- /*!
- * @brief Update the EPG from a scraper set in the channel tag.
- * TODO: not implemented yet
- * @param start Get entries with a start date after this time.
- * @param end Get entries with an end date before this time.
- * @return True if the update was successful, false otherwise.
- */
- virtual bool UpdateFromScraper(time_t start, time_t end);
-
- /*!
- * @brief Persist all tags in this container.
- * @param bQueueWrite Don't execute the query immediately but queue it if true.
- * @return True if all tags were persisted, false otherwise.
- */
- virtual bool PersistTags(bool bQueueWrite = false) const;
-
- /*!
- * @brief Fix overlapping events from the tables.
- * @param bStore Store in the database if true.
- * @return True if the events were fixed successfully, false otherwise.
- */
- virtual bool FixOverlappingEvents(bool bStore = true);
-
- /*!
- * @brief Create a new tag.
- * @return The new tag.
- */
- virtual CEpgInfoTag *CreateTag(void);
-
- /*!
- * @brief Sort all entries in this EPG by date.
- */
- virtual void Sort(void);
-
- /*!
- * @brief Add an infotag to this container.
- * @param tag The tag to add.
- */
- virtual void AddEntry(const CEpgInfoTag &tag);
-
- /*!
- * @brief Remove all tags between begin and end from this table.
- * @param begin Remove all entries after this start time. Use 0 to remove all entries before "end".
- * @param end Remove all entries before this end time. Use 0 to remove all before after "begin". If both "begin" and "end" are 0, all entries will be removed.
- * @param bRemoveFromDb Set to true to remove these entries from the database too.
- */
- virtual void RemoveTagsBetween(time_t begin, time_t end, bool bRemoveFromDb = false);
-
- /*!
- * @see RemoveTagsBetween(time_t begin, time_t end, bool bRemoveFromDb = false)
- */
- virtual void RemoveTagsBetween(const CDateTime &begin, const CDateTime &end, bool bRemoveFromDb = false);
-
- /*!
- * @brief Load all EPG entries from clients into a temporary table and update this table with the contents of that temporary table.
- * @param start Only get entries after this start time. Use 0 to get all entries before "end".
- * @param end Only get entries before this end time. Use 0 to get all entries after "begin". If both "begin" and "end" are 0, all entries will be updated.
- * @return True if the update was successful, false otherwise.
- */
- virtual bool LoadFromClients(time_t start, time_t end);
-
- /*!
- * @brief Update the contents of this table with the contents provided in "epg"
- * @param epg The updated contents.
- * @param bStoreInDb True to store the updated contents in the db, false otherwise.
- * @return True if the update was successful, false otherwise.
- */
- virtual bool UpdateEntries(const CEpg &epg, bool bStoreInDb = true);
-
- /*!
- * @brief Update the cached first and last date.
- */
- virtual void UpdateFirstAndLastDates(void);
-
-protected:
- /*!
- * @brief Update this table's info with the given info. Doesn't change the EpgID.
- * @param epg The new info.
- * @param bUpdateDb If true, persist the changes.
- * @return True if the update was successful, false otherwise.
- */
- virtual bool Update(const CEpg &epg, bool bUpdateDb = false);
-
- /*!
- * @brief Load all entries for this table from the database.
- * @return True if any entries were loaded, false otherwise.
- */
- bool Load(void);
-
-public:
- /*!
- * @brief Create a new EPG instance.
- * @param iEpgID The ID of this table or <= 0 to create a new ID.
- * @param strName The name of this table.
- * @param strScraperName The name of the scraper to use.
- */
- CEpg(int iEpgID, const CStdString &strName = "", const CStdString &strScraperName = "");
-
- /*!
- * @brief Destroy this EPG instance.
- */
- virtual ~CEpg(void);
-
- /*!
- * @brief The channel this EPG belongs to.
- * @return The channel this EPG belongs to
- */
- const CPVRChannel *Channel(void) const { return m_bHasChannel ? m_Channel : NULL; }
-
- /*!
- * @brief Get the name of the scraper to use for this table.
- * @return The name of the scraper to use for this table.
- */
- const CStdString &ScraperName(void) const { return m_strScraperName; }
-
- /*!
- * @brief Get the name of this table.
- * @return The name of this table.
- */
- const CStdString &Name(void) const { return m_strName; }
-
- /*!
- * @brief Get the database ID of this table.
- * @return The database ID of this table.
- */
- virtual int EpgID(void) const { return m_iEpgID; }
-
- /*!
- * @brief Check whether this EPG contains valid entries.
- * @return True if it has valid entries, false if not.
- */
- virtual bool HasValidEntries(void) const;
-
- /*!
- * @brief Delete an infotag from this EPG.
- * @param tag The tag to delete.
- * @return True if it was deleted successfully, false if not.
- */
- virtual bool DeleteInfoTag(CEpgInfoTag *tag);
-
- /*!
- * @brief Remove all entries from this EPG that finished before the given time
- * and that have no timers set.
- * @param Time Delete entries with an end time before this time in UTC.
- */
- virtual void Cleanup(const CDateTime &Time);
-
- /*!
- * @brief Remove all entries from this EPG that finished before the given time
- * and that have no timers set.
- */
- virtual void Cleanup(void);
-
- /*!
- * @brief Remove all entries from this EPG.
- */
- virtual void Clear(void);
-
- /*!
- * @brief Get the event that is occurring now.
- * @return The current event.
- */
- virtual const CEpgInfoTag *InfoTagNow(void) const;
-
- /*!
- * @brief Get the event that will occur next.
- * @return The next event.
- */
- virtual const CEpgInfoTag *InfoTagNext(void) const;
-
- /*!
- * @brief Get the event that occurs at the given time.
- * @param time The time to find the event for.
- * @return The found tag or NULL if it wasn't found.
- */
- virtual const CEpgInfoTag *GetTagAround(const CDateTime &time) const;
-
- /*!
- * Get the event that occurs between the given begin and end time.
- * @param beginTime Minimum start time of the event.
- * @param endTime Maximum end time of the event.
- * @return The found tag or NULL if it wasn't found.
- */
- virtual const CEpgInfoTag *GetTagBetween(const CDateTime &beginTime, const CDateTime &endTime) const;
-
- /*!
- * @brief Get the infotag with the given ID.
- *
- * Get the infotag with the given ID.
- * If it wasn't found, try finding the event with the given start time
- *
- * @param uniqueID The unique ID of the event to find.
- * @param beginTime The start time of the event to find if it wasn't found by it's unique ID.
- * @return The found tag or NULL if it wasn't found.
- */
- virtual const CEpgInfoTag *GetTag(int uniqueID, const CDateTime &beginTime) const;
-
- /*!
- * @brief Update an entry in this EPG.
- * @param tag The tag to update.
- * @param bUpdateDatabase If set to true, this event will be persisted in the database.
- * @return True if it was updated successfully, false otherwise.
- */
- virtual bool UpdateEntry(const CEpgInfoTag &tag, bool bUpdateDatabase = false);
-
- /*!
- * @brief Update the EPG from 'start' till 'end'.
- * @param start The start time.
- * @param end The end time.
- * @param iUpdateTime Update the table after the given amount of time has passed.
- * @return True if the update was successful, false otherwise.
- */
- virtual bool Update(const time_t start, const time_t end, int iUpdateTime);
-
- /*!
- * @brief Get all EPG entries.
- * @param results The file list to store the results in.
- * @return The amount of entries that were added.
- */
- virtual int Get(CFileItemList *results) const;
-
- /*!
- * @brief Get all EPG entries that and apply a filter.
- * @param results The file list to store the results in.
- * @param filter The filter to apply.
- * @return The amount of entries that were added.
- */
- virtual int Get(CFileItemList *results, const EpgSearchFilter &filter) const;
-
- /*!
- * @brief Persist this table in the database.
- * @param bPersistTags Set to true to persist all changed tags in this container.
- * @param bQueueWrite Don't execute the query immediately but queue it if true.
- * @return True if the table was persisted, false otherwise.
- */
- virtual bool Persist(bool bPersistTags = false, bool bQueueWrite = false);
-
- /*!
- * @brief Get the start time of the first entry in this table.
- * @return The first date.
- */
- virtual const CDateTime &GetFirstDate(void) const;
-
- /*!
- * @brief Get the end time of the last entry in this table.
- * @return The last date.
- */
- virtual const CDateTime &GetLastDate(void) const;
-
- /*!
- * @return The last time this table was scanned.
- */
- virtual const CDateTime &GetLastScanTime(void);
-};
+ class CEpg : public std::vector<CEpgInfoTag*>
+ {
+ friend class CEpgDatabase;
+
+ protected:
+ bool m_bInhibitSorting; /*!< don't sort the table if this is true */
+ int m_iEpgID; /*!< the database ID of this table */
+ CStdString m_strName; /*!< the name of this table */
+ CStdString m_strScraperName; /*!< the name of the scraper to use */
+ mutable const CEpgInfoTag *m_nowActive; /*!< the tag that is currently active */
+
+ CDateTime m_lastScanTime; /*!< the last time the EPG has been updated */
+ CDateTime m_firstDate; /*!< start time of the first epg event in this table */
+ CDateTime m_lastDate; /*!< end time of the last epg event in this table */
+
+ PVR::CPVRChannel * m_Channel; /*!< the channel this EPG belongs to */
+
+ mutable CCriticalSection m_critSection; /*!< critical section for changes in this table */
+
+ /*!
+ * @brief Update the EPG from a scraper set in the channel tag.
+ * TODO: not implemented yet
+ * @param start Get entries with a start date after this time.
+ * @param end Get entries with an end date before this time.
+ * @return True if the update was successful, false otherwise.
+ */
+ virtual bool UpdateFromScraper(time_t start, time_t end);
+
+ /*!
+ * @brief Persist all tags in this container.
+ * @param bQueueWrite Don't execute the query immediately but queue it if true.
+ * @return True if all tags were persisted, false otherwise.
+ */
+ virtual bool PersistTags(bool bQueueWrite = false) const;
+
+ /*!
+ * @brief Fix overlapping events from the tables.
+ * @param bStore Store in the database if true.
+ * @return True if the events were fixed successfully, false otherwise.
+ */
+ virtual bool FixOverlappingEvents(bool bStore = true);
+
+ /*!
+ * @brief Create a new tag.
+ * @return The new tag.
+ */
+ virtual CEpgInfoTag *CreateTag(void);
+
+ /*!
+ * @brief Sort all entries in this EPG by date.
+ */
+ virtual void Sort(void);
+
+ /*!
+ * @brief Add an infotag to this container.
+ * @param tag The tag to add.
+ */
+ virtual void AddEntry(const CEpgInfoTag &tag);
+
+ /*!
+ * @brief Remove all tags between begin and end from this table.
+ * @param begin Remove all entries after this start time. Use 0 to remove all entries before "end".
+ * @param end Remove all entries before this end time. Use 0 to remove all before after "begin". If both "begin" and "end" are 0, all entries will be removed.
+ * @param bRemoveFromDb Set to true to remove these entries from the database too.
+ */
+ virtual void RemoveTagsBetween(time_t begin, time_t end, bool bRemoveFromDb = false);
+
+ /*!
+ * @see RemoveTagsBetween(time_t begin, time_t end, bool bRemoveFromDb = false)
+ */
+ virtual void RemoveTagsBetween(const CDateTime &begin, const CDateTime &end, bool bRemoveFromDb = false);
+
+ /*!
+ * @brief Load all EPG entries from clients into a temporary table and update this table with the contents of that temporary table.
+ * @param start Only get entries after this start time. Use 0 to get all entries before "end".
+ * @param end Only get entries before this end time. Use 0 to get all entries after "begin". If both "begin" and "end" are 0, all entries will be updated.
+ * @return True if the update was successful, false otherwise.
+ */
+ virtual bool LoadFromClients(time_t start, time_t end);
+
+ /*!
+ * @brief Update the contents of this table with the contents provided in "epg"
+ * @param epg The updated contents.
+ * @param bStoreInDb True to store the updated contents in the db, false otherwise.
+ * @return True if the update was successful, false otherwise.
+ */
+ virtual bool UpdateEntries(const CEpg &epg, bool bStoreInDb = true);
+
+ /*!
+ * @brief Update the cached first and last date.
+ */
+ virtual void UpdateFirstAndLastDates(void);
+
+ public:
+ /*!
+ * @brief Update this table's info with the given info. Doesn't change the EpgID.
+ * @param epg The new info.
+ * @param bUpdateDb If true, persist the changes.
+ * @return True if the update was successful, false otherwise.
+ */
+ virtual bool Update(const CEpg &epg, bool bUpdateDb = false);
+
+ /*!
+ * @brief Load all entries for this table from the database.
+ * @return True if any entries were loaded, false otherwise.
+ */
+ bool Load(void);
+
+ /*!
+ * @brief Create a new EPG instance.
+ * @param iEpgID The ID of this table or <= 0 to create a new ID.
+ * @param strName The name of this table.
+ * @param strScraperName The name of the scraper to use.
+ */
+ CEpg(int iEpgID, const CStdString &strName = "", const CStdString &strScraperName = "");
+
+ /*!
+ * @brief Destroy this EPG instance.
+ */
+ virtual ~CEpg(void);
+
+ /*!
+ * @brief The channel this EPG belongs to.
+ * @return The channel this EPG belongs to
+ */
+ const PVR::CPVRChannel *Channel(void) const { return m_Channel; }
+
+ /*!
+ * @brief Channel the channel tag linked to this EPG table.
+ * @param channel The new channel tag.
+ */
+ virtual void SetChannel(PVR::CPVRChannel *channel) { m_Channel = channel; }
+
+ /*!
+ * @brief Get the name of the scraper to use for this table.
+ * @return The name of the scraper to use for this table.
+ */
+ const CStdString &ScraperName(void) const { return m_strScraperName; }
+
+ /*!
+ * @brief Get the name of this table.
+ * @return The name of this table.
+ */
+ const CStdString &Name(void) const { return m_strName; }
+
+ /*!
+ * @brief Get the database ID of this table.
+ * @return The database ID of this table.
+ */
+ virtual int EpgID(void) const { return m_iEpgID; }
+
+ /*!
+ * @brief Check whether this EPG contains valid entries.
+ * @return True if it has valid entries, false if not.
+ */
+ virtual bool HasValidEntries(void) const;
+
+ /*!
+ * @brief Delete an infotag from this EPG.
+ * @param tag The tag to delete.
+ * @return True if it was deleted successfully, false if not.
+ */
+ virtual bool DeleteInfoTag(CEpgInfoTag *tag);
+
+ /*!
+ * @brief Remove all entries from this EPG that finished before the given time
+ * and that have no timers set.
+ * @param Time Delete entries with an end time before this time in UTC.
+ */
+ virtual void Cleanup(const CDateTime &Time);
+
+ /*!
+ * @brief Remove all entries from this EPG that finished before the given time
+ * and that have no timers set.
+ */
+ virtual void Cleanup(void);
+
+ /*!
+ * @brief Remove all entries from this EPG.
+ */
+ virtual void Clear(void);
+
+ /*!
+ * @brief Get the event that is occurring now.
+ * @return The current event.
+ */
+ virtual const CEpgInfoTag *InfoTagNow(void) const;
+
+ /*!
+ * @brief Get the event that will occur next.
+ * @return The next event.
+ */
+ virtual const CEpgInfoTag *InfoTagNext(void) const;
+
+ /*!
+ * @brief Get the event that occurs at the given time.
+ * @param time The time to find the event for.
+ * @return The found tag or NULL if it wasn't found.
+ */
+ virtual const CEpgInfoTag *GetTagAround(const CDateTime &time) const;
+
+ /*!
+ * Get the event that occurs between the given begin and end time.
+ * @param beginTime Minimum start time of the event.
+ * @param endTime Maximum end time of the event.
+ * @return The found tag or NULL if it wasn't found.
+ */
+ virtual const CEpgInfoTag *GetTagBetween(const CDateTime &beginTime, const CDateTime &endTime) const;
+
+ /*!
+ * @brief Get the infotag with the given ID.
+ *
+ * Get the infotag with the given ID.
+ * If it wasn't found, try finding the event with the given start time
+ *
+ * @param uniqueID The unique ID of the event to find.
+ * @param beginTime The start time of the event to find if it wasn't found by it's unique ID.
+ * @return The found tag or NULL if it wasn't found.
+ */
+ virtual const CEpgInfoTag *GetTag(int uniqueID, const CDateTime &beginTime) const;
+
+ /*!
+ * @brief Update an entry in this EPG.
+ * @param tag The tag to update.
+ * @param bUpdateDatabase If set to true, this event will be persisted in the database.
+ * @return True if it was updated successfully, false otherwise.
+ */
+ virtual bool UpdateEntry(const CEpgInfoTag &tag, bool bUpdateDatabase = false);
+
+ /*!
+ * @brief Update the EPG from 'start' till 'end'.
+ * @param start The start time.
+ * @param end The end time.
+ * @param iUpdateTime Update the table after the given amount of time has passed.
+ * @return True if the update was successful, false otherwise.
+ */
+ virtual bool Update(const time_t start, const time_t end, int iUpdateTime);
+
+ /*!
+ * @brief Get all EPG entries.
+ * @param results The file list to store the results in.
+ * @return The amount of entries that were added.
+ */
+ virtual int Get(CFileItemList *results) const;
+
+ /*!
+ * @brief Get all EPG entries that and apply a filter.
+ * @param results The file list to store the results in.
+ * @param filter The filter to apply.
+ * @return The amount of entries that were added.
+ */
+ virtual int Get(CFileItemList *results, const EpgSearchFilter &filter) const;
+
+ /*!
+ * @brief Persist this table in the database.
+ * @param bPersistTags Set to true to persist all changed tags in this container.
+ * @param bQueueWrite Don't execute the query immediately but queue it if true.
+ * @return True if the table was persisted, false otherwise.
+ */
+ virtual bool Persist(bool bPersistTags = false, bool bQueueWrite = false);
+
+ /*!
+ * @brief Get the start time of the first entry in this table.
+ * @return The first date.
+ */
+ virtual const CDateTime &GetFirstDate(void) const;
+
+ /*!
+ * @brief Get the end time of the last entry in this table.
+ * @return The last date.
+ */
+ virtual const CDateTime &GetLastDate(void) const;
+
+ /*!
+ * @return The last time this table was scanned.
+ */
+ virtual const CDateTime &GetLastScanTime(void);
+
+ /*!
+ * @brief Convert a genre id and subid to a human readable name.
+ * @param iID The genre ID.
+ * @param iSubID The genre sub ID.
+ * @return A human readable name.
+ */
+ static const CStdString &ConvertGenreIdToString(int iID, int iSubID);
+ };
+}
View
21 xbmc/epg/EpgContainer.cpp
@@ -34,15 +34,10 @@
#include "EpgInfoTag.h"
#include "EpgSearchFilter.h"
-#include "pvr/PVRManager.h"
-#include "pvr/addons/PVRClients.h"
-
using namespace std;
+using namespace EPG;
-CEpgContainer g_EpgContainer;
-
-CEpgContainer::CEpgContainer(void) :
- Observable()
+CEpgContainer::CEpgContainer(void)
{
m_bStop = true;
Clear(false);
@@ -53,6 +48,12 @@ CEpgContainer::~CEpgContainer(void)
Clear();
}
+CEpgContainer &CEpgContainer::Get(void)
+{
+ static CEpgContainer epgInstance;
+ return epgInstance;
+}
+
void CEpgContainer::Unload(void)
{
Stop();
@@ -143,7 +144,7 @@ void CEpgContainer::Process(void)
if (m_database.Open())
{
m_database.DeleteOldEpgEntries();
- m_database.Get(this);
+ m_database.Get(*this);
m_database.Close();
}
@@ -280,7 +281,7 @@ bool CEpgContainer::DeleteEpg(const CEpg &epg, bool bDeleteFromDatabase /* = fal
for (unsigned int iEpgPtr = 0; iEpgPtr < size(); iEpgPtr++)
{
- if (at(iEpgPtr)->m_iEpgID == epg.m_iEpgID)
+ if (at(iEpgPtr)->EpgID() == epg.EpgID())
{
if (bDeleteFromDatabase && m_database.Open())
{
@@ -325,7 +326,7 @@ bool CEpgContainer::UpdateSingleTable(CEpg *epg, const time_t start, const time_
bool CEpgContainer::InterruptUpdate(void) const
{
- return (m_bStop || (g_PVRManager.IsStarted() && g_PVRClients->IsPlaying()));;
+ return m_bStop;
}
bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
View
402 xbmc/epg/EpgContainer.h
@@ -30,205 +30,205 @@
#include "EpgDatabase.h"
class CFileItemList;
-class CPVREpg;
-class CPVREpgContainer;
-class CPVRManager;
-
-class CEpgContainer : public std::vector<CEpg *>,
- public Observer,
- public Observable,
- private CThread
+
+namespace EPG
{
- friend class CEpg;
- friend class CEpgDatabase;
-
- friend class CPVREpg;
- friend class CPVREpgContainer;
- friend class CPVRManager;
-
-private:
- CEpgDatabase m_database; /*!< the EPG database */
-
- /** @name Configuration */
- //@{
- bool m_bIgnoreDbForClient; /*!< don't save the EPG data in the database */
- int m_iDisplayTime; /*!< hours of EPG data to fetch */
- int m_iUpdateTime; /*!< update the full EPG after this period */
- //@}
-
- /** @name Class state properties */
- //@{
- bool m_bDatabaseLoaded; /*!< true if we already loaded the EPG from the database */
- time_t m_iLastEpgCleanup; /*!< the time the EPG was cleaned up */
- time_t m_iLastEpgUpdate; /*!< the time the EPG was updated */
- //@}
-
- CCriticalSection m_critSection; /*!< a critical section for changes to this container */
-
- /*!
- * @brief Load the EPG settings.
- * @return True if the settings were loaded successfully, false otherwise.
- */
- virtual bool LoadSettings(void);
-
- /*!
- * @brief Remove old EPG entries.
- * @return True if the old entries were removed successfully, false otherwise.
- */
- virtual bool RemoveOldEntries(void);
-
- /*!
- * @brief Load and update the EPG data.
- * @param bShowProgress Show a progress bar if true.
- * @return True if the update was successful, false otherwise.
- */
- virtual bool UpdateEPG(bool bShowProgress = false);
-
- /*!
- * @return True if a running update should be interrupted, false otherwise.
- */
- virtual bool InterruptUpdate(void) const;
-
- /*!
- * @brief Load or update a single table.
- * @param epg The table to update.
- * @param start The start time to use.
- * @param end The end time to use.
- * @return True if the load or update was successful, false otherwise.
- */
- virtual bool UpdateSingleTable(CEpg *epg, const time_t start, const time_t end);
-
- /*!
- * @brief A hook that will be called on every update thread iteration.
- */
- virtual void ProcessHook(const CDateTime &time) {};
-
- /*!
- * @brief A hook that is called after the tables have been loaded from the database.
- * @return True if the hook was executed successfully, false otherwise.
- */
- virtual bool AutoCreateTablesHook(void) { return true; }
-
- /*!
- * @brief Create a new EPG table.
- * @param iEpgId The table ID or -1 to create a new one.
- * @return The new table.
- */
- virtual CEpg *CreateEpg(int iEpgId);
-
-protected:
- /*!
- * @brief EPG update thread
- */
- virtual void Process(void);
-
-public:
- /*!
- * @brief Create a new EPG table container.
- */
- CEpgContainer(void);
-
- /*!
- * @brief Destroy this instance.
- */
- virtual ~CEpgContainer(void);
-
- /*!
- * @brief Get a pointer to the database instance.
- * @return A pointer to the database instance.
- */
- CEpgDatabase *GetDatabase(void) { return &m_database; }
-
- /*!
- * @brief Start the EPG update thread.
- */
- virtual void Start(void);
-
- /*!
- * @brief Stop the EPG update thread.
- * @return
- */
- virtual bool Stop(void);
-
- /*!
- * @brief Clear all EPG entries.
- * @param bClearDb Clear the database too if true.
- */
- virtual void Clear(bool bClearDb = false);
-
- /*!
- * @brief Stop the update thread and unload all data.
- */
- virtual void Unload(void);
-
- /*!
- * @brief Clear the EPG and all it's database entries.
- */
- virtual void Reset(void) { Clear(true); }
-
- /*!
- * @brief Delete an EPG table from this container.
- * @param epg The table to delete.
- * @param bDeleteFromDatabase Delete this table from the database too if true.
- * @return
- */
- virtual bool DeleteEpg(const CEpg &epg, bool bDeleteFromDatabase = false);
-
- /*!
- * @brief Process a notification from an observable.
- * @param obs The observable that sent the update.
- * @param msg The update message.
- */
- virtual void Notify(const Observable &obs, const CStdString& msg);
-
- /*!
- * @brief Update an entry in this container.
- * @param tag The table to update.
- * @param bUpdateDatabase If set to true, this table will be persisted in the database.
- * @return True if it was updated successfully, false otherwise.
- */
- virtual bool UpdateEntry(const CEpg &entry, bool bUpdateDatabase = false);
-
- /*!
- * @brief Get all EPG tables and apply a filter.
- * @param results The fileitem list to store the results in.
- * @param filter The filter to apply.
- * @return The amount of entries that were added.
- */
- virtual int GetEPGSearch(CFileItemList* results, const EpgSearchFilter &filter);
-
- /*!
- * @brief Get all EPG tables.
- * @param results The fileitem list to store the results in.
- * @return The amount of entries that were added.
- */
- virtual int GetEPGAll(CFileItemList* results);
-
- /*!
- * @brief Get the start time of the first entry.
- * @return The start time.
- */
- virtual const CDateTime GetFirstEPGDate(void) const;
-
- /*!
- * @brief Get the end time of the last entry.
- * @return The end time.
- */
- virtual const CDateTime GetLastEPGDate(void) const;
-
- /*!
- * @brief Get an EPG table given it's ID.
- * @param iEpgId The database ID of the table.
- * @return The table or NULL if it wasn't found.
- */
- virtual CEpg *GetById(int iEpgId) const;
-
- /*!
- * @brief Get an EPG table given it's index in this container.
- * @param iIndex The index.
- * @return The table or NULL if it wasn't found.
- */
- virtual CEpg *GetByIndex(unsigned int iIndex) const;
-};
-
-extern CEpgContainer g_EpgContainer; /*!< The container for all EPG tables */
+ #define g_EpgContainer CEpgContainer::Get()
+
+ class CEpgContainer : public std::vector<CEpg *>,
+ public Observer,
+ public Observable,
+ private CThread
+ {
+ friend class CEpgDatabase;
+
+ protected:
+ CEpgDatabase m_database; /*!< the EPG database */
+
+ /** @name Configuration */
+ //@{
+ bool m_bIgnoreDbForClient; /*!< don't save the EPG data in the database */
+ int m_iDisplayTime; /*!< hours of EPG data to fetch */
+ int m_iUpdateTime; /*!< update the full EPG after this period */
+ //@}
+
+ /** @name Class state properties */
+ //@{
+ bool m_bDatabaseLoaded; /*!< true if we already loaded the EPG from the database */
+ time_t m_iLastEpgCleanup; /*!< the time the EPG was cleaned up */
+ time_t m_iLastEpgUpdate; /*!< the time the EPG was updated */
+ //@}
+
+ CCriticalSection m_critSection; /*!< a critical section for changes to this container */
+
+ /*!
+ * @brief Load the EPG settings.
+ * @return True if the settings were loaded successfully, false otherwise.
+ */
+ virtual bool LoadSettings(void);
+
+ /*!
+ * @brief Remove old EPG entries.
+ * @return True if the old entries were removed successfully, false otherwise.
+ */
+ virtual bool RemoveOldEntries(void);
+
+ /*!
+ * @brief Load and update the EPG data.
+ * @param bShowProgress Show a progress bar if true.
+ * @return True if the update was successful, false otherwise.
+ */
+ virtual bool UpdateEPG(bool bShowProgress = false);
+
+ /*!
+ * @return True if a running update should be interrupted, false otherwise.
+ */
+ virtual bool InterruptUpdate(void) const;
+
+ /*!
+ * @brief Load or update a single table.
+ * @param epg The table to update.
+ * @param start The start time to use.
+ * @param end The end time to use.
+ * @return True if the load or update was successful, false otherwise.
+ */
+ virtual bool UpdateSingleTable(CEpg *epg, const time_t start, const time_t end);
+
+ /*!
+ * @brief A hook that will be called on every update thread iteration.
+ */
+ virtual void ProcessHook(const CDateTime &time) {};
+
+ /*!
+ * @brief A hook that is called after the tables have been loaded from the database.
+ * @return True if the hook was executed successfully, false otherwise.
+ */
+ virtual bool AutoCreateTablesHook(void) { return true; }
+
+ /*!
+ * @brief Create a new EPG table.
+ * @param iEpgId The table ID or -1 to create a new one.
+ * @return The new table.
+ */
+ virtual CEpg *CreateEpg(int iEpgId);
+
+ protected:
+ /*!
+ * @brief EPG update thread
+ */
+ virtual void Process(void);
+
+ /*!
+ * @brief Create a new EPG table container.
+ */
+ CEpgContainer(void);
+
+ public:
+ /*!
+ * @brief Destroy this instance.
+ */
+ virtual ~CEpgContainer(void);
+
+ /*!
+ * @return An instance of this singleton.
+ */
+ static CEpgContainer &Get(void);
+
+ /*!
+ * @brief Get a pointer to the database instance.
+ * @return A pointer to the database instance.
+ */
+ CEpgDatabase *GetDatabase(void) { return &m_database; }
+
+ /*!
+ * @brief Start the EPG update thread.
+ */
+ virtual void Start(void);
+
+ /*!
+ * @brief Stop the EPG update thread.
+ * @return
+ */
+ virtual bool Stop(void);
+
+ /*!
+ * @brief Clear all EPG entries.
+ * @param bClearDb Clear the database too if true.
+ */
+ virtual void Clear(bool bClearDb = false);
+
+ /*!
+ * @brief Stop the update thread and unload all data.
+ */
+ virtual void Unload(void);
+
+ /*!
+ * @brief Clear the EPG and all it's database entries.
+ */
+ virtual void Reset(void) { Clear(true); }
+
+ /*!
+ * @brief Delete an EPG table from this container.
+ * @param epg The table to delete.
+ * @param bDeleteFromDatabase Delete this table from the database too if true.
+ * @return
+ */
+ virtual bool DeleteEpg(const CEpg &epg, bool bDeleteFromDatabase = false);
+
+ /*!
+ * @brief Process a notification from an observable.
+ * @param obs The observable that sent the update.
+ * @param msg The update message.
+ */
+ virtual void Notify(const Observable &obs, const CStdString& msg);
+
+ /*!
+ * @brief Update an entry in this container.
+ * @param tag The table to update.
+ * @param bUpdateDatabase If set to true, this table will be persisted in the database.
+ * @return True if it was updated successfully, false otherwise.
+ */
+ virtual bool UpdateEntry(const CEpg &entry, bool bUpdateDatabase = false);
+
+ /*!
+ * @brief Get all EPG tables and apply a filter.
+ * @param results The fileitem list to store the results in.
+ * @param filter The filter to apply.
+ * @return The amount of entries that were added.
+ */
+ virtual int GetEPGSearch(CFileItemList* results, const EpgSearchFilter &filter);
+
+ /*!
+ * @brief Get all EPG tables.
+ * @param results The fileitem list to store the results in.
+ * @return The amount of entries that were added.
+ */
+ virtual int GetEPGAll(CFileItemList* results);
+
+ /*!
+ * @brief Get the start time of the first entry.
+ * @return The start time.
+ */
+ virtual const CDateTime GetFirstEPGDate(void) const;
+
+ /*!
+ * @brief Get the end time of the last entry.
+ * @return The end time.
+ */
+ virtual const CDateTime GetLastEPGDate(void) const;
+
+ /*!
+ * @brief Get an EPG table given it's ID.
+ * @param iEpgId The database ID of the table.
+ * @return The table or NULL if it wasn't found.
+ */
+ virtual CEpg *GetById(int iEpgId) const;
+
+ /*!
+ * @brief Get an EPG table given it's index in this container.
+ * @param iIndex The index.
+ * @return The table or NULL if it wasn't found.
+ */
+ virtual CEpg *GetByIndex(unsigned int iIndex) const;
+ };
+}
View
23 xbmc/epg/EpgDatabase.cpp
@@ -29,14 +29,7 @@
using namespace std;
using namespace dbiplus;
-
-CEpgDatabase::CEpgDatabase(void)
-{
-}
-
-CEpgDatabase::~CEpgDatabase(void)
-{
-}
+using namespace EPG;
bool CEpgDatabase::Open(void)
{
@@ -183,7 +176,7 @@ bool CEpgDatabase::Delete(const CEpgInfoTag &tag)
return DeleteValues("epgtags", strWhereClause);
}
-int CEpgDatabase::Get(CEpgContainer *container)
+int CEpgDatabase::Get(CEpgContainer &container)
{
int iReturn = -1;
@@ -201,7 +194,7 @@ int CEpgDatabase::Get(CEpgContainer *container)
CStdString strScraperName = m_pDS->fv("sScraperName").get_asString().c_str();
CEpg newEpg(iEpgID, strName, strScraperName);
- if (container->UpdateEntry(newEpg))
+ if (container.UpdateEntry(newEpg))
++iReturn;
else
{
@@ -226,12 +219,12 @@ int CEpgDatabase::Get(CEpgContainer *container)
return iReturn;
}
-int CEpgDatabase::Get(CEpg *epg)
+int CEpgDatabase::Get(CEpg &epg)
{
int iReturn = -1;
CStdString strWhereClause;
- strWhereClause = FormatSQL("idEpg = %u", epg->EpgID());
+ strWhereClause = FormatSQL("idEpg = %u", epg.EpgID());
CStdString strQuery;
strQuery.Format("SELECT * FROM epgtags WHERE %s ORDER BY iStartTime ASC;", strWhereClause.c_str());
@@ -268,12 +261,12 @@ int CEpgDatabase::Get(CEpg *epg)
newTag.m_iParentalRating = m_pDS->fv("iParentalRating").get_asInt();
newTag.m_iStarRating = m_pDS->fv("iStarRating").get_asInt();
newTag.m_bNotify = m_pDS->fv("bNotify").get_asBool();
- newTag.m_iEpisodeNumber = m_pDS->fv("iEpisodeId").get_asInt();
+ newTag.m_iEpisodeNumber = m_pDS->fv("iEpisodeId").get_asInt();
newTag.m_iEpisodePart = m_pDS->fv("iEpisodePart").get_asInt();
newTag.m_strEpisodeName = m_pDS->fv("sEpisodeName").get_asString().c_str();
- newTag.m_iSeriesNumber = m_pDS->fv("iSeriesId").get_asInt();
+ newTag.m_iSeriesNumber = m_pDS->fv("iSeriesId").get_asInt();
- epg->AddEntry(newTag);
+ epg.AddEntry(newTag);
++iReturn;
m_pDS->next();
View
263 xbmc/epg/EpgDatabase.h
@@ -23,134 +23,137 @@
#include "dbwrappers/Database.h"
#include "XBDateTime.h"
-class CEpg;
-class CEpgInfoTag;
-class CEpgContainer;
-
-/** The EPG database */
-
-class CEpgDatabase : public CDatabase
+namespace EPG
{
-public:
- /*!
- * @brief Create a new instance of the EPG database.
- */
- CEpgDatabase(void);
-
- /*!
- * @brief Destroy this instance.
- */
- virtual ~CEpgDatabase(void);
-
- /*!
- * @brief Open the database.
- * @return True if it was opened successfully, false otherwise.
- */
- virtual bool Open(void);
-
- /*!
- * @brief Get the minimal database version that is required to operate correctly.
- * @return The minimal database version.
- */
- virtual int GetMinVersion(void) const { return 4; };
-
- /*!
- * @brief Get the default sqlite database filename.
- * @return The default filename.
- */
- const char *GetBaseDBName(void) const { return "Epg"; };
-
- /*! @name EPG methods */
- //@{
-
- /*!
- * @brief Remove all EPG information from the database
- * @return True if the EPG information was erased, false otherwise.
- */
- virtual bool DeleteEpg(void);
-
- /*!
- * @brief Erase all EPG entries for a table.
- * @param table The table to remove the EPG entries for.
- * @param start Remove entries after this time if set.
- * @param end Remove entries before this time if set.
- * @return True if the entries were removed successfully, false otherwise.
- */
- virtual bool Delete(const CEpg &table, const time_t start = 0, const time_t end = 0);
-
- /*!
- * @brief Erase all EPG entries older than 1 day.
- * @return True if the entries were removed successfully, false otherwise.
- */
- virtual bool DeleteOldEpgEntries(void);
-
- /*!
- * @brief Remove a single EPG entry.
- * @param tag The entry to remove.
- * @return True if it was removed successfully, false otherwise.
- */
- virtual bool Delete(const CEpgInfoTag &tag);
-
- /*!
- * @brief Get all EPG tables from the database. Does not get the EPG tables' entries.
- * @param container The container to fill.
- * @return The amount of entries that was added.
- */
- virtual int Get(CEpgContainer *container);
-
- /*!
- * @brief Get all EPG entries for a table.
- * @param epg The EPG table to get the entries for.
- * @return The amount of entries that was added.
- */
- virtual int Get(CEpg *epg);
-
- /*!
- * @brief Get the last stored EPG scan time.
- * @param iEpgId The table to update the time for. Use 0 for a global value.
- * @param lastScan The last scan time or -1 if it wasn't found.
- * @return True if the time was fetched successfully, false otherwise.
- */
- virtual bool GetLastEpgScanTime(int iEpgId, CDateTime *lastScan);
-
- /*!
- * @brief Update the last scan time.
- * @param iEpgId The table to update the time for. Use 0 for a global value.
- * @param bQueueWrite Don't execute the query immediately but queue it if true.
- * @return True if it was updated successfully, false otherwise.
- */
- virtual bool PersistLastEpgScanTime(int iEpgId = 0, bool bQueueWrite = false);
-
- /*!
- * @brief Persist an EPG table. It's entries are not persisted.
- * @param epg The table to persist.
- * @param bQueueWrite Don't execute the query immediately but queue it if true.
- * @return The database ID of this entry or 0 if bSingleUpdate is false and the query was queued.
- */
- virtual int Persist(const CEpg &epg, bool bQueueWrite = false);
-
- /*!
- * @brief Persist an infotag.
- * @param tag The tag to persist.
- * @param bSingleUpdate If true, this is a single update and the query will be executed immediately.
- * @param bLastUpdate If multiple updates were sent, set this to true on the last update to execute the queries.
- * @return The database ID of this entry or 0 if bSingleUpdate is false and the query was queued.
- */
- virtual int Persist(const CEpgInfoTag &tag, bool bSingleUpdate = true, bool bLastUpdate = false);
-
- //@}
-
-private:
- /*!
- * @brief Create the EPG database tables.
- * @return True if the tables were created successfully, false otherwise.
- */
- virtual bool CreateTables(void);
-
- /*!
- * @brief Update an old version of the database.
- * @param version The version to update the database from.
- * @return True if it was updated successfully, false otherwise.
- */
- virtual bool UpdateOldVersion(int version);
-};
+ class CEpg;
+ class CEpgInfoTag;
+ class CEpgContainer;
+
+ /** The EPG database */
+
+ class CEpgDatabase : public CDatabase
+ {
+ public:
+ /*!
+ * @brief Create a new instance of the EPG database.
+ */
+ CEpgDatabase(void) {};
+
+ /*!
+ * @brief Destroy this instance.
+ */
+ virtual ~CEpgDatabase(void) {};
+
+ /*!
+ * @brief Open the database.
+ * @return True if it was opened successfully, false otherwise.
+ */
+ virtual bool Open(void);
+
+ /*!
+ * @brief Get the minimal database version that is required to operate correctly.
+ * @return The minimal database version.
+ */
+ virtual int GetMinVersion(void) const { return 4; };
+
+ /*!
+ * @brief Get the default sqlite database filename.
+ * @return The default filename.
+ */
+ const char *GetBaseDBName(void) const { return "Epg"; };
+
+ /*! @name EPG methods */
+ //@{
+
+ /*!
+ * @brief Remove all EPG information from the database
+ * @return True if the EPG information was erased, false otherwise.
+ */