@@ -65,6 +69,7 @@ export default {
episodesCopy: [],
filterKey: 'incomplete',
sortKey: 'publishedAt',
+ seasonKey: 'allSeasons',
sortDesc: true,
selectedEpisode: null,
showPodcastRemoveModal: false,
@@ -145,6 +150,28 @@ export default {
}
]
},
+ seasonItems() {
+ const seasonsSet = this.episodesCopy.reduce((acc, episode) => {
+ if (episode.season) {
+ acc.add(episode.season);
+ }
+ return acc;
+ }, new Set());
+
+ const seasonsArray = Array.from(seasonsSet);
+
+ const seasonItems = seasonsArray.map(season => ({
+ value: season,
+ text: `Season ${season}`
+ }));
+
+ seasonItems.unshift({
+ value: 'allSeasons',
+ text: 'All Seasons'
+ });
+
+ return seasonItems;
+ },
isSelectionMode() {
return this.selectedEpisodes.length > 0
},
@@ -163,6 +190,9 @@ export default {
episodesSorted() {
return this.episodesCopy
.filter((ep) => {
+ // Filter by season
+ if (this.seasonKey !== 'allSeasons' && ep.season !== this.seasonKey) return false
+
if (this.filterKey === 'all') return true
const episodeProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItem.id, ep.id)
if (this.filterKey === 'incomplete') return !episodeProgress || !episodeProgress.isFinished