Skip to content
This repository
Browse code

smartplaylists: add tag field for tvshows and musicvideos

  • Loading branch information...
commit b22f67f9276e32547a7c5ab8578c91338aa38171 1 parent 3fb2f9d
Sascha Montellese authored February 04, 2013
11  xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
@@ -298,10 +298,15 @@ void CGUIDialogSmartPlaylistRule::OnBrowse()
298 298
   }
299 299
   else if (m_rule.m_field == FieldTag)
300 300
   {
301  
-    if (m_type == "movies")
302  
-      videodatabase.GetTagsNav(basePath + "9/", items, VIDEODB_CONTENT_MOVIES);
303  
-    else
  301
+    VIDEODB_CONTENT_TYPE type = VIDEODB_CONTENT_MOVIES;
  302
+    if (m_type == "tvshows")
  303
+      type = VIDEODB_CONTENT_TVSHOWS;
  304
+    else if (m_type == "musicvideos")
  305
+      type = VIDEODB_CONTENT_MUSICVIDEOS;
  306
+    else if (m_type != "movies")
304 307
       return;
  308
+
  309
+    videodatabase.GetTagsNav(basePath + "9/", items, type);
305 310
     iLabel = 20459;
306 311
   }
307 312
   else
6  xbmc/playlists/SmartPlayList.cpp
@@ -418,6 +418,7 @@ vector<Field> CSmartPlaylistRule::GetFields(const CStdString &type)
418 418
     fields.push_back(FieldDateAdded);
419 419
     fields.push_back(FieldLastPlayed);
420 420
     fields.push_back(FieldInProgress);
  421
+    fields.push_back(FieldTag);
421 422
   }
422 423
   else if (type == "episodes")
423 424
   {
@@ -489,6 +490,7 @@ vector<Field> CSmartPlaylistRule::GetFields(const CStdString &type)
489 490
     fields.push_back(FieldDirector);
490 491
     fields.push_back(FieldStudio);
491 492
     fields.push_back(FieldPlot);
  493
+    fields.push_back(FieldTag);
492 494
     fields.push_back(FieldDateAdded);
493 495
     isVideo = true;
494 496
   }
@@ -899,6 +901,8 @@ CStdString CSmartPlaylistRule::GetWhereClause(const CDatabase &db, const CStdStr
899 901
         query = GetField(FieldId, strType) + negate + " IN (SELECT idMVideo FROM directorlinkmusicvideo JOIN actors ON actors.idActor=directorlinkmusicvideo.idDirector WHERE actors.strActor" + parameter + ")";
900 902
       else if ((m_field == FieldLastPlayed || m_field == FieldDateAdded) && (m_operator == OPERATOR_LESS_THAN || m_operator == OPERATOR_BEFORE || m_operator == OPERATOR_NOT_IN_THE_LAST))
901 903
         query = GetField(m_field, strType) + " IS NULL OR " + GetField(m_field, strType) + parameter;
  904
+      else if (m_field == FieldTag)
  905
+        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')";
902 906
     }
903 907
     else if (strType == "tvshows")
904 908
     {
@@ -918,6 +922,8 @@ CStdString CSmartPlaylistRule::GetWhereClause(const CDatabase &db, const CStdStr
918 922
         query = GetField(m_field, strType) + " IS NULL OR " + GetField(m_field, strType) + parameter;
919 923
       else if (m_field == FieldPlaycount)
920 924
         query = "CASE WHEN COALESCE(" + GetField(FieldNumberOfEpisodes, strType) + " - " + GetField(FieldNumberOfWatchedEpisodes, strType) + ", 0) > 0 THEN 0 ELSE 1 END " + parameter;
  925
+      else if (m_field == FieldTag)
  926
+        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')";
921 927
     }
922 928
     else if (strType == "episodes")
923 929
     {

0 notes on commit b22f67f

Please sign in to comment.
Something went wrong with that request. Please try again.