Permalink
Browse files

Merge remote branch 'opdenkamp/master'

  • Loading branch information...
2 parents fa41cca + 91eb062 commit 955a1baa706d0a0f3902cafe97da3b8b43534cb3 @margro committed May 5, 2011
Showing with 1,389 additions and 1,005 deletions.
  1. +3 −0 configure.in
  2. 0 lib/addons/library.xbmc.addon/{Makefile → Makefile.in}
  3. 0 lib/addons/library.xbmc.gui/{Makefile → Makefile.in}
  4. 0 lib/addons/library.xbmc.pvr/{Makefile → Makefile.in}
  5. +0 −13 xbmc/addons/include/xbmc_pvr_types.h
  6. +34 −9 xbmc/epg/Epg.cpp
  7. +15 −1 xbmc/epg/Epg.h
  8. +1 −1 xbmc/epg/EpgContainer.cpp
  9. +4 −11 xbmc/epg/EpgDatabase.cpp
  10. +23 −8 xbmc/pvr/PVRDatabase.cpp
  11. +1 −0 xbmc/pvr/PVRDatabase.h
  12. +1 −1 xbmc/pvr/PVRGUIInfo.cpp
  13. +6 −10 xbmc/pvr/PVRManager.cpp
  14. +0 −7 xbmc/pvr/PVRManager.h
  15. +3 −6 xbmc/pvr/addons/PVRClient.cpp
  16. +1 −9 xbmc/pvr/addons/PVRClient.h
  17. +689 −709 xbmc/pvr/addons/PVRClients.cpp
  18. +379 −145 xbmc/pvr/addons/PVRClients.h
  19. +12 −16 xbmc/pvr/channels/PVRChannel.cpp
  20. +3 −2 xbmc/pvr/channels/PVRChannelGroup.cpp
  21. +2 −1 xbmc/pvr/channels/PVRChannelGroup.h
  22. +9 −16 xbmc/pvr/channels/PVRChannelGroups.cpp
  23. +3 −3 xbmc/pvr/epg/PVREpg.cpp
  24. +2 −1 xbmc/pvr/epg/PVREpg.h
  25. +1 −1 xbmc/pvr/epg/PVREpgContainer.cpp
  26. +2 −1 xbmc/pvr/recordings/PVRRecordings.cpp
  27. +3 −1 xbmc/pvr/recordings/PVRRecordings.h
  28. +2 −8 xbmc/pvr/timers/PVRTimers.cpp
  29. +13 −0 xbmc/pvr/windows/GUIWindowPVR.cpp
  30. +1 −0 xbmc/pvr/windows/GUIWindowPVR.h
  31. +37 −0 xbmc/pvr/windows/GUIWindowPVRChannels.cpp
  32. +5 −1 xbmc/pvr/windows/GUIWindowPVRChannels.h
  33. +38 −15 xbmc/pvr/windows/GUIWindowPVRGuide.cpp
  34. +2 −0 xbmc/pvr/windows/GUIWindowPVRGuide.h
  35. +44 −0 xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
  36. +7 −3 xbmc/pvr/windows/GUIWindowPVRRecordings.h
  37. +33 −0 xbmc/pvr/windows/GUIWindowPVRTimers.cpp
  38. +6 −2 xbmc/pvr/windows/GUIWindowPVRTimers.h
  39. +1 −1 xbmc/pvrclients/tvheadend/HTSPData.cpp
  40. +1 −1 xbmc/pvrclients/tvheadend/HTSPData.h
  41. +1 −1 xbmc/pvrclients/tvheadend/HTSPSession.cpp
  42. +1 −1 xbmc/pvrclients/tvheadend/HTSPSession.h
View
@@ -1436,6 +1436,9 @@ OUTPUT_FILES="Makefile \
xbmc/pvrclients/mythtv/Makefile \
xbmc/pvrclients/tvheadend/Makefile \
xbmc/pvrclients/vdr-vnsi/Makefile \
+ lib/addons/library.xbmc.addon/Makefile \
+ lib/addons/library.xbmc.gui/Makefile \
+ lib/addons/library.xbmc.pvr/Makefile \
tools/Linux/xbmc.sh \
tools/Linux/xbmc-standalone.sh \
tools/TexturePacker/Makefile \
@@ -123,19 +123,6 @@ extern "C" {
const char *strClientPath; /*!< @brief (required) path to this add-on */
} PVR_PROPERTIES;
- /*!
- * @brief PVR add-on event codes, sent via PVRManager callback.
- */
- typedef enum
- {
- PVR_EVENT_UNKNOWN = 0,
- PVR_EVENT_CLOSE = 1,
- PVR_EVENT_RECORDINGS_CHANGE = 2,
- PVR_EVENT_CHANNELS_CHANGE = 3,
- PVR_EVENT_TIMERS_CHANGE = 4,
- PVR_EVENT_CHANNEL_GROUPS_CHANGE = 5
- } PVR_EVENT;
-
/*!
* @brief PVR add-on capabilities. All capabilities are set to "false" as default.
*/
View
@@ -44,7 +44,8 @@ struct sortEPGbyDate
}
};
-CEpg::CEpg(int iEpgID, const CStdString &strName /* = "" */, const CStdString &strScraperName /* = "" */) :
+CEpg::CEpg(int iEpgID, const CStdString &strName /* = "" */, const CStdString &strScraperName /* = "" */, bool bLoadedFromDb /* = false */) :
+ m_bChanged(!bLoadedFromDb),
m_bInhibitSorting(false),
m_iEpgID(iEpgID),
m_strName(strName),
@@ -65,6 +66,28 @@ CEpg::~CEpg(void)
/** @name Public methods */
//@{
+void CEpg::SetName(const CStdString &strName)
+{
+ CSingleLock lock(m_critSection);
+
+ if (!m_strName.Equals(strName))
+ {
+ m_bChanged = true;
+ m_strName = strName;
+ }
+}
+
+void CEpg::SetScraperName(const CStdString &strScraperName)
+{
+ CSingleLock lock(m_critSection);
+
+ if (!m_strScraperName.Equals(strScraperName))
+ {
+ m_bChanged = true;
+ m_strScraperName = strScraperName;
+ }
+}
+
bool CEpg::HasValidEntries(void) const
{
CSingleLock lock(m_critSection);
@@ -621,19 +644,21 @@ bool CEpg::Persist(bool bPersistTags /* = false */, bool bQueueWrite /* = false
}
CSingleLock lock(m_critSection);
-
- int iId = database->Persist(*this, bQueueWrite && m_iEpgID > 0);
- if (iId >= 0)
+ if (m_iEpgID <= 0 || m_bChanged)
{
+ int iId = database->Persist(*this, bQueueWrite && m_iEpgID > 0);
if (iId > 0)
+ {
m_iEpgID = iId;
-
- if (bPersistTags)
- bReturn = PersistTags(bQueueWrite);
- else
- bReturn = true;
+ m_bChanged = false;
+ }
}
+ if (bPersistTags)
+ bReturn = PersistTags(bQueueWrite);
+ else
+ bReturn = true;
+
database->Close();
return bReturn;
View
@@ -37,6 +37,7 @@ namespace EPG
friend class CEpgDatabase;
protected:
+ bool m_bChanged; /*!< true if anything changed that needs to be persisted, false otherwise */
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 */
@@ -145,8 +146,9 @@ namespace EPG
* @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.
+ * @param bLoadedFromDb True if this table was loaded from the database, false otherwise.
*/
- CEpg(int iEpgID, const CStdString &strName = "", const CStdString &strScraperName = "");
+ CEpg(int iEpgID, const CStdString &strName = "", const CStdString &strScraperName = "", bool bLoadedFromDb = false);
/*!
* @brief Destroy this EPG instance.
@@ -171,12 +173,24 @@ namespace EPG
*/
const CStdString &ScraperName(void) const { return m_strScraperName; }
+ /*!
+ * @brief Change the name of the scraper to use.
+ * @param strScraperName The new scraper.
+ */
+ void SetScraperName(const CStdString &strScraperName);
+
/*!
* @brief Get the name of this table.
* @return The name of this table.
*/
const CStdString &Name(void) const { return m_strName; }
+ /*!
+ * @brief Changed the name of this table.
+ * @param strName The new name.
+ */
+ void SetName(const CStdString &strName);
+
/*!
* @brief Get the database ID of this table.
* @return The database ID of this table.
@@ -110,8 +110,8 @@ void CEpgContainer::Start(void)
CSingleLock lock(m_critSection);
m_bStop = false;
- LoadSettings();
g_guiSettings.AddObserver(this);
+ LoadSettings();
Create();
SetName("XBMC EPG thread");
View
@@ -193,7 +193,7 @@ int CEpgDatabase::Get(CEpgContainer &container)
CStdString strName = m_pDS->fv("sName").get_asString().c_str();
CStdString strScraperName = m_pDS->fv("sScraperName").get_asString().c_str();
- CEpg newEpg(iEpgID, strName, strScraperName);
+ CEpg newEpg(iEpgID, strName, strScraperName, true);
if (container.UpdateEntry(newEpg))
++iReturn;
else
@@ -223,12 +223,9 @@ int CEpgDatabase::Get(CEpg &epg)
{
int iReturn = -1;
- CStdString strWhereClause;
- strWhereClause = FormatSQL("idEpg = %u", epg.EpgID());
-
- CStdString strQuery;
- strQuery.Format("SELECT * FROM epgtags WHERE %s ORDER BY iStartTime ASC;", strWhereClause.c_str());
+ CLog::Log(LOGDEBUG, "get table '%s' id %d", epg.Name().c_str(), epg.EpgID());
+ CStdString strQuery = FormatSQL("SELECT * FROM epgtags WHERE idEpg = %u ORDER BY iStartTime ASC;", epg.EpgID());
if (ResultQuery(strQuery))
{
iReturn = 0;
@@ -314,15 +311,11 @@ int CEpgDatabase::Persist(const CEpg &epg, bool bQueueWrite /* = false */)
CStdString strQuery;
if (epg.EpgID() > 0)
- {
strQuery = FormatSQL("REPLACE INTO epg (idEpg, sName, sScraperName) "
"VALUES (%u, '%s', '%s');", epg.EpgID(), epg.Name().c_str(), epg.ScraperName().c_str());
- }
else
- {
- strQuery = FormatSQL("REPLACE INTO epg (sName, sScraperName) "
+ strQuery = FormatSQL("INSERT INTO epg (sName, sScraperName) "
"VALUES ('%s', '%s');", epg.Name().c_str(), epg.ScraperName().c_str());
- }
if (bQueueWrite)
{
View
@@ -464,6 +464,12 @@ bool CPVRDatabase::RemoveChannelsFromGroup(const CPVRChannelGroup &group)
return DeleteValues("map_channelgroups_channels", strWhereClause);
}
+bool CPVRDatabase::RemoveStaleChannelsFromGroup(const CPVRChannelGroup &group)
+{
+ CStdString strWhereClause = FormatSQL("idGroup = %u AND iChannelNumber > %u", group.GroupID(), group.size());
+ return DeleteValues("map_channelgroups_channels", strWhereClause);
+}
+
bool CPVRDatabase::DeleteChannelGroups(void)
{
CLog::Log(LOGDEBUG, "PVRDB - %s - deleting all channel groups from the database", __FUNCTION__);
@@ -600,27 +606,36 @@ bool CPVRDatabase::Persist(CPVRChannelGroup &group)
bool CPVRDatabase::PersistGroupMembers(CPVRChannelGroup &group)
{
- bool bReturn = RemoveChannelsFromGroup(group);
+ bool bReturn = false;
+ bool bRemoveChannels = false;
CStdString strQuery;
CSingleLock lock(group.m_critSection);
- if (bReturn && group.size() > 0)
+ if (group.size() > 0)
{
for (unsigned int iChannelPtr = 0; iChannelPtr < group.size(); iChannelPtr++)
{
PVRChannelGroupMember member = group.at(iChannelPtr);
- strQuery = FormatSQL("REPLACE INTO map_channelgroups_channels ("
- "idGroup, idChannel, iChannelNumber) "
- "VALUES (%i, %i, %i);",
- group.GroupID(), member.channel->ChannelID(), member.iChannelNumber);
- QueueInsertQuery(strQuery);
+
+ CStdString strWhereClause = FormatSQL("idChannel = %u AND idGroup = %u AND iChannelNumber = %u",
+ member.channel->ChannelID(), group.GroupID(), member.iChannelNumber);
+
+ CStdString strValue = GetSingleValue("map_channelgroups_channels", "idChannel", strWhereClause);
+ if (strValue.IsEmpty()) {
+ strQuery = FormatSQL("REPLACE INTO map_channelgroups_channels ("
+ "idGroup, idChannel, iChannelNumber) "
+ "VALUES (%i, %i, %i);",
+ group.GroupID(), member.channel->ChannelID(), member.iChannelNumber);
+ QueueInsertQuery(strQuery);
+ }
}
lock.Leave();
bReturn = CommitInsertQueries();
+ bRemoveChannels = RemoveStaleChannelsFromGroup(group);
}
- return bReturn;
+ return bReturn && bRemoveChannels;
}
/********** Client methods **********/
View
@@ -142,6 +142,7 @@ namespace PVR
//@{
bool RemoveChannelsFromGroup(const CPVRChannelGroup &group);
+ bool RemoveStaleChannelsFromGroup(const CPVRChannelGroup &group);
/*!
* @brief Remove all channel groups from the database
View
@@ -95,7 +95,7 @@ void CPVRGUIInfo::Stop(void)
void CPVRGUIInfo::Notify(const Observable &obs, const CStdString& msg)
{
- if (msg.Equals("timers"))
+ if (msg.Equals("timers") || msg.Equals("timers-reset"))
UpdateTimersCache();
}
View
@@ -232,6 +232,11 @@ void CPVRManager::Process(void)
return;
}
+ /* reset observers that are observing pvr related data in the pvr windows, or updates won't work after a reload */
+ CGUIWindowPVR *pWindow = (CGUIWindowPVR *) g_windowManager.GetWindow(WINDOW_PVR);
+ if (pWindow)
+ pWindow->ResetObservers();
+
/* start the other pvr related update threads */
m_addons->Start();
m_guiInfo->Start();
@@ -246,7 +251,6 @@ void CPVRManager::Process(void)
ShowBusyDialog(false);
/* signal to window that clients are loaded */
- CGUIWindowPVR *pWindow = (CGUIWindowPVR *) g_windowManager.GetWindow(WINDOW_PVR);
if (pWindow)
pWindow->UnlockWindow();
@@ -338,14 +342,6 @@ bool CPVRManager::ContinueLastChannel(void)
return bReturn;
}
-void CPVRManager::UpdateWindow(PVRWindow window, bool bResetContents /* = true */)
-{
- /* TODO use an observable for this! */
- CGUIWindowPVR *pWindow = (CGUIWindowPVR *) g_windowManager.GetWindow(WINDOW_PVR);
- if (pWindow)
- pWindow->UpdateWindow(window, bResetContents);
-}
-
void CPVRManager::ResetProperties(void)
{
m_currentFile = NULL;
@@ -971,7 +967,7 @@ bool CPVRManager::IsRunningChannelScan(void) const
PVR_ADDON_CAPABILITIES *CPVRManager::GetCurrentClientProperties(void)
{
- return m_addons->GetCurrentClientProperties();
+ return m_addons->GetCurrentAddonCapabilities();
}
void CPVRManager::StartChannelScan(void)
View
@@ -340,13 +340,6 @@ namespace PVR
*/
void UpdateCurrentFile(void);
- /*!
- * @brief Update the data in a pvr window if that window is currently visible.
- * @param window The window to update.
- * @param bResetContents True to reset the contents of the given window, false to just mark all the window's items invalid.
- */
- void UpdateWindow(PVRWindow window, bool bResetContents = true);
-
/*!
* @brief Check whether names are still correct after the language settings changed.
*/
@@ -76,14 +76,13 @@ CPVRClient::~CPVRClient(void)
{
}
-bool CPVRClient::Create(int iClientId, IPVRClientCallback *pvrCB)
+bool CPVRClient::Create(int iClientId)
{
bool bReturn(false);
CSingleLock lock(m_critSection);
CLog::Log(LOGDEBUG, "PVR - %s - creating PVR add-on instance '%s'", __FUNCTION__, Name().c_str());
/* initialise members */
- m_manager = pvrCB;
if (!m_pInfo)
m_pInfo = new PVR_PROPERTIES;
m_pInfo->iClienId = iClientId;
@@ -126,11 +125,9 @@ void CPVRClient::Destroy(void)
bool CPVRClient::ReCreate(void)
{
- long clientID = m_pInfo->iClienId;
- IPVRClientCallback *pvrCB = m_manager;
-
+ int clientID = m_pInfo->iClienId;
Destroy();
- return Create(clientID, pvrCB);
+ return Create(clientID);
}
bool CPVRClient::ReadyToUse(void) const
@@ -38,12 +38,6 @@ namespace PVR
typedef std::vector<PVR_MENUHOOK> PVR_MENUHOOKS;
- class IPVRClientCallback
- {
- public:
- virtual void OnClientMessage(const int clientID, const PVR_EVENT clientEvent, const char* msg)=0;
- };
-
/*!
* Interface from XBMC to a PVR add-on.
*
@@ -62,10 +56,9 @@ namespace PVR
/*!
* @brief Initialise the instance of this add-on.
* @param iClientId The ID of this add-on.
- * @param pvrCB The call-back to use.
* @return True if it was created successfully, false otherwise.
*/
- bool Create(int iClientId, IPVRClientCallback *pvrCB);
+ bool Create(int iClientId);
/*!
* @brief Destroy the instance of this add-on.
@@ -447,7 +440,6 @@ namespace PVR
protected:
bool m_bReadyToUse; /*!< true if this add-on is connected to the backend, false otherwise */
- IPVRClientCallback *m_manager; /*!< the callback to use for this add-on */
CStdString m_strHostName; /*!< the host name */
CCriticalSection m_critSection; /*!< mutex for this class */
PVR_MENUHOOKS m_menuhooks; /*!< the menu hooks for this add-on */
Oops, something went wrong.

0 comments on commit 955a1ba

Please sign in to comment.