Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[musicdb] cosmetic: Add HasArtistInfo and make GetArtistInfo use the …

…views, for consistency with albums
  • Loading branch information...
commit 84216cefeb464c374c331ef5ac120f1c7b2ffb3b 1 parent 901c7d5
night199uk night199uk authored
16 xbmc/music/MusicDatabase.cpp
View
@@ -1310,16 +1310,7 @@ bool CMusicDatabase::GetArtistInfo(int idArtist, CArtist &info, bool needAll)
if (idArtist == -1)
return false; // not in the database
- CStdString strSQL=PrepareSQL("SELECT artist.idArtist AS idArtist, strArtist, "
- " strBorn, strFormed, strGenres,"
- " strMoods, strStyles, strInstruments, "
- " strBiography, strDied, strDisbanded, "
- " strYearsActive, strImage, strFanart "
- " FROM artist "
- " JOIN artistinfo "
- " ON artist.idArtist = artistinfo.idArtist "
- " WHERE artistinfo.idArtist = %i"
- , idArtist);
+ CStdString strSQL=PrepareSQL("SELECT * FROM artistview WHERE idArtist = %i", idArtist);
if (!m_pDS2->query(strSQL.c_str())) return false;
int iRowsFound = m_pDS2->num_rows();
@@ -1350,6 +1341,11 @@ bool CMusicDatabase::GetArtistInfo(int idArtist, CArtist &info, bool needAll)
return false;
}
+bool CMusicDatabase::HasArtistInfo(int idArtist)
+{
+ return strtol(GetSingleValue("artistinfo", "count(idArtist)", PrepareSQL("idArtist = %ld", idArtist)), NULL, 10) > 0;
+}
+
bool CMusicDatabase::DeleteArtistInfo(int idArtist)
{
if (idArtist == -1)
6 xbmc/music/MusicDatabase.h
View
@@ -117,6 +117,12 @@ class CMusicDatabase : public CDatabase
bool GetAlbumInfo(int idAlbum, CAlbum &info, VECSONGS* songs, bool scrapedInfo = false);
bool HasAlbumInfo(int idAlbum);
bool GetArtistInfo(int idArtist, CArtist &info, bool needAll=true);
+
+ /*! \brief Check if an artist entity has additional metadata (scraped)
+ \param idArtist the id of the Artist to check
+ \return true or false - whether the artist has metadata
+ */
+ bool HasArtistInfo(int idArtist);
bool GetSongByFileName(const CStdString& strFileName, CSong& song, int startOffset = 0);
int GetAlbumIdByPath(const CStdString& path);
bool GetSongById(int idSong, CSong& song);
2  xbmc/music/infoscanner/MusicInfoScanner.cpp
View
@@ -1153,7 +1153,7 @@ bool CMusicInfoScanner::DownloadArtistInfo(const CStdString& strPath, const CStd
bCanceled = false;
CArtist artist;
m_musicDatabase.Open();
- if (m_musicDatabase.GetArtistInfo(params.GetArtistId(),artist)) // already got the info
+ if (m_musicDatabase.HasArtistInfo(params.GetArtistId()) && m_musicDatabase.GetArtistInfo(params.GetArtistId(),artist)) // already got the info
return true;
// find artist info
Please sign in to comment.
Something went wrong with that request. Please try again.