diff options
-rw-r--r-- | xbmc/pvr/PVRManager.cpp | 93 | ||||
-rw-r--r-- | xbmc/pvr/PVRManager.h | 19 |
2 files changed, 1 insertions, 111 deletions
diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index 8e0e5f343e..e94c03eb73 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -23,8 +23,6 @@ #include <cassert> #include <utility> -#include "addons/AddonInstaller.h" -#include "addons/AddonSystemSettings.h" #include "Application.h" #include "dialogs/GUIDialogExtendedProgressBar.h" #include "dialogs/GUIDialogKaiToast.h" @@ -233,89 +231,6 @@ bool CPVRManager::IsPVRWindow(int windowId) return (windowId >= WINDOW_PVR_ID_START && windowId <= WINDOW_PVR_ID_END) ? true : false; } -bool CPVRManager::InstallAddonAllowed(const std::string& strAddonId) const -{ - return !IsStarted() || - !m_addons->IsInUse(strAddonId) || - (!IsPVRWindowActive() && !IsPlaying()); -} - -void CPVRManager::MarkAsOutdated(const std::string& strAddonId) -{ - if (IsStarted() && CSettings::GetInstance().GetInt(CSettings::SETTING_ADDONS_AUTOUPDATES) == ADDON::AUTO_UPDATES_ON) - { - CSingleLock lock(m_critSection); - m_outdatedAddons.push_back(strAddonId); - } -} - -bool CPVRManager::UpgradeOutdatedAddons(void) -{ - CSingleLock lock(m_critSection); - if (m_outdatedAddons.empty()) - return true; - - // there's add-ons that couldn't be updated - for (auto it = m_outdatedAddons.begin(); it != m_outdatedAddons.end(); ++it) - { - if (!InstallAddonAllowed(*it)) - { - // we can't upgrade right now - return true; - } - } - - // all outdated add-ons can be upgraded now - CLog::Log(LOGINFO, "PVR - upgrading outdated add-ons"); - - auto outdatedAddons = m_outdatedAddons; - // stop threads and unload - SetState(ManagerStateInterrupted); - - { - CSingleExit exit(m_critSection); - g_EpgContainer.Stop(); - } - - m_guiInfo->Stop(); - Cleanup(); - - // upgrade all add-ons - for (auto it = outdatedAddons.begin(); it != outdatedAddons.end(); ++it) - { - CLog::Log(LOGINFO, "PVR - updating add-on '%s'", (*it).c_str()); - CAddonInstaller::GetInstance().InstallOrUpdate(*it, false); - } - - // reload - CLog::Log(LOGINFO, "PVRManager - %s - restarting the PVR manager", __FUNCTION__); - SetState(ManagerStateStarting); - ResetProperties(); - - const unsigned int MAX_PROGRESS_DISPLAY_TIME = 30000; // 30 secs - XbmcThreads::EndTime progressTimeout(MAX_PROGRESS_DISPLAY_TIME); - while (!Load(!progressTimeout.IsTimePast()) && IsInitialising()) - { - CLog::Log(LOGERROR, "PVRManager - %s - failed to load PVR data, retrying", __FUNCTION__); - Sleep(1000); - } - - if (IsInitialising()) - { - SetState(ManagerStateStarted); - - { - CSingleExit exit(m_critSection); - g_EpgContainer.Start(true); - } - - CLog::Log(LOGDEBUG, "PVRManager - %s - restarted", __FUNCTION__); - return true; - } - - return false; -} - void CPVRManager::Cleanup(void) { CSingleLock lock(m_critSection); @@ -330,7 +245,6 @@ void CPVRManager::Cleanup(void) m_currentFile = NULL; m_bIsSwitchingChannels = false; - m_outdatedAddons.clear(); m_bEpgsCreated = false; for (unsigned int iJobPtr = 0; iJobPtr < m_pendingUpdates.size(); iJobPtr++) @@ -514,12 +428,7 @@ void CPVRManager::Process(void) bRestart = true; } - if (!UpgradeOutdatedAddons()) - { - // failed to load after upgrading - CLog::Log(LOGERROR, "PVRManager - %s - could not load pvr data after upgrading. stopping the pvrmanager", __FUNCTION__); - } - else if (IsStarted() && !bRestart) + if (IsStarted() && !bRestart) m_triggerEvent.WaitMSec(1000); } diff --git a/xbmc/pvr/PVRManager.h b/xbmc/pvr/PVRManager.h index 1f391e2938..97f60cf96b 100644 --- a/xbmc/pvr/PVRManager.h +++ b/xbmc/pvr/PVRManager.h @@ -182,24 +182,6 @@ private: static bool IsPVRWindow(int windowId); /*! - * @brief Check whether an add-on can be upgraded or installed without restarting the pvr manager, when the add-on is in use or the pvr window is active - * @param strAddonId The add-on to check. - * @return True when the add-on can be installed, false otherwise. - */ - bool InstallAddonAllowed(const std::string& strAddonId) const; - - /*! - * @brief Mark an add-on as outdated so it will be upgrade when it's possible again - * @param strAddonId The add-on to mark as outdated - */ - void MarkAsOutdated(const std::string& strAddonId); - - /*! - * @return True when updated, false when the pvr manager failed to load after the attempt - */ - bool UpgradeOutdatedAddons(void); - - /*! * @brief Get the TV database. * @return The TV database. */ @@ -683,7 +665,6 @@ private: CCriticalSection m_managerStateMutex; ManagerState m_managerState; std::unique_ptr<CStopWatch> m_parentalTimer; - std::vector<std::string> m_outdatedAddons; static const int m_pvrWindowIds[12]; }; |