Skip to content

Commit

Permalink
[dbupdate] add settings indicating the db needs an update, so that la…
Browse files Browse the repository at this point in the history
…ter update code can kick in and rescan as needed
  • Loading branch information
Jonathan Marshall committed Jul 3, 2012
1 parent 2e56957 commit 392bf9c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions xbmc/music/MusicDatabase.cpp
Expand Up @@ -3518,6 +3518,9 @@ bool CMusicDatabase::UpdateOldVersion(int version)
if (version < 27)
{
m_pDS->exec("DROP TABLE thumb");

g_settings.m_musicNeedsUpdate = 27;
g_settings.Save();
}

// always recreate the views after any table change
Expand Down
8 changes: 7 additions & 1 deletion xbmc/settings/Settings.cpp
Expand Up @@ -135,6 +135,9 @@ void CSettings::Initialize()
m_lastUsedProfile = 0;
m_currentProfile = 0;
m_nextIdProfile = 0;

m_musicNeedsUpdate = 0;
m_videoNeedsUpdate = 0;
}

CSettings::~CSettings(void)
Expand Down Expand Up @@ -609,6 +612,7 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile)
GetInteger(pElement, "startwindow", m_iMyMusicStartWindow, WINDOW_MUSIC_FILES, WINDOW_MUSIC_FILES, WINDOW_MUSIC_NAV); //501; view songs
XMLUtils::GetBoolean(pElement, "songinfoinvis", m_bMyMusicSongInfoInVis);
XMLUtils::GetBoolean(pElement, "songthumbinvis", m_bMyMusicSongThumbInVis);
GetInteger(pElement, "needsupdate", m_musicNeedsUpdate, 0, 0, INT_MAX);
GetPath(pElement, "defaultlibview", m_defaultMusicLibSource);
}
// myvideos settings
Expand All @@ -624,6 +628,7 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile)
GetInteger(pElement, "watchmodemusicvideos", m_watchMode["musicvideos"], VIDEO_SHOW_ALL, VIDEO_SHOW_ALL, VIDEO_SHOW_WATCHED);

XMLUtils::GetBoolean(pElement, "flatten", m_bMyVideoNavFlatten);
GetInteger(pElement, "needsupdate", m_videoNeedsUpdate, 0, 0, INT_MAX);

TiXmlElement *pChild = pElement->FirstChildElement("playlist");
if (pChild)
Expand Down Expand Up @@ -805,6 +810,7 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo
XMLUtils::SetBoolean(pChild, "isscanning", m_bMyMusicIsScanning);
}

XMLUtils::SetInt(pNode, "needsupdate", m_musicNeedsUpdate);
XMLUtils::SetInt(pNode, "startwindow", m_iMyMusicStartWindow);
XMLUtils::SetBoolean(pNode, "songinfoinvis", m_bMyMusicSongInfoInVis);
XMLUtils::SetBoolean(pNode, "songthumbinvis", m_bMyMusicSongThumbInVis);
Expand All @@ -822,7 +828,7 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo
XMLUtils::SetInt(pNode, "watchmodemovies", m_watchMode.find("movies")->second);
XMLUtils::SetInt(pNode, "watchmodetvshows", m_watchMode.find("tvshows")->second);
XMLUtils::SetInt(pNode, "watchmodemusicvideos", m_watchMode.find("musicvideos")->second);

XMLUtils::SetInt(pNode, "needsupdate", m_videoNeedsUpdate);
XMLUtils::SetBoolean(pNode, "flatten", m_bMyVideoNavFlatten);

{ // playlist window
Expand Down
3 changes: 3 additions & 0 deletions xbmc/settings/Settings.h
Expand Up @@ -255,6 +255,9 @@ class CSettings
CStdString m_UPnPUUIDRenderer;
int m_UPnPPortRenderer;

int m_musicNeedsUpdate; ///< if a database update means an update is required (set to the version number of the db)
int m_videoNeedsUpdate; ///< if a database update means an update is required (set to the version number of the db)

/*! \brief Retrieve the master profile
\return const reference to the master profile
*/
Expand Down
3 changes: 3 additions & 0 deletions xbmc/video/VideoDatabase.cpp
Expand Up @@ -3836,6 +3836,9 @@ bool CVideoDatabase::UpdateOldVersion(int iVersion)
m_pDS->exec("CREATE TRIGGER delete_season AFTER DELETE ON seasons FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idSeason AND media_type='season'; END");
m_pDS->exec("CREATE TRIGGER delete_set AFTER DELETE ON sets FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idSet AND media_type='set'; END");
m_pDS->exec("CREATE TRIGGER delete_person AFTER DELETE ON actors FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idActor AND media_type IN ('actor','artist','writer','director'); END");

g_settings.m_videoNeedsUpdate = 63;
g_settings.Save();
}
if (iVersion < 64)
{ // add idShow to episode table
Expand Down

0 comments on commit 392bf9c

Please sign in to comment.