Skip to content

Commit

Permalink
Fix false positive mismatch in Movie Scrape dialog (stashapp#4144)
Browse files Browse the repository at this point in the history
* 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

* Fallback to original value if not a number

---------

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
  • Loading branch information
Maista6969 and WithoutPants authored Sep 25, 2023
1 parent 9577600 commit 165528f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export const MovieScrapeDialog: React.FC<IMovieScrapeDialogProps> = (
const [duration, setDuration] = useState<ScrapeResult<string>>(
new ScrapeResult<string>(
DurationUtils.secondsToString(props.movie.duration || 0),
props.scraped.duration
// convert seconds to string if it's a number
props.scraped.duration && !isNaN(+props.scraped.duration)
? DurationUtils.secondsToString(parseInt(props.scraped.duration, 10))
: props.scraped.duration
)
);
const [date, setDate] = useState<ScrapeResult<string>>(
Expand Down

0 comments on commit 165528f

Please sign in to comment.