fixed: Music album info gets stuck on failure (fixes #14435)
authorarnova <arnova@void.org>
Sun, 23 Jun 2013 20:31:22 +0000 (22:31 +0200)
committerarnova <arnova@void.org>
Mon, 24 Jun 2013 17:59:14 +0000 (19:59 +0200)
xbmc/music/windows/GUIWindowMusicBase.cpp
xbmc/music/windows/GUIWindowMusicBase.h

index 8b4f0df..cf8ae67 100644 (file)
@@ -339,7 +339,7 @@ void CGUIWindowMusicBase::OnInfo(CFileItem *pItem, bool bShowInfo)
     }
   }
 
-  // check the first song we find in the folder, and grab it's album info
+  // check the first song we find in the folder, and grab its album info
   for (int i = 0; i < items.Size(); i++)
   {
     CFileItemPtr pItem = items[i];
@@ -347,9 +347,13 @@ void CGUIWindowMusicBase::OnInfo(CFileItem *pItem, bool bShowInfo)
     if (pItem->HasMusicInfoTag() && pItem->GetMusicInfoTag()->Loaded() &&
        !pItem->GetMusicInfoTag()->GetAlbum().IsEmpty())
     {
-      ShowAlbumInfo(pItem.get());
+      bool result = ShowAlbumInfo(pItem.get());
+
       if (m_dlgProgress && bShowInfo)
         m_dlgProgress->Close();
+
+      if (!result) // Something went wrong, so bail for the rest
+        break;
     }
   }
 
@@ -420,7 +424,7 @@ void CGUIWindowMusicBase::ShowArtistInfo(const CFileItem *pItem, bool bShowInfo
     m_dlgProgress->Close();
 }
 
-void CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /* = true */)
+bool CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /* = true */)
 {
   CQueryParams params;
   CDirectoryNode::GetDatabaseInfo(pItem->GetPath(), params);
@@ -431,12 +435,19 @@ void CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /
         !m_musicdatabase.GetAlbumInfo(params.GetAlbumId(), albumInfo.GetAlbum(), &albumInfo.GetAlbum().songs))
     {
       if (!CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
-        break; // should display a dialog saying no permissions
+      {
+        // TODO: should display a dialog saying no permissions
+        if (m_dlgProgress)
+          m_dlgProgress->Close();
+        return false;
+      }
 
       if (g_application.IsMusicScanning())
       {
         CGUIDialogOK::ShowAndGetInput(189, 14057, 0, 0);
-        break;
+        if (m_dlgProgress)
+          m_dlgProgress->Close();
+        return false;
       }
 
       // show dialog box indicating we're searching the album
@@ -453,7 +464,9 @@ void CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /
       if (scanner.UpdateDatabaseAlbumInfo(pItem->GetPath(), albumInfo, bShowInfo) != INFO_ADDED || !albumInfo.Loaded())
       {
         CGUIDialogOK::ShowAndGetInput(185, 0, 500, 0);
-        break;
+        if (m_dlgProgress)
+          m_dlgProgress->Close();
+        return false;
       }
     }
 
@@ -479,6 +492,7 @@ void CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /
   }
   if (m_dlgProgress)
     m_dlgProgress->Close();
+  return true;
 }
 
 void CGUIWindowMusicBase::ShowSongInfo(CFileItem* pItem)
index 2b86799..6d616dd 100644 (file)
@@ -88,7 +88,7 @@ protected:
   bool FindAlbumInfo(const CFileItem* album, MUSIC_GRABBER::CMusicAlbumInfo& albumInfo, ALLOW_SELECTION allowSelection);
   bool FindArtistInfo(const CFileItem* artist, MUSIC_GRABBER::CMusicArtistInfo& artistInfo, ALLOW_SELECTION allowSelection);
 
-  void ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo = true);
+  bool ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo = true);
   void ShowArtistInfo(const CFileItem *pItem, bool bShowInfo = true);
   void ShowSongInfo(CFileItem* pItem);
   void UpdateThumb(const CAlbum &album, const CStdString &path);