From 4a774378abd7939b5d380e5e1c910b122d28f4bf Mon Sep 17 00:00:00 2001 From: Maista6969 Date: Fri, 22 Sep 2023 15:19:36 +0200 Subject: [PATCH 1/2] Fix false positive mismatch in Movie Scrape dialog Scraping a movie by URL would show a difference in duration because the persisted value of duration was converted to HH:MM:SS while the newly scraped value was displayed without formatting: this makes sense because the newly scraped value is just a string and so could be anything This adds a check to see if the string is a number and converts it to HH:MM:SS format if possible --- .../src/components/Movies/MovieDetails/MovieScrapeDialog.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx b/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx index f11edf6e8c3..116f5c7a258 100644 --- a/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx +++ b/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx @@ -84,7 +84,9 @@ export const MovieScrapeDialog: React.FC = ( const [duration, setDuration] = useState>( new ScrapeResult( DurationUtils.secondsToString(props.movie.duration || 0), - props.scraped.duration + props.scraped.duration && !isNaN(+props.scraped.duration) + ? DurationUtils.secondsToString(parseInt(props.scraped.duration, 10)) + : undefined ) ); const [date, setDate] = useState>( From 2b8b3ac8fcdbe888a88c265a05a34750f72f9801 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Mon, 25 Sep 2023 12:41:11 +1000 Subject: [PATCH 2/2] Fallback to original value if not a number --- .../src/components/Movies/MovieDetails/MovieScrapeDialog.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx b/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx index 116f5c7a258..2cba1e31533 100644 --- a/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx +++ b/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx @@ -84,9 +84,10 @@ export const MovieScrapeDialog: React.FC = ( const [duration, setDuration] = useState>( new ScrapeResult( DurationUtils.secondsToString(props.movie.duration || 0), + // convert seconds to string if it's a number props.scraped.duration && !isNaN(+props.scraped.duration) ? DurationUtils.secondsToString(parseInt(props.scraped.duration, 10)) - : undefined + : props.scraped.duration ) ); const [date, setDate] = useState>(