Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TypeError with Episode Range on Remap #292

Closed
BrutuZ opened this issue Apr 1, 2024 · 1 comment
Closed

[BUG] TypeError with Episode Range on Remap #292

BrutuZ opened this issue Apr 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@BrutuZ
Copy link
Contributor

BrutuZ commented Apr 1, 2024

Describe the bug

As brought up on #291, I get a TypeError exception when using the match.episode field on remap_rules.toml.
I'm guessing the Season/Episode fields overridden by the include_regexes expression are not being converted from Strings to Integers

Desktop (please complete the following information):

  • OS and Version: Win10
  • Python Version: 3.11
  • Player and Version: MPC-HC

To Reproduce

remap_rules.toml

[[rules]]
match.title = "Mashle - Magic and Muscles"
match.episode = "1:12"
match.season = 2
id.trakt_slug = "mashle-magic-and-muscles"
type = "episode"
season = 1
episode_delta = 12

config.yaml

fileinfo:
  include_regexes:
    episode:
      - '.*Q[1-4]] (?P<title>.+?)\\+\[(?P<release_group>.+?)] (?P<alternate_name>.+?) - (S0?(?P<season>[0-9]+)E0?)?(?P<episode>[0-9]+( ?v\d)?).*'

players:
  monitored:
    - mpc-hc
version: "1.0"

Log file

Click to see log contents

DEBUG - mpc-hc - file_info - Raw filepath 'G:\\anime-seasonals\\[2024 Q1] Mashle - Magic and Muscles\\[DKB] MASHLE - S02E12 [1080p][END][HEVC x265 10bit][Multi-Subs].mkv'
DEBUG - mpc-hc - file_info - Matched whitelist entry WindowsPath('G:/anime-seasonals')
DEBUG - mpc-hc - file_info - Matched regex pattern re.compile('.*Q[1-4]] (?P<title>.+?)\\\\+\\[(?P<release_group>.+?)] (?P<alternate_name>.+?) - (S0?(?P<season>[0-9]+)E0?)?(?P<episode>[0-9]+( ?v\\d)?).*')
DEBUG - mpc-hc - file_info - Guess: {'title': 'Mashle - Magic and Muscles', 'release_group': 'DKB', 'alternate_name': 'MASHLE', 'season': '2', 'episode': '12', 'type': 'episode'}
ERROR - mpc-hc - __init__ - Unhandled exception
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "...\trakt_scrobbler\player_monitors\monitor.py", line 387, in run
    self.handle_status_update()
  File "...\trakt_scrobbler\player_monitors\monitor.py", line 338, in handle_status_update
    current_state = self.parse_status(self.status)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\trakt_scrobbler\player_monitors\monitor.py", line 163, in parse_status
    media_info = get_media_info(status['filepath'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\trakt_scrobbler\file_info.py", line 137, in get_media_info
    guess = apply_remap_rules(file_path, guess)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\trakt_scrobbler\mediainfo_remap.py", line 308, in apply_remap_rules
    upd = rule.apply(path, media_info)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\trakt_scrobbler\mediainfo_remap.py", line 235, in apply
    match = self.match.match(path, media_info)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\trakt_scrobbler\mediainfo_remap.py", line 149, in match
    if not self.episode.match(episode):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\trakt_scrobbler\mediainfo_remap.py", line 43, in match
    return self.start <= val and val <= self.end
           ^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'int' and 'str'

@iamkroot
Copy link
Owner

iamkroot commented Apr 3, 2024

Fixed in master, give it a shot!

@iamkroot iamkroot added the bug Something isn't working label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants