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

[ManiaPlanet4] Replay Issue #3

Open
w1lla opened this issue Mar 11, 2021 · 3 comments
Open

[ManiaPlanet4] Replay Issue #3

w1lla opened this issue Mar 11, 2021 · 3 comments

Comments

@w1lla
Copy link

w1lla commented Mar 11, 2021

Some issue with reading ManiaPlanet 4 Replays, Its in the gbx.py as it has no full support for all .Gbx Files it seems?

Processing:     Old fashioned tech - 026_da¢SP´Niwes(00'22''05).Replay.Gbx
ERROR:root:unpack requires a buffer of 4 bytes
ERROR:root:unpack requires a buffer of 4 bytes
ERROR:root:unpack requires a buffer of 4 bytes
ERROR:root:unpack requires a buffer of 4 bytes
ERROR:root:Failed to read string: 'utf-8' codec can't decode byte 0x90 in position 1: invalid start byte
ERROR:root:unpack requires a buffer of 16777216 bytes
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "c:\users\w1lla\appdata\local\programs\python\python38\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "c:\users\w1lla\appdata\local\programs\python\python38\lib\multiprocessing\pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "C:\tmn\pyplanet\tmtrackNN\preprocessing.py", line 99, in process_fname
    replay_file = Gbx(fname)
  File "C:\tmn\pyplanet\tmtrackNN\tmnnenv\lib\site-packages\pygbx\gbx.py", line 136, in __init__
    self._read_node(self.class_id, -1, bp)
  File "C:\tmn\pyplanet\tmtrackNN\tmnnenv\lib\site-packages\pygbx\gbx.py", line 590, in _read_node
    game_class.track = Gbx(data)
  File "C:\tmn\pyplanet\tmtrackNN\tmnnenv\lib\site-packages\pygbx\gbx.py", line 136, in __init__
    self._read_node(self.class_id, -1, bp)
  File "C:\tmn\pyplanet\tmtrackNN\tmnnenv\lib\site-packages\pygbx\gbx.py", line 431, in _read_node
    block.name = bp.read_string_lookback()
  File "C:\tmn\pyplanet\tmtrackNN\tmnnenv\lib\site-packages\pygbx\bytereader.py", line 212, in read_string_lookback
    s = self.read_string()
  File "C:\tmn\pyplanet\tmtrackNN\tmnnenv\lib\site-packages\pygbx\bytereader.py", line 167, in read_string
    return self.read(strlen, str(strlen) + 's').decode('utf-8')
AttributeError: 'int' object has no attribute 'decode'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "preprocessing.py", line 143, in <module>
    entries = p.starmap(process_fname, it)
  File "c:\users\w1lla\appdata\local\programs\python\python38\lib\multiprocessing\pool.py", line 372, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "c:\users\w1lla\appdata\local\programs\python\python38\lib\multiprocessing\pool.py", line 768, in get
    raise self._value
AttributeError: 'int' object has no attribute 'decode'
```

@donadigo
Copy link
Owner

Nope, the lib has mostly support for TMNF/TMUF files. Anything up MP4, 2020 doesn't work. It's entirely possible to add support for these though, there's other parsers like Gbx NET and ManiaPlanetSharp which successfully parse these.

@w1lla
Copy link
Author

w1lla commented Mar 11, 2021

Okay, well as anything up ManiaPlanet is also TrackMania in a way and parsing replays from other parsers is a bit worry some as you can't get data from it. Its because the way Replay/Map files are written has changed some bit.

https://github.com/PyPlanet/PyPlanet/blob/c491a9265c53a47c3bd2867537003bf59c9a0357/pyplanet/utils/gbxparser.py GBX Parser for python in a way that works for TM2020 and also Maniaplanet4.

@donadigo
Copy link
Owner

I didn't know about that parser, that'll definitely be useful. TMTrackNN is quite special in that it needs all replay and all map data to be available, but I think fixing the current parser to work for new titles is managable with some deeper work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants