From 2a4c6a5723d8177e83b832a6911c8248272c8f67 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Mon, 23 Feb 2015 14:34:22 +0100 Subject: [PATCH] [videos] check whether or not we already know about the scraper and re-use it --- xbmc/video/dialogs/GUIDialogVideoInfo.cpp | 11 +---------- xbmc/video/windows/GUIWindowVideoNav.cpp | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp index 14f934cebb8b0..8f0a2a61e6295 100644 --- a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp @@ -208,16 +208,7 @@ void CGUIDialogVideoInfo::OnInitWindow() m_hasUpdatedThumb = false; m_bViewReview = true; - CVideoDatabase database; - ADDON::ScraperPtr scraper; - - if(database.Open()) - { - scraper = database.GetScraperForPath(m_movieItem->GetVideoInfoTag()->GetPath()); - database.Close(); - } - - CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_REFRESH, (CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !StringUtils::StartsWithNoCase(m_movieItem->GetVideoInfoTag()->m_strIMDBNumber, "xx") && scraper); + CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_REFRESH, (CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !StringUtils::StartsWithNoCase(m_movieItem->GetVideoInfoTag()->m_strIMDBNumber, "xx")); CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_THUMB, (CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !StringUtils::StartsWithNoCase(m_movieItem->GetVideoInfoTag()->m_strIMDBNumber.c_str() + 2, "plugin")); VIDEODB_CONTENT_TYPE type = (VIDEODB_CONTENT_TYPE)m_movieItem->GetVideoContentType(); diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index 8d4128703f202..0fec4e7c3ec08 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -688,16 +688,19 @@ void CGUIWindowVideoNav::PlayItem(int iItem) void CGUIWindowVideoNav::OnInfo(CFileItem* pItem, ADDON::ScraperPtr& scraper) { - m_database.Open(); // since we can be called from the music library without being inited - if (pItem->IsVideoDb()) - scraper = m_database.GetScraperForPath(pItem->GetVideoInfoTag()->m_strPath); - else + if (!scraper || scraper->Content() == CONTENT_NONE) { - std::string strPath,strFile; - URIUtils::Split(pItem->GetPath(),strPath,strFile); - scraper = m_database.GetScraperForPath(strPath); + m_database.Open(); // since we can be called from the music library without being inited + if (pItem->IsVideoDb()) + scraper = m_database.GetScraperForPath(pItem->GetVideoInfoTag()->m_strPath); + else + { + std::string strPath,strFile; + URIUtils::Split(pItem->GetPath(),strPath,strFile); + scraper = m_database.GetScraperForPath(strPath); + } + m_database.Close(); } - m_database.Close(); CGUIWindowVideoBase::OnInfo(pItem,scraper); }