Open drygoatair opened 4 months ago
Thank you for the detailed bug report! It is very concise and clear.
The current code indeed tries to run the validations before applying remap rules. And I'm not sure if I would like to change this behaviour. The reasoning is that remap rules, at least in my head, are meant for mapping one valid media info to another. It greatly simplifies things to assume valid media info as the input for remap rules.
Since you mention renaming is not an option, the appropriate solution for this is to use custom regexes.
Example, I have used .*?/Breaking Bad \(2008\) Season 1-5 S01-S05 .*?/Season \d+/(?P<title>Breaking Bad) .*? - S(?P<season>\d+)E(?P<episode>\d+) - (?:.*)
for this issue of multiple seasons.
(This is mostly for my own benefit, but please feel free to comment if you have opinions.)
If we start allowing raw media info for remap rules, I fear the data might be too arbitrary to make sense. For instance - what happens when the user adds match.season = "1:2"
to your rule above?
[[rules]]
match.path = ".*Mr Inbetween.*Season 01.*"
match.season = "1:2" # match either 1 or 2
type = "episode"
id.trakt_slug = "mr-inbetween"
season = 1
Does this rule apply to the given file? You can have two answers:
season = [1,2,3]
implies all three seasons are present in the file. So this match rule shouldn't apply.season = [1,2,3]
should imply any of the three seasons. Sure, but now the logic breaks down for multi-episode files (like double-episodes) which does include all the listed episodes
.To maintain consistency, we have to go with option 1, and that is also confusing for the end user.
Even after all this, I do feel it might be best to allow remap_rules
to work with raw input. Need to come up with a coherent design that subsumes include_regexes
and validations.
Describe the bug I'm playing this video file:
M:\tmp\Mr Inbetween S01-S03 1080p WEBRip DD5.1Ch HEVC 10Bit-Shieldearer\Season 01\Mr Inbetween - S01E01 - The Pee Pee Guy.mkv
Note that the filename contains all details necessary to properly scrobble this video. However, trakts returns this message:
Multiple probable seasons found: (1,2,3). Consider renaming the folder.
So I add the following remap rule:
Still, trakts returns:
Multiple probable seasons found: (1,2,3). Consider renaming the folder.
Renaming the folder is not an option.
Desktop (please complete the following information):
To Reproduce
Steps to reproduce the behavior:
Mr Inbetween S01-S03 1080p WEBRip DD5.1Ch HEVC 10Bit-Shieldearer
Season 01
Mr Inbetween - S01E01 - The Pee Pee Guy.mkv
in theSeason 01
folderremap_rules.toml
Log file
Click to see log contents
``` 2024-07-03 22:36:41,308 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2024-07-03 22:36:41,999 - INFO - MainThread - scrobbler - Started scrobbler thread. 2024-07-03 22:36:42,062 - DEBUG - MainThread - monitor - Autoloaded mpv ipc_path = \\.\pipe\mpvsocket 2024-07-03 22:36:42,062 - INFO - MainThread - monitor - Started monitor for mpv 2024-07-03 22:36:42,062 - INFO - mpv - mpv - Unable to connect to MPV. Check ipc path. 2024-07-03 22:36:42,062 - INFO - MainThread - monitor - Started monitor for mpc-be 2024-07-03 22:36:42,063 - INFO - MainThread - monitor - Started monitor for vlc 2024-07-03 22:36:44,108 - DEBUG - mpc-be - file_info - Raw filepath 'M:\\tmp\\Mr Inbetween S01-S03 1080p WEBRip DD5.1Ch HEVC 10Bit-Shieldearer\\Season 01\\Mr Inbetween - S01E01 - The Pee Pee Guy.mkv' 2024-07-03 22:36:44,108 - DEBUG - mpc-be - file_info - Matched whitelist entry 'M:\\tmp' 2024-07-03 22:36:44,249 - DEBUG - mpc-be - file_info - Guess: MatchesDict([('title', 'Mr Inbetween'), ('season', [1, 2, 3]), ('screen_size', '1080p'), ('source', 'Web'), ('other', 'Rip'), ('audio_codec', 'Dolby Digital'), ('audio_channels', '5.1'), ('video_codec', 'H.265'), ('video_profile', 'High Efficiency Video Coding'), ('color_depth', '10-bit'), ('episode_title', 'Shieldearer'), ('episode', 1), ('container', 'mkv'), ('mimetype', 'video/x-matroska'), ('type', 'episode')]) 2024-07-03 22:36:44,249 - WARNING - mpc-be - file_info - Multiple probable seasons found: (1,2,3). Consider renaming the folder. 2024-07-03 22:36:44,250 - ERROR - mpc-be - __init__ - Unhandled exception Traceback (most recent call last): File "C:\Program Files\Python311\Lib\threading.py", line 1045, in _bootstrap_inner self.run() File "C:\Users\DryGo\.local\pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\player_monitors\monitor.py", line 387, in run self.handle_status_update() File "C:\Users\DryGo\.local\pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\player_monitors\monitor.py", line 338, in handle_status_update current_state = self.parse_status(self.status) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DryGo\.local\pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\player_monitors\monitor.py", line 163, in parse_status media_info = get_media_info(status['filepath']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DryGo\.local\pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\file_info.py", line 130, in get_media_info guess = apply_remap_rules(file_path, guess) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DryGo\.local\pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\mediainfo_remap.py", line 284, in apply_remap_rules upd = rule.apply(path, media_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DryGo\.local\pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\mediainfo_remap.py", line 213, in apply match = self.match.match(path, media_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DryGo\.local\pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\mediainfo_remap.py", line 115, in match title = guess.get("title") ^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get' 2024-07-03 22:36:46,143 - INFO - vlc - monitor - Unable to connect to vlc. Ensure that the web interface is running. 2024-07-03 22:36:49,272 - ERROR - Thread-6 (_show_toast) - __init__ - Unhandled exception TypeError: WPARAM is simple, so must be an int object (got NoneType) ```