Skip to content
Browse files

save the list at the end of the thumbloader thread so the next time t…

…he directory is fetched it doesn't need to run
  • Loading branch information...
1 parent c7cf16c commit 868caeffcef999017524323a89b96107b79a2d22 Jonathan Marshall committed May 23, 2012
View
5 xbmc/BackgroundInfoLoader.cpp
@@ -35,6 +35,7 @@ CBackgroundInfoLoader::CBackgroundInfoLoader(int nThreads)
m_pObserver=NULL;
m_pProgressCallback=NULL;
m_pVecItems = NULL;
+ m_windowID = 0;
m_nRequestedThreads = nThreads;
m_bStartCalled = false;
m_nActiveThreads = 0;
@@ -109,7 +110,7 @@ void CBackgroundInfoLoader::Run()
}
}
-void CBackgroundInfoLoader::Load(CFileItemList& items)
+void CBackgroundInfoLoader::Load(CFileItemList& items, int windowID)
{
StopThread();
@@ -122,6 +123,7 @@ void CBackgroundInfoLoader::Load(CFileItemList& items)
m_vecItems.push_back(items[nItem]);
m_pVecItems = &items;
+ m_windowID = windowID;
m_bStop = false;
m_bStartCalled = false;
@@ -164,6 +166,7 @@ void CBackgroundInfoLoader::StopThread()
m_workers.clear();
m_vecItems.clear();
m_pVecItems = NULL;
+ m_windowID = 0;
m_nActiveThreads = 0;
}
View
3 xbmc/BackgroundInfoLoader.h
@@ -44,7 +44,7 @@ class CBackgroundInfoLoader : public IRunnable
CBackgroundInfoLoader(int nThreads=-1);
virtual ~CBackgroundInfoLoader();
- void Load(CFileItemList& items);
+ void Load(CFileItemList& items, int windowID = 0);
bool IsLoading();
virtual void Run();
void SetObserver(IBackgroundLoaderObserver* pObserver);
@@ -61,6 +61,7 @@ class CBackgroundInfoLoader : public IRunnable
virtual void OnLoaderFinish() {};
CFileItemList *m_pVecItems;
+ int m_windowID; ///< the window ID we're loading the list for - used for saving the list for fast loading next time around.
std::vector<CFileItemPtr> m_vecItems; // FileItemList would delete the items and we only want to keep a reference.
CCriticalSection m_lock;
View
3 xbmc/ThumbLoader.cpp
@@ -156,6 +156,9 @@ void CVideoThumbLoader::OnLoaderStart()
void CVideoThumbLoader::OnLoaderFinish()
{
+ // save current list for later
+ if (m_pVecItems && (m_pVecItems->CacheToDiscAlways() || m_pVecItems->CacheToDiscIfSlow()))
+ m_pVecItems->Save(m_windowID);
m_database->Close();
}
View
2 xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1716,7 +1716,7 @@ bool CGUIWindowVideoBase::Update(const CStdString &strDirectory)
if (!CGUIMediaWindow::Update(strDirectory))
return false;
- m_thumbLoader.Load(*m_vecItems);
+ m_thumbLoader.Load(*m_vecItems, GetID());
return true;
}

2 comments on commit 868caef

@Voyager1

have done more testing on this commit. Unfortunately there's a little problem with it:

If you are in Files view, go to a movie source folder, then select ".." to go back up, "Add Videos..." appears twice! Do it again, three times etc...

@jmarshallnz
Owner

Yeah - with the current thumbloader there's too many issues with doing it this way. I'll be popping in the other commits here (and the ones I have locally) later today which should improve things nonetheless.

Please sign in to comment.
Something went wrong with that request. Please try again.