Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Watch Recordings: Add a Season/Episode sort order.

In combination with the new metadata functionality, you can now order your shows by season and episode regardless of when you recorded them.

Setup->Video->Playback->Page 4, Sort Episodes: Season/Episode.
  • Loading branch information...
commit 5a19ce031daccfcebc664dc09d3659ffae3afca8 1 parent 143e456
Robert McNamara authored
View
1  mythtv/programs/mythfrontend/globalsettings.cpp
@@ -1281,6 +1281,7 @@ static HostComboBox *PlayBoxEpisodeSort()
HostComboBox *gc = new HostComboBox("PlayBoxEpisodeSort");
gc->setLabel(QObject::tr("Sort episodes"));
gc->addSelection(QObject::tr("Record date"), "Date");
+ gc->addSelection(QObject::tr("Season/Episode"), "Season");
gc->addSelection(QObject::tr("Original air date"), "OrigAirDate");
gc->addSelection(QObject::tr("Program ID"), "Id");
gc->setHelpText(QObject::tr("Selects how to sort a shows episodes"));
View
46 mythtv/programs/mythfrontend/playbackbox.cpp
@@ -122,6 +122,26 @@ static int comp_recordDate_rev(const ProgramInfo *a, const ProgramInfo *b)
b->GetScheduledStartTime().date() ? 1 : -1);
}
+static int comp_season(const ProgramInfo *a, const ProgramInfo *b)
+{
+ if (a->GetSeason() == b->GetSeason())
+ return (a->GetEpisode() <
+ b->GetEpisode() ? 1 : -1);
+ else
+ return (a->GetSeason() <
+ b->GetSeason() ? 1 : -1);
+}
+
+static int comp_season_rev(const ProgramInfo *a, const ProgramInfo *b)
+{
+ if (a->GetSeason() == b->GetSeason())
+ return (a->GetEpisode() >
+ b->GetEpisode() ? 1 : -1);
+ else
+ return (a->GetSeason() >
+ b->GetSeason() ? 1 : -1);
+}
+
static bool comp_programid_less_than(
const ProgramInfo *a, const ProgramInfo *b)
{
@@ -164,6 +184,18 @@ static bool comp_recordDate_rev_less_than(
return comp_recordDate_rev(a, b) < 0;
}
+static bool comp_season_less_than(
+ const ProgramInfo *a, const ProgramInfo *b)
+{
+ return comp_season(a, b) < 0;
+}
+
+static bool comp_season_rev_less_than(
+ const ProgramInfo *a, const ProgramInfo *b)
+{
+ return comp_season_rev(a, b) < 0;
+}
+
static const uint s_artDelay[] =
{ kArtworkFanTimeout, kArtworkBannerTimeout, kArtworkCoverTimeout,};
@@ -1734,6 +1766,20 @@ bool PlaybackBox::UpdateUILists(void)
}
}
}
+ else if (episodeSort == "Season")
+ {
+ QMap<QString, ProgramList>::iterator it;
+ for (it = m_progLists.begin(); it != m_progLists.end(); ++it)
+ {
+ if (!it.key().isEmpty())
+ {
+ std::stable_sort((*it).begin(), (*it).end(),
+ (!m_listOrder || m_type == kDeleteBox) ?
+ comp_season_rev_less_than :
+ comp_season_less_than);
+ }
+ }
+ }
if (!m_progLists[m_watchGroupLabel].empty())
{
Please sign in to comment.
Something went wrong with that request. Please try again.