1 /*
2  *  Copyright (C) 2016-2018 Team Kodi
3  *  This file is part of Kodi - https://kodi.tv
4  *
5  *  SPDX-License-Identifier: GPL-2.0-or-later
6  *  See LICENSES/README.md for more information.
7  */
8 
9 #include "QueryParams.h"
10 
11 #include "video/VideoDatabase.h"
12 
13 using namespace XFILE::VIDEODATABASEDIRECTORY;
14 
CQueryParams()15 CQueryParams::CQueryParams()
16 {
17   m_idMovie = -1;
18   m_idGenre = -1;
19   m_idCountry = -1;
20   m_idYear = -1;
21   m_idActor = -1;
22   m_idDirector = -1;
23   m_idContent = -1;
24   m_idShow = -1;
25   m_idSeason = -1;
26   m_idEpisode = -1;
27   m_idStudio = -1;
28   m_idMVideo = -1;
29   m_idAlbum = -1;
30   m_idSet = -1;
31   m_idTag = -1;
32 }
33 
SetQueryParam(NODE_TYPE NodeType,const std::string & strNodeName)34 void CQueryParams::SetQueryParam(NODE_TYPE NodeType, const std::string& strNodeName)
35 {
36   long idDb=atol(strNodeName.c_str());
37 
38   switch (NodeType)
39   {
40   case NODE_TYPE_OVERVIEW:
41     if (strNodeName == "tvshows")
42       m_idContent = VIDEODB_CONTENT_TVSHOWS;
43     else if (strNodeName == "musicvideos")
44       m_idContent = VIDEODB_CONTENT_MUSICVIDEOS;
45     else
46       m_idContent = VIDEODB_CONTENT_MOVIES;
47     break;
48   case NODE_TYPE_GENRE:
49     m_idGenre = idDb;
50     break;
51   case NODE_TYPE_COUNTRY:
52     m_idCountry = idDb;
53     break;
54   case NODE_TYPE_YEAR:
55     m_idYear = idDb;
56     break;
57   case NODE_TYPE_ACTOR:
58     m_idActor = idDb;
59     break;
60   case NODE_TYPE_DIRECTOR:
61     m_idDirector = idDb;
62     break;
63   case NODE_TYPE_TITLE_MOVIES:
64   case NODE_TYPE_RECENTLY_ADDED_MOVIES:
65     m_idMovie = idDb;
66     break;
67   case NODE_TYPE_TITLE_TVSHOWS:
68   case NODE_TYPE_INPROGRESS_TVSHOWS:
69     m_idShow = idDb;
70     break;
71   case NODE_TYPE_SEASONS:
72     m_idSeason = idDb;
73     break;
74   case NODE_TYPE_EPISODES:
75   case NODE_TYPE_RECENTLY_ADDED_EPISODES:
76     m_idEpisode = idDb;
77     break;
78   case NODE_TYPE_STUDIO:
79     m_idStudio = idDb;
80     break;
81   case NODE_TYPE_TITLE_MUSICVIDEOS:
82   case NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS:
83     m_idMVideo = idDb;
84     break;
85   case NODE_TYPE_MUSICVIDEOS_ALBUM:
86     m_idAlbum = idDb;
87     break;
88   case NODE_TYPE_SETS:
89     m_idSet = idDb;
90     break;
91   case NODE_TYPE_TAGS:
92     m_idTag = idDb;
93     break;
94   default:
95     break;
96   }
97 }
98