mmmmmtasty / SportScanner

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

Cannot deal with large files #26

Open ghost opened 5 years ago

ghost commented 5 years ago

I am trying to scan in a surprisingly large 5GB (5431101221 bytes) video file with SportsScanner. The plugin scanned in a lower quality video perfectly so I know the set up works.

This is appearing in the logs

Traceback (most recent call last):
  File "/srv/dev-disk-by-label-omv-data/plexmediaserver/Library/Application Support/Plex Media Server/Scanners/Series/SportScanner.py", line 81, in Scan
    file_contents = os.read(fd, size)
OverflowError: signed integer is greater than maximum

I assume that this is a simple change that I will start looking into

ghost commented 5 years ago

Upon further investigation, line 81 looks like it is in the if statement route that reads the SportScanner.txt file, but there isn't one present in the directory

jbalcorn commented 2 years ago

Hm. I was using the .SportsScanner files but I never really looked at that code. It's looking for a 'SportsScanner.txt' file but the regular expression only works on Windows so when you're on Linux it just gets back the name of your video file. That's not good, it never hurt me but it definitely hurts performance to be reading video files as a text file and then trying to read it. I'll take a look and see if I can come up with a better way.

jbalcorn commented 2 years ago

I know this is very old, but if you replace the regular expression

filename = re.sub(r'(.*\\).*?$',r'\1SportScanner.txt',clean_files[file])

with

filename = "{0}{1}SportScanner.txt".format(os.path.dirname(clean_files[file]),os.path.sep)

That will fix your problem because it will ONLY read the file if its name is */SportScanner.txt

I'll submit a pull request to fix this.

jbalcorn commented 2 years ago

Well, that explains why the single folder never worked for me before. It works now (I'm on Linux)

Jan 24 10:48:36 gossamer Plex Media Server[3767]: SS: Starting scan
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Starting scan
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Starting scan
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: files | ['/mnt/disk/share/sports/NFL/NFL.2022-01-04.Pittsburgh_Steelers_vs_Cleveland_Browns.mkv', '/mnt/disk/share/sports/NFL/NFL.2022-01-23.Kansas_City_Chiefs_vs_Buffalo_Bills.mkv', '/mnt/disk/share/sports/NFL/NFL.2022-01-23.Tampa_Bay_Buccaneers_vs_Los_Angeles_Rams.mkv'] |
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: subdirs | ['/mnt/disk/share/sports/NFL/Season 2122'] |
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Working on file | NFL.2022-01-23.Kansas_City_Chiefs_vs_Buffalo_Bills |
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: matched regex | (?P<show>.*?)[^0-9a-zA-Z]+(?P<year>[0-9]{4})[^0-9a-zA-Z]+(?P<month>[0-9]{2})[^0-9a-zA-Z]+(?P<day>[0-9]{2})[^0-9a-zA-Z]+(?P<title>.*)$ |
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: FileName: /mnt/disk/share/sports/NFL/SportScanner.txt
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: FileContents: XXYY
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Using xxyy season format for NFL
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Split date is 3-1
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Event date is 1-23
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Event happened before split date
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: Working on file | NFL.2022-01-23.Tampa_Bay_Buccaneers_vs_Los_Angeles_Rams |
Jan 24 10:48:42 gossamer Plex Media Server[3767]: SS: matched regex | (?P<show>.*?)[^0-9a-zA-Z]+(?P<year>[0-9]{4})[^0-9a-zA-Z]+(?P<month>[0-9]{2})[^0-9a-zA-Z]+(?P<day>[0-9]{2})[^0-9a-zA-Z]+(?P<title>.*)$ |
jbalcorn commented 2 years ago

Pull Request submitted on a new branch.

jbalcorn commented 2 years ago

@lengland Can you check to see if this fixes your issue and close?

jbalcorn commented 2 years ago

@mmmmmtasty you can probably close this issue