Permalink
Browse files

add prompt to rescan music library on entry to music

  • Loading branch information...
1 parent 44a0f68 commit 3ec411a9a73ac7b5e89a265942a3d0fba8595560 Jonathan Marshall committed Jul 6, 2012
@@ -2784,7 +2784,21 @@ msgctxt "#798"
msgid "Internet access"
msgstr ""
-#empty strings from id 799 to 849
+msgctxt "#799"
+msgid "Library Update"
+msgstr ""
+
+#: xbmc/music/windows/GUIWindowMusicBase.cpp
+msgctxt "#800"
+msgid "Music library needs to rescan art from tags"
+msgstr ""
+
+#: xbmc/music/windows/GUIWindowMusicBase.cpp
+msgctxt "#801"
+msgid "Would you like to scan now?"
+msgstr ""
+
+#empty strings from id 802 to 849
msgctxt "#850"
msgid "Invalid port number entered"
@@ -380,7 +380,7 @@ bool CMusicInfoScanner::DoScan(const CStdString& strDirectory)
// check whether we need to rescan or not
CStdString dbHash;
- if (!m_musicDatabase.GetPathHash(strDirectory, dbHash) || dbHash != hash)
+ if ((m_flags & SCAN_RESCAN) || !m_musicDatabase.GetPathHash(strDirectory, dbHash) || dbHash != hash)
{ // path has changed - rescan
if (dbHash.IsEmpty())
CLog::Log(LOGDEBUG, "%s Scanning dir '%s' as not in the database", __FUNCTION__, strDirectory.c_str());
@@ -48,7 +48,8 @@ class CMusicInfoScanner : CThread, public IRunnable
*/
enum SCAN_FLAGS { SCAN_NORMAL = 0,
SCAN_ONLINE = 1 << 0,
- SCAN_BACKGROUND = 1 << 1 };
+ SCAN_BACKGROUND = 1 << 1,
+ SCAN_RESCAN = 1 << 2 };
CMusicInfoScanner();
virtual ~CMusicInfoScanner();
@@ -50,6 +50,7 @@
#include "music/tags/MusicInfoTag.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogKeyboard.h"
#include "dialogs/GUIDialogProgress.h"
#include "FileItem.h"
@@ -1344,6 +1345,21 @@ void CGUIWindowMusicBase::OnPrepareFileItems(CFileItemList &items)
{
}
+void CGUIWindowMusicBase::OnInitWindow()
+{
+ CGUIMediaWindow::OnInitWindow();
+ if (g_settings.m_musicNeedsUpdate == 27 && !g_application.IsMusicScanning())
+ {
+ // rescan of music library required
+ if (CGUIDialogYesNo::ShowAndGetInput(799, 800, 801, -1))
+ {
+ g_application.StartMusicScan("", CMusicInfoScanner::SCAN_RESCAN);
+ g_settings.m_musicNeedsUpdate = false; // once is enough (user may interrupt, but that's up to them)
+ g_settings.Save();
+ }
+ }
+}
+
CStdString CGUIWindowMusicBase::GetStartFolder(const CStdString &dir)
{
if (dir.Equals("Plugins") || dir.Equals("Addons"))
@@ -51,6 +51,7 @@ class CGUIWindowMusicBase : public CGUIMediaWindow
void OnInfo(CFileItem *pItem, bool bShowInfo = false);
protected:
+ virtual void OnInitWindow();
/*!
\brief Will be called when an popup context menu has been asked for
\param itemNumber List/thumb control item that has been clicked on

8 comments on commit 3ec411a

Member

arnova replied Jul 15, 2012

I just updated xbmc on my HTPC with one build from today's master but after the rescan of my music database the info manager no longer shows any music thumbs in the now playing window.

Member

jmarshallnz replied Jul 15, 2012

Now playing window isn't the infomanager - it's a known issue though (the MusicInfoLoader runs threaded in that case, the thumb loader doesn't run, and the thumb assigning stuff won't work due to not working on a real folder).

Member

arnova replied Aug 6, 2012

I'm willing to look into this but do you have any ideas how to fix this?

Member

jmarshallnz replied Aug 6, 2012

First step is running the thumbloader. Problem with that is that you don't want 2 threads running.

Member

arnova replied Aug 7, 2012

Can't we modify the thumbloader to allow non threaded thumb retrieval and have the musicinfoloader use that to take care of the thumb-loading. Basically a non-threaded version of the thumbloader?

Member

jmarshallnz replied Aug 7, 2012

Member

arnova replied Aug 7, 2012

Member

arnova replied Aug 7, 2012

Please sign in to comment.