aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Marshall <jmarshall@xbmc.org>2013-12-03 12:23:02 +1300
committerJonathan Marshall <jmarshall@xbmc.org>2013-12-24 13:48:56 +1300
commitf5ffcd2b8af54006b1f2baf19b28ab86856d46db (patch)
tree4900d7b7d754a3f853ef8057e64ced06c95402be
parentd0c413ae71782ccb885dd35b2df9d172b855e6f9 (diff)
[musicdb] Adds HasArtistScrapedInfo/ClearArtistLastScrapeTime and drop old methods
-rw-r--r--xbmc/music/MusicDatabase.cpp26
-rw-r--r--xbmc/music/MusicDatabase.h4
-rw-r--r--xbmc/music/infoscanner/MusicInfoScanner.cpp4
-rw-r--r--xbmc/music/windows/GUIWindowMusicBase.cpp4
4 files changed, 18 insertions, 20 deletions
diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp
index a786652eb2..15515e7a85 100644
--- a/xbmc/music/MusicDatabase.cpp
+++ b/xbmc/music/MusicDatabase.cpp
@@ -1151,6 +1151,18 @@ bool CMusicDatabase::GetArtist(int idArtist, CArtist &artist, bool fetchAll /* =
return false;
}
+bool CMusicDatabase::HasArtistBeenScraped(int idArtist)
+{
+ CStdString strSQL = PrepareSQL("SELECT idArtist FROM artist WHERE idArtist = %i AND lastScraped IS NULL", idArtist);
+ return GetSingleValue(strSQL).empty();
+}
+
+bool CMusicDatabase::ClearArtistLastScrapedTime(int idArtist)
+{
+ CStdString strSQL = PrepareSQL("UPDATE artist SET lastScraped = NULL WHERE idArtist = %i", idArtist);
+ return ExecuteQuery(strSQL);
+}
+
bool CMusicDatabase::AddSongArtist(int idArtist, int idSong, std::string joinPhrase, bool featured, int iOrder)
{
CStdString strSQL;
@@ -1752,20 +1764,6 @@ bool CMusicDatabase::SearchArtists(const CStdString& search, CFileItemList &arti
return false;
}
-bool CMusicDatabase::HasArtistInfo(int idArtist)
-{
- CStdString strSQL = PrepareSQL("SELECT idArtist FROM artist WHERE idArtist = %ld AND lastScraped IS NULL", idArtist);
- return GetSingleValue(strSQL).empty();
-}
-
-bool CMusicDatabase::DeleteArtistInfo(int idArtist)
-{
- if (idArtist == -1)
- return false; // not in the database
-
- return ExecuteQuery(PrepareSQL("UPDATE artist SET lastScraped=NULL where idArtist=%i",idArtist));
-}
-
bool CMusicDatabase::GetTop100(const CStdString& strBaseDir, CFileItemList& items)
{
try
diff --git a/xbmc/music/MusicDatabase.h b/xbmc/music/MusicDatabase.h
index ad3f0b9418..5048202a37 100644
--- a/xbmc/music/MusicDatabase.h
+++ b/xbmc/music/MusicDatabase.h
@@ -247,6 +247,8 @@ public:
bool GetArtist(int idArtist, CArtist& artist, bool fetchAll = true);
int UpdateArtist(int idArtist, const CArtist& artist);
bool DeleteArtist(int idArtist);
+ bool HasArtistBeenScraped(int idArtist);
+ bool ClearArtistLastScrapedTime(int idArtist);
CStdString GetArtistById(int id);
int GetArtistByName(const CStdString& strArtist);
@@ -276,9 +278,7 @@ public:
\param idArtist the id of the Artist to check
\return true or false - whether the artist has metadata
*/
- bool HasArtistInfo(int idArtist);
int SetArtistInfo(int idArtist, const CArtist& artist);
- bool DeleteArtistInfo(int idArtist);
/////////////////////////////////////////////////
// Link tables
diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp
index 832b4bae32..a982751bf9 100644
--- a/xbmc/music/infoscanner/MusicInfoScanner.cpp
+++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp
@@ -197,7 +197,7 @@ void CMusicInfoScanner::Process()
{
CQueryParams params;
CDirectoryNode::GetDatabaseInfo(*it, params);
- if (m_musicDatabase.HasArtistInfo(params.GetArtistId())) // should this be here?
+ if (m_musicDatabase.HasArtistBeenScraped(params.GetArtistId())) // should this be here?
continue;
CArtist artist;
@@ -341,7 +341,7 @@ void CMusicInfoScanner::FetchArtistInfo(const CStdString& strDirectory,
m_pathsToScan.insert(items[i]->GetPath());
if (refresh)
{
- m_musicDatabase.DeleteArtistInfo(items[i]->GetMusicInfoTag()->GetDatabaseId());
+ m_musicDatabase.ClearArtistLastScrapedTime(items[i]->GetMusicInfoTag()->GetDatabaseId());
}
}
m_musicDatabase.Close();
diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp
index a1bded2da1..cf45b63111 100644
--- a/xbmc/music/windows/GUIWindowMusicBase.cpp
+++ b/xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -368,7 +368,7 @@ void CGUIWindowMusicBase::ShowArtistInfo(const CFileItem *pItem, bool bShowInfo
while (1)
{
// Check if we have the information in the database first
- if (!m_musicdatabase.HasArtistInfo(params.GetArtistId()) ||
+ if (!m_musicdatabase.HasArtistBeenScraped(params.GetArtistId()) ||
!m_musicdatabase.GetArtist(params.GetArtistId(), artistInfo.GetArtist()))
{
if (!CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
@@ -411,7 +411,7 @@ void CGUIWindowMusicBase::ShowArtistInfo(const CFileItem *pItem, bool bShowInfo
if (pDlgArtistInfo->NeedRefresh())
{
- m_musicdatabase.DeleteArtistInfo(params.GetArtistId());
+ m_musicdatabase.ClearArtistLastScrapedTime(params.GetArtistId());
continue;
}
else if (pDlgArtistInfo->HasUpdatedThumb())