Skip to content

Commit

Permalink
[videos] check whether or not we already know about the scraper and r…
Browse files Browse the repository at this point in the history
…e-use it
  • Loading branch information
mkortstiege committed Feb 23, 2015
1 parent 1f7566a commit 2a4c6a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
11 changes: 1 addition & 10 deletions xbmc/video/dialogs/GUIDialogVideoInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
19 changes: 11 additions & 8 deletions xbmc/video/windows/GUIWindowVideoNav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 2a4c6a5

Please sign in to comment.