2 * Copyright (C) 2016-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "GUIViewStateVideo.h"
12 #include "ServiceBroker.h"
13 #include "VideoDatabase.h"
14 #include "filesystem/Directory.h"
15 #include "filesystem/VideoDatabaseDirectory.h"
16 #include "guilib/WindowIDs.h"
17 #include "playlists/PlayListTypes.h"
18 #include "settings/MediaSettings.h"
19 #include "settings/MediaSourceSettings.h"
20 #include "settings/Settings.h"
21 #include "settings/SettingsComponent.h"
22 #include "utils/FileExtensionProvider.h"
23 #include "utils/SortUtils.h"
24 #include "view/ViewStateSettings.h"
26 using namespace XFILE
;
27 using namespace VIDEODATABASEDIRECTORY
;
29 std::string
CGUIViewStateWindowVideo::GetLockType()
34 std::string
CGUIViewStateWindowVideo::GetExtensions()
36 return CServiceBroker::GetFileExtensionProvider().GetVideoExtensions();
39 PLAYLIST::Id
CGUIViewStateWindowVideo::GetPlaylist() const
41 return PLAYLIST::TYPE_VIDEO
;
44 VECSOURCES
& CGUIViewStateWindowVideo::GetSources()
47 return CGUIViewState::GetSources();
50 bool CGUIViewStateWindowVideo::AutoPlayNextItem()
52 return AutoPlayNextVideoItem();
55 /***************************/
57 CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList
& items
) : CGUIViewStateWindowVideo(items
)
59 SortAttribute sortAttributes
= SortAttributeNone
;
60 if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING
))
61 sortAttributes
= SortAttributeIgnoreArticle
;
63 if (items
.IsVirtualDirectoryRoot())
65 AddSortMethod(SortByNone
, 551, LABEL_MASKS("%F", "%I", "%L", "")); // Filename, Size | Label, empty
66 SetSortMethod(SortByNone
);
68 SetViewAsControl(DEFAULT_VIEW_LIST
);
70 SetSortOrder(SortOrderNone
);
72 else if (items
.IsVideoDb())
74 NODE_TYPE NodeType
=CVideoDatabaseDirectory::GetDirectoryChildType(items
.GetPath());
76 CVideoDatabaseDirectory::GetQueryParams(items
.GetPath(),params
);
80 case NODE_TYPE_MOVIES_OVERVIEW
:
81 case NODE_TYPE_TVSHOWS_OVERVIEW
:
82 case NODE_TYPE_MUSICVIDEOS_OVERVIEW
:
83 case NODE_TYPE_OVERVIEW
:
85 AddSortMethod(SortByNone
, 551, LABEL_MASKS("%F", "%I", "%L", "")); // Filename, Size | Label, empty
87 SetSortMethod(SortByNone
);
89 SetViewAsControl(DEFAULT_VIEW_LIST
);
91 SetSortOrder(SortOrderNone
);
94 case NODE_TYPE_DIRECTOR
:
97 AddSortMethod(SortByLabel
, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
98 AddSortMethod(SortByRelevance
, 38026, LABEL_MASKS("%T", "%c", "%L", "%c")); // Title, Actor's appearances (Relevance) | Label, Actor's appearances (Relevance)
99 SetSortMethod(SortByLabel
);
101 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavactors");
102 SetViewAsControl(viewState
->m_viewMode
);
103 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
108 AddSortMethod(SortByLabel
, 562, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
109 SetSortMethod(SortByLabel
);
111 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavyears");
112 SetViewAsControl(viewState
->m_viewMode
);
113 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
116 case NODE_TYPE_SEASONS
:
118 AddSortMethod(SortBySortTitle
, 556, LABEL_MASKS("%L", "","%L","")); // Label, empty | Label, empty
119 SetSortMethod(SortBySortTitle
);
121 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavseasons");
122 SetViewAsControl(viewState
->m_viewMode
);
123 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
126 case NODE_TYPE_TITLE_TVSHOWS
:
127 case NODE_TYPE_INPROGRESS_TVSHOWS
:
129 AddSortMethod(SortBySortTitle
, sortAttributes
, 556, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
130 AddSortMethod(SortByOriginalTitle
, sortAttributes
, 20376,
131 LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
133 AddSortMethod(SortByNumberOfEpisodes
, sortAttributes
, 20360,
134 LABEL_MASKS("%L", "%M", "%L", "%M")); // Label, #Episodes | Label, #Episodes
136 SortByLastPlayed
, sortAttributes
, 568,
137 LABEL_MASKS("%T", "%p", "%T", "%p")); // Title, #Last played | Title, #Last played
138 AddSortMethod(SortByDateAdded
, sortAttributes
, 570,
139 LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
140 AddSortMethod(SortByYear
, sortAttributes
, 562,
141 LABEL_MASKS("%L", "%Y", "%L", "%Y")); // Label, Year | Label, Year
142 AddSortMethod(SortByRating
, sortAttributes
, 563,
143 LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
144 AddSortMethod(SortByUserRating
, sortAttributes
, 38018,
145 LABEL_MASKS("%T", "%r", "%T", "%r")); // Title, Userrating | Title, Userrating
146 SetSortMethod(SortByLabel
);
148 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavtvshows");
149 SetViewAsControl(viewState
->m_viewMode
);
150 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
153 case NODE_TYPE_MUSICVIDEOS_ALBUM
:
154 case NODE_TYPE_GENRE
:
155 case NODE_TYPE_COUNTRY
:
156 case NODE_TYPE_STUDIO
:
158 AddSortMethod(SortByLabel
, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
159 SetSortMethod(SortByLabel
);
161 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavgenres");
162 SetViewAsControl(viewState
->m_viewMode
);
163 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
168 AddSortMethod(SortByLabel
, sortAttributes
, 551, LABEL_MASKS("%T","%R", "%T","%R")); // Title, Rating | Title, Rating
170 AddSortMethod(SortByYear
, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
171 AddSortMethod(SortByRating
, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
172 AddSortMethod(SortByDateAdded
, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
173 AddSortMethod(SortByPlaycount
, 567,
174 LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
176 SetSortMethod(SortByLabel
);
178 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavgenres");
179 SetViewAsControl(viewState
->m_viewMode
);
180 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
184 case NODE_TYPE_VIDEOVERSIONS
:
186 AddSortMethod(SortByLabel
, sortAttributes
, 551,
187 LABEL_MASKS("%T", "", "%T", "")); // Title, empty | Title, empty
188 SetSortMethod(SortByLabel
);
190 const CViewState
* viewState
= CViewStateSettings::GetInstance().Get("videonavgenres");
191 SetViewAsControl(viewState
->m_viewMode
);
192 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
195 case NODE_TYPE_EPISODES
:
197 if (params
.GetSeason() > -1)
199 AddSortMethod(SortByEpisodeNumber
, 20359, LABEL_MASKS("%E. %T","%R")); // Episode. Title, Rating | empty, empty
200 AddSortMethod(SortByRating
, 563, LABEL_MASKS("%E. %T", "%R")); // Episode. Title, Rating | empty, empty
201 AddSortMethod(SortByUserRating
, 38018, LABEL_MASKS("%E. %T", "%r")); // Episode. Title, Userrating | empty, empty
202 AddSortMethod(SortByMPAA
, 20074, LABEL_MASKS("%E. %T", "%O")); // Episode. Title, MPAA | empty, empty
203 AddSortMethod(SortByProductionCode
, 20368, LABEL_MASKS("%E. %T","%P", "%E. %T","%P")); // Episode. Title, ProductionCode | Episode. Title, ProductionCode
204 AddSortMethod(SortByDate
, 552, LABEL_MASKS("%E. %T","%J","%E. %T","%J")); // Episode. Title, Date | Episode. Title, Date
205 AddSortMethod(SortByPlaycount
, 567,
206 LABEL_MASKS("%E. %T", "%V")); // Episode. Title, Playcount | empty, empty
210 AddSortMethod(SortByEpisodeNumber
, 20359, LABEL_MASKS("%H. %T","%R")); // Order. Title, Rating | empty, empty
211 AddSortMethod(SortByRating
, 563, LABEL_MASKS("%H. %T", "%R")); // Order. Title, Rating | empty, empty
212 AddSortMethod(SortByUserRating
, 38018, LABEL_MASKS("%H. %T", "%r")); // Order. Title, Userrating | empty, empty
213 AddSortMethod(SortByMPAA
, 20074, LABEL_MASKS("%H. %T", "%O")); // Order. Title, MPAA | empty, empty
214 AddSortMethod(SortByProductionCode
, 20368, LABEL_MASKS("%H. %T","%P", "%H. %T","%P")); // Order. Title, ProductionCode | Episode. Title, ProductionCode
215 AddSortMethod(SortByDate
, 552, LABEL_MASKS("%H. %T","%J","%H. %T","%J")); // Order. Title, Date | Episode. Title, Date
216 AddSortMethod(SortByPlaycount
, 567,
217 LABEL_MASKS("%H. %T", "%V")); // Order. Title, Playcount | empty, empty
219 AddSortMethod(SortByLabel
, sortAttributes
, 551, LABEL_MASKS("%T","%R")); // Title, Rating | empty, empty
221 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavepisodes");
222 SetSortMethod(viewState
->m_sortDescription
);
223 SetViewAsControl(viewState
->m_viewMode
);
224 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
227 case NODE_TYPE_RECENTLY_ADDED_EPISODES
:
229 AddSortMethod(SortByNone
, 552, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
230 SetSortMethod(SortByNone
);
232 SetViewAsControl(CViewStateSettings::GetInstance().Get("videonavepisodes")->m_viewMode
);
233 SetSortOrder(SortOrderNone
);
237 case NODE_TYPE_TITLE_MOVIES
:
239 if (params
.GetSetId() > -1) // Is this a listing within a set?
241 AddSortMethod(SortByYear
, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
242 AddSortMethod(SortBySortTitle
, sortAttributes
, 556, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
243 AddSortMethod(SortByOriginalTitle
, sortAttributes
, 20376,
244 LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
248 AddSortMethod(SortBySortTitle
, sortAttributes
, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
249 AddSortMethod(SortByOriginalTitle
, sortAttributes
, 20376,
250 LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
251 AddSortMethod(SortByYear
, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
253 AddSortMethod(SortByRating
, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
254 AddSortMethod(SortByUserRating
, 38018, LABEL_MASKS("%T", "%r", "%T", "%r")); // Title, Userrating | Title, Userrating
255 AddSortMethod(SortByMPAA
, 20074, LABEL_MASKS("%T", "%O")); // Title, MPAA | empty, empty
256 AddSortMethod(SortByTime
, 180, LABEL_MASKS("%T", "%D")); // Title, Duration | empty, empty
257 AddSortMethod(SortByDateAdded
, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
258 AddSortMethod(SortByLastPlayed
, 568, LABEL_MASKS("%T", "%p", "%T", "%p")); // Title, #Last played | Title, #Last played
259 AddSortMethod(SortByPlaycount
, 567,
260 LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
262 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavtitles");
263 if (params
.GetSetId() > -1)
265 SetSortMethod(SortByYear
);
266 SetSortOrder(SortOrderAscending
);
270 SetSortMethod(viewState
->m_sortDescription
);
271 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
274 SetViewAsControl(viewState
->m_viewMode
);
277 case NODE_TYPE_TITLE_MUSICVIDEOS
:
279 AddSortMethod(SortByLabel
, sortAttributes
, 551, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year | empty, empty
280 AddSortMethod(SortByAlbum
, sortAttributes
, 558, LABEL_MASKS("%B - %T - %A", "%Y")); // Album, Title, Artist, Year | empty, empty
281 AddSortMethod(SortByArtist
, sortAttributes
, 557, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
282 AddSortMethod(SortByArtistThenYear
, sortAttributes
, 578, LABEL_MASKS("%A - %T", "%Y")); // Artist, Title, Year| empty, empty
283 AddSortMethod(SortByYear
, 562, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year| empty, empty
284 AddSortMethod(SortByTime
, 180, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
285 AddSortMethod(SortByDateAdded
, 570, LABEL_MASKS("%T - %A", "%a")); // Title - Artist, DateAdded | empty, empty
286 AddSortMethod(SortByPlaycount
, 567, LABEL_MASKS("%T - %A", "%V")); // Title - Artist, PlayCount
287 AddSortMethod(SortByMPAA
, 20074, LABEL_MASKS("%T - %A", "%O")); // Title - Artist, MPAARating
288 AddSortMethod(SortByUserRating
, 38018, LABEL_MASKS("%T - %A", "%r")); // Title - Artist, UserRating
290 std::string strTrack
=CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT
);
291 AddSortMethod(SortByTrackNumber
, 554, LABEL_MASKS(strTrack
, "%N")); // Userdefined, Track Number | empty, empty
293 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavmusicvideos");
294 SetSortMethod(viewState
->m_sortDescription
);
295 SetViewAsControl(viewState
->m_viewMode
);
296 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
299 case NODE_TYPE_RECENTLY_ADDED_MOVIES
:
301 AddSortMethod(SortByNone
, 552, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
302 SetSortMethod(SortByNone
);
304 SetViewAsControl(CViewStateSettings::GetInstance().Get("videonavtitles")->m_viewMode
);
306 SetSortOrder(SortOrderNone
);
309 case NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS
:
311 AddSortMethod(SortByNone
, 552, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
312 SetSortMethod(SortByNone
);
314 SetViewAsControl(CViewStateSettings::GetInstance().Get("videonavmusicvideos")->m_viewMode
);
316 SetSortOrder(SortOrderNone
);
325 AddSortMethod(SortByLabel
, sortAttributes
, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
326 AddSortMethod(SortBySize
, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Label, Size | Label, Size
327 AddSortMethod(SortByDate
, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Label, Date | Label, Date
328 AddSortMethod(SortByFile
, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
330 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videofiles");
331 SetSortMethod(viewState
->m_sortDescription
);
332 SetViewAsControl(viewState
->m_viewMode
);
333 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
335 LoadViewState(items
.GetPath(), WINDOW_VIDEO_NAV
);
338 void CGUIViewStateWindowVideoNav::SaveViewState()
340 if (m_items
.IsVideoDb())
342 NODE_TYPE NodeType
= CVideoDatabaseDirectory::GetDirectoryChildType(m_items
.GetPath());
344 CVideoDatabaseDirectory::GetQueryParams(m_items
.GetPath(),params
);
347 case NODE_TYPE_ACTOR
:
348 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavactors"));
351 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavyears"));
353 case NODE_TYPE_GENRE
:
354 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavgenres"));
356 case NODE_TYPE_TITLE_MOVIES
:
357 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, params
.GetSetId() > -1 ? NULL
: CViewStateSettings::GetInstance().Get("videonavtitles"));
359 case NODE_TYPE_EPISODES
:
360 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavepisodes"));
362 case NODE_TYPE_TITLE_TVSHOWS
:
363 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavtvshows"));
365 case NODE_TYPE_SEASONS
:
366 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavseasons"));
368 case NODE_TYPE_TITLE_MUSICVIDEOS
:
369 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavmusicvideos"));
372 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
);
378 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videofiles"));
382 VECSOURCES
& CGUIViewStateWindowVideoNav::GetSources()
384 // Setup shares we want to have
387 if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_MYVIDEOS_FLATTEN
))
388 CDirectory::GetDirectory("library://video_flat/", items
, "", DIR_FLAG_DEFAULTS
);
390 CDirectory::GetDirectory("library://video/", items
, "", DIR_FLAG_DEFAULTS
);
391 for (int i
=0; i
<items
.Size(); ++i
)
393 CFileItemPtr item
=items
[i
];
395 share
.strName
=item
->GetLabel();
396 share
.strPath
= item
->GetPath();
397 share
.m_strThumbnailImage
= item
->GetArt("icon");
398 share
.m_iDriveType
= CMediaSource::SOURCE_TYPE_LOCAL
;
399 m_sources
.push_back(share
);
401 return CGUIViewStateWindowVideo::GetSources();
404 bool CGUIViewStateWindowVideoNav::AutoPlayNextItem()
407 CVideoDatabaseDirectory::GetQueryParams(m_items
.GetPath(),params
);
408 if (static_cast<VideoDbContentType
>(params
.GetContentType()) == VideoDbContentType::MUSICVIDEOS
)
409 return CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_MUSICPLAYER_AUTOPLAYNEXTITEM
);
411 return CGUIViewStateWindowVideo::AutoPlayNextItem();
414 CGUIViewStateWindowVideoPlaylist::CGUIViewStateWindowVideoPlaylist(const CFileItemList
& items
) : CGUIViewStateWindowVideo(items
)
416 AddSortMethod(SortByNone
, 551, LABEL_MASKS("%L", "", "%L", "")); // Label, empty | Label, empty
417 SetSortMethod(SortByNone
);
419 SetViewAsControl(DEFAULT_VIEW_LIST
);
421 SetSortOrder(SortOrderNone
);
423 LoadViewState(items
.GetPath(), WINDOW_VIDEO_PLAYLIST
);
426 void CGUIViewStateWindowVideoPlaylist::SaveViewState()
428 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_PLAYLIST
);
431 bool CGUIViewStateWindowVideoPlaylist::HideExtensions()
436 bool CGUIViewStateWindowVideoPlaylist::HideParentDirItems()
441 VECSOURCES
& CGUIViewStateWindowVideoPlaylist::GetSources()
446 share
.strPath
= "playlistvideo://";
447 share
.m_iDriveType
= CMediaSource::SOURCE_TYPE_LOCAL
;
448 m_sources
.push_back(share
);
450 // no plugins in playlist window
454 CGUIViewStateVideoMovies::CGUIViewStateVideoMovies(const CFileItemList
& items
) : CGUIViewStateWindowVideo(items
)
456 SortAttribute sortAttributes
= SortAttributeNone
;
457 if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
458 CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING
))
459 sortAttributes
= SortAttributeIgnoreArticle
;
461 AddSortMethod(SortBySortTitle
, sortAttributes
, 556,
462 LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
463 AddSortMethod(SortByOriginalTitle
, sortAttributes
, 20376,
464 LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
465 AddSortMethod(SortByYear
, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
466 AddSortMethod(SortByRating
, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
467 AddSortMethod(SortByUserRating
, 38018, LABEL_MASKS("%T", "%r", "%T", "%r")); // Title, Userrating | Title, Userrating
468 AddSortMethod(SortByMPAA
, 20074, LABEL_MASKS("%T", "%O")); // Title, MPAA | empty, empty
469 AddSortMethod(SortByTime
, 180, LABEL_MASKS("%T", "%D")); // Title, Duration | empty, empty
470 AddSortMethod(SortByDateAdded
, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
471 AddSortMethod(SortByPlaycount
, 567,
472 LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
474 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavtitles");
475 if (items
.IsSmartPlayList() || items
.IsLibraryFolder())
476 AddPlaylistOrder(items
, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
479 SetSortMethod(viewState
->m_sortDescription
);
480 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
483 SetViewAsControl(viewState
->m_viewMode
);
485 LoadViewState(items
.GetPath(), WINDOW_VIDEO_NAV
);
488 void CGUIViewStateVideoMovies::SaveViewState()
490 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavtitles"));
493 CGUIViewStateVideoMusicVideos::CGUIViewStateVideoMusicVideos(const CFileItemList
& items
) : CGUIViewStateWindowVideo(items
)
495 SortAttribute sortAttributes
= SortAttributeNone
;
496 const std::shared_ptr
<CSettings
> settings
= CServiceBroker::GetSettingsComponent()->GetSettings();
497 if (settings
->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING
))
498 sortAttributes
= SortAttributeIgnoreArticle
;
500 AddSortMethod(SortByLabel
, sortAttributes
, 551, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year | empty, empty
501 AddSortMethod(SortByAlbum
, sortAttributes
, 558, LABEL_MASKS("%B - %T - %A", "%Y")); // Album, Title, Artist, Year | empty, empty
502 AddSortMethod(SortByArtist
, sortAttributes
, 557, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
503 AddSortMethod(SortByArtistThenYear
, sortAttributes
, 578, LABEL_MASKS("%A - %T", "%Y")); // Artist, Title, Year| empty, empty
504 AddSortMethod(SortByYear
, 562, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year| empty, empty
505 AddSortMethod(SortByTime
, 180, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
506 AddSortMethod(SortByDateAdded
, 570, LABEL_MASKS("%T - %A", "%a")); // Title - Artist, DateAdded | empty, empty
507 AddSortMethod(SortByPlaycount
, 567, LABEL_MASKS("%T - %A", "%V")); // Title - Artist, PlayCount
508 AddSortMethod(SortByMPAA
, 20074, LABEL_MASKS("%T - %A", "%O")); // Title - Artist, MPAARating
509 AddSortMethod(SortByUserRating
, 38018, LABEL_MASKS("%T - %A", "%r")); // Title - Artist, UserRating
511 std::string strTrack
= settings
->GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT
);
512 AddSortMethod(SortByTrackNumber
, 554, LABEL_MASKS(strTrack
, "%N")); // Userdefined, Track Number | empty, empty
514 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavmusicvideos");
515 if (items
.IsSmartPlayList() || items
.IsLibraryFolder())
516 AddPlaylistOrder(items
, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
519 SetSortMethod(viewState
->m_sortDescription
);
520 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
523 SetViewAsControl(viewState
->m_viewMode
);
525 LoadViewState(items
.GetPath(), WINDOW_VIDEO_NAV
);
528 void CGUIViewStateVideoMusicVideos::SaveViewState()
530 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavmusicvideos"));
533 CGUIViewStateVideoTVShows::CGUIViewStateVideoTVShows(const CFileItemList
& items
) : CGUIViewStateWindowVideo(items
)
535 SortAttribute sortAttributes
= SortAttributeNone
;
536 const std::shared_ptr
<CSettings
> settings
= CServiceBroker::GetSettingsComponent()->GetSettings();
537 if (settings
->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING
))
538 sortAttributes
= SortAttributeIgnoreArticle
;
540 AddSortMethod(SortBySortTitle
, sortAttributes
, 556,
541 LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
542 AddSortMethod(SortByNumberOfEpisodes
, sortAttributes
, 20360,
543 LABEL_MASKS("%L", "%M", "%L", "%M")); // Label, #Episodes | Label, #Episodes
544 AddSortMethod(SortByLastPlayed
, sortAttributes
, 568,
545 LABEL_MASKS("%T", "%p", "%T", "%p")); // Title, #Last played | Title, #Last played
546 AddSortMethod(SortByDateAdded
, sortAttributes
, 570,
547 LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
548 AddSortMethod(SortByYear
, sortAttributes
, 562,
549 LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
550 AddSortMethod(SortByUserRating
, sortAttributes
, 38018,
551 LABEL_MASKS("%T", "%r", "%T", "%r")); // Title, Userrating | Title, Userrating
553 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavtvshows");
554 if (items
.IsSmartPlayList() || items
.IsLibraryFolder())
555 AddPlaylistOrder(items
, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
558 SetSortMethod(viewState
->m_sortDescription
);
559 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
562 SetViewAsControl(viewState
->m_viewMode
);
564 LoadViewState(items
.GetPath(), WINDOW_VIDEO_NAV
);
567 void CGUIViewStateVideoTVShows::SaveViewState()
569 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavtvshows"));
572 CGUIViewStateVideoEpisodes::CGUIViewStateVideoEpisodes(const CFileItemList
& items
) : CGUIViewStateWindowVideo(items
)
574 // TvShow - Order. Title, Rating | empty, empty
575 AddSortMethod(SortByEpisodeNumber
, 20359, LABEL_MASKS("%Z - %H. %T","%R"));
576 // TvShow - Order. Title, Rating | empty, empty
577 AddSortMethod(SortByRating
, 563, LABEL_MASKS("%Z - %H. %T", "%R"));
578 // TvShow - Order. Title, Userrating | empty, empty
579 AddSortMethod(SortByUserRating
, 38018, LABEL_MASKS("%Z - %H. %T", "%r"));
580 // TvShow - Order. Title, MPAA | empty, empty
581 AddSortMethod(SortByMPAA
, 20074, LABEL_MASKS("%Z - %H. %T", "%O"));
582 // TvShow - Order. Title, Production Code | empty, empty
583 AddSortMethod(SortByProductionCode
, 20368, LABEL_MASKS("%Z - %H. %T","%P"));
584 // TvShow - Order. Title, Date | empty, empty
585 AddSortMethod(SortByDate
, 552, LABEL_MASKS("%Z - %H. %T","%J"));
586 // TvShow - Order. Title, Playcount | empty, empty
587 AddSortMethod(SortByPlaycount
, 567, LABEL_MASKS("%H. %T", "%V"));
589 AddSortMethod(SortByLabel
, 551, LABEL_MASKS("%Z - %H. %T","%R"), // TvShow - Order. Title, Rating | empty, empty
590 CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING
) ? SortAttributeIgnoreArticle
: SortAttributeNone
);
592 const CViewState
*viewState
= CViewStateSettings::GetInstance().Get("videonavepisodes");
593 if (items
.IsSmartPlayList() || items
.IsLibraryFolder())
594 AddPlaylistOrder(items
, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
597 SetSortMethod(viewState
->m_sortDescription
);
598 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
601 SetViewAsControl(viewState
->m_viewMode
);
603 LoadViewState(items
.GetPath(), WINDOW_VIDEO_NAV
);
606 void CGUIViewStateVideoEpisodes::SaveViewState()
608 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
, CViewStateSettings::GetInstance().Get("videonavepisodes"));
611 CGUIViewStateVideoPlaylist::CGUIViewStateVideoPlaylist(const CFileItemList
& items
)
612 : CGUIViewStateWindowVideo(items
)
614 SortAttribute sortAttributes
= SortAttributeNone
;
615 if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
616 CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING
))
617 sortAttributes
= SortAttributeIgnoreArticle
;
619 AddSortMethod(SortByPlaylistOrder
, 559, LABEL_MASKS("%L", "")); // Label, empty
620 AddSortMethod(SortByLabel
, sortAttributes
, 551,
621 LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
622 AddSortMethod(SortBySize
, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Label, Size | Label, Size
623 AddSortMethod(SortByDate
, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Label, Date | Label, Date
624 AddSortMethod(SortByFile
, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
626 SetSortMethod(SortByPlaylistOrder
);
628 const CViewState
* viewState
= CViewStateSettings::GetInstance().Get("videofiles");
629 SetViewAsControl(viewState
->m_viewMode
);
630 SetSortOrder(viewState
->m_sortDescription
.sortOrder
);
632 LoadViewState(items
.GetPath(), WINDOW_VIDEO_NAV
);
635 void CGUIViewStateVideoPlaylist::SaveViewState()
637 SaveViewToDb(m_items
.GetPath(), WINDOW_VIDEO_NAV
);