Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[musicdb] fix: db updates fail due to duplicate keys creating unique …

…indexes for musicbrainz
  • Loading branch information...
commit a0dbc673b7f01b1c58295b4fdcbee2feeadbc0ff 1 parent 6deaf5f
night199uk night199uk authored
3  xbmc/music/MusicDatabase.cpp
@@ -3727,6 +3727,7 @@ bool CMusicDatabase::UpdateOldVersion(int version)
m_pDS->exec("CREATE INDEX idxSong3 ON song(idAlbum)");
m_pDS->exec("CREATE INDEX idxSong6 ON song(idPath)");
+ m_pDS->exec("UPDATE song SET strMusicBrainzTrackID = NULL where strMusicBrainzTrackID = ''");
m_pDS->exec("CREATE UNIQUE INDEX idxArtist1 ON artist(strMusicBrainzArtistID(36))");
@@ -3736,6 +3737,8 @@ bool CMusicDatabase::UpdateOldVersion(int version)
m_pDS->exec("CREATE UNIQUE INDEX idxSong7 ON song( idAlbum, strMusicBrainzTrackID(36) )");
m_pDS->exec("ALTER TABLE album_artist ADD strJoinPhrase text\n");
m_pDS->exec("ALTER TABLE song_artist ADD strJoinPhrase text\n");
+ CMediaSettings::Get().SetMusicNeedsUpdate(35);
+ CSettings::Get().Save();
// always recreate the views after any table change
9 xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -1142,13 +1142,18 @@ bool CGUIWindowMusicBase::CanContainFilter(const CStdString &strDirectory) const
void CGUIWindowMusicBase::OnInitWindow()
- if (CMediaSettings::Get().GetMusicNeedsUpdate() == 27 && !g_application.IsMusicScanning() &&
+ if (CMediaSettings::Get().GetMusicNeedsUpdate() == 35 && !g_application.IsMusicScanning() &&
// rescan of music library required
if (CGUIDialogYesNo::ShowAndGetInput(799, 800, 801, -1))
- g_application.StartMusicScan("", CMusicInfoScanner::SCAN_RESCAN);
+ int flags = CMusicInfoScanner::SCAN_RESCAN;
+ if (CSettings::Get().GetBool("musiclibrary.downloadinfo"))
+ flags |= CMusicInfoScanner::SCAN_ONLINE;
+ if (CSettings::Get().GetBool("musiclibrary.backgroundupdate"))
+ flags |= CMusicInfoScanner::SCAN_BACKGROUND;
+ g_application.StartMusicScan("", flags);
jmarshallnz Owner

Is there really no other solution to this bug than a complete rescan, including online? This should be a last resort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
CMediaSettings::Get().SetMusicNeedsUpdate(0); // once is enough (user may interrupt, but that's up to them)

Is there really no other solution to this bug than a complete rescan, including online? This should be a last resort.

Please sign in to comment.
Something went wrong with that request. Please try again.