Skip to content
Browse files

Merge branch 'master' into pvr-ppa

  • Loading branch information...
2 parents ab82e45 + 26ec15a commit 248d3f123a1fac2931f20d8aae78c241860aeb46 @opdenkamp opdenkamp committed
Showing with 943 additions and 5,221 deletions.
  1. +1 −1 addons/pvr.hts/resources/language/Dutch/strings.xml
  2. +1 −1 addons/pvr.hts/resources/language/English/strings.xml
  3. +0 −1 addons/pvr.hts/resources/language/Finnish/strings.xml
  4. +1 −1 addons/pvr.hts/resources/settings.xml
  5. +2 −2 addons/skin.confluence/720p/DialogPVRGuideOSD.xml
  6. +8 −8 addons/skin.confluence/720p/ViewsPVR.xml
  7. +1 −0 language/English/strings.xml
  8. +4 −4 xbmc/addons/AddonCallbacksPVR.cpp
  9. +13 −13 xbmc/addons/include/xbmc_pvr_types.h
  10. +4 −2 xbmc/epg/Epg.cpp
  11. +1 −1 xbmc/epg/Epg.h
  12. +58 −30 xbmc/epg/EpgContainer.cpp
  13. +14 −0 xbmc/epg/EpgContainer.h
  14. +6 −5 xbmc/pvr/PVRGUIInfo.cpp
  15. +48 −43 xbmc/pvr/PVRManager.cpp
  16. +2 −5 xbmc/pvr/PVRManager.h
  17. +41 −59 xbmc/pvr/addons/PVRClient.cpp
  18. +3 −3 xbmc/pvr/addons/PVRClient.h
  19. +4 −0 xbmc/pvr/channels/PVRChannel.cpp
  20. +4 −0 xbmc/pvr/channels/PVRChannelGroup.cpp
  21. +16 −7 xbmc/pvr/channels/PVRChannelGroupInternal.cpp
  22. +1 −1 xbmc/pvr/epg/PVREpgInfoTag.cpp
  23. +3 −0 xbmc/pvr/recordings/PVRRecordings.cpp
  24. +44 −28 xbmc/pvr/timers/PVRTimerInfoTag.cpp
  25. +1 −1 xbmc/pvr/timers/PVRTimerInfoTag.h
  26. +37 −34 xbmc/pvr/timers/PVRTimers.cpp
  27. +1 −1 xbmc/pvr/windows/GUIWindowPVR.cpp
  28. +6 −0 xbmc/pvr/windows/GUIWindowPVRChannels.cpp
  29. +5 −17 xbmc/pvr/windows/GUIWindowPVRCommon.cpp
  30. +8 −24 xbmc/pvr/windows/GUIWindowPVRGuide.cpp
  31. +1 −1 xbmc/pvr/windows/GUIWindowPVRGuide.h
  32. +5 −0 xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
  33. +5 −0 xbmc/pvr/windows/GUIWindowPVRSearch.cpp
  34. +8 −14 xbmc/pvr/windows/GUIWindowPVRTimers.cpp
  35. +45 −37 xbmc/pvrclients/tvheadend/HTSPData.cpp
  36. +30 −24 xbmc/pvrclients/tvheadend/HTSPData.h
  37. +37 −129 xbmc/pvrclients/tvheadend/HTSPDemux.cpp
  38. +4 −3 xbmc/pvrclients/tvheadend/HTSPDemux.h
  39. +107 −58 xbmc/pvrclients/tvheadend/HTSPSession.cpp
  40. +33 −235 xbmc/pvrclients/tvheadend/HTSPSession.h
  41. +235 −0 xbmc/pvrclients/tvheadend/HTSPTypes.h
  42. +0 −4,333 xbmc/pvrclients/tvheadend/StdString.h
  43. +71 −64 xbmc/pvrclients/tvheadend/client.cpp
  44. +19 −26 xbmc/pvrclients/tvheadend/client.h
  45. +1 −1 xbmc/pvrclients/tvheadend/thread.cpp
  46. +1 −1 xbmc/pvrclients/tvheadend/tools.h
  47. +3 −3 xbmc/pvrclients/vdr-vnsi/VNSIData.cpp
View
2 addons/pvr.hts/resources/language/Dutch/strings.xml
@@ -6,7 +6,7 @@
<string id="30002">HTSP poort</string>
<string id="30003">Gebruikersnaam</string>
<string id="30004">Wachtwoord</string>
- <string id="30005">Sla eerste I-frames over</string>
<string id="30006">Verbinding timeout in seconden</string>
<string id="30007">Antwoord timeout in seconden</string>
+ <string id="30008">Toon een melding bij timer updates</string>
</strings>
View
2 addons/pvr.hts/resources/language/English/strings.xml
@@ -6,7 +6,7 @@
<string id="30002">HTSP port</string>
<string id="30003">Username</string>
<string id="30004">Password</string>
- <string id="30005">Skip first I-frames</string>
<string id="30006">Connect timeout in seconds</string>
<string id="30007">Response timeout in seconds</string>
+ <string id="30008">Display a notification on timer updates</string>
</strings>
View
1 addons/pvr.hts/resources/language/Finnish/strings.xml
@@ -6,5 +6,4 @@
<string id="30002">HTSP-portti</string>
<string id="30003">Käyttäjänimi</string>
<string id="30004">Salasana</string>
- <string id="30005">Ohita ensimmäinen I-frame</string>
</strings>
View
2 addons/pvr.hts/resources/settings.xml
@@ -5,7 +5,7 @@
<setting id="htsp_port" type="integer" label="30002" default="9982" />
<setting id="user" type="text" label="30003" default="" />
<setting id="pass" type="text" label="30004" option="hidden" default="" />
- <setting id="skip_I_frame_count" type="enum" label="30005" values="0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15" default="0" />
<setting id="connect_timeout" type="enum" label="30006" values="1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60" default="29" />
<setting id="response_timeout" type="enum" label="30007" values="1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60" default="1" />
+ <setting id="notifications_timers" type="bool" label="30008" default="true" />
</settings>
View
4 addons/skin.confluence/720p/DialogPVRGuideOSD.xml
@@ -140,7 +140,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
</itemlayout>
<focusedlayout height="60" width="500">
@@ -225,7 +225,7 @@
<posy>30</posy>
<width>20</width>
<height>20</height>
- <texture>PVR-HasTimer.png</texture>
+ <texture>PVR-HasTimer.png + !ListItem.IsRecording</texture>
<visible>ListItem.HasTimer</visible>
</control>
</focusedlayout>
View
16 addons/skin.confluence/720p/ViewsPVR.xml
@@ -777,7 +777,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
</itemlayout>
<focusedlayout height="52" width="40">
@@ -821,7 +821,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
</focusedlayout>
</control>
@@ -1262,7 +1262,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
<control type="label">
<posx>1000</posx>
@@ -1392,7 +1392,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
<control type="label">
<posx>1000</posx>
@@ -1583,7 +1583,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
<control type="label">
<posx>1000</posx>
@@ -1715,7 +1715,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
<control type="label">
<posx>1000</posx>
@@ -1938,7 +1938,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
<control type="label">
<posx>1000</posx>
@@ -2089,7 +2089,7 @@
<width>20</width>
<height>20</height>
<texture>PVR-HasTimer.png</texture>
- <visible>ListItem.HasTimer</visible>
+ <visible>ListItem.HasTimer + !ListItem.IsRecording</visible>
</control>
<control type="label">
<posx>1000</posx>
View
1 language/English/strings.xml
@@ -1749,6 +1749,7 @@
<string id="19220">Channels in</string>
<string id="19221">Synchronise channel groups with backends</string>
<string id="19222">EPG</string>
+ <string id="19223">No PVR add-on could be enabled. Check your settings or the log for more info.</string>
<string id="19499">Other/Unknown</string>
<string id="19500">Movie/Drama</string>
View
8 xbmc/addons/AddonCallbacksPVR.cpp
@@ -173,9 +173,9 @@ void CAddonCallbacksPVR::PVRTransferTimerEntry(void *addonData, const PVR_HANDLE
return;
}
- CPVRTimers *xbmcTimers = (CPVRTimers*) handle->dataAddress;
- CPVRClient* client = (CPVRClient*) handle->callerAddress;
- const CPVRChannel *channel = CPVRManager::GetChannelGroups()->GetByUniqueID(timer->iClientChannelUid, client->GetClientID());
+ CPVRTimers *xbmcTimers = (CPVRTimers*) handle->dataAddress;
+ CPVRClient* client = (CPVRClient*) handle->callerAddress;
+ CPVRChannel *channel = (CPVRChannel *) CPVRManager::GetChannelGroups()->GetByUniqueID(timer->iClientChannelUid, client->GetClientID());
if (channel == NULL)
{
@@ -184,7 +184,7 @@ void CAddonCallbacksPVR::PVRTransferTimerEntry(void *addonData, const PVR_HANDLE
return;
}
- CPVRTimerInfoTag tag(*timer, client->GetClientID());
+ CPVRTimerInfoTag tag(*timer, channel, client->GetClientID());
/* transfer this entry to the timers container */
xbmcTimers->UpdateFromClient(tag);
View
26 xbmc/addons/include/xbmc_pvr_types.h
@@ -135,22 +135,22 @@ extern "C" {
} PVR_EVENT;
/*!
- * @brief PVR add-on capabilities.
+ * @brief PVR add-on capabilities. All capabilities are set to "false" as default.
*/
typedef struct PVR_ADDON_CAPABILITIES
{
- bool bSupportsChannelLogo; /*!< @brief (required) true if this add-on supports channel logos */
- bool bSupportsChannelSettings; /*!< @brief (required) true if this add-on supports changing channel settings on the backend */
- bool bSupportsTimeshift; /*!< @brief (required) true if the backend will handle timeshift. false if XBMC should handle it. */
- bool bSupportsEPG; /*!< @brief (required) true if the add-on provides EPG information */
- bool bSupportsTV; /*!< @brief (required) true if this add-on provides TV channels */
- bool bSupportsRadio; /*!< @brief (required) true if this add-on supports radio channels */
- bool bSupportsRecordings; /*!< @brief (required) true if this add-on supports playback of recordings stored on the backend */
- bool bSupportsTimers; /*!< @brief (required) true if this add-on supports the creation and editing of timers */
- bool bSupportsChannelGroups; /*!< @brief (required) true if this add-on supports channel groups */
- bool bSupportsChannelScan; /*!< @brief (required) true if this add-on support scanning for new channels on the backend */
- bool bHandlesInputStream; /*!< @brief (required) true if this add-on provides an input stream. false if XBMC handles the stream. */
- bool bHandlesDemuxing; /*!< @brief (required) true if this add-on demultiplexes packets. */
+ bool bSupportsChannelLogo; /*!< @brief (optional) true if this add-on supports channel logos */
+ bool bSupportsChannelSettings; /*!< @brief (optional) true if this add-on supports changing channel settings on the backend */
+ bool bSupportsTimeshift; /*!< @brief (optional) true if the backend will handle timeshift. false if XBMC should handle it. */
+ bool bSupportsEPG; /*!< @brief (optional) true if the add-on provides EPG information */
+ bool bSupportsTV; /*!< @brief (optional) true if this add-on provides TV channels */
+ bool bSupportsRadio; /*!< @brief (optional) true if this add-on supports radio channels */
+ bool bSupportsRecordings; /*!< @brief (optional) true if this add-on supports playback of recordings stored on the backend */
+ bool bSupportsTimers; /*!< @brief (optional) true if this add-on supports the creation and editing of timers */
+ bool bSupportsChannelGroups; /*!< @brief (optional) true if this add-on supports channel groups */
+ bool bSupportsChannelScan; /*!< @brief (optional) true if this add-on support scanning for new channels on the backend */
+ bool bHandlesInputStream; /*!< @brief (optional) true if this add-on provides an input stream. false if XBMC handles the stream. */
+ bool bHandlesDemuxing; /*!< @brief (optional) true if this add-on demultiplexes packets. */
} ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES;
/*!
View
6 xbmc/epg/Epg.cpp
@@ -151,14 +151,14 @@ void CEpg::Clear(void)
void CEpg::Cleanup(void)
{
- Cleanup(CDateTime::GetCurrentDateTime());
+ Cleanup(CDateTime::GetCurrentDateTime().GetAsUTCDateTime());
}
void CEpg::Cleanup(const CDateTime &Time)
{
CSingleLock lock(m_critSection);
- CDateTime firstDate = Time.GetAsUTCDateTime() - CDateTimeSpan(0, g_advancedSettings.m_iEpgLingerTime / 60, g_advancedSettings.m_iEpgLingerTime % 60, 0);
+ CDateTime firstDate = Time - CDateTimeSpan(0, g_advancedSettings.m_iEpgLingerTime / 60, g_advancedSettings.m_iEpgLingerTime % 60, 0);
CDateTime dummy; dummy.SetValid(false);
RemoveTagsBetween(dummy, firstDate);
@@ -245,6 +245,8 @@ const CEpgInfoTag *CEpg::InfoTagNow(void) const
const CEpgInfoTag *CEpg::InfoTagNext(void) const
{
+ CSingleLock lock(m_critSection);
+
const CEpgInfoTag *nowTag = InfoTagNow();
return nowTag ? nowTag->GetNextEvent() : NULL;
View
2 xbmc/epg/Epg.h
@@ -199,7 +199,7 @@ class CEpg : public std::vector<CEpgInfoTag*>
/*!
* @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.
+ * @param Time Delete entries with an end time before this time in UTC.
*/
virtual void Cleanup(const CDateTime &Time);
View
88 xbmc/epg/EpgContainer.cpp
@@ -149,8 +149,6 @@ void CEpgContainer::Process(void)
AutoCreateTablesHook();
- bool bInitialLoadSucess = UpdateEPG(true);
-
while (!m_bStop)
{
CDateTime::GetCurrentDateTime().GetAsTime(iNow);
@@ -158,8 +156,7 @@ void CEpgContainer::Process(void)
/* load or update the EPG */
if (!m_bStop && (iNow > m_iLastEpgUpdate + g_advancedSettings.m_iEpgUpdateCheckInterval || !m_bDatabaseLoaded))
{
- UpdateEPG(!bInitialLoadSucess);
- bInitialLoadSucess = true;
+ UpdateEPG(!m_bDatabaseLoaded);
}
/* clean up old entries */
@@ -299,12 +296,54 @@ bool CEpgContainer::DeleteEpg(const CEpg &epg, bool bDeleteFromDatabase /* = fal
return bReturn;
}
+bool CEpgContainer::UpdateSingleTable(CEpg *epg, const time_t start, const time_t end)
+{
+ bool bReturn(false);
+
+ if (!epg)
+ return bReturn;
+
+ if (m_bDatabaseLoaded)
+ epg->Cleanup();
+
+ bReturn = m_bDatabaseLoaded || m_bIgnoreDbForClient ?
+ epg->Update(start, end, m_iUpdateTime) :
+ epg->Load();
+
+ /* try to update the table from clients if nothing was loaded from the db */
+ if (!m_bDatabaseLoaded && !m_bIgnoreDbForClient && !bReturn)
+ bReturn = epg->Update(start, end, m_iUpdateTime);
+
+ if (!bReturn && m_bDatabaseLoaded)
+ {
+ CLog::Log(LOGERROR, "EpgContainer - %s - failed to update table '%s'",
+ __FUNCTION__, epg->Name().c_str());
+ }
+
+ return bReturn;
+}
+
+bool CEpgContainer::InterruptUpdate(void) const
+{
+ if (m_bStop || (CPVRManager::Get()->IsStarted() && CPVRManager::GetClients()->IsPlaying()))
+ {
+ CLog::Log(LOGNOTICE, "EpgContainer - %s - EPG load/update interrupted", __FUNCTION__);
+ return true;
+ }
+
+ return false;
+}
+
bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
{
CSingleLock lock(m_critSection);
unsigned int iEpgCount = size();
+
+ if (InterruptUpdate())
+ return false;
lock.Leave();
+ bool bInterrupted(false);
long iStartTime = CTimeUtils::GetTimeMS();
bool bUpdateSuccess = true;
CGUIDialogExtendedProgressBar *progress = NULL;
@@ -319,7 +358,7 @@ bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
/* set start and end time */
time_t start;
time_t end;
- CDateTime::GetCurrentDateTime().GetAsTime(start); // NOTE: XBMC stores the EPG times as local time
+ CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(start);
end = start;
start -= g_advancedSettings.m_iEpgLingerTime * 60;
end += m_iDisplayTime;
@@ -344,11 +383,9 @@ bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
/* load or update all EPG tables */
for (unsigned int iEpgPtr = 0; iEpgPtr < iEpgCount; iEpgPtr++)
{
- /* interrupt the update on exit or when livetv is playing */
- if (m_bStop || (CPVRManager::Get()->IsStarted() && CPVRManager::GetClients()->IsPlaying()))
+ if (InterruptUpdate())
{
- CLog::Log(LOGNOTICE, "EpgContainer - %s - EPG load/update interrupted", __FUNCTION__);
- bUpdateSuccess = false;
+ bInterrupted = true;
break;
}
@@ -356,20 +393,7 @@ bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
if (!epg)
continue;
- if (m_bDatabaseLoaded)
- at(iEpgPtr)->Cleanup();
-
- bool bCurrent = m_bDatabaseLoaded || m_bIgnoreDbForClient ?
- at(iEpgPtr)->Update(start, end, m_iUpdateTime) :
- at(iEpgPtr)->Load() && bUpdateSuccess;
-
- /* try to update the table from clients if nothing was loaded from the db */
- if (!m_bDatabaseLoaded && !m_bIgnoreDbForClient && !bCurrent)
- bCurrent = at(iEpgPtr)->Update(start, end, m_iUpdateTime);
-
- if (!bCurrent && m_bDatabaseLoaded)
- CLog::Log(LOGERROR, "EpgContainer - %s - failed to update table '%s'",
- __FUNCTION__, at(iEpgPtr)->Name().c_str());
+ bool bCurrent = UpdateSingleTable(epg, start, end);
bUpdateSuccess = bCurrent && bUpdateSuccess;
if (bCurrent)
@@ -387,10 +411,17 @@ bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
Sleep(50); /* give other threads a chance to get a lock on tables */
}
- CDateTime::GetCurrentDateTime().GetAsTime(m_iLastEpgUpdate);
- /* update the last scan time if we did a full update */
- if (bUpdateSuccess && m_bDatabaseLoaded && !m_bIgnoreDbForClient)
- m_database.PersistLastEpgScanTime(0);
+ if (!bInterrupted)
+ {
+ /* only try to load the database once */
+ m_bDatabaseLoaded = true;
+
+ CDateTime::GetCurrentDateTime().GetAsTime(m_iLastEpgUpdate);
+ /* update the last scan time if we did a full update */
+ if (bUpdateSuccess && m_bDatabaseLoaded && !m_bIgnoreDbForClient)
+ m_database.PersistLastEpgScanTime(0);
+ }
+
m_database.Close();
if (bShowProgress)
@@ -400,9 +431,6 @@ bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
CLog::Log(LOGINFO, "EpgContainer - %s - finished %s %d EPG tables after %li.%li seconds",
__FUNCTION__, m_bDatabaseLoaded ? "updating" : "loading", iEpgCount, lUpdateTime / 1000, lUpdateTime % 1000);
- /* only try to load the database once */
- m_bDatabaseLoaded = true;
-
/* notify observers */
if (iUpdatedTables > 0)
{
View
14 xbmc/epg/EpgContainer.h
@@ -85,6 +85,20 @@ class CEpgContainer : public std::vector<CEpg *>,
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) {};
View
11 xbmc/pvr/PVRGUIInfo.cpp
@@ -659,14 +659,15 @@ void CPVRGUIInfo::UpdatePlayingTag(void)
{
CSingleLock lock(m_critSection);
- if (m_playingEpgTag && m_playingEpgTag->IsActive())
- return;
-
CPVRChannel currentChannel;
if (CPVRManager::Get()->GetCurrentChannel(&currentChannel))
{
- m_playingEpgTag = currentChannel.GetEPGNow();
- CPVRManager::Get()->UpdateCurrentFile();
+ if (!m_playingEpgTag || !m_playingEpgTag->IsActive() ||
+ !(*m_playingEpgTag->ChannelTag() == currentChannel))
+ {
+ m_playingEpgTag = currentChannel.GetEPGNow();
+ CPVRManager::Get()->UpdateCurrentFile();
+ }
}
}
View
91 xbmc/pvr/PVRManager.cpp
@@ -38,10 +38,9 @@
#include "settings/Settings.h"
#include "filesystem/StackDirectory.h"
-/* GUI Messages includes */
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogProgress.h"
-#include "dialogs/GUIDialogSelect.h"
+#include "dialogs/GUIDialogBusy.h"
#include "PVRManager.h"
#include "addons/PVRClients.h"
@@ -109,31 +108,6 @@ void CPVRManager::Destroy(void)
}
}
-void CPVRManager::Unload(void)
-{
- CLog::Log(LOGNOTICE, "PVRManager - stopping");
-
- /* stop playback if a pvr file is playing */
- if (IsPlaying())
- {
- CLog::Log(LOGNOTICE,"PVRManager - %s - stopping PVR playback", __FUNCTION__);
- g_application.StopPlaying();
- }
-
- /* stop all update threads */
- StopUpdateThreads();
-
- m_epg->RemoveObserver(this);
- m_epg->Unload();
-
- m_recordings->Unload();
- m_timers->Unload();
- m_channelGroups->Unload();
- m_addons->Unload();
-
- m_bLoaded = false;
-}
-
void CPVRManager::Start(void)
{
/* first stop and remove any clients */
@@ -152,8 +126,6 @@ void CPVRManager::Start(void)
void CPVRManager::Stop(void)
{
CSingleLock lock(m_critSectionTriggers);
- if (!m_bLoaded)
- return;
m_bLoaded = false;
lock.Leave();
@@ -166,13 +138,23 @@ void CPVRManager::Stop(void)
}
StopUpdateThreads();
- Unload();
+
+ m_epg->RemoveObserver(this);
+ m_epg->Unload();
+
+ m_recordings->Unload();
+ m_timers->Unload();
+ m_channelGroups->Unload();
+ m_addons->Unload();
}
bool CPVRManager::StartUpdateThreads(void)
{
CLog::Log(LOGNOTICE, "PVRManager - starting up");
+ m_loadingBusyDialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
+ m_loadingBusyDialog->Show();
+
Create();
SetName("XBMC PVRManager");
SetPriority(-1);
@@ -230,6 +212,11 @@ void CPVRManager::Process(void)
/* load the pvr data from the db and clients if it's not already loaded */
if (!Load())
{
+ if (m_loadingBusyDialog && m_loadingBusyDialog->IsActive())
+ {
+ m_loadingBusyDialog->Close();
+ m_loadingBusyDialog = NULL;
+ }
CLog::Log(LOGERROR, "PVRManager - %s - failed to load PVR data", __FUNCTION__);
return;
}
@@ -244,6 +231,12 @@ void CPVRManager::Process(void)
if (!m_bStop && m_bFirstStart && g_guiSettings.GetInt("pvrplayback.startlast") != START_LAST_CHANNEL_OFF)
ContinueLastChannel();
+ if (m_loadingBusyDialog && m_loadingBusyDialog->IsActive())
+ {
+ m_loadingBusyDialog->Close();
+ m_loadingBusyDialog = NULL;
+ }
+
CLog::Log(LOGDEBUG, "PVRManager - %s - entering main loop", __FUNCTION__);
/* main loop */
@@ -377,6 +370,7 @@ bool CPVRManager::DisableIfNoClients(void)
{
g_guiSettings.SetBool("pvrmanager.enabled", false);
CLog::Log(LOGNOTICE,"PVRManager - no clients enabled. pvrmanager disabled.");
+ CGUIDialogOK::ShowAndGetInput(257,0,19223,0);
bReturn = true;
}
@@ -406,44 +400,68 @@ void CPVRManager::ResetDatabase(bool bShowProgress /* = true */)
}
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(10);
+ pDlgProgress->Progress();
+ }
/* stop the thread */
Stop();
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(20);
+ pDlgProgress->Progress();
+ }
if (m_database.Open())
{
/* clean the EPG database */
m_epg->Clear(true);
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(30);
+ pDlgProgress->Progress();
+ }
/* delete all TV channel groups */
m_database.DeleteChannelGroups(false);
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(50);
+ pDlgProgress->Progress();
+ }
/* delete all radio channel groups */
m_database.DeleteChannelGroups(true);
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(60);
+ pDlgProgress->Progress();
+ }
/* delete all channels */
m_database.DeleteChannels();
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(70);
+ pDlgProgress->Progress();
+ }
/* delete all channel settings */
m_database.DeleteChannelSettings();
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(80);
+ pDlgProgress->Progress();
+ }
/* delete all client information */
m_database.DeleteClients();
if (bShowProgress)
+ {
pDlgProgress->SetPercentage(90);
+ pDlgProgress->Progress();
+ }
m_database.Close();
}
@@ -740,34 +758,21 @@ void CPVRManager::OnJobComplete(unsigned int jobID, bool success, CJob* job)
CSingleLock lock(m_critSectionTriggers);
m_bChannelGroupsUpdating = false;
m_bChannelsUpdating = false;
-
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_TV);
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_RADIO);
}
else if (!strcmp(job->GetType(), "pvr-update-channels"))
{
CSingleLock lock(m_critSectionTriggers);
m_bChannelsUpdating = false;
-
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_TV);
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_RADIO);
}
else if (!strcmp(job->GetType(), "pvr-update-timers"))
{
CSingleLock lock(m_critSectionTriggers);
m_bTimersUpdating = false;
-
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_TIMERS);
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_EPG);
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_TV);
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_RADIO);
}
else if (!strcmp(job->GetType(), "pvr-update-recordings"))
{
CSingleLock lock(m_critSectionTriggers);
m_bRecordingsUpdating = false;
-
- CPVRManager::Get()->UpdateWindow(PVR_WINDOW_RECORDINGS);
}
}
View
7 xbmc/pvr/PVRManager.h
@@ -34,6 +34,7 @@ class CPVRRecordings;
class CPVRTimers;
class CPVREpgContainer;
class CPVRGUIInfo;
+class CGUIDialogBusy;
#define INFO_TOGGLE_TIME 1500
@@ -401,11 +402,6 @@ class CPVRManager : public Observer, private CThread, public IJobCallback
*/
bool ContinueLastChannel(void);
- /*!
- * @brief Clean up all data that was created by the PVRManager.
- */
- void Unload(void);
-
void OnJobComplete(unsigned int jobID, bool success, CJob* job);
/** @name singleton instance */
@@ -438,6 +434,7 @@ class CPVRManager : public Observer, private CThread, public IJobCallback
CCriticalSection m_critSection; /*!< critical section for all changes to this class */
bool m_bFirstStart; /*!< true when the PVR manager was started first, false otherwise */
bool m_bLoaded;
+ CGUIDialogBusy * m_loadingBusyDialog;
//@}
/*--- Previous Channel data ---*/
View
100 xbmc/pvr/addons/PVRClient.cpp
@@ -39,8 +39,6 @@
using namespace std;
using namespace ADDON;
-/* TODO factor out the annoying time conversion */
-
CPVRClient::CPVRClient(const AddonProps& props) :
CAddonDll<DllPVRClient, PVRClient, PVR_PROPERTIES>(props),
m_bReadyToUse(false),
@@ -53,7 +51,7 @@ CPVRClient::CPVRClient(const AddonProps& props) :
m_bGotConnectionString(false),
m_strFriendlyName("unknown"),
m_bGotFriendlyName(false),
- m_bGotServerProperties(false)
+ m_bGotAddonCapabilities(false)
{
}
@@ -69,7 +67,7 @@ CPVRClient::CPVRClient(const cp_extension_t *ext) :
m_bGotConnectionString(false),
m_strFriendlyName("unknown"),
m_bGotFriendlyName(false),
- m_bGotServerProperties(false)
+ m_bGotAddonCapabilities(false)
{
}
@@ -96,6 +94,7 @@ bool CPVRClient::Create(int iClientId, IPVRClientCallback *pvrCB)
if (CAddonDll<DllPVRClient, PVRClient, PVR_PROPERTIES>::Create())
{
m_strHostName = m_pStruct->GetConnectionString();
+ SetAddonCapabilities();
m_bReadyToUse = true;
bReturn = true;
}
@@ -150,11 +149,9 @@ PVR_ERROR CPVRClient::GetAddonCapabilities(PVR_ADDON_CAPABILITIES *pCapabilities
{
CSingleLock lock(m_critSection);
- /* cached locally */
- PVR_ERROR retVal = SetProperties();
- *pCapabilities = m_serverProperties;
+ *pCapabilities = m_addonCapabilities;
- return retVal;
+ return PVR_ERROR_NO_ERROR;
}
const char *CPVRClient::GetBackendName(void)
@@ -249,8 +246,7 @@ PVR_ERROR CPVRClient::StartChannelScan(void)
if (!m_bReadyToUse)
return PVR_ERROR_UNKOWN;
- SetProperties();
- if (!m_serverProperties.bSupportsChannelScan)
+ if (!m_addonCapabilities.bSupportsChannelScan)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -290,8 +286,7 @@ PVR_ERROR CPVRClient::GetEPGForChannel(const CPVRChannel &channel, CPVREpg *epg,
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsEPG)
+ if (!m_addonCapabilities.bSupportsEPG)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -330,8 +325,7 @@ int CPVRClient::GetChannelGroupsAmount(void)
if (!m_bReadyToUse)
return iReturn;
- SetProperties();
- if (!m_serverProperties.bSupportsChannelGroups)
+ if (!m_addonCapabilities.bSupportsChannelGroups)
return iReturn;
try
@@ -354,8 +348,7 @@ PVR_ERROR CPVRClient::GetChannelGroups(CPVRChannelGroups *groups)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsChannelGroups)
+ if (!m_addonCapabilities.bSupportsChannelGroups)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -387,8 +380,7 @@ PVR_ERROR CPVRClient::GetChannelGroupMembers(CPVRChannelGroup *group)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsChannelGroups)
+ if (!m_addonCapabilities.bSupportsChannelGroups)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -450,9 +442,8 @@ PVR_ERROR CPVRClient::GetChannels(CPVRChannelGroup &channels, bool radio)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if ((!m_serverProperties.bSupportsRadio && radio) ||
- (!m_serverProperties.bSupportsTV && !radio))
+ if ((!m_addonCapabilities.bSupportsRadio && radio) ||
+ (!m_addonCapabilities.bSupportsTV && !radio))
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -484,8 +475,7 @@ int CPVRClient::GetRecordingsAmount(void)
if (!m_bReadyToUse)
return iReturn;
- SetProperties();
- if (!m_serverProperties.bSupportsRecordings)
+ if (!m_addonCapabilities.bSupportsRecordings)
return iReturn;
try
@@ -508,8 +498,7 @@ PVR_ERROR CPVRClient::GetRecordings(CPVRRecordings *results)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsRecordings)
+ if (!m_addonCapabilities.bSupportsRecordings)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -541,8 +530,7 @@ PVR_ERROR CPVRClient::DeleteRecording(const CPVRRecording &recording)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsRecordings)
+ if (!m_addonCapabilities.bSupportsRecordings)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -574,8 +562,7 @@ PVR_ERROR CPVRClient::RenameRecording(const CPVRRecording &recording)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsRecordings)
+ if (!m_addonCapabilities.bSupportsRecordings)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -625,8 +612,7 @@ int CPVRClient::GetTimersAmount(void)
if (!m_bReadyToUse)
return iReturn;
- SetProperties();
- if (!m_serverProperties.bSupportsTimers)
+ if (!m_addonCapabilities.bSupportsTimers)
return iReturn;
try
@@ -649,8 +635,7 @@ PVR_ERROR CPVRClient::GetTimers(CPVRTimers *results)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsTimers)
+ if (!m_addonCapabilities.bSupportsTimers)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -682,8 +667,7 @@ PVR_ERROR CPVRClient::AddTimer(const CPVRTimerInfoTag &timer)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsTimers)
+ if (!m_addonCapabilities.bSupportsTimers)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -723,8 +707,7 @@ PVR_ERROR CPVRClient::DeleteTimer(const CPVRTimerInfoTag &timer, bool bForce /*
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsTimers)
+ if (!m_addonCapabilities.bSupportsTimers)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -764,8 +747,7 @@ PVR_ERROR CPVRClient::RenameTimer(const CPVRTimerInfoTag &timer, const CStdStrin
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsTimers)
+ if (!m_addonCapabilities.bSupportsTimers)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -805,8 +787,7 @@ PVR_ERROR CPVRClient::UpdateTimer(const CPVRTimerInfoTag &timer)
if (!m_bReadyToUse)
return retVal;
- SetProperties();
- if (!m_serverProperties.bSupportsTimers)
+ if (!m_addonCapabilities.bSupportsTimers)
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -873,9 +854,8 @@ bool CPVRClient::OpenLiveStream(const CPVRChannel &channel)
if (!m_bReadyToUse)
return bReturn;
- SetProperties();
- if ((!m_serverProperties.bSupportsTV && !channel.IsRadio()) ||
- (!m_serverProperties.bSupportsRadio && channel.IsRadio()))
+ if ((!m_addonCapabilities.bSupportsTV && !channel.IsRadio()) ||
+ (!m_addonCapabilities.bSupportsRadio && channel.IsRadio()))
return PVR_ERROR_NOT_IMPLEMENTED;
try
@@ -1015,8 +995,7 @@ bool CPVRClient::OpenRecordedStream(const CPVRRecording &recording)
{
CSingleLock lock(m_critSection);
- SetProperties();
- if (!m_serverProperties.bSupportsRecordings)
+ if (!m_addonCapabilities.bSupportsRecordings)
return false;
PVR_RECORDING tag;
@@ -1197,30 +1176,33 @@ void CPVRClient::SetFriendlyName(void)
m_strFriendlyName.Format("%s:%s", GetBackendName(), GetConnectionString());
}
-PVR_ERROR CPVRClient::SetProperties(void)
+PVR_ERROR CPVRClient::SetAddonCapabilities(void)
{
CSingleLock lock(m_critSection);
- if (m_bGotServerProperties)
+ if (m_bGotAddonCapabilities)
return PVR_ERROR_NO_ERROR;
/* reset all properties to disabled */
- m_serverProperties.bSupportsChannelLogo = false;
- m_serverProperties.bSupportsTimeshift = false;
- m_serverProperties.bSupportsEPG = false;
- m_serverProperties.bSupportsRecordings = false;
- m_serverProperties.bSupportsTimers = false;
- m_serverProperties.bSupportsRadio = false;
- m_serverProperties.bSupportsChannelSettings = false;
- m_serverProperties.bSupportsChannelGroups = false;
- m_serverProperties.bSupportsChannelScan = false;
+ m_addonCapabilities.bSupportsChannelLogo = false;
+ m_addonCapabilities.bSupportsChannelSettings = false;
+ m_addonCapabilities.bSupportsTimeshift = false;
+ m_addonCapabilities.bSupportsEPG = false;
+ m_addonCapabilities.bSupportsTV = false;
+ m_addonCapabilities.bSupportsRadio = false;
+ m_addonCapabilities.bSupportsRecordings = false;
+ m_addonCapabilities.bSupportsTimers = false;
+ m_addonCapabilities.bSupportsChannelGroups = false;
+ m_addonCapabilities.bSupportsChannelScan = false;
+ m_addonCapabilities.bHandlesInputStream = false;
+ m_addonCapabilities.bHandlesDemuxing = false;
/* try to get the addon properties */
try
{
- PVR_ERROR retVal = m_pStruct->GetAddonCapabilities(&m_serverProperties);
+ PVR_ERROR retVal = m_pStruct->GetAddonCapabilities(&m_addonCapabilities);
if (retVal == PVR_ERROR_NO_ERROR)
- m_bGotServerProperties = true;
+ m_bGotAddonCapabilities = true;
return retVal;
}
View
6 xbmc/pvr/addons/PVRClient.h
@@ -459,8 +459,8 @@ class CPVRClient : public ADDON::CAddonDll<DllPVRClient, PVRClient, PVR_PROPERTI
bool m_bGotConnectionString; /*!< true if the connection string has already been fetched */
CStdString m_strFriendlyName; /*!< the cached friendly name */
bool m_bGotFriendlyName; /*!< true if the friendly name has already been fetched */
- PVR_ADDON_CAPABILITIES m_serverProperties; /*!< the cached server properties */
- bool m_bGotServerProperties; /*!< true if the server properties have already been fetched */
+ PVR_ADDON_CAPABILITIES m_addonCapabilities; /*!< the cached add-on capabilities */
+ bool m_bGotAddonCapabilities; /*!< true if the add-on capabilities have already been fetched */
private:
/*!
@@ -514,5 +514,5 @@ class CPVRClient : public ADDON::CAddonDll<DllPVRClient, PVRClient, PVR_PROPERTI
/*!
* @brief Get the backend properties from the server and store it locally.
*/
- PVR_ERROR SetProperties(void);
+ PVR_ERROR SetAddonCapabilities(void);
};
View
4 xbmc/pvr/channels/PVRChannel.cpp
@@ -111,6 +111,8 @@ CPVRChannel::CPVRChannel(const PVR_CHANNEL &channel, unsigned int iClientId)
m_strEPGScraper = "client";
m_EPG = NULL;
m_bChanged = false;
+
+ UpdateEncryptionName();
}
CPVRChannel::CPVRChannel(const CPVRChannel &channel)
@@ -142,6 +144,8 @@ CPVRChannel &CPVRChannel::operator=(const CPVRChannel &channel)
m_EPG = channel.m_EPG;
m_bChanged = channel.m_bChanged;
+ UpdateEncryptionName();
+
return *this;
}
View
4 xbmc/pvr/channels/PVRChannelGroup.cpp
@@ -504,6 +504,10 @@ bool CPVRChannelGroup::UpdateGroupEntries(const CPVRChannelGroup &channels)
new channels were added at the back, so they'll get the highest numbers */
Renumber();
+ lock.Leave();
+
+ CPVRManager::Get()->UpdateWindow(m_bRadio ? PVR_WINDOW_CHANNELS_RADIO : PVR_WINDOW_CHANNELS_TV);
+
return Persist();
}
View
23 xbmc/pvr/channels/PVRChannelGroupInternal.cpp
@@ -384,15 +384,15 @@ bool CPVRChannelGroupInternal::Persist(void)
{
bool bReturn(false);
CSingleLock lock(m_critSection);
- CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
- if (!database || !database->Open())
- return bReturn;
+ bool bHasNewChannels = HasNewChannels();
+ bool bHasChangedChannels = HasChangedChannels();
+ if (bHasNewChannels || bHasChangedChannels)
CLog::Log(LOGDEBUG, "CPVRChannelGroupInternal - %s - persisting %d channels",
__FUNCTION__, (int) size());
- if (HasNewChannels())
+ if (bHasNewChannels)
{
CLog::Log(LOGDEBUG, "CPVRChannelGroupInternal - %s - group '%s' has new channels. writing changes directly",
__FUNCTION__, GroupName().c_str());
@@ -408,21 +408,30 @@ bool CPVRChannelGroupInternal::Persist(void)
}
}
}
- else
+ else if (bHasChangedChannels)
{
+ /* open the database */
+ CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
+ if (!database || !database->Open())
+ {
+ CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to open the database", __FUNCTION__);
+ return false;
+ }
+
/* queue queries */
for (unsigned int iChannelPtr = 0; iChannelPtr < size(); iChannelPtr++)
at(iChannelPtr).channel->Persist(true);
+
/* and commit them */
bReturn = database->CommitInsertQueries();
if (!bReturn)
CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to persist channels", __FUNCTION__);
+
+ database->Close();
}
if (bReturn)
bReturn = CPVRChannelGroup::Persist();
- database->Close();
-
return bReturn;
}
View
2 xbmc/pvr/epg/PVREpgInfoTag.cpp
@@ -65,7 +65,7 @@ void CPVREpgInfoTag::UpdatePath(void)
return;
CStdString path;
- path.Format("pvr://guide/channel-%04i/%s.epg", ((CPVREpg *)m_Epg)->Channel()->ChannelNumber(), m_startTime.GetAsDBDateTime().c_str());
+ path.Format("pvr://guide/channel-%04i/%s.epg", m_Epg->EpgID(), m_startTime.GetAsDBDateTime().c_str());
SetPath(path);
}
View
3 xbmc/pvr/recordings/PVRRecordings.cpp
@@ -189,6 +189,9 @@ void CPVRRecordings::ExecuteUpdate(void)
CSingleLock lock(m_critSection);
m_bIsUpdating = false;
+ lock.Leave();
+
+ CPVRManager::Get()->UpdateWindow(PVR_WINDOW_RECORDINGS);
}
void CPVRRecordings::Process(void)
View
72 xbmc/pvr/timers/PVRTimerInfoTag.cpp
@@ -56,7 +56,7 @@ CPVRTimerInfoTag::CPVRTimerInfoTag(void)
m_strGenre = "";
}
-CPVRTimerInfoTag::CPVRTimerInfoTag(const PVR_TIMER &timer, unsigned int iClientId)
+CPVRTimerInfoTag::CPVRTimerInfoTag(const PVR_TIMER &timer, CPVRChannel *channel, unsigned int iClientId)
{
m_strTitle = timer.strTitle;
m_strDirectory = timer.strDirectory;
@@ -82,10 +82,9 @@ CPVRTimerInfoTag::CPVRTimerInfoTag(const PVR_TIMER &timer, unsigned int iClientI
if (timer.iEpgUid > 0)
{
- CPVRChannel *channel = (CPVRChannel *) CPVRManager::GetChannelGroups()->GetByClientFromAll(iClientId, timer.iClientChannelUid);
- if (channel)
- m_epgInfo = (CPVREpgInfoTag *) channel->GetEPG()->GetTag(timer.iEpgUid, m_StartTime);
-
+ m_channel = channel;
+ m_bIsRadio = channel->IsRadio();
+ m_epgInfo = (CPVREpgInfoTag *) channel->GetEPG()->GetTag(timer.iEpgUid, m_StartTime);
if (m_epgInfo)
m_strGenre = m_epgInfo->Genre();
}
@@ -219,8 +218,7 @@ bool CPVRTimerInfoTag::AddToClient(void)
}
else
{
- if (StartAsLocalTime() < CDateTime::GetCurrentDateTime() && EndAsLocalTime() > CDateTime::GetCurrentDateTime())
- CPVRManager::Get()->TriggerTimersUpdate();
+ CPVRManager::Get()->TriggerTimersUpdate();
return true;
}
}
@@ -267,6 +265,10 @@ bool CPVRTimerInfoTag::RenameOnClient(const CStdString &strNewName)
DisplayError(error);
return false;
}
+ else
+ {
+ CPVRManager::Get()->TriggerTimersUpdate();
+ }
return true;
}
@@ -313,27 +315,38 @@ bool CPVRTimerInfoTag::UpdateEntry(const CPVRTimerInfoTag &tag)
void CPVRTimerInfoTag::UpdateEpgEvent(bool bClear /* = false */)
{
- /* already got an epg event set */
- if (m_epgInfo)
- return;
+ if (bClear)
+ {
+ if (m_epgInfo)
+ {
+ m_epgInfo->SetTimer(NULL);
+ m_epgInfo = NULL;
+ }
+ }
+ else
+ {
+ /* already got an epg event set */
+ if (m_epgInfo)
+ return;
- /* try to get the channel */
- CPVRChannel *channel = (CPVRChannel *) CPVRManager::GetChannelGroups()->GetByUniqueID(m_iClientChannelUid, m_iClientId);
- if (!channel)
- return;
+ /* try to get the channel */
+ CPVRChannel *channel = (CPVRChannel *) CPVRManager::GetChannelGroups()->GetByUniqueID(m_iClientChannelUid, m_iClientId);
+ if (!channel)
+ return;
- /* try to get the EPG table */
- CPVREpg *epg = channel->GetEPG();
- if (!epg)
- return;
+ /* try to get the EPG table */
+ CPVREpg *epg = channel->GetEPG();
+ if (!epg)
+ return;
- /* try to set the timer on the epg tag that matches */
- m_epgInfo = (CPVREpgInfoTag *) epg->GetTagBetween(StartAsLocalTime(), EndAsLocalTime());
- if (!m_epgInfo)
- m_epgInfo = (CPVREpgInfoTag *) epg->GetTagAround(StartAsLocalTime());
+ /* try to set the timer on the epg tag that matches with a 2 minute margin */
+ m_epgInfo = (CPVREpgInfoTag *) epg->GetTagBetween(StartAsLocalTime() - CDateTimeSpan(0, 0, 2, 0), EndAsLocalTime() + CDateTimeSpan(0, 0, 2, 0));
+ if (!m_epgInfo)
+ m_epgInfo = (CPVREpgInfoTag *) epg->GetTagAround(StartAsLocalTime());
- if (m_epgInfo)
- m_epgInfo->SetTimer(bClear ? NULL : this);
+ if (m_epgInfo)
+ m_epgInfo->SetTimer(this);
+ }
}
bool CPVRTimerInfoTag::UpdateOnClient()
@@ -347,8 +360,7 @@ bool CPVRTimerInfoTag::UpdateOnClient()
}
else
{
- if (StartAsLocalTime() < CDateTime::GetCurrentDateTime() && EndAsLocalTime() > CDateTime::GetCurrentDateTime())
- CPVRManager::Get()->TriggerTimersUpdate();
+ CPVRManager::Get()->TriggerTimersUpdate();
return true;
}
}
@@ -421,7 +433,7 @@ CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CPVREpgInfoTag &tag)
}
/* check if a valid channel is set */
- const CPVRChannel *channel = tag.ChannelTag();
+ CPVRChannel *channel = (CPVRChannel *) tag.ChannelTag();
if (channel == NULL)
{
CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
@@ -454,7 +466,7 @@ CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CPVREpgInfoTag &tag)
/* set the timer data */
CDateTime newStart = tag.StartAsUTC();
CDateTime newEnd = tag.EndAsUTC();
- newTag->m_iClientIndex = (tag.UniqueBroadcastID() > 0 ? tag.UniqueBroadcastID() : channel->ClientID());
+ newTag->m_iClientIndex = -1;
newTag->m_bIsActive = true;
newTag->m_strTitle = tag.Title().IsEmpty() ? channel->ChannelName() : tag.Title();
newTag->m_iChannelNumber = channel->ChannelNumber();
@@ -468,6 +480,10 @@ CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CPVREpgInfoTag &tag)
newTag->m_iMarginStart = iMarginStart;
newTag->m_iMarginEnd = iMarginStop;
+ /* we might have a copy of the tag here, so get the real one from the pvrmanager */
+ const CPVREpg *epgTable = channel->GetEPG();
+ newTag->m_epgInfo = epgTable ? (CPVREpgInfoTag *) epgTable->GetTag(tag.UniqueBroadcastID(), tag.StartAsUTC()) : NULL;
+
/* generate summary string */
newTag->m_strSummary.Format("%s %s %s %s %s",
newTag->StartAsLocalTime().GetAsLocalizedDate(),
View
2 xbmc/pvr/timers/PVRTimerInfoTag.h
@@ -82,7 +82,7 @@ class CPVRTimerInfoTag
CStdString m_strGenre; /*!< @brief genre of the timer */
CPVRTimerInfoTag(void);
- CPVRTimerInfoTag(const PVR_TIMER &timer, unsigned int iClientId);
+ CPVRTimerInfoTag(const PVR_TIMER &timer, CPVRChannel *channel, unsigned int iClientId);
void Reset();
View
71 xbmc/pvr/timers/PVRTimers.cpp
@@ -197,6 +197,11 @@ bool CPVRTimers::UpdateEntries(CPVRTimers *timers)
lock.Leave();
NotifyObservers("timers", false);
+
+ CPVRManager::Get()->UpdateWindow(PVR_WINDOW_TIMERS);
+ CPVRManager::Get()->UpdateWindow(PVR_WINDOW_EPG);
+ CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_TV);
+ CPVRManager::Get()->UpdateWindow(PVR_WINDOW_CHANNELS_RADIO);
}
return bChanged;
@@ -352,42 +357,40 @@ CPVRTimerInfoTag *CPVRTimers::InstantTimer(CPVRChannel *channel, bool bStartTime
return NULL;
}
- CPVRTimerInfoTag *newTimer = new CPVRTimerInfoTag();
-
+ const CPVREpgInfoTag *epgTag = channel->GetEPGNow();
+ int iMarginEnd = g_guiSettings.GetInt("pvrrecord.marginend");
+ int iPriority = g_guiSettings.GetInt("pvrrecord.defaultpriority");
+ int iLifetime = g_guiSettings.GetInt("pvrrecord.defaultlifetime");
int iDuration = g_guiSettings.GetInt("pvrrecord.instantrecordtime");
- if (!iDuration)
- iDuration = 180; /* default to 180 minutes */
- int iPriority = g_guiSettings.GetInt("pvrrecord.defaultpriority");
- if (!iPriority)
- iPriority = 50; /* default to 50 */
+ CPVRTimerInfoTag *newTimer = epgTag ? CPVRTimerInfoTag::CreateFromEpg(*epgTag) : NULL;
+ if (!newTimer)
+ {
+ newTimer = new CPVRTimerInfoTag;
+ /* set the timer data */
+ newTimer->m_iClientIndex = -1;
+ newTimer->m_bIsActive = true;
+ newTimer->m_strTitle = channel->ChannelName();
+ newTimer->m_strSummary = g_localizeStrings.Get(19056);
+ newTimer->m_iMarginEnd = iMarginEnd ? iMarginEnd : 5; /* use 5 minutes as default */
+ newTimer->m_iChannelNumber = channel->ChannelNumber();
+ newTimer->m_iClientChannelUid = channel->UniqueID();
+ newTimer->m_iClientId = channel->ClientID();
+ newTimer->m_bIsRadio = channel->IsRadio();
+ newTimer->m_iPriority = iPriority ? iPriority : 50; /* default to 50 */
+ newTimer->m_iLifetime = iLifetime ? iLifetime : 30; /* default to 30 days */
+
+ /* generate summary string */
+ newTimer->m_strSummary.Format("%s %s %s %s %s",
+ newTimer->StartAsLocalTime().GetAsLocalizedDate(),
+ g_localizeStrings.Get(19159),
+ newTimer->StartAsLocalTime().GetAsLocalizedTime("", false),
+ g_localizeStrings.Get(19160),
+ newTimer->EndAsLocalTime().GetAsLocalizedTime("", false));
+ }
- int iLifetime = g_guiSettings.GetInt("pvrrecord.defaultlifetime");
- if (!iLifetime)
- iLifetime = 30; /* default to 30 days */
-
- /* set the timer data */
- CDateTime now = CDateTime::GetCurrentDateTime();
- newTimer->m_iClientIndex = -1;
- newTimer->m_bIsActive = true;
- newTimer->m_strTitle = channel->ChannelName();
- newTimer->m_strTitle = g_localizeStrings.Get(19056);
- newTimer->m_iChannelNumber = channel->ChannelNumber();
- newTimer->m_iClientChannelUid = channel->UniqueID();
- newTimer->m_iClientId = channel->ClientID();
- newTimer->m_bIsRadio = channel->IsRadio();
- newTimer->SetStartFromLocalTime(now);
- newTimer->SetDuration(iDuration);
- newTimer->m_iPriority = iPriority;
- newTimer->m_iLifetime = iLifetime;
-
- /* generate summary string */
- newTimer->m_strSummary.Format("%s %s %s %s %s",
- newTimer->StartAsLocalTime().GetAsLocalizedDate(),
- g_localizeStrings.Get(19159),
- newTimer->StartAsLocalTime().GetAsLocalizedTime("", false),
- g_localizeStrings.Get(19160),
- newTimer->EndAsLocalTime().GetAsLocalizedTime("", false));
+ newTimer->m_iMarginStart = 0;
+ newTimer->SetDuration(iDuration ? iDuration : 120); /* use 120 minutes as default */
/* unused only for reference */
newTimer->m_strFileNameAndPath = "pvr://timers/new";
@@ -493,7 +496,7 @@ bool CPVRTimers::UpdateTimer(const CFileItem &item)
if (!tag)
return false;
- return UpdateTimer(*tag);
+ return UpdateTimer((CPVRTimerInfoTag &) *tag);
}
bool CPVRTimers::UpdateTimer(CPVRTimerInfoTag &item)
View
2 xbmc/pvr/windows/GUIWindowPVR.cpp
@@ -287,5 +287,5 @@ void CGUIWindowPVR::InitializeEpgCache(void)
{
CreateViews();
- m_windowGuide->InitializeEpgCache();
+ m_windowGuide->UpdateEpgCache();
}
View
6 xbmc/pvr/windows/GUIWindowPVRChannels.cpp
@@ -141,6 +141,11 @@ void CGUIWindowPVRChannels::UpdateData(void)
__FUNCTION__, GetName(), m_iControlList);
m_bIsFocusing = true;
m_bUpdateRequired = false;
+
+ /* lock the graphics context while updating */
+ CSingleLock graphicsLock(g_graphicsContext);
+
+ m_iSelected = m_parent->m_viewControl.GetSelectedItem();
m_parent->m_viewControl.Clear();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
@@ -163,6 +168,7 @@ void CGUIWindowPVRChannels::UpdateData(void)
/* show the visible channels instead */
m_bShowHiddenChannels = false;
lock.Leave();
+ graphicsLock.Leave();
UpdateData();
return;
View
22 xbmc/pvr/windows/GUIWindowPVRCommon.cpp
@@ -310,12 +310,10 @@ bool CGUIWindowPVRCommon::OnContextButtonMenuHooks(CFileItem *item, CONTEXT_BUTT
bool CGUIWindowPVRCommon::ActionDeleteTimer(CFileItem *item)
{
- bool bReturn = false;
-
/* check if the timer tag is valid */
CPVRTimerInfoTag *timerTag = item->GetPVRTimerInfoTag();
if (!timerTag || timerTag->m_iClientIndex < 0)
- return bReturn;
+ return false;
/* show a confirmation dialog */
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
@@ -329,16 +327,10 @@ bool CGUIWindowPVRCommon::ActionDeleteTimer(CFileItem *item)
/* prompt for the user's confirmation */
if (!pDialog->IsConfirmed())
- return bReturn;
+ return false;
/* delete the timer */
- if (CPVRManager::GetTimers()->DeleteTimer(*item))
- {
- UpdateData();
- bReturn = true;
- }
-
- return bReturn;
+ return CPVRManager::GetTimers()->DeleteTimer(*item);
}
bool CGUIWindowPVRCommon::ActionShowTimer(CFileItem *item)
@@ -358,9 +350,7 @@ bool CGUIWindowPVRCommon::ActionShowTimer(CFileItem *item)
if (ShowTimerSettings(newItem))
{
/* Add timer to backend */
- CPVRManager::GetTimers()->AddTimer(*newItem);
- UpdateData();
- bReturn = true;
+ bReturn = CPVRManager::GetTimers()->AddTimer(*newItem);
}
delete newItem;
@@ -372,9 +362,7 @@ bool CGUIWindowPVRCommon::ActionShowTimer(CFileItem *item)
if (ShowTimerSettings(item))
{
/* Update timer on pvr backend */
- CPVRManager::GetTimers()->UpdateTimer(*item);
- UpdateData();
- bReturn = true;
+ bReturn = CPVRManager::GetTimers()->UpdateTimer(*item);
}
}
View
32 xbmc/pvr/windows/GUIWindowPVRGuide.cpp
@@ -56,12 +56,7 @@ void CGUIWindowPVRGuide::Notify(const Observable &obs, const CStdString& msg)
{
if (msg.Equals("epg"))
{
- /* update the EPG cache */
- CSingleLock lock(m_critSection);
- m_epgData->Clear();
- CPVRManager::GetEpg()->GetEPGAll(m_epgData, m_bLastEpgView);
- m_bGotInitialEpg = true;
- lock.Leave();
+ UpdateEpgCache(m_bLastEpgView, true);
/* update the current window if the EPG timeline view is active */
if (IsActive() && m_iGuideView == GUIDE_VIEW_TIMELINE)
@@ -202,22 +197,7 @@ void CGUIWindowPVRGuide::UpdateViewTimeline(void)
CSingleLock lock(m_critSection);
- /* start observing the EPG for changes, so our cache becomes updated in the background */
- if (!m_bObservingEpg)
- {
- CPVRManager::GetEpg()->AddObserver(this);
- m_bObservingEpg = true;
- }
-
- if (!m_bGotInitialEpg)
- InitializeEpgCache(bRadio);
-
- if (bRadio != m_bLastEpgView)
- {
- m_epgData->Clear();
- CPVRManager::GetEpg()->GetEPGAll(m_epgData, bRadio);
- }
- m_bLastEpgView = bRadio;
+ UpdateEpgCache(bRadio, false);
if (m_epgData->Size() <= 0)
return;
@@ -248,6 +228,9 @@ void CGUIWindowPVRGuide::UpdateData(void)
m_bIsFocusing = true;
m_bUpdateRequired = false;
+
+ /* lock the graphics context while updating */
+ CSingleLock graphicsLock(g_graphicsContext);
m_parent->m_viewControl.Clear();
m_parent->m_vecItems->Clear();
@@ -443,7 +426,7 @@ void CGUIWindowPVRGuide::UpdateButtons(void)
m_parent->SetLabel(m_iControlButton, g_localizeStrings.Get(19222) + ": " + g_localizeStrings.Get(19032));
}
-void CGUIWindowPVRGuide::InitializeEpgCache(bool bRadio /* = false */)
+void CGUIWindowPVRGuide::UpdateEpgCache(bool bRadio /* = false */, bool bForceUpdate /* = false */)
{
CSingleLock lock(m_critSection);
@@ -454,8 +437,9 @@ void CGUIWindowPVRGuide::InitializeEpgCache(bool bRadio /* = false */)
m_bObservingEpg = true;
}
- if (!m_bGotInitialEpg || m_bLastEpgView != bRadio)
+ if (!m_bGotInitialEpg || m_bLastEpgView != bRadio || bForceUpdate)
{
+ CLog::Log(LOGDEBUG, "CGUIWindowPVRGuide - %s - updating EPG cache", __FUNCTION__);
m_epgData->Clear();
CPVRManager::GetEpg()->GetEPGAll(m_epgData, bRadio);
}
View
2 xbmc/pvr/windows/GUIWindowPVRGuide.h
@@ -59,7 +59,7 @@ class CGUIWindowPVRGuide : public CGUIWindowPVRCommon, public Observer
virtual void UpdateViewNow(void);
virtual void UpdateViewNext(void);
virtual void UpdateViewTimeline(void);
- virtual void InitializeEpgCache(bool bRadio = false);
+ virtual void UpdateEpgCache(bool bRadio = false, bool bForceUpdate = false);
int m_iGuideView;
CFileItemList * m_epgData;
View
5 xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
@@ -107,6 +107,11 @@ void CGUIWindowPVRRecordings::UpdateData(void)
CLog::Log(LOGDEBUG, "CGUIWindowPVRRecordings - %s - update window '%s'. set view to %d", __FUNCTION__, GetName(), m_iControlList);
m_bIsFocusing = true;
m_bUpdateRequired = false;
+
+ /* lock the graphics context while updating */
+ CSingleLock graphicsLock(g_graphicsContext);
+
+ m_iSelected = m_parent->m_viewControl.GetSelectedItem();
m_parent->m_viewControl.Clear();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
View
5 xbmc/pvr/windows/GUIWindowPVRSearch.cpp
@@ -109,6 +109,11 @@ void CGUIWindowPVRSearch::UpdateData(void)
CLog::Log(LOGDEBUG, "CGUIWindowPVRSearch - %s - update window '%s'. set view to %d", __FUNCTION__, GetName(), m_iControlList);
m_bIsFocusing = true;
m_bUpdateRequired = false;
+
+ /* lock the graphics context while updating */
+ CSingleLock graphicsLock(g_graphicsContext);
+
+ m_iSelected = m_parent->m_viewControl.GetSelectedItem();
m_parent->m_viewControl.Clear();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
View
22 xbmc/pvr/windows/GUIWindowPVRTimers.cpp
@@ -90,6 +90,11 @@ void CGUIWindowPVRTimers::UpdateData(void)
CLog::Log(LOGDEBUG, "CGUIWindowPVRTimers - %s - update window '%s'. set view to %d", __FUNCTION__, GetName(), m_iControlList);
m_bIsFocusing = true;
m_bUpdateRequired = false;
+
+ /* lock the graphics context while updating */
+ CSingleLock graphicsLock(g_graphicsContext);
+
+ m_iSelected = m_parent->m_viewControl.GetSelectedItem();
m_parent->m_viewControl.Clear();
m_parent->m_vecItems->Clear();
m_parent->m_viewControl.SetCurrentView(m_iControlList);
@@ -98,6 +103,7 @@ void CGUIWindowPVRTimers::UpdateData(void)
m_parent->m_vecItems->Sort(m_iSortMethod, m_iSortOrder);
m_parent->m_viewControl.SetItems(*m_parent->m_vecItems);
m_parent->m_viewControl.SetSelectedItem(m_iSelected);
+ graphicsLock.Leave();
m_parent->SetLabel(CONTROL_LABELHEADER, g_localizeStrings.Get(19025));
m_parent->SetLabel(CONTROL_LABELGROUP, "");
@@ -112,7 +118,6 @@ bool CGUIWindowPVRTimers::OnClickButton(CGUIMessage &message)
{
bReturn = true;
CPVRManager::Get()->TriggerTimersUpdate();
- UpdateData();
}
return bReturn;
@@ -170,7 +175,6 @@ bool CGUIWindowPVRTimers::OnContextButtonActivate(CFileItem *item, CONTEXT_BUTTO
CGUIDialogOK::ShowAndGetInput(19033, 19040, 0, iLabelId);
CPVRManager::GetTimers()->UpdateTimer(*item);
- UpdateData();
}
return bReturn;
@@ -187,10 +191,7 @@ bool CGUIWindowPVRTimers::OnContextButtonAdd(CFileItem *item, CONTEXT_BUTTON but
CFileItem *item = new CFileItem(*newtimer);
if (ShowTimerSettings(item))
- {
CPVRManager::GetTimers()->AddTimer(*item);
- UpdateData();
- }
}
return bReturn;
@@ -218,8 +219,7 @@ bool CGUIWindowPVRTimers::OnContextButtonDelete(CFileItem *item, CONTEXT_BUTTON
if (!pDialog->IsConfirmed())
return bReturn;
- if (CPVRManager::GetTimers()->DeleteTimer(*item))
- UpdateData();
+ CPVRManager::GetTimers()->DeleteTimer(*item);
}
return bReturn;
@@ -236,10 +236,7 @@ bool CGUIWindowPVRTimers::OnContextButtonEdit(CFileItem *item, CONTEXT_BUTTON bu
return bReturn;
if (ShowTimerSettings(item))
- {
CPVRManager::GetTimers()->UpdateTimer(*item);
- UpdateData();
- }
}
return bReturn;
@@ -258,10 +255,7 @@ bool CGUIWindowPVRTimers::OnContextButtonRename(CFileItem *item, CONTEXT_BUTTON
CStdString strNewName(timer->m_strTitle);
if (CGUIDialogKeyboard::ShowAndGetInput(strNewName, g_localizeStrings.Get(19042), false))
- {
- if (CPVRManager::GetTimers()->RenameTimer(*item, strNewName))
- UpdateData();
- }
+ CPVRManager::GetTimers()->RenameTimer(*item, strNewName);
}
return bReturn;
View
82 xbmc/pvrclients/tvheadend/HTSPData.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2010 Team XBMC
+ * Copyright (C) 2005-2011 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
@@ -37,43 +37,50 @@ cHTSPData::~cHTSPData()
Close();
}
-bool cHTSPData::Open(CStdString hostname, int port, CStdString user, CStdString pass, long timeout)
+bool cHTSPData::Open(const std::string &strHostname, unsigned int iPort, const std::string &strUsername, const std::string &strPassword, long iTimeout)
{
- if(!m_session.Connect(hostname, port))
+ if(!m_session.Connect(strHostname, iPort, iTimeout))
+ {
+ /* failed to connect */
return false;
+ }
if(m_session.GetProtocol() < 2)
{
- XBMC->Log(LOG_ERROR, "%s - Incompatible protocol version %d", __FUNCTION__, m_session.GetProtocol());
+ XBMC->Log(LOG_ERROR, "%s - incompatible protocol version %d", __FUNCTION__, m_session.GetProtocol());
+ m_session.Close(true);
return false;
}
- if(!user.IsEmpty())
- m_session.Auth(user, pass);
+ if(!strUsername.empty())
+ {
+ if (!m_session.Auth(strUsername, strPassword))
+ {
+ XBMC->Log(LOG_ERROR, "%s - failed to authenticate", __FUNCTION__);
+ m_session.Close(true);
+ return false;
+ }
+ }
SetDescription("HTSP Data Listener");
Start();
- m_started.Wait(timeout);
+ m_started.Wait(iTimeout);
+
return Running();
}
void cHTSPData::Close()
{
- m_session.Abort();
- Cancel(1);
- m_session.Close();
-}
-
-bool cHTSPData::CheckConnection()
-{
- if (!m_session.IsConnected())
- m_session.Connect(g_szHostname, g_iPortHTSP);
-
- return m_session.IsConnected();
+ if (IsConnected())
+ {
+ m_session.Abort();
+ Cancel(1);
+ m_session.Close();
+ }
}
-htsmsg_t* cHTSPData::ReadResult(htsmsg_t* m)
+htsmsg_t* cHTSPData::ReadResult(htsmsg_t *m)
{
m_Mutex.Lock();
unsigned seq (m_session.AddSequence());
@@ -157,7 +164,7 @@ bool cHTSPData::GetTime(time_t *localTime, int *gmtOffset)
return true;
}
-int cHTSPData::GetNumChannels()
+unsigned int cHTSPData::GetNumChannels()
{
return GetChannels().size();
}
@@ -270,7 +277,7 @@ SRecordings cHTSPData::GetDVREntries(bool recorded, bool scheduled)
return recordings;
}
-int cHTSPData::GetNumRecordings()
+unsigned int cHTSPData::GetNumRecordings()
{
SRecordings recordings = GetDVREntries(true, false);
return recordings.size();
@@ -278,6 +285,7 @@ int cHTSPData::GetNumRecordings()
PVR_ERROR cHTSPData::GetRecordings(PVR_HANDLE handle)
{
+ m_session.EnableNotifications(true);
SRecordings recordings = GetDVREntries(true, false);
for(SRecordings::const_iterator it = recordings.begin(); it != recordings.end(); ++it)
@@ -285,7 +293,7 @@ PVR_ERROR cHTSPData::GetRecordings(PVR_HANDLE handle)
SRecording recording = it->second;
CStdString strStreamURL = "http://";
- CStdString strChannelName = "";
+ std::string strChannelName = "";
/* lock */
{
@@ -294,17 +302,17 @@ PVR_ERROR cHTSPData::GetRecordings(PVR_HANDLE handle)
if (itr != m_channels.end())
strChannelName = itr->second.name.c_str();
- if (g_szUsername != "")
+ if (g_strUsername != "")
{
- strStreamURL += g_szUsername;
- if (g_szPassword != "")
+ strStreamURL += g_strUsername;
+ if (g_strPassword != "")
{
strStreamURL += ":";
- strStreamURL += g_szPassword;
+ strStreamURL += g_strPassword;
}
strStreamURL += "@";
}
- strStreamURL.Format("%s%s:%i/dvrfile/%i", strStreamURL.c_str(), g_szHostname.c_str(), g_iPortHTTP, recording.id);
+ strStreamURL.Format("%s%s:%i/dvrfile/%i", strStreamURL.c_str(), g_strHostname.c_str(), g_iPortHTTP, recording.id);
}
PVR_RECORDING tag;
@@ -353,15 +361,15 @@ PVR_ERROR cHTSPData::DeleteRecording(const PVR_RECORDING &recording)
return success > 0 ? PVR_ERROR_NO_ERROR : PVR_ERROR_NOT_DELETED;
}
-int cHTSPData::GetNumTimers()
+unsigned int cHTSPData::GetNumTimers()
{
SRecordings recordings = GetDVREntries(false, true);
return recordings.size();
}
-int cHTSPData::GetNumChannelGroups(void)
+unsigned int cHTSPData::GetNumChannelGroups(void)
{
- return (int) m_tags.size();
+ return m_tags.size();
}
PVR_ERROR cHTSPData::GetChannelGroups(PVR_HANDLE handle)
@@ -428,7 +436,7 @@ PVR_ERROR cHTSPData::GetTimers(PVR_HANDLE handle)
tag.endTime = recording.stop;
tag.strTitle = recording.title.c_str();
tag.strDirectory = "/"; // unused
- tag.strSummary = ""; // unused
+ tag.strSummary = recording.description.c_str();
tag.bIsActive = recording.state == ST_SCHEDULED || recording.state == ST_RECORDING;
tag.bIsRecording = recording.state == ST_RECORDING;
tag.iPriority = 0; // unused
@@ -564,7 +572,7 @@ PVR_ERROR cHTSPData::RenameRecording(const PVR_RECORDING &recording, const char
void cHTSPData::Action()
{
- XBMC->Log(LOG_DEBUG, "%s - Starting", __FUNCTION__);
+ XBMC->Log(LOG_DEBUG, "%s - starting", __FUNCTION__);
htsmsg_t* msg;
if(!m_session.SendEnableAsync())
@@ -574,7 +582,7 @@ void cHTSPData::Action()
return;
}
- while (Running())
+ while (IsConnected() && Running())
{
if((msg = m_session.ReadMessage()) == NULL)
break;
@@ -615,11 +623,11 @@ void cHTSPData::Action()
else if(strstr(method, "initialSyncCompleted"))
m_started.Signal();
else if(strstr(method, "dvrEntryAdd"))
- cHTSPSession::ParseDVREntryUpdate(msg, m_recordings);
+ cHTSPSession::ParseDVREntryUpdate(msg, m_recordings, g_bShowTimerNotifications && m_session.SendNotifications());
else if(strstr(method, "dvrEntryUpdate"))
- cHTSPSession::ParseDVREntryUpdate(msg, m_recordings);
+ cHTSPSession::ParseDVREntryUpdate(msg, m_recordings, g_bShowTimerNotifications && m_session.SendNotifications());
else if(strstr(method, "dvrEntryDelete"))
- cHTSPSession::ParseDVREntryDelete(msg, m_recordings);
+ cHTSPSession::ParseDVREntryDelete(msg, m_recordings, g_bShowTimerNotifications && m_session.SendNotifications());
else
XBMC->Log(LOG_DEBUG, "%s - Unmapped action recieved '%s'", __FUNCTION__, method);
@@ -627,7 +635,7 @@ void cHTSPData::Action()
}
m_started.Signal();
- XBMC->Log(LOG_DEBUG, "%s - Exiting", __FUNCTION__);
+ XBMC->Log(LOG_DEBUG, "%s - exiting", __FUNCTION__);
}
SChannels cHTSPData::GetChannels()
View
54 xbmc/pvrclients/tvheadend/HTSPData.h
@@ -1,7 +1,7 @@
#pragma once
/*
- * Copyright (C) 2005-2010 Team XBMC
+ * Copyright (C) 2005-2011 Team XBMC