ZeroQI / Absolute-Series-Scanner

Seasons, absolute mode, Subfolders...
999 stars 155 forks source link

Episodes with a leading numeral in title map to multiple episodes #492

Closed craized closed 3 months ago

craized commented 3 months ago

When processing a file with a name like the below, the scanner will capture the 3 in "3rd" as ep2 instead of treating it as a title. Bleach.343.s16e01.3rd.Year.High.School.Student!.avi

Platform

Operating system and version: CentOS Linux release 7.9 Plex version: 4.125.1

Expected Behavior

The episode should be matched as absolute episode 343 or s16 e01

Current Behavior

The episode is matched as episode s16 e01-e03. Plex shows a duplicate episode for s16 e02 and s16 e03

I have patched out behavior and don't have logs available but if required I can provide them.

Steps to Reproduce

  1. Create a Bleach folder
  2. Add episode files 2a. Bleach.343.s16e01.3rd.Year.High.School.Student!.avi 2b. Bleach.344.s16e02.A.Dispute.in.School!!.Ichigo.and.Uryuu,.Fight.Together!.avi 2c. Bleach.345.s16e03.Uryuu.is.Attacked,.A.Threat.Draws.Near.the.Friends!.avi
  3. Check file info for files 2b or 2c to see that it shows two entries, one of which points to 2a
  4. Rename 2a to Bleach.343.s16e01.Third.Year.High.School.Student!.avi to clear the issue

Additional information

The following patch fixes this issue although I'm not sure it fits with the general desires of the community and maintainer. More than happy to contribute it if desired.

git show 5dbf743440ca205ed89196cc93e017d840d951ab
commit 5dbf743440ca205ed89196cc93e017d840d951ab
Author: Root <root@localhost>
Date:   Sat May 18 18:46:57 2024 -0700

    Only allow ep + ep2 delimiter to be a space, underscore or dot if the "E" or "EP" keyword exists.
    This prevents capturing a title with leading numerals as a second episode number.

diff --git a/Scanners/Series/Absolute Series Scanner.py b/Scanners/Series/Absolute Series Scanner.py
index 543af9e..a55d7a9 100755
--- a/Scanners/Series/Absolute Series Scanner.py        
+++ b/Scanners/Series/Absolute Series Scanner.py        
@@ -108,7 +108,7 @@ SEASON_RX       = [ cic(ur'^(Specials|Speciali|SPs?|映像特典)'),
                     cic(ur'^(Saga|(Story )?Ar[kc])')]                                                                                                                             # Last en
 SERIES_RX       = [                                                                                                                                                              ######### 
   cic(ur'(^|(?P<show>.*?)[ _\.\-]*)(?P<season>\d{1,2})XE?(?P<ep>\d{1,4})(([_\-X]|[_\-]\d{1,2}X)(?P<ep2>\d{1,4}))?([ _\.\-]+(?P<title>.*))?$'),                                    #  0 # 1x
-  cic(ur'(^|(?P<show>.*?)[ _\.\-]*)SE?(?P<season>\d{1,4})[ _\.\-]?EP?(?P<ep>\d{1,4})(([ _\.\-]|EP?|[ _\.\-]EP?)(?P<ep2>\d{1,4}))?[ _\.]*(?P<title>.*?)$'),                        #  1 # s0
+  cic(ur'(^|(?P<show>.*?)[ _\.\-]*)SE?(?P<season>\d{1,4})[ _\.\-]?EP?(?P<ep>\d{1,4})(([\-]|EP?|[ _\.\-]EP?)(?P<ep2>\d{1,4}))?[ _\.]*(?P<title>.*?)$'),                        #  1 # s01e01
   cic(ur'^(?P<show>.*?)[ _\.]-[ _\.](EP?)?(?P<ep>\d{1,3})(-(?P<ep2>\d{1,3}))?(V\d)?[ _\.]*?(?P<title>.*)$'), # 2 # Serie - xx - title.ext | ep01-ep02 | e01-02
   cic(ur'^(?P<show>.*?)[ _\.]\[(?P<season>\d{1,2})\][ _\.]\[(?P<ep>\d{1,4})\][ _\.](?P<title>.*)$'),
   cic(ur'^\[.*\]\[(?P<show>.*)\]\[第?(?P<ep>\d{1,4})[话話集]?(-(?P<ep2>\d{1,4})[话話集]?)?\].*$'),
craized commented 3 months ago

Thanks for the quick merge. Very much appreciate this project.