Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2194 from Montellese/chooseart_all_artwork

show all existing artwork types for a specific media type in the "Choose art" dialog
  • Loading branch information...
commit 9c1e76361dfea0825afaa68fc599ec64165fd646 2 parents 686dd32 + 11c9ed3
Sascha Montellese Montellese authored
27 xbmc/video/VideoDatabase.cpp
View
@@ -3731,6 +3731,33 @@ bool CVideoDatabase::GetTvShowSeasonArt(int showId, map<int, map<string, string>
return false;
}
+bool CVideoDatabase::GetArtTypes(const std::string &mediaType, std::vector<std::string> &artTypes)
+{
+ try
+ {
+ if (NULL == m_pDB.get()) return false;
+ if (NULL == m_pDS.get()) return false;
+
+ CStdString sql = PrepareSQL("SELECT DISTINCT type FROM art WHERE media_type='%s'", mediaType.c_str());
+ int numRows = RunQuery(sql);
+ if (numRows <= 0)
+ return numRows == 0;
+
+ while (!m_pDS->eof())
+ {
+ artTypes.push_back(m_pDS->fv(0).get_asString());
+ m_pDS->next();
+ }
+ m_pDS->close();
+ return true;
+ }
+ catch (...)
+ {
+ CLog::Log(LOGERROR, "%s(%s) failed", __FUNCTION__, mediaType.c_str());
+ }
+ return false;
+}
+
/// \brief GetStackTimes() obtains any saved video times for the stacked file
/// \retval Returns true if the stack times exist, false otherwise.
bool CVideoDatabase::GetStackTimes(const CStdString &filePath, vector<int> &times)
1  xbmc/video/VideoDatabase.h
View
@@ -682,6 +682,7 @@ class CVideoDatabase : public CDatabase
bool GetArtForItem(int mediaId, const std::string &mediaType, std::map<std::string, std::string> &art);
std::string GetArtForItem(int mediaId, const std::string &mediaType, const std::string &artType);
bool GetTvShowSeasonArt(int mediaId, std::map<int, std::map<std::string, std::string> > &seasonArt);
+ bool GetArtTypes(const std::string &mediaType, std::vector<std::string> &artTypes);
int AddTag(const std::string &tag);
void AddTagToItem(int idItem, int idTag, const std::string &type);
9 xbmc/video/dialogs/GUIDialogVideoInfo.cpp
View
@@ -620,6 +620,15 @@ string CGUIDialogVideoInfo::ChooseArtType(const CFileItem &videoItem, map<string
artTypes.push_back(i->first);
}
+ // add any art types that exist for other media items of the same type
+ vector<string> dbArtTypes;
+ db.GetArtTypes(videoItem.GetVideoInfoTag()->m_type, dbArtTypes);
+ for (vector<string>::const_iterator it = dbArtTypes.begin(); it != dbArtTypes.end(); it++)
+ {
+ if (find(artTypes.begin(), artTypes.end(), *it) == artTypes.end())
+ artTypes.push_back(*it);
+ }
+
for (vector<string>::const_iterator i = artTypes.begin(); i != artTypes.end(); ++i)
{
string type = *i;
Please sign in to comment.
Something went wrong with that request. Please try again.