return ret;
}
-void CMusicDatabase::DeleteAlbumInfo()
-{
- // open our database
- Open();
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
-
- // If we are scanning for music info in the background,
- // other writing access to the database is prohibited.
- if (g_application.IsMusicScanning())
- {
- CGUIDialogOK::ShowAndGetInput(189, 14057, 0, 0);
- return;
- }
-
- CStdString strSQL="select * from albuminfo,album,artist where and albuminfo.idAlbum=album.idAlbum and album.idArtist=artist.idArtist order by album.strAlbum";
- if (!m_pDS->query(strSQL.c_str())) return ;
- int iRowsFound = m_pDS->num_rows();
- if (iRowsFound == 0)
- {
- m_pDS->close();
- CGUIDialogOK::ShowAndGetInput(313, 425, 0, 0);
- }
- vector<CAlbum> vecAlbums;
- while (!m_pDS->eof())
- {
- CAlbum album;
- album.idAlbum = m_pDS->fv("album.idAlbum").get_asInt() ;
- album.strAlbum = m_pDS->fv("album.strAlbum").get_asString();
- album.artist = StringUtils::Split(m_pDS->fv("album.strArtists").get_asString(), g_advancedSettings.m_musicItemSeparator);
- vecAlbums.push_back(album);
- m_pDS->next();
- }
- m_pDS->close();
-
- // Show a selectdialog that the user can select the albuminfo to delete
- CGUIDialogSelect *pDlg = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
- if (pDlg)
- {
- pDlg->SetHeading(g_localizeStrings.Get(181).c_str());
- pDlg->Reset();
- for (int i = 0; i < (int)vecAlbums.size(); ++i)
- {
- CAlbum& album = vecAlbums[i];
- pDlg->Add(album.strAlbum + " - " + StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator));
- }
- pDlg->DoModal();
-
- // and wait till user selects one
- int iSelectedAlbum = pDlg->GetSelectedLabel();
- if (iSelectedAlbum < 0)
- {
- vecAlbums.erase(vecAlbums.begin(), vecAlbums.end());
- return ;
- }
-
- CAlbum& album = vecAlbums[iSelectedAlbum];
- strSQL=PrepareSQL("delete from albuminfo where albuminfo.idAlbum=%i", album.idAlbum);
- if (!m_pDS->exec(strSQL.c_str())) return ;
-
- vecAlbums.erase(vecAlbums.begin(), vecAlbums.end());
- }
-}
-
bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/)
{
#ifdef HAS_DVD_DRIVE