Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add prompt to rescan music library on entry to music

  • Loading branch information...
commit 3ec411a9a73ac7b5e89a265942a3d0fba8595560 1 parent 44a0f68
Jonathan Marshall authored
16 language/English/strings.po
View
@@ -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"
2  xbmc/music/infoscanner/MusicInfoScanner.cpp
View
@@ -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());
3  xbmc/music/infoscanner/MusicInfoScanner.h
View
@@ -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();
16 xbmc/music/windows/GUIWindowMusicBase.cpp
View
@@ -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"))
1  xbmc/music/windows/GUIWindowMusicBase.h
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.