mmmmmtasty / SportScanner

Scanner and Metadata Agent for Plex that uses sportdb
115 stars 31 forks source link

Y22bug - Create 9-char episode number if it's 2022 #42

Closed jbalcorn closed 2 years ago

jbalcorn commented 2 years ago

Address issue #37 This time with the correct code.

Episode numbers are copied to the index field in the metadata_items table internally in Plex. It's a 32-bit unsigned integer so it has a maximum value of 2,147,483,647. When we create a 10-digit episode number in 2022 it starts at 2,200,000,000 and overflows the index attribute, so it gets a -1.

Since all the events for that season on that day have the same index, they show up as the same event.

This code implements a kludge - just make the episodes 9 characters long if they're after 2021. We leave the code the same for older events so that the code continues to generate the same episode number for the same file.

This PR includes corrected code.