2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "GUIViewStateVideo.h"
22 #include "PlayListPlayer.h"
23 #include "filesystem/PluginDirectory.h"
24 #include "filesystem/PVRDirectory.h"
25 #include "filesystem/VideoDatabaseDirectory.h"
26 #include "filesystem/Directory.h"
27 #include "VideoDatabase.h"
28 #include "settings/AdvancedSettings.h"
29 #include "settings/MediaSettings.h"
30 #include "settings/MediaSourceSettings.h"
31 #include "settings/Settings.h"
33 #include "guilib/WindowIDs.h"
34 #include "guilib/LocalizeStrings.h"
35 #include "view/ViewStateSettings.h"
37 using namespace XFILE;
38 using namespace VIDEODATABASEDIRECTORY;
40 CStdString CGUIViewStateWindowVideo::GetLockType()
45 CStdString CGUIViewStateWindowVideo::GetExtensions()
47 return g_advancedSettings.m_videoExtensions;
50 int CGUIViewStateWindowVideo::GetPlaylist()
52 return PLAYLIST_VIDEO;
55 VECSOURCES& CGUIViewStateWindowVideo::GetSources()
58 return CGUIViewState::GetSources();
61 CGUIViewStateWindowVideoFiles::CGUIViewStateWindowVideoFiles(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
63 if (items.IsVirtualDirectoryRoot())
65 AddSortMethod(SortByLabel, 551, LABEL_MASKS()); // Preformated
66 AddSortMethod(SortByDriveType, 564, LABEL_MASKS()); // Preformated
67 SetSortMethod(SortByLabel);
69 SetViewAsControl(DEFAULT_VIEW_LIST);
71 SetSortOrder(SortOrderAscending);
75 AddSortMethod(SortByLabel, 551, LABEL_MASKS("%L", "%I", "%L", ""), // Label, Size | Label, empty
76 CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
77 AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Label, Size | Label, Size
78 AddSortMethod(SortByDate, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Label, Date | Label, Date
79 AddSortMethod(SortByFile, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
81 const CViewState *viewState = CViewStateSettings::Get().Get("videofiles");
82 SetSortMethod(viewState->m_sortDescription);
83 SetViewAsControl(viewState->m_viewMode);
84 SetSortOrder(viewState->m_sortDescription.sortOrder);
86 LoadViewState(items.GetPath(), WINDOW_VIDEO_FILES);
89 void CGUIViewStateWindowVideoFiles::SaveViewState()
91 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_FILES, CViewStateSettings::Get().Get("videofiles"));
94 VECSOURCES& CGUIViewStateWindowVideoFiles::GetSources()
96 VECSOURCES *videoSources = CMediaSourceSettings::Get().GetSources("video");
97 AddOrReplace(*videoSources, CGUIViewStateWindowVideo::GetSources());
101 CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
103 SortAttribute sortAttributes = SortAttributeNone;
104 if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
105 sortAttributes = SortAttributeIgnoreArticle;
107 if (items.IsVirtualDirectoryRoot())
109 AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "%I", "%L", "")); // Filename, Size | Label, empty
110 SetSortMethod(SortByNone);
112 SetViewAsControl(DEFAULT_VIEW_LIST);
114 SetSortOrder(SortOrderNone);
116 else if (items.IsVideoDb())
118 NODE_TYPE NodeType=CVideoDatabaseDirectory::GetDirectoryChildType(items.GetPath());
120 CVideoDatabaseDirectory::GetQueryParams(items.GetPath(),params);
124 case NODE_TYPE_MOVIES_OVERVIEW:
125 case NODE_TYPE_TVSHOWS_OVERVIEW:
126 case NODE_TYPE_MUSICVIDEOS_OVERVIEW:
127 case NODE_TYPE_OVERVIEW:
129 AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "%I", "%L", "")); // Filename, Size | Label, empty
131 SetSortMethod(SortByNone);
133 SetViewAsControl(DEFAULT_VIEW_LIST);
135 SetSortOrder(SortOrderNone);
138 case NODE_TYPE_DIRECTOR:
139 case NODE_TYPE_ACTOR:
141 AddSortMethod(SortByLabel, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
142 SetSortMethod(SortByLabel);
144 const CViewState *viewState = CViewStateSettings::Get().Get("videonavactors");
145 SetViewAsControl(viewState->m_viewMode);
146 SetSortOrder(viewState->m_sortDescription.sortOrder);
151 AddSortMethod(SortByLabel, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
152 SetSortMethod(SortByLabel);
154 const CViewState *viewState = CViewStateSettings::Get().Get("videonavyears");
155 SetViewAsControl(viewState->m_viewMode);
156 SetSortOrder(viewState->m_sortDescription.sortOrder);
159 case NODE_TYPE_SEASONS:
161 AddSortMethod(SortBySortTitle, 556, LABEL_MASKS("%L", "","%L","")); // Label, empty | Label, empty
162 SetSortMethod(SortBySortTitle);
164 const CViewState *viewState = CViewStateSettings::Get().Get("videonavseasons");
165 SetViewAsControl(viewState->m_viewMode);
166 SetSortOrder(viewState->m_sortDescription.sortOrder);
169 case NODE_TYPE_TITLE_TVSHOWS:
171 AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
173 // NOTE: This uses SortByEpisodeNumber to mean "sort shows by the number of episodes" and uses the label "Episodes"
174 AddSortMethod(SortByEpisodeNumber, 20360, LABEL_MASKS("%L", "%M", "%L", "%M")); // Label, #Episodes | Label, #Episodes
175 AddSortMethod(SortByLastPlayed, 568, LABEL_MASKS("%T", "%p", "%T", "%p")); // Title, #Last played | Title, #Last played
176 AddSortMethod(SortByYear, 562, LABEL_MASKS("%L","%Y","%L","%Y")); // Label, Year | Label, Year
177 SetSortMethod(SortByLabel);
179 const CViewState *viewState = CViewStateSettings::Get().Get("videonavtvshows");
180 SetViewAsControl(viewState->m_viewMode);
181 SetSortOrder(viewState->m_sortDescription.sortOrder);
184 case NODE_TYPE_MUSICVIDEOS_ALBUM:
185 case NODE_TYPE_GENRE:
186 case NODE_TYPE_COUNTRY:
187 case NODE_TYPE_STUDIO:
189 AddSortMethod(SortByLabel, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
190 SetSortMethod(SortByLabel);
192 const CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
193 SetViewAsControl(viewState->m_viewMode);
194 SetSortOrder(viewState->m_sortDescription.sortOrder);
199 AddSortMethod(SortByLabel, sortAttributes, 551, LABEL_MASKS("%T","%R", "%T","%R")); // Title, Rating | Title, Rating
201 AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
202 AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
203 AddSortMethod(SortByDateAdded, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
205 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
206 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
208 SetSortMethod(SortByLabel, SortAttributeIgnoreArticle);
210 const CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
211 SetViewAsControl(viewState->m_viewMode);
212 SetSortOrder(viewState->m_sortDescription.sortOrder);
217 AddSortMethod(SortByLabel, sortAttributes, 551, LABEL_MASKS("%T","", "%T","")); // Title, empty | Title, empty
218 SetSortMethod(SortByLabel, sortAttributes);
220 const CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
221 SetViewAsControl(viewState->m_viewMode);
222 SetSortOrder(viewState->m_sortDescription.sortOrder);
225 case NODE_TYPE_EPISODES:
227 if (params.GetSeason() > -1)
229 AddSortMethod(SortByEpisodeNumber, 20359, LABEL_MASKS("%E. %T","%R")); // Episode. Title, Rating | empty, empty
230 AddSortMethod(SortByRating, 563, LABEL_MASKS("%E. %T", "%R")); // Episode. Title, Rating | empty, empty
231 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%E. %T", "%O")); // Episode. Title, MPAA | empty, empty
232 AddSortMethod(SortByProductionCode, 20368, LABEL_MASKS("%E. %T","%P", "%E. %T","%P")); // Episode. Title, ProductionCode | Episode. Title, ProductionCode
233 AddSortMethod(SortByDate, 552, LABEL_MASKS("%E. %T","%J","%E. %T","%J")); // Episode. Title, Date | Episode. Title, Date
235 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
236 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%E. %T", "%V")); // Episode. Title, Playcount | empty, empty
240 AddSortMethod(SortByEpisodeNumber, 20359, LABEL_MASKS("%H. %T","%R")); // Order. Title, Rating | emtpy, empty
241 AddSortMethod(SortByRating, 563, LABEL_MASKS("%H. %T", "%R")); // Order. Title, Rating | emtpy, empty
242 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%H. %T", "%O")); // Order. Title, MPAA | emtpy, empty
243 AddSortMethod(SortByProductionCode, 20368, LABEL_MASKS("%H. %T","%P", "%H. %T","%P")); // Order. Title, ProductionCode | Episode. Title, ProductionCode
244 AddSortMethod(SortByDate, 552, LABEL_MASKS("%H. %T","%J","%H. %T","%J")); // Order. Title, Date | Episode. Title, Date
246 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
247 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%H. %T", "%V")); // Order. Title, Playcount | empty, empty
249 AddSortMethod(SortByLabel, sortAttributes, 551, LABEL_MASKS("%T","%R")); // Title, Rating | empty, empty
251 const CViewState *viewState = CViewStateSettings::Get().Get("videonavepisodes");
252 SetSortMethod(viewState->m_sortDescription);
253 SetViewAsControl(viewState->m_viewMode);
254 SetSortOrder(viewState->m_sortDescription.sortOrder);
257 case NODE_TYPE_RECENTLY_ADDED_EPISODES:
259 AddSortMethod(SortByNone, 552, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
260 SetSortMethod(SortByNone);
262 SetViewAsControl(CViewStateSettings::Get().Get("videonavepisodes")->m_viewMode);
263 SetSortOrder(SortOrderNone);
267 case NODE_TYPE_TITLE_MOVIES:
269 if (params.GetSetId() > -1) // Is this a listing within a set?
271 AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
272 AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
276 AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
277 AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
279 AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
280 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O")); // Title, MPAA | empty, empty
281 AddSortMethod(SortByTime, 180, LABEL_MASKS("%T", "%D")); // Title, Duration | empty, empty
282 AddSortMethod(SortByDateAdded, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
284 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
285 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
287 const CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles");
288 if (params.GetSetId() > -1)
289 SetSortMethod(SortByYear);
291 SetSortMethod(viewState->m_sortDescription);
293 SetViewAsControl(viewState->m_viewMode);
294 SetSortOrder(viewState->m_sortDescription.sortOrder);
297 case NODE_TYPE_TITLE_MUSICVIDEOS:
299 AddSortMethod(SortByLabel, sortAttributes, 551, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
300 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O"));
301 AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
302 AddSortMethod(SortByArtist, sortAttributes, 557, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
303 AddSortMethod(SortByAlbum, sortAttributes, 558, LABEL_MASKS("%B - %T", "%Y")); // Album - Title, Year | empty, empty
305 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
306 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty
308 CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
309 CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
310 AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
312 const CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos");
313 SetSortMethod(viewState->m_sortDescription);
314 SetViewAsControl(viewState->m_viewMode);
315 SetSortOrder(viewState->m_sortDescription.sortOrder);
318 case NODE_TYPE_RECENTLY_ADDED_MOVIES:
320 AddSortMethod(SortByNone, 552, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
321 SetSortMethod(SortByNone);
323 SetViewAsControl(CViewStateSettings::Get().Get("videonavtitles")->m_viewMode);
325 SetSortOrder(SortOrderNone);
328 case NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS:
330 AddSortMethod(SortByNone, 552, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
331 SetSortMethod(SortByNone);
333 SetViewAsControl(CViewStateSettings::Get().Get("videonavmusicvideos")->m_viewMode);
335 SetSortOrder(SortOrderNone);
344 AddSortMethod(SortByLabel, sortAttributes, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
345 AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Label, Size | Label, Size
346 AddSortMethod(SortByDate, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Label, Date | Label, Date
347 AddSortMethod(SortByFile, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
349 const CViewState *viewState = CViewStateSettings::Get().Get("videofiles");
350 SetSortMethod(viewState->m_sortDescription);
351 SetViewAsControl(viewState->m_viewMode);
352 SetSortOrder(viewState->m_sortDescription.sortOrder);
354 LoadViewState(items.GetPath(), WINDOW_VIDEO_NAV);
357 void CGUIViewStateWindowVideoNav::SaveViewState()
359 if (m_items.IsVideoDb())
361 NODE_TYPE NodeType = CVideoDatabaseDirectory::GetDirectoryChildType(m_items.GetPath());
363 CVideoDatabaseDirectory::GetQueryParams(m_items.GetPath(),params);
366 case NODE_TYPE_ACTOR:
367 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavactors"));
370 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavyears"));
372 case NODE_TYPE_GENRE:
373 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavgenres"));
375 case NODE_TYPE_TITLE_MOVIES:
376 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, params.GetSetId() > -1 ? NULL : CViewStateSettings::Get().Get("videonavtitles"));
378 case NODE_TYPE_EPISODES:
379 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavepisodes"));
381 case NODE_TYPE_TITLE_TVSHOWS:
382 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavtvshows"));
384 case NODE_TYPE_SEASONS:
385 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavseasons"));
387 case NODE_TYPE_TITLE_MUSICVIDEOS:
388 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavmusicvideos"));
391 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV);
397 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videofiles"));
401 VECSOURCES& CGUIViewStateWindowVideoNav::GetSources()
403 // Setup shares we want to have
406 if (CSettings::Get().GetBool("myvideos.flatten"))
407 CDirectory::GetDirectory("library://video_flat/", items, "");
409 CDirectory::GetDirectory("library://video/", items, "");
410 for (int i=0; i<items.Size(); ++i)
412 CFileItemPtr item=items[i];
414 share.strName=item->GetLabel();
415 share.strPath = item->GetPath();
416 share.m_strThumbnailImage= item->GetIconImage();
417 share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL;
418 m_sources.push_back(share);
420 return CGUIViewStateWindowVideo::GetSources();
423 bool CGUIViewStateWindowVideoNav::AutoPlayNextItem()
426 CVideoDatabaseDirectory::GetQueryParams(m_items.GetPath(),params);
427 if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS || params.GetContentType() == 6) // recently added musicvideos
428 return CSettings::Get().GetBool("musicplayer.autoplaynextitem");
430 return CSettings::Get().GetBool("videoplayer.autoplaynextitem");
433 CGUIViewStateWindowVideoPlaylist::CGUIViewStateWindowVideoPlaylist(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
435 AddSortMethod(SortByNone, 551, LABEL_MASKS("%L", "", "%L", "")); // Label, empty | Label, empty
436 SetSortMethod(SortByNone);
438 SetViewAsControl(DEFAULT_VIEW_LIST);
440 SetSortOrder(SortOrderNone);
442 LoadViewState(items.GetPath(), WINDOW_VIDEO_PLAYLIST);
445 void CGUIViewStateWindowVideoPlaylist::SaveViewState()
447 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_PLAYLIST);
450 bool CGUIViewStateWindowVideoPlaylist::HideExtensions()
455 bool CGUIViewStateWindowVideoPlaylist::HideParentDirItems()
460 VECSOURCES& CGUIViewStateWindowVideoPlaylist::GetSources()
465 share.strPath= "playlistvideo://";
466 share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL;
467 m_sources.push_back(share);
469 // no plugins in playlist window
473 CGUIViewStateVideoMovies::CGUIViewStateVideoMovies(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
475 AddSortMethod(SortBySortTitle, 556, LABEL_MASKS("%T", "%R", "%T", "%R"), // Title, Rating | Title, Rating
476 CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
477 AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
478 AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
479 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O")); // Title, MPAA | empty, empty
480 AddSortMethod(SortByTime, 180, LABEL_MASKS("%T", "%D")); // Title, Duration | empty, empty
481 AddSortMethod(SortByDateAdded, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded
483 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
484 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
486 const CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles");
487 if (items.IsSmartPlayList() || items.IsLibraryFolder())
488 AddPlaylistOrder(items, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
491 SetSortMethod(viewState->m_sortDescription);
492 SetSortOrder(viewState->m_sortDescription.sortOrder);
495 SetViewAsControl(viewState->m_viewMode);
497 LoadViewState(items.GetPath(), WINDOW_VIDEO_NAV);
500 void CGUIViewStateVideoMovies::SaveViewState()
502 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavtitles"));
505 CGUIViewStateVideoMusicVideos::CGUIViewStateVideoMusicVideos(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
507 SortAttribute sortAttributes = SortAttributeNone;
508 if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
509 sortAttributes = SortAttributeIgnoreArticle;
511 AddSortMethod(SortByLabel, sortAttributes, 551, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
512 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O"));
513 AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
514 AddSortMethod(SortByArtist, sortAttributes, 557, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
515 AddSortMethod(SortByAlbum, sortAttributes, 558, LABEL_MASKS("%B - %T", "%Y")); // Album - Title, Year | empty, empty
517 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
518 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty
520 CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
521 CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
522 AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
524 const CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos");
525 if (items.IsSmartPlayList() || items.IsLibraryFolder())
526 AddPlaylistOrder(items, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
529 SetSortMethod(viewState->m_sortDescription);
530 SetSortOrder(viewState->m_sortDescription.sortOrder);
533 SetViewAsControl(viewState->m_viewMode);
535 LoadViewState(items.GetPath(), WINDOW_VIDEO_NAV);
538 void CGUIViewStateVideoMusicVideos::SaveViewState()
540 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavmusicvideos"));
543 CGUIViewStateVideoTVShows::CGUIViewStateVideoTVShows(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
545 AddSortMethod(SortBySortTitle, 556, LABEL_MASKS("%T", "%M", "%T", "%M"), // Title, #Episodes | Title, #Episodes
546 CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
547 // NOTE: This uses SortByEpisodeNumber to mean "sort shows by the number of episodes" and uses the label "Episodes"
548 AddSortMethod(SortByEpisodeNumber, 20360, LABEL_MASKS("%L", "%M", "%L", "%M")); // Label, #Episodes | Label, #Episodes
549 AddSortMethod(SortByLastPlayed, 568, LABEL_MASKS("%T", "%p", "%T", "%p")); // Title, #Last played | Title, #Last played
550 AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
552 const CViewState *viewState = CViewStateSettings::Get().Get("videonavtvshows");
553 if (items.IsSmartPlayList() || items.IsLibraryFolder())
554 AddPlaylistOrder(items, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
557 SetSortMethod(viewState->m_sortDescription);
558 SetSortOrder(viewState->m_sortDescription.sortOrder);
561 SetViewAsControl(viewState->m_viewMode);
563 LoadViewState(items.GetPath(), WINDOW_VIDEO_NAV);
566 void CGUIViewStateVideoTVShows::SaveViewState()
568 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavtvshows"));
571 CGUIViewStateVideoEpisodes::CGUIViewStateVideoEpisodes(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
573 if (0)//params.GetSeason() > -1)
575 AddSortMethod(SortByEpisodeNumber, 20359, LABEL_MASKS("%E. %T","%R")); // Episode. Title, Rating | empty, empty
576 AddSortMethod(SortByRating, 563, LABEL_MASKS("%E. %T", "%R")); // Episode. Title, Rating | empty, empty
577 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%E. %T", "%O")); // Episode. Title, MPAA | empty, empty
578 AddSortMethod(SortByProductionCode, 20368, LABEL_MASKS("%E. %T","%P", "%E. %T","%P")); // Episode. Title, Production Code | Episode. Title, Production Code
579 AddSortMethod(SortByDate, 552, LABEL_MASKS("%E. %T","%J","E. %T","%J")); // Episode. Title, Date | Episode. Title, Date
581 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
582 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%E. %T", "%V")); // Episode. Title, Playcount | empty, empty
585 { // format here is tvshowtitle - season/episode number. episode title
586 AddSortMethod(SortByEpisodeNumber, 20359, LABEL_MASKS("%Z - %H. %T","%R")); // TvShow - Order. Title, Rating | empty, empty
587 AddSortMethod(SortByRating, 563, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
588 AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%Z - %H. %T", "%O")); // TvShow - Order. Title, MPAA | empty, empty
589 AddSortMethod(SortByProductionCode, 20368, LABEL_MASKS("%Z - %H. %T","%P")); // TvShow - Order. Title, Production Code | empty, empty
590 AddSortMethod(SortByDate, 552, LABEL_MASKS("%Z - %H. %T","%J")); // TvShow - Order. Title, Date | empty, empty
592 if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
593 AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%H. %T", "%V")); // Order. Title, Playcount | empty, empty
596 AddSortMethod(SortByLabel, 551, LABEL_MASKS("%Z - %H. %T","%R"), // TvShow - Order. Title, Rating | empty, empty
597 CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
599 const CViewState *viewState = CViewStateSettings::Get().Get("videonavepisodes");
600 if (items.IsSmartPlayList() || items.IsLibraryFolder())
601 AddPlaylistOrder(items, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
604 SetSortMethod(viewState->m_sortDescription);
605 SetSortOrder(viewState->m_sortDescription.sortOrder);
608 SetViewAsControl(viewState->m_viewMode);
610 LoadViewState(items.GetPath(), WINDOW_VIDEO_NAV);
613 void CGUIViewStateVideoEpisodes::SaveViewState()
615 SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavepisodes"));