Compare commits

...

3 Commits

Author SHA1 Message Date
allcontributors[bot]
4aac491209 docs: add AhmedNSidd as a contributor for code (#3964) [skip ci]
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2024-10-20 22:11:50 -07:00
Ahmed Siddiqui
c2d4c61fae 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.
2024-10-21 05:02:10 +00:00
Brandon Cohen
a2c25d5e4b fix: correct icon showing on certain phones when not pulled (#3939) 2024-09-24 07:32:21 +09:00
14 changed files with 78 additions and 44 deletions

View File

@@ -962,6 +962,15 @@
"contributions": [
"code"
]
},
{
"login": "AhmedNSidd",
"name": "Ahmed Siddiqui",
"avatar_url": "https://avatars.githubusercontent.com/u/36286128?v=4",
"profile": "https://github.com/AhmedNSidd",
"contributions": [
"code"
]
}
],
"badgeTemplate": "<a href=\"#contributors-\"><img alt=\"All Contributors\" src=\"https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg\"/></a>",

View File

@@ -11,7 +11,7 @@
<a href="https://hosted.weblate.org/engage/overseerr/"><img src="https://hosted.weblate.org/widgets/overseerr/-/overseerr-frontend/svg-badge.svg" alt="Translation status" /></a>
<a href="https://github.com/sct/overseerr/blob/develop/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/sct/overseerr"></a>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="#contributors-"><img alt="All Contributors" src="https://img.shields.io/badge/all_contributors-105-orange.svg"/></a>
<a href="#contributors-"><img alt="All Contributors" src="https://img.shields.io/badge/all_contributors-106-orange.svg"/></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
</p>
@@ -209,6 +209,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://maxtrier.dk"><img src="https://avatars.githubusercontent.com/u/5898152?v=4?s=100" width="100px;" alt="Max T. Kristiansen"/><br /><sub><b>Max T. Kristiansen</b></sub></a><br /><a href="https://github.com/sct/overseerr/commits?author=maxnatamo" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://damsdev.me"><img src="https://avatars.githubusercontent.com/u/60252259?v=4?s=100" width="100px;" alt="Damien Fajole"/><br /><sub><b>Damien Fajole</b></sub></a><br /><a href="https://github.com/sct/overseerr/commits?author=DamsDev1" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AhmedNSidd"><img src="https://avatars.githubusercontent.com/u/36286128?v=4?s=100" width="100px;" alt="Ahmed Siddiqui"/><br /><sub><b>Ahmed Siddiqui</b></sub></a><br /><a href="https://github.com/sct/overseerr/commits?author=AhmedNSidd" title="Code">💻</a></td>
</tr>
</tbody>
</table>

View File

@@ -5018,7 +5018,7 @@ paths:
- type: array
items:
type: number
minimum: 1
minimum: 0
- type: string
enum: [all]
is4k:
@@ -5124,7 +5124,7 @@ paths:
type: array
items:
type: number
minimum: 1
minimum: 0
is4k:
type: boolean
example: false

View File

@@ -246,9 +246,7 @@ export class MediaRequest {
>;
const requestedSeasons =
requestBody.seasons === 'all'
? tmdbMediaShow.seasons
.map((season) => season.season_number)
.filter((sn) => sn > 0)
? tmdbMediaShow.seasons.map((season) => season.season_number)
: (requestBody.seasons as number[]);
let existingSeasons: number[] = [];

View File

@@ -278,9 +278,7 @@ class PlexScanner
const seasons = tvShow.seasons;
const processableSeasons: ProcessableSeason[] = [];
const filteredSeasons = 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
);

View File

@@ -103,10 +103,8 @@ class SonarrScanner
const tmdbId = tvShow.id;
const filteredSeasons = sonarrSeries.seasons.filter(
(sn) =>
sn.seasonNumber !== 0 &&
tvShow.seasons.find((s) => s.season_number === sn.seasonNumber)
const filteredSeasons = sonarrSeries.seasons.filter((sn) =>
tvShow.seasons.find((s) => s.season_number === sn.seasonNumber)
);
for (const season of filteredSeasons) {

View File

@@ -4,7 +4,6 @@ import { useEffect, useRef, useState } from 'react';
const PullToRefresh = () => {
const router = useRouter();
const [pullStartPoint, setPullStartPoint] = useState(0);
const [pullChange, setPullChange] = useState(0);
const refreshDiv = useRef<HTMLDivElement>(null);
@@ -19,6 +18,7 @@ const PullToRefresh = () => {
// Reload function that is called when reload threshold has been hit
// Add loading class to determine when to add spin animation
const forceReload = () => {
setPullStartPoint(0);
refreshDiv.current?.classList.add('loading');
setTimeout(() => {
router.reload();
@@ -32,6 +32,8 @@ const PullToRefresh = () => {
const pullStart = (e: TouchEvent) => {
setPullStartPoint(e.targetTouches[0].screenY);
const html = document.querySelector('html');
if (window.scrollY === 0 && window.scrollX === 0) {
refreshDiv.current?.classList.add('block');
refreshDiv.current?.classList.remove('hidden');
@@ -41,6 +43,7 @@ const PullToRefresh = () => {
html.style.overscrollBehaviorY = 'none';
}
} else {
setPullStartPoint(0);
refreshDiv.current?.classList.remove('block');
refreshDiv.current?.classList.add('hidden');
}
@@ -49,7 +52,6 @@ const PullToRefresh = () => {
// Tracks how far we have pulled down the refresh icon
const pullDown = async (e: TouchEvent) => {
const screenY = e.targetTouches[0].screenY;
const pullLength =
pullStartPoint < screenY ? Math.abs(screenY - pullStartPoint) : 0;
@@ -59,12 +61,11 @@ const PullToRefresh = () => {
// Will reload the page if we are past the threshold
// Otherwise, we reset the pull
const pullFinish = () => {
setPullStartPoint(0);
if (pullDownReloadThreshold) {
if (pullDownReloadThreshold && pullStartPoint !== 0) {
forceReload();
} else {
setPullChange(0);
setTimeout(() => setPullStartPoint(0), 200);
}
document.body.style.touchAction = 'auto';
@@ -83,7 +84,21 @@ const PullToRefresh = () => {
window.removeEventListener('touchmove', pullDown);
window.removeEventListener('touchend', pullFinish);
};
}, [pullDownInitThreshold, pullDownReloadThreshold, pullStartPoint, router]);
}, [
pullDownInitThreshold,
pullDownReloadThreshold,
pullStartPoint,
refreshDiv,
router,
setPullStartPoint,
]);
if (
pullStartPoint === 0 &&
!refreshDiv.current?.classList.contains('loading')
) {
return null;
}
return (
<div
@@ -102,7 +117,7 @@ const PullToRefresh = () => {
<div
className={`${
refreshDiv.current?.classList.contains('loading') && 'animate-spin'
} relative -top-24 h-9 w-9 rounded-full border-4 border-gray-800 bg-gray-800 shadow-md shadow-black ring-1 ring-gray-700`}
} relative -top-28 h-9 w-9 rounded-full border-4 border-gray-800 bg-gray-800 shadow-md shadow-black ring-1 ring-gray-700`}
style={{ animationDirection: 'reverse' }}
>
<ArrowPathIcon

View File

@@ -243,7 +243,11 @@ const RequestBlock = ({ request, onUpdate }: RequestBlockProps) => {
key={`season-${season.id}`}
className="mb-1 mr-2 inline-block"
>
<Badge>{season.seasonNumber}</Badge>
<Badge>
{season.seasonNumber === 0
? intl.formatMessage(globalMessages.specials)
: season.seasonNumber}
</Badge>
</span>
))}
</div>

View File

@@ -381,8 +381,7 @@ const RequestCard = ({ request, onTitleData }: RequestCardProps) => {
<span className="mr-2 font-bold ">
{intl.formatMessage(messages.seasons, {
seasonCount:
title.seasons.filter((season) => season.seasonNumber !== 0)
.length === request.seasons.length
title.seasons.length === request.seasons.length
? 0
: request.seasons.length,
})}
@@ -390,7 +389,11 @@ const RequestCard = ({ request, onTitleData }: RequestCardProps) => {
<div className="hide-scrollbar overflow-x-scroll">
{request.seasons.map((season) => (
<span key={`season-${season.id}`} className="mr-2">
<Badge>{season.seasonNumber}</Badge>
<Badge>
{season.seasonNumber === 0
? intl.formatMessage(globalMessages.specials)
: season.seasonNumber}
</Badge>
</span>
))}
</div>

View File

@@ -440,9 +440,7 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
<span className="card-field-name">
{intl.formatMessage(messages.seasons, {
seasonCount:
title.seasons.filter(
(season) => season.seasonNumber !== 0
).length === request.seasons.length
title.seasons.length === request.seasons.length
? 0
: request.seasons.length,
})}
@@ -450,7 +448,11 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
<div className="hide-scrollbar flex flex-nowrap overflow-x-scroll">
{request.seasons.map((season) => (
<span key={`season-${season.id}`} className="mr-2">
<Badge>{season.seasonNumber}</Badge>
<Badge>
{season.seasonNumber === 0
? intl.formatMessage(globalMessages.specials)
: season.seasonNumber}
</Badge>
</span>
))}
</div>

View File

@@ -41,7 +41,6 @@ const messages = defineMessages({
season: 'Season',
numberofepisodes: '# of Episodes',
seasonnumber: 'Season {number}',
extras: 'Extras',
errorediting: 'Something went wrong while editing the request.',
requestedited: 'Request for <strong>{title}</strong> edited successfully!',
requestApproved: 'Request for <strong>{title}</strong> approved!',
@@ -232,9 +231,7 @@ const TvRequestModal = ({
const getAllSeasons = (): number[] => {
return (data?.seasons ?? [])
.filter(
(season) => season.seasonNumber !== 0 && season.episodeCount !== 0
)
.filter((season) => season.episodeCount !== 0)
.map((season) => season.seasonNumber);
};
@@ -557,10 +554,7 @@ const TvRequestModal = ({
</thead>
<tbody className="divide-y divide-gray-700">
{data?.seasons
.filter(
(season) =>
season.seasonNumber !== 0 && season.episodeCount !== 0
)
.filter((season) => season.episodeCount !== 0)
.map((season) => {
const seasonRequest = getSeasonRequest(
season.seasonNumber
@@ -637,7 +631,7 @@ const TvRequestModal = ({
</td>
<td className="whitespace-nowrap px-1 py-4 text-sm font-medium leading-5 text-gray-100 md:px-6">
{season.seasonNumber === 0
? intl.formatMessage(messages.extras)
? intl.formatMessage(globalMessages.specials)
: intl.formatMessage(messages.seasonnumber, {
number: season.seasonNumber,
})}

View File

@@ -200,6 +200,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
);
}
// Does NOT include "Specials"
const seasonCount = data.seasons.filter(
(season) => season.seasonNumber !== 0 && season.episodeCount !== 0
).length;
@@ -257,9 +258,17 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
return [...requestedSeasons, ...availableSeasons];
};
const isComplete = seasonCount <= getAllRequestedSeasons(false).length;
const showHasSpecials = data.seasons.some(
(season) => season.seasonNumber === 0
);
const is4kComplete = seasonCount <= getAllRequestedSeasons(true).length;
const isComplete =
(showHasSpecials ? seasonCount + 1 : seasonCount) <=
getAllRequestedSeasons(false).length;
const is4kComplete =
(showHasSpecials ? seasonCount + 1 : seasonCount) <=
getAllRequestedSeasons(true).length;
const streamingProviders =
data?.watchProviders?.find((provider) => provider.iso_3166_1 === region)
@@ -522,7 +531,6 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
{data.seasons
.slice()
.reverse()
.filter((season) => season.seasonNumber !== 0)
.map((season) => {
const show4k =
settings.currentSettings.series4kEnabled &&
@@ -576,9 +584,11 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
>
<div className="flex flex-1 items-center space-x-2 text-lg">
<span>
{intl.formatMessage(messages.seasonnumber, {
seasonNumber: season.seasonNumber,
})}
{season.seasonNumber === 0
? intl.formatMessage(globalMessages.specials)
: intl.formatMessage(messages.seasonnumber, {
seasonNumber: season.seasonNumber,
})}
</span>
<Badge badgeType="dark">
{intl.formatMessage(messages.episodeCount, {

View File

@@ -55,6 +55,7 @@ const globalMessages = defineMessages({
noresults: 'No results.',
open: 'Open',
resolved: 'Resolved',
specials: 'Specials',
});
export default globalMessages;

View File

@@ -471,7 +471,6 @@
"components.RequestModal.cancel": "Cancel Request",
"components.RequestModal.edit": "Edit Request",
"components.RequestModal.errorediting": "Something went wrong while editing the request.",
"components.RequestModal.extras": "Extras",
"components.RequestModal.numberofepisodes": "# of Episodes",
"components.RequestModal.pending4krequest": "Pending 4K Request",
"components.RequestModal.pendingapproval": "Your request is pending approval.",