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 <[email protected]>
  • Loading branch information
2 people authored and halkeye committed Sep 1, 2024
1 parent 1eeff96 commit 1ca3dc5
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 1ca3dc5

Please sign in to comment.