fix sorting by season/episode for seasons > 9 and episodes > 99

Patch by Steve Campbell, extended to cover "year as season" and series
with lots of episodes

Fixes #11893
(cherry picked from commit 86d4b489d5b633c5d92bc1adbc94ccc9485098e6)