iamkroot / trakt-scrobbler

Scrobbler for trakt.tv that supports VLC, Plex, MPC-HC, and MPV.
https://github.com/iamkroot/trakt-scrobbler/wiki
GNU General Public License v2.0
466 stars 30 forks source link

[BUG] TypeError with Episode Range on Remap #292

Closed BrutuZ closed 7 months ago

BrutuZ commented 8 months ago

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):

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

```log 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.+?)\\\\+\\[(?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' ``` </p> </details> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/iamkroot"><img src="https://avatars.githubusercontent.com/u/29517049?v=4" />iamkroot</a> commented <strong> 7 months ago</strong> </div> <div class="markdown-body"> <p>Fixed in master, give it a shot!</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>