mirror of
https://github.com/sct/overseerr.git
synced 2025-12-26 08:25:07 +01:00
feat: add support for requesting "Specials" for TV Shows (#3724)
* feat: add support for requesting "Specials" for TV Shows This commit is responsible for adding support in Overseerr for requesting "Special" episodes for TV Shows. This request has become especially pertinent when you consider shows like "Doctor Who". These shows have Specials that are critical to understanding the plot of a TV show. fix #779 * chore(yarn.lock): undo inappropriate changes to yarn.lock I was informed by @sct in a comment on the #3724 PR that it was not appropriate to commit the changes that ended up being made to the yarn.lock file. This commit is responsible, then, for undoing the changes to the yarn.lock file that ended up being submitted. * refactor: change loose equality to strict equality I received a comment from OwsleyJr pointing out that we are using loose equality when we could alternatively just be using strict equality to increase the robustness of our code. This commit does exactly that by squashing out previous usages of loose equality in my commits and replacing them with strict equality * refactor: move 'Specials' string to a global message Owsley pointed out that we are redefining the 'Specials' string multiple times throughout this PR. Instead, we can just move it as a global message. This commit does exactly that. It squashes out and previous declarations of the 'Specials' string inside the src files, and moves it directly to the global messages file.
This commit is contained in:
@@ -381,9 +381,7 @@ export class MediaRequest {
|
||||
>;
|
||||
let requestedSeasons =
|
||||
requestBody.seasons === 'all'
|
||||
? tmdbMediaShow.seasons
|
||||
.filter((season) => season.season_number !== 0)
|
||||
.map((season) => season.season_number)
|
||||
? tmdbMediaShow.seasons.map((season) => season.season_number)
|
||||
: (requestBody.seasons as number[]);
|
||||
if (!settings.main.enableSpecialEpisodes) {
|
||||
requestedSeasons = requestedSeasons.filter((sn) => sn > 0);
|
||||
|
||||
@@ -323,11 +323,7 @@ class PlexScanner
|
||||
const processableSeasons: ProcessableSeason[] = [];
|
||||
const settings = getSettings();
|
||||
|
||||
const filteredSeasons = settings.main.enableSpecialEpisodes
|
||||
? seasons
|
||||
: seasons.filter((sn) => sn.season_number !== 0);
|
||||
|
||||
for (const season of filteredSeasons) {
|
||||
for (const season of seasons) {
|
||||
const matchedPlexSeason = metadata.Children?.Metadata.find(
|
||||
(md) => Number(md.index) === season.season_number
|
||||
);
|
||||
|
||||
@@ -104,10 +104,8 @@ class SonarrScanner
|
||||
const tmdbId = tvShow.id;
|
||||
const settings = getSettings();
|
||||
|
||||
const filteredSeasons = sonarrSeries.seasons.filter(
|
||||
(sn) =>
|
||||
tvShow.seasons.find((s) => s.season_number === sn.seasonNumber) &&
|
||||
(!settings.main.enableSpecialEpisodes ? sn.seasonNumber !== 0 : true)
|
||||
const filteredSeasons = sonarrSeries.seasons.filter((sn) =>
|
||||
tvShow.seasons.find((s) => s.season_number === sn.seasonNumber)
|
||||
);
|
||||
|
||||
for (const season of filteredSeasons) {
|
||||
|
||||
@@ -403,11 +403,7 @@ const RequestCard = ({ request, onTitleData }: RequestCardProps) => {
|
||||
<span className="mr-2 font-bold ">
|
||||
{intl.formatMessage(messages.seasons, {
|
||||
seasonCount:
|
||||
(settings.currentSettings.enableSpecialEpisodes
|
||||
? title.seasons.length
|
||||
: title.seasons.filter(
|
||||
(season) => season.seasonNumber !== 0
|
||||
).length) === request.seasons.length
|
||||
title.seasons.length === request.seasons.length
|
||||
? 0
|
||||
: request.seasons.length,
|
||||
})}
|
||||
|
||||
@@ -471,11 +471,7 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
|
||||
<span className="card-field-name">
|
||||
{intl.formatMessage(messages.seasons, {
|
||||
seasonCount:
|
||||
(settings.currentSettings.enableSpecialEpisodes
|
||||
? title.seasons.length
|
||||
: title.seasons.filter(
|
||||
(season) => season.seasonNumber !== 0
|
||||
).length) === request.seasons.length
|
||||
title.seasons.length === request.seasons.length
|
||||
? 0
|
||||
: request.seasons.length,
|
||||
})}
|
||||
|
||||
@@ -236,13 +236,9 @@ const TvRequestModal = ({
|
||||
};
|
||||
|
||||
const getAllSeasons = (): number[] => {
|
||||
let allSeasons = (data?.seasons ?? []).filter(
|
||||
(season) => season.episodeCount !== 0
|
||||
);
|
||||
if (!settings.currentSettings.enableSpecialEpisodes) {
|
||||
allSeasons = allSeasons.filter((season) => season.seasonNumber > 0);
|
||||
}
|
||||
return allSeasons.map((season) => season.seasonNumber);
|
||||
return (data?.seasons ?? [])
|
||||
.filter((season) => season.episodeCount !== 0)
|
||||
.map((season) => season.seasonNumber);
|
||||
};
|
||||
|
||||
const getAllRequestedSeasons = (): number[] => {
|
||||
@@ -574,16 +570,7 @@ const TvRequestModal = ({
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-700">
|
||||
{data?.seasons
|
||||
.filter(
|
||||
(season) =>
|
||||
(!settings.currentSettings.enableSpecialEpisodes
|
||||
? season.seasonNumber !== 0
|
||||
: true) &&
|
||||
(!settings.currentSettings.partialRequestsEnabled
|
||||
? season.episodeCount !== 0 &&
|
||||
season.seasonNumber !== 0
|
||||
: season.episodeCount !== 0)
|
||||
)
|
||||
.filter((season) => season.episodeCount !== 0)
|
||||
.map((season) => {
|
||||
const seasonRequest = getSeasonRequest(
|
||||
season.seasonNumber
|
||||
|
||||
@@ -304,9 +304,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
||||
};
|
||||
|
||||
const showHasSpecials = data.seasons.some(
|
||||
(season) =>
|
||||
season.seasonNumber === 0 &&
|
||||
settings.currentSettings.enableSpecialEpisodes
|
||||
(season) => season.seasonNumber === 0
|
||||
);
|
||||
|
||||
const isComplete =
|
||||
@@ -317,6 +315,10 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
||||
(showHasSpecials ? seasonCount + 1 : seasonCount) <=
|
||||
getAllRequestedSeasons(true).length;
|
||||
|
||||
const is4kComplete =
|
||||
(showHasSpecials ? seasonCount + 1 : seasonCount) <=
|
||||
getAllRequestedSeasons(true).length;
|
||||
|
||||
const streamingRegion = user?.settings?.streamingRegion
|
||||
? user.settings.streamingRegion
|
||||
: settings.currentSettings.streamingRegion
|
||||
@@ -785,11 +787,6 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
||||
{data.seasons
|
||||
.slice()
|
||||
.reverse()
|
||||
.filter(
|
||||
(season) =>
|
||||
settings.currentSettings.enableSpecialEpisodes ||
|
||||
season.seasonNumber !== 0
|
||||
)
|
||||
.map((season) => {
|
||||
const show4k =
|
||||
settings.currentSettings.series4kEnabled &&
|
||||
|
||||
@@ -57,16 +57,6 @@ const globalMessages = defineMessages('i18n', {
|
||||
noresults: 'No results.',
|
||||
open: 'Open',
|
||||
resolved: 'Resolved',
|
||||
blacklist: 'Blacklist',
|
||||
blacklisted: 'Blacklisted',
|
||||
blacklistSuccess: '<strong>{title}</strong> was successfully blacklisted.',
|
||||
blacklistError: 'Something went wrong. Please try again.',
|
||||
blacklistDuplicateError:
|
||||
'<strong>{title}</strong> has already been blacklisted.',
|
||||
removeFromBlacklistSuccess:
|
||||
'<strong>{title}</strong> was successfully removed from the Blacklist.',
|
||||
addToBlacklist: 'Add to Blacklist',
|
||||
removefromBlacklist: 'Remove from Blacklist',
|
||||
specials: 'Specials',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user