Skip to content

Anitopy Parser crashes tracker on invalid episode number formats #843

Description

@Neelo16

Bug

While my anime library follows a consistent naming scheme to help with trackma's recognition, regular TV show episodes don't quite match it. Mr. Robot, in particular, has a specific format for its episode titles in the first few seasons: eps2.3_logic-b0mb.hc. This wouldn't be a problem, since trackma should just ignore these non-anime shows. However, when anitopy tries to parse this, it tries to parse the 2.3 as an int, doesn't catch this exception, and crashes the tracker, requiring an application restart in order for new episodes to be tracked.

Current Behavior

Example (in debug mode):

[D] Tracker (Plex): Guessing filename: Mr. Robot - S02E05 - eps2.3_logic-b0mb.hc Bluray-1080p.mkv
[D] Parser: Parsing Mr. Robot - Season 02 - 05 - eps2.3_logic-b0mb.hc Bluray-1080p.mkv
Neelo [anilist] (anime) watching >> Exception in thread Thread-1 (observe):
Traceback (most recent call last):
  File "/usr/lib/python3.14/threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib/python3.14/threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/trackma/tracker/plex.py", line 111, in observe
    (state, show_tuple) = self._get_playing_show(player[0])
                          ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/trackma/tracker/tracker.py", line 262, in _get_playing_show
    (show_title, show_ep) = (aie.getName(), aie.getEpisode())
                                            ~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/trackma/parser/anitopy.py", line 64, in getEpisode
    return int(self.episode_number)
ValueError: invalid literal for int() with base 10: '2.3'

Neelo [anilist] (anime) watching >> tracker
- Tracker status -
State: No video
Filename: Mr. Robot - S02E05 - eps2.3_logic-b0mb.hc Bluray-1080p.mkv
Timer: N/A
Show: N/A
Neelo [anilist] (anime) watching >>

After this point, cli commands work, but the tracker is no longer working. I've tested this with Plex, but as it's an issue in the parser itself, I expect the same to happen with other tracker types.

Expected behavior

[D] Tracker (Plex): Guessing filename: Mr. Robot - S02E05 - eps2.3_logic-b0mb.hc Bluray-1080p.mkv
[D] Parser: Parsing Mr. Robot - Season 02 - 05 - eps2.3_logic-b0mb.hc Bluray-1080p.mkv
[D] Tracker (Plex): Show guess: Mr. Robot Season 02: None - 2
Tracker (Plex) warning: Found player but show not in list.
Neelo [anilist] (anime) watching >> tracker
- Tracker status -
State: Not found
Filename: Mr. Robot - S02E05 - eps2.3_logic-b0mb.hc Bluray-1080p.mkv
Timer: N/A [P]
Show: N/A
[D] Tracker (Plex): Guessing filename: [Erai-raws] Akane-banashi S1 - 01 (S01E01) [WEBDL-1080p].mkv
[D] Parser: Parsing [Erai-raws] Akane-banashi S1 - 01 (Season 01 - 01) [WEBDL-1080p].mkv
[D] Tracker (Plex): Show guess: Akane-banashi: {'id': 196935, 'title': 'Akane-banashi', 'my_progress': 6, 'total': 0, 'type': None, 'titles': ['Akane-banashi', 'Akane-banashi', 'Akane-banashi', 'あかね噺', 'อาคาเนะ พลิกตำนานวงการราคุโ
กะ', 'Сказание об Аканэ']} - 1
Tracker (Plex) warning: Not playing the next episode of Akane-banashi (expected: 7, found: 1). Ignoring.
Neelo [anilist] (anime) watching >>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions