[musicdb] refactor out FindAlbumInfo and tidy up some common code
authornight199uk <night199uk@xbmc.org>
Sun, 14 Apr 2013 17:48:39 +0000 (01:48 +0800)
committernight199uk <night199uk@xbmc.org>
Wed, 1 May 2013 16:36:33 +0000 (00:36 +0800)
xbmc/music/infoscanner/MusicInfoScanner.cpp
xbmc/music/infoscanner/MusicInfoScanner.h
xbmc/music/windows/GUIWindowMusicBase.cpp

index 89a0972..20f76bd 100644 (file)
@@ -179,16 +179,8 @@ void CMusicInfoScanner::Process()
           m_handle->SetPercentage(percentage);
         }
 
-        // find album info
-        ADDON::ScraperPtr scraper;
-        if (!m_musicDatabase.GetScraperForPath(*it, scraper, ADDON::ADDON_SCRAPER_ALBUMS) || !scraper)
-          continue;
-        
-        CLog::Log(LOGDEBUG, "%s downloading info for: %s", __FUNCTION__, album.strAlbum.c_str());
         CMusicAlbumInfo albumInfo;
-        DownloadAlbumInfo(album, scraper, albumInfo); // genre field holds path - see fetchalbuminfo()
-        m_musicDatabase.SetAlbumInfo(params.GetAlbumId(), albumInfo.GetAlbum(), albumInfo.GetAlbum().songs);
-        GetAlbumArtwork(params.GetAlbumId(), albumInfo.GetAlbum());
+        UpdateDatabaseAlbumInfo(*it, albumInfo, false);
 
         if (m_bStop || bCanceled)
           break;
@@ -214,16 +206,8 @@ void CMusicInfoScanner::Process()
           m_handle->SetPercentage(percentage);
         }
         
-        // find album info
-        ADDON::ScraperPtr scraper;
-        if (!m_musicDatabase.GetScraperForPath(*it, scraper, ADDON::ADDON_SCRAPER_ARTISTS) || !scraper)
-          continue;
-
         CMusicArtistInfo artistInfo;
-        DownloadArtistInfo(artist, scraper, artistInfo); // genre field holds path - see fetchartistinfo()
-        m_musicDatabase.SetArtistInfo(params.GetArtistId(), artistInfo.GetArtist());
-        map<string, string> artwork = GetArtistArtwork(params.GetArtistId(), &artist);
-        m_musicDatabase.SetArtForItem(params.GetArtistId(), "artist", artwork);
+        UpdateDatabaseArtistInfo(*it, artistInfo, false);
 
         if (m_bStop || bCanceled)
           break;
@@ -704,8 +688,8 @@ int CMusicInfoScanner::RetrieveMusicInfo(const CStdString& strDirectory, CFileIt
           m_musicDatabase.SetArtistInfo(downloadedArtist.idArtist,
                                         downloadedArtist);
 
-          map<string, string> artwork = GetArtistArtwork(downloadedArtist.idArtist,
-                                                         &downloadedArtist);
+          URIUtils::GetParentPath(album->strPath, downloadedArtist.strPath);
+          map<string, string> artwork = GetArtistArtwork(downloadedArtist);
           // check thumb stuff
           m_musicDatabase.SetArtForItem(downloadedArtist.idArtist, "artist", artwork);
           m_artistCache.insert(make_pair(*artistCredit, downloadedArtist));
@@ -765,8 +749,8 @@ int CMusicInfoScanner::RetrieveMusicInfo(const CStdString& strDirectory, CFileIt
             m_musicDatabase.SetArtistInfo(downloadedArtist.idArtist,
                                           downloadedArtist);
             // check thumb stuff
-            map<string, string> artwork = GetArtistArtwork(downloadedArtist.idArtist,
-                                                           &downloadedArtist);
+            URIUtils::GetParentPath(album->strPath, downloadedArtist.strPath);
+            map<string, string> artwork = GetArtistArtwork(downloadedArtist);
             m_musicDatabase.SetArtForItem(downloadedArtist.idArtist, "artist", artwork);
             m_artistCache.insert(make_pair(*artistCredit, downloadedArtist));
           }
@@ -1041,6 +1025,96 @@ int CMusicInfoScanner::GetPathHash(const CFileItemList &items, CStdString &hash)
   return count;
 }
 
+INFO_RET CMusicInfoScanner::UpdateDatabaseAlbumInfo(const CStdString& strPath, CMusicAlbumInfo& albumInfo, bool bAllowSelection, CGUIDialogProgress* pDialog /* = NULL */)
+{
+  m_musicDatabase.Open();
+  CQueryParams params;
+  CDirectoryNode::GetDatabaseInfo(strPath, params);
+
+  if (params.GetAlbumId() == -1)
+    return INFO_ERROR;
+
+  CAlbum album;
+  m_musicDatabase.GetAlbumInfo(params.GetAlbumId(), album, &album.songs);
+
+  // find album info
+  ADDON::ScraperPtr scraper;
+  if (!m_musicDatabase.GetScraperForPath(strPath, scraper, ADDON::ADDON_SCRAPER_ALBUMS) || !scraper)
+    return INFO_ERROR;
+  m_musicDatabase.Close();
+
+loop:
+  CLog::Log(LOGDEBUG, "%s downloading info for: %s", __FUNCTION__, album.strAlbum.c_str());
+  INFO_RET albumDownloadStatus = DownloadAlbumInfo(album, scraper, albumInfo, pDialog);
+  if (albumDownloadStatus == INFO_NOT_FOUND)
+  {
+    if (pDialog && bAllowSelection)
+    {
+      if (!CGUIKeyboardFactory::ShowAndGetInput(album.strAlbum, g_localizeStrings.Get(16011), false))
+        return INFO_CANCELLED;
+
+      CStdString strTempArtist(StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator));
+      if (!CGUIKeyboardFactory::ShowAndGetInput(strTempArtist, g_localizeStrings.Get(16025), false))
+        return INFO_CANCELLED;
+
+      album.artist = StringUtils::Split(strTempArtist, g_advancedSettings.m_musicItemSeparator);
+      goto loop;
+    }
+  }
+  else if (albumDownloadStatus == INFO_ADDED)
+  {
+    m_musicDatabase.Open();
+    m_musicDatabase.SetAlbumInfo(params.GetAlbumId(), albumInfo.GetAlbum(), albumInfo.GetAlbum().songs);
+    GetAlbumArtwork(params.GetAlbumId(), albumInfo.GetAlbum());
+    albumInfo.SetLoaded(true);
+    m_musicDatabase.Close();
+  }
+  return albumDownloadStatus;
+}
+
+INFO_RET CMusicInfoScanner::UpdateDatabaseArtistInfo(const CStdString& strPath, CMusicArtistInfo& artistInfo, bool bAllowSelection, CGUIDialogProgress* pDialog /* = NULL */)
+{
+  m_musicDatabase.Open();
+  CQueryParams params;
+  CDirectoryNode::GetDatabaseInfo(strPath, params);
+
+  if (params.GetArtistId() == -1)
+    return INFO_ERROR;
+
+  CArtist artist;
+  m_musicDatabase.GetArtistInfo(params.GetArtistId(), artist);
+
+  // find album info
+  ADDON::ScraperPtr scraper;
+  if (!m_musicDatabase.GetScraperForPath(strPath, scraper, ADDON::ADDON_SCRAPER_ARTISTS) || !scraper)
+    return INFO_ERROR;
+  m_musicDatabase.Close();
+
+loop:
+  CLog::Log(LOGDEBUG, "%s downloading info for: %s", __FUNCTION__, artist.strArtist.c_str());
+  INFO_RET artistDownloadStatus = DownloadArtistInfo(artist, scraper, artistInfo, pDialog);
+  if (artistDownloadStatus == INFO_NOT_FOUND)
+  {
+    if (pDialog && bAllowSelection)
+    {
+      if (!CGUIKeyboardFactory::ShowAndGetInput(artist.strArtist, g_localizeStrings.Get(16025), false))
+        return INFO_CANCELLED;
+      goto loop;
+    }
+  }
+  else if (artistDownloadStatus == INFO_ADDED)
+  {
+    m_musicDatabase.Open();
+    m_musicDatabase.SetArtistInfo(params.GetArtistId(), artistInfo.GetArtist());
+    m_musicDatabase.GetArtistPath(params.GetArtistId(), artist.strPath);
+    map<string, string> artwork = GetArtistArtwork(artist);
+    m_musicDatabase.SetArtForItem(params.GetArtistId(), "artist", artwork);
+    artistInfo.SetLoaded();
+    m_musicDatabase.Close();
+  }
+  return artistDownloadStatus;
+}
+
 #define THRESHOLD .95f
 
 INFO_RET CMusicInfoScanner::DownloadAlbumInfo(const CAlbum& album, ADDON::ScraperPtr& info, CMusicAlbumInfo& albumInfo, CGUIDialogProgress* pDialog)
@@ -1485,22 +1559,26 @@ bool CMusicInfoScanner::ResolveMusicBrainz(const CStdString strMusicBrainzID, Sc
   return bMusicBrainz;
 }
 
-map<string, string> CMusicInfoScanner::GetArtistArtwork(long id, const CArtist *artist)
+map<string, string> CMusicInfoScanner::GetArtistArtwork(const CArtist& artist)
 {
-  CStdString artistPath;
-  m_musicDatabase.Open();
-  bool checkLocal = m_musicDatabase.GetArtistPath(id, artistPath);
-  m_musicDatabase.Close();
-
-  CFileItem item(artistPath, true);
   map<string, string> artwork;
 
   // check thumb
+  CStdString strFolder;
   CStdString thumb;
-  if (checkLocal)
-    thumb = item.GetUserMusicThumb(true);
-  if (thumb.IsEmpty() && artist)
-    thumb = CScraperUrl::GetThumbURL(artist->thumbURL.GetFirstThumb());
+  if (!artist.strPath.IsEmpty())
+  {
+    strFolder = artist.strPath;
+    for (int i = 0; i < 3 && thumb.IsEmpty(); ++i)
+    {
+      CFileItem item(strFolder, true);
+      thumb = item.GetUserMusicThumb(true);
+      CStdString strTemp = strFolder;
+      URIUtils::GetParentPath(strTemp, strFolder);
+    }
+  }
+  if (thumb.IsEmpty())
+    thumb = CScraperUrl::GetThumbURL(artist.thumbURL.GetFirstThumb());
   if (!thumb.IsEmpty())
   {
     CTextureCache::Get().BackgroundCacheImage(thumb);
@@ -1509,10 +1587,19 @@ map<string, string> CMusicInfoScanner::GetArtistArtwork(long id, const CArtist *
 
   // check fanart
   CStdString fanart;
-  if (checkLocal)
-    fanart = item.GetLocalFanart();
-  if (fanart.IsEmpty() && artist)
-    fanart = artist->fanart.GetImageURL();
+  if (!artist.strPath.IsEmpty())
+  {
+    strFolder = artist.strPath;
+    for (int i = 0; i < 3 && fanart.IsEmpty(); ++i)
+    {
+      CFileItem item(strFolder, true);
+      fanart = item.GetLocalFanart();
+      CStdString strTemp = strFolder;
+      URIUtils::GetParentPath(strFolder, strFolder);
+    }
+  }
+  if (fanart.IsEmpty())
+    fanart = artist.fanart.GetImageURL();
   if (!fanart.IsEmpty())
   {
     CTextureCache::Get().BackgroundCacheImage(fanart);
index f959c38..32118f3 100644 (file)
@@ -110,10 +110,58 @@ public:
    */
   static void FindArtForAlbums(VECALBUMS &albums, const CStdString &path);
 
+  /*! \brief Update the database information for a MusicDB album
+   Given a musicdb:// style path pointing to an album, search and update its info
+   with the scrapers. If info is found, update the database and artwork with the new
+   information.
+   \param strPath [in] musicdb:// style path to the album in the database
+   \param albumInfo [in/out] a CMusicAlbumInfo struct which will be populated with the output of the scraper
+   \param pDialog [in] a progress dialog which this and downstream functions can update with status, if required
+   \param bAllowSelection [in] should we allow the user to manually override the info with a GUI if the album is not found?
+   */
+  INFO_RET UpdateDatabaseAlbumInfo(const CStdString& strPath, MUSIC_GRABBER::CMusicAlbumInfo& albumInfo, bool bAllowSelection, CGUIDialogProgress* pDialog = NULL);
+  /*! \brief Update the database information for a MusicDB artist
+   Given a musicdb:// style path pointing to an artist, search and update its info
+   with the scrapers. If info is found, update the database and artwork with the new
+   information.
+   \param strPath [in] musicdb:// style path to the artist in the database
+   \param albumInfo [in/out] a CMusicArtistInfo struct which will be populated with the output of the scraper
+   \param pDialog [in] a progress dialog which this and downstream functions can update with status, if required
+   \param bAllowSelection [in] should we allow the user to manually override the info with a GUI if the album is not found?
+   */
+  INFO_RET UpdateDatabaseArtistInfo(const CStdString& strPath, MUSIC_GRABBER::CMusicArtistInfo& artistInfo, bool bAllowSelection, CGUIDialogProgress* pDialog = NULL);
+
+  /*! \brief Using the scrapers download metadata for an album
+   Given a CAlbum style struct containing some data about an album, query
+   the scrapers to try and get more information about the album. The responsibility
+   is with the caller to do something with that information. It will be passed back
+   in a MusicInfo struct, which you can save, display to the user or throw away.
+   \param album [in] a partially or fully filled out album structure containing the search query
+   \param scraper [in] the scraper to query, usually the default or the relevant scraper for the musicdb path
+   \param albumInfo [in/out] a CMusicAlbumInfo struct which will be populated with the output of the scraper
+   \param pDialog [in] a progress dialog which this and downstream functions can update with status, if required
+   */
   INFO_RET DownloadAlbumInfo(const CAlbum& album, ADDON::ScraperPtr& scraper, MUSIC_GRABBER::CMusicAlbumInfo& albumInfo, CGUIDialogProgress* pDialog = NULL);
+
+  /*! \brief Using the scrapers download metadata for an artist
+   Given a CAlbum style struct containing some data about an artist, query
+   the scrapers to try and get more information about the artist. The responsibility
+   is with the caller to do something with that information. It will be passed back
+   in a MusicInfo struct, which you can save, display to the user or throw away.
+   \param artist [in] a partially or fully filled out artist structure containing the search query
+   \param scraper [in] the scraper to query, usually the default or the relevant scraper for the musicdb path
+   \param artistInfo [in/out] a CMusicAlbumInfo struct which will be populated with the output of the scraper
+   \param pDialog [in] a progress dialog which this and downstream functions can update with status, if required
+   */
   INFO_RET DownloadArtistInfo(const CArtist& artist, ADDON::ScraperPtr& scraper, MUSIC_GRABBER::CMusicArtistInfo& artistInfo, CGUIDialogProgress* pDialog = NULL);
 
-  std::map<std::string, std::string> GetArtistArtwork(long id, const CArtist *artist = NULL);
+  /*! \brief Search for art for an artist
+   Look for art for an artist. Checks the artist structure for thumbs, and checks
+   the artist path (if non-empty) for artist/folder tbns, etc.
+   \param artist [in] an artist
+   */
+  std::map<std::string, std::string> GetArtistArtwork(const CArtist& artist);
 protected:
   virtual void Process();
 
index 82e8d08..e53bac8 100644 (file)
@@ -375,54 +375,53 @@ void CGUIWindowMusicBase::OnManualAlbumInfo()
 
 void CGUIWindowMusicBase::ShowArtistInfo(const CFileItem *pItem, bool bShowInfo /* = true */)
 {
-  CArtist artist;
   CQueryParams params;
   CDirectoryNode::GetDatabaseInfo(pItem->GetPath(), params);
-  m_musicdatabase.GetArtistInfo(params.GetArtistId(), artist);
-  m_musicdatabase.GetArtistPath(artist.idArtist, artist.strPath);
-
-  bool saveDb = artist.idArtist != -1;
-  if (!CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
-    saveDb = false;
-
   CMusicArtistInfo artistInfo;
   while (1)
   {
     // Check if we have the information in the database first
-    if (!m_musicdatabase.HasArtistInfo(artist.idArtist) ||
-        !m_musicdatabase.GetArtistInfo(artist.idArtist, artistInfo.GetArtist()))
+    if (!m_musicdatabase.HasArtistInfo(params.GetArtistId()) ||
+        !m_musicdatabase.GetArtistInfo(params.GetArtistId(), artistInfo.GetArtist()))
     {
+      if (!CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
+        break; // should display a dialog saying no permissions
+
       if (g_application.IsMusicScanning())
       {
         CGUIDialogOK::ShowAndGetInput(189, 14057, 0, 0);
         break;
       }
 
-      if (!FindArtistInfo(pItem,
-                          artistInfo,
-                          bShowInfo ? SELECTION_ALLOWED : SELECTION_AUTO))
-        break;
+      // show dialog box indicating we're searching the album
+      if (m_dlgProgress && bShowInfo)
+      {
+        m_dlgProgress->SetHeading(21889);
+        m_dlgProgress->SetLine(0, pItem->GetMusicInfoTag()->GetArtist());
+        m_dlgProgress->SetLine(1, "");
+        m_dlgProgress->SetLine(2, "");
+        m_dlgProgress->StartModal();
+      }
 
-      if (!artistInfo.Loaded())
+      CMusicInfoScanner scanner;
+      if (scanner.UpdateDatabaseArtistInfo(pItem->GetPath(), artistInfo, bShowInfo) != INFO_ADDED || !artistInfo.Loaded())
       {
-        // Failed to download album info
         CGUIDialogOK::ShowAndGetInput(21889, 0, 20199, 0);
         break;
       }
-
-      if (saveDb)
-        m_musicdatabase.SetArtistInfo(artist.idArtist, artistInfo.GetArtist());
     }
 
     CGUIDialogMusicInfo *pDlgArtistInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
     if (pDlgArtistInfo)
     {
-      pDlgArtistInfo->SetArtist(artistInfo.GetArtist(), artist.strPath);
+      CStdString strPath;
+      m_musicdatabase.GetArtistPath(params.GetArtistId(), strPath);
+      pDlgArtistInfo->SetArtist(artistInfo.GetArtist(), strPath);
       pDlgArtistInfo->DoModal();
 
       if (pDlgArtistInfo->NeedRefresh())
       {
-        m_musicdatabase.DeleteArtistInfo(artist.idArtist);
+        m_musicdatabase.DeleteArtistInfo(params.GetArtistId());
         continue;
       } 
       else if (pDlgArtistInfo->HasUpdatedThumb()) 
@@ -440,38 +439,37 @@ void CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /
 {
   CQueryParams params;
   CDirectoryNode::GetDatabaseInfo(pItem->GetPath(), params);
-
-  bool saveDb = params.GetAlbumId() != -1;
-  if (!CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
-    saveDb = false;
-
   CMusicAlbumInfo albumInfo;
   while (1)
   {
     if (!m_musicdatabase.HasAlbumInfo(params.GetAlbumId()) || 
         !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
+
       if (g_application.IsMusicScanning())
       {
         CGUIDialogOK::ShowAndGetInput(189, 14057, 0, 0);
         break;
       }
 
-      if (!FindAlbumInfo(pItem,
-                         albumInfo,
-                         bShowInfo ? SELECTION_ALLOWED : SELECTION_AUTO))
-        break;
-      
-      if (!albumInfo.Loaded())
+      // show dialog box indicating we're searching the album
+      if (m_dlgProgress && bShowInfo)
+      {
+        m_dlgProgress->SetHeading(185);
+        m_dlgProgress->SetLine(0, pItem->GetMusicInfoTag()->GetAlbum());
+        m_dlgProgress->SetLine(1, StringUtils::Join(pItem->GetMusicInfoTag()->GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator));
+        m_dlgProgress->SetLine(2, "");
+        m_dlgProgress->StartModal();
+      }
+
+      CMusicInfoScanner scanner;
+      if (scanner.UpdateDatabaseAlbumInfo(pItem->GetPath(), albumInfo, bShowInfo) != INFO_ADDED || !albumInfo.Loaded())
       {
         CGUIDialogOK::ShowAndGetInput(185, 0, 500, 0);
         break;
       }
-
-//      albumInfo.GetAlbum().strAlbum = album.strAlbum; FIXME?
-
-      if (saveDb)
-        m_musicdatabase.SetAlbumInfo(params.GetAlbumId(), albumInfo.GetAlbum(), albumInfo.GetSongs());
     }
 
     CGUIDialogMusicInfo *pDlgAlbumInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
@@ -690,110 +688,6 @@ void CGUIWindowMusicBase::UpdateButtons()
   CGUIMediaWindow::UpdateButtons();
 }
 
-// This is basically the same as the MusicInfoScanner->Process, with a different kind
-// of dialog, and should be merged.
-bool CGUIWindowMusicBase::FindAlbumInfo(const CFileItem* item, CMusicAlbumInfo& albumInfo, ALLOW_SELECTION allowSelection)
-{
-  CQueryParams params;
-  CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
-
-  CAlbum album(*item);
-  if (params.GetAlbumId() != -1 && m_musicdatabase.HasAlbumInfo(params.GetArtistId()))
-    m_musicdatabase.GetAlbumInfo(params.GetAlbumId(), album, &album.songs);
-
-  // show dialog box indicating we're searching the album
-  if (m_dlgProgress && allowSelection != SELECTION_AUTO)
-  {
-    m_dlgProgress->SetHeading(185);
-    m_dlgProgress->SetLine(0, album.strAlbum);
-    m_dlgProgress->SetLine(1, StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator));
-    m_dlgProgress->SetLine(2, "");
-    m_dlgProgress->StartModal();
-  }
-  
-  // find album info
-  ADDON::ScraperPtr scraper;
-  if (!m_musicdatabase.GetScraperForPath(item->GetPath(), scraper, ADDON::ADDON_SCRAPER_ALBUMS) || !scraper)
-    return false;
-
-  CMusicInfoScanner scanner;
-
-loop:
-  INFO_RET albumDownloadStatus = scanner.DownloadAlbumInfo(album, scraper, albumInfo, m_dlgProgress);
-  if (albumDownloadStatus == INFO_NOT_FOUND)
-  {
-    if (m_dlgProgress && allowSelection != SELECTION_AUTO)
-    {
-      if (!CGUIKeyboardFactory::ShowAndGetInput(album.strAlbum, g_localizeStrings.Get(16011), false))
-        return false;
-
-      CStdString strTempArtist(StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator));
-      if (!CGUIKeyboardFactory::ShowAndGetInput(strTempArtist, g_localizeStrings.Get(16025), false))
-        return false;
-      album.artist = StringUtils::Split(strTempArtist, g_advancedSettings.m_musicItemSeparator);
-      goto loop;
-    }
-  }
-  else if (albumDownloadStatus == INFO_ADDED)
-  {
-    m_musicdatabase.SetAlbumInfo(params.GetAlbumId(), albumInfo.GetAlbum(), albumInfo.GetAlbum().songs);
-    albumInfo.SetLoaded(true);
-    return true;
-  }
-
-  return false;
-}
-
-// This is basically the same as the MusicInfoScanner->Process, with a different kind
-// of dialog, and should be merged.
-bool CGUIWindowMusicBase::FindArtistInfo(const CFileItem* item, CMusicArtistInfo& artistInfo, ALLOW_SELECTION allowSelection)
-{
-  CQueryParams params;
-  CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
-
-  // We can only ever be called with a database artist, so no need
-  // to check if we can convert the FileItem.
-  CArtist artist;
-  m_musicdatabase.GetArtistInfo(params.GetArtistId(), artist);
-  
-  // show dialog box indicating we're searching the album
-  if (m_dlgProgress && allowSelection != SELECTION_AUTO)
-  {
-    m_dlgProgress->SetHeading(21889);
-    m_dlgProgress->SetLine(0, artist.strArtist);
-    m_dlgProgress->SetLine(1, "");
-    m_dlgProgress->SetLine(2, "");
-    m_dlgProgress->StartModal();
-  }
-
-  // find album info
-  ADDON::ScraperPtr scraper;
-  if (!m_musicdatabase.GetScraperForPath(item->GetPath(), scraper, ADDON::ADDON_SCRAPER_ARTISTS) || !scraper)
-    return false;
-  
-  CMusicInfoScanner scanner;
-
-loop:
-  INFO_RET artistDownloadStatus = scanner.DownloadArtistInfo(artist, scraper, artistInfo, m_dlgProgress);
-  if (artistDownloadStatus == INFO_NOT_FOUND)
-  {
-    if (m_dlgProgress && allowSelection != SELECTION_AUTO)
-    {
-      if (!CGUIKeyboardFactory::ShowAndGetInput(artist.strArtist, g_localizeStrings.Get(16025), false))
-        return false;
-      goto loop;
-    }
-  }
-  else if (artistDownloadStatus == INFO_ADDED)
-  {
-    m_musicdatabase.SetArtistInfo(params.GetArtistId(), artistInfo.GetArtist());
-    artistInfo.SetLoaded();
-    return true;
-  }
-
-  return false;
-}
-
 void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &buttons)
 {
   CFileItemPtr item;