Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

smartplaylists: add tag field for tvshows and musicvideos

  • Loading branch information...
commit b22f67f9276e32547a7c5ab8578c91338aa38171 1 parent 3fb2f9d
@Montellese Montellese authored
View
11 xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
@@ -298,10 +298,15 @@ void CGUIDialogSmartPlaylistRule::OnBrowse()
}
else if (m_rule.m_field == FieldTag)
{
- if (m_type == "movies")
- videodatabase.GetTagsNav(basePath + "9/", items, VIDEODB_CONTENT_MOVIES);
- else
+ VIDEODB_CONTENT_TYPE type = VIDEODB_CONTENT_MOVIES;
+ if (m_type == "tvshows")
+ type = VIDEODB_CONTENT_TVSHOWS;
+ else if (m_type == "musicvideos")
+ type = VIDEODB_CONTENT_MUSICVIDEOS;
+ else if (m_type != "movies")
return;
+
+ videodatabase.GetTagsNav(basePath + "9/", items, type);
iLabel = 20459;
}
else
View
6 xbmc/playlists/SmartPlayList.cpp
@@ -418,6 +418,7 @@ vector<Field> CSmartPlaylistRule::GetFields(const CStdString &type)
fields.push_back(FieldDateAdded);
fields.push_back(FieldLastPlayed);
fields.push_back(FieldInProgress);
+ fields.push_back(FieldTag);
}
else if (type == "episodes")
{
@@ -489,6 +490,7 @@ vector<Field> CSmartPlaylistRule::GetFields(const CStdString &type)
fields.push_back(FieldDirector);
fields.push_back(FieldStudio);
fields.push_back(FieldPlot);
+ fields.push_back(FieldTag);
fields.push_back(FieldDateAdded);
isVideo = true;
}
@@ -899,6 +901,8 @@ CStdString CSmartPlaylistRule::GetWhereClause(const CDatabase &db, const CStdStr
query = GetField(FieldId, strType) + negate + " IN (SELECT idMVideo FROM directorlinkmusicvideo JOIN actors ON actors.idActor=directorlinkmusicvideo.idDirector WHERE actors.strActor" + parameter + ")";
else if ((m_field == FieldLastPlayed || m_field == FieldDateAdded) && (m_operator == OPERATOR_LESS_THAN || m_operator == OPERATOR_BEFORE || m_operator == OPERATOR_NOT_IN_THE_LAST))
query = GetField(m_field, strType) + " IS NULL OR " + GetField(m_field, strType) + parameter;
+ else if (m_field == FieldTag)
+ query = GetField(FieldId, strType) + negate + " IN (SELECT idMedia FROM taglinks JOIN tag ON tag.idTag = taglinks.idTag WHERE tag.strTag" + parameter + " AND taglinks.media_type = 'musicvideo')";
}
else if (strType == "tvshows")
{
@@ -918,6 +922,8 @@ CStdString CSmartPlaylistRule::GetWhereClause(const CDatabase &db, const CStdStr
query = GetField(m_field, strType) + " IS NULL OR " + GetField(m_field, strType) + parameter;
else if (m_field == FieldPlaycount)
query = "CASE WHEN COALESCE(" + GetField(FieldNumberOfEpisodes, strType) + " - " + GetField(FieldNumberOfWatchedEpisodes, strType) + ", 0) > 0 THEN 0 ELSE 1 END " + parameter;
+ else if (m_field == FieldTag)
+ query = GetField(FieldId, strType) + negate + " IN (SELECT idMedia FROM taglinks JOIN tag ON tag.idTag = taglinks.idTag WHERE tag.strTag" + parameter + " AND taglinks.media_type = 'tvshow')";
}
else if (strType == "episodes")
{
Please sign in to comment.
Something went wrong with that request. Please try again.