Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[musicdb] cosmetic: shuffle some code to a place where it makes more …

…sense
  • Loading branch information...
commit 8983723256893dd43568451d72628713d3d07880 1 parent 5704b96
night199uk night199uk authored
Showing with 32 additions and 37 deletions.
  1. +32 −37 xbmc/music/infoscanner/MusicInfoScanner.cpp
69 xbmc/music/infoscanner/MusicInfoScanner.cpp
View
@@ -996,14 +996,13 @@ bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdS
}
}
- CGUIDialogSelect *pDlg=NULL;
+ CGUIDialogSelect *pDlg = NULL;
int iSelectedAlbum=0;
if (result == CNfoFile::NO_NFO)
{
iSelectedAlbum = -1; // set negative so that we can detect a failure
if (scraper.Succeeded() && scraper.GetAlbumCount() >= 1)
{
- int bestMatch = -1;
double bestRelevance = 0;
double minRelevance = THRESHOLD;
if (scraper.GetAlbumCount() > 1) // score the matches
@@ -1029,7 +1028,7 @@ bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdS
if (relevance >= max(minRelevance, bestRelevance))
{ // we auto-select the best of these
bestRelevance = relevance;
- bestMatch = i;
+ iSelectedAlbum = i;
}
if (pDialog)
{
@@ -1043,6 +1042,35 @@ bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdS
if (relevance > .99f) // we're so close, no reason to search further
break;
}
+
+ if (pDialog && bestRelevance < THRESHOLD)
+ {
+ pDlg->Sort(false);
+ pDlg->DoModal();
+
+ // and wait till user selects one
+ if (pDlg->GetSelectedLabel() < 0)
+ { // none chosen
+ if (!pDlg->IsButtonPressed())
+ return false;
+
+ // manual button pressed
+ CStdString strNewAlbum = album.strAlbum;
+ if (!CGUIKeyboardFactory::ShowAndGetInput(strNewAlbum, g_localizeStrings.Get(16011), false)) return false;
+ if (strNewAlbum == "") return false;
+
+ CStdString strNewArtist = StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator);
+ if (!CGUIKeyboardFactory::ShowAndGetInput(strNewArtist, g_localizeStrings.Get(16025), false)) return false;
+
+ pDialog->SetLine(0, strNewAlbum);
+ pDialog->SetLine(1, strNewArtist);
+ pDialog->Progress();
+
+ m_musicDatabase.Close();
+ return DownloadAlbumInfo(strPath,strNewArtist,strNewAlbum,bCanceled,albumInfo,pDialog);
+ }
+ iSelectedAlbum = pDlg->GetSelectedItem()->m_idepth;
+ }
}
else
{
@@ -1055,40 +1083,7 @@ bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdS
m_musicDatabase.Close();
return false;
}
- bestRelevance = relevance;
- bestMatch = 0;
- }
-
- iSelectedAlbum = bestMatch;
- if (pDialog && bestRelevance < THRESHOLD)
- {
- pDlg->Sort(false);
- pDlg->DoModal();
-
- // and wait till user selects one
- if (pDlg->GetSelectedLabel() < 0)
- { // none chosen
- if (!pDlg->IsButtonPressed())
- {
- bCanceled = true;
- return false;
- }
- // manual button pressed
- CStdString strNewAlbum = strAlbum;
- if (!CGUIKeyboardFactory::ShowAndGetInput(strNewAlbum, g_localizeStrings.Get(16011), false)) return false;
- if (strNewAlbum == "") return false;
-
- CStdString strNewArtist = strArtist;
- if (!CGUIKeyboardFactory::ShowAndGetInput(strNewArtist, g_localizeStrings.Get(16025), false)) return false;
-
- pDialog->SetLine(0, strNewAlbum);
- pDialog->SetLine(1, strNewArtist);
- pDialog->Progress();
-
- m_musicDatabase.Close();
- return DownloadAlbumInfo(strPath,strNewArtist,strNewAlbum,bCanceled,albumInfo,pDialog);
- }
- iSelectedAlbum = pDlg->GetSelectedItem()->m_idepth;
+ iSelectedAlbum = 0;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.