kelesi / mtga-utils

Magic the Gathering: Arena related stuff (Card collection export)
MIT License
53 stars 13 forks source link

Log file format broken by latest MTGA update #33

Open pak21 opened 2 years ago

pak21 commented 2 years ago

Wizards broke the file format parsing again :-(

$ ProgramFiles=/mnt/windows/Program\ Files/ ./import-collection.py 
Traceback (most recent call last):
  File "/home/philip/mtga/mtga-utils/mtga_log.py", line 107, in get_last_json_block
    return self._list_to_json(block)
  File "/home/philip/mtga/mtga-utils/mtga_log.py", line 114, in _list_to_json
    return json.loads(json_string)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/philip/mtga/mtga-utils/./import-collection.py", line 24, in <module>
    main()
  File "/home/philip/mtga/mtga-utils/./import-collection.py", line 16, in main
    for mtga_id, card, count in log.get_collection():
  File "/home/philip/mtga/mtga-utils/mtga_log.py", line 145, in get_collection
    collection = self.get_last_json_block('<== ' + MTGA_COLLECTION_KEYWORD)
  File "/home/philip/mtga/mtga-utils/mtga_log.py", line 109, in get_last_json_block
    raise MtgaLogParsingError(exception)
mtga_log.MtgaLogParsingError: Expecting value: line 1 column 1 (char 0)

I will investigate, but due to Real Life I won't have a chance to look at it properly until Monday 2021-08-30. This has broken a number of the trackers as well, so it's not just us...

kelesi commented 2 years ago

Seems like whole PlayerInventory section is gone from the log. So far we cannot do much until an equivallent is being logged by Arena. https://feedback.wizards.com/forums/918667-mtg-arena-bugs-product-suggestions/suggestions/44050746-broken-logs-in-2021-8-0-3855

pak21 commented 2 years ago

Yeah, that was my initial conclusion after looking at the log files I had last night - I hoped I was missing something but apparently not :-(

I think I can reconstruct some of the functionality (e.g. the getInventory call for vault progress) but it looks like the collection call is gone for now which is the thing I think we want the most...

pak21 commented 2 years ago

Small progress update: I haven't made any real progress on log file parsing, but have updated my fork of python-mtga to handle the changes in the latest Arena update (Wizards made a bunch of previously mandatory fields optional so we couldn't load the card database...)

zyll71 commented 2 years ago

Has there been any progress or did the change break this project?

pak21 commented 2 years ago

I've looked at it, but don't believe the inventory is in the log :-( so yes, this does fundamentally break this major part of the project.

AetherHub do manage to get the inventory somehow, but I don't know how they do it.

kelesi commented 2 years ago

@pak21 Untapped.gg seems to also get the card inventory somehow. I wonder how they do it.

lanmaster53 commented 1 year ago

Any progress on this?

pak21 commented 1 year ago

@lanmaster53 Not from me I'm afraid, I've stopped playing Arena so this isn't on my priority list any more.

lanmaster53 commented 1 year ago

@lanmaster53 Not from me I'm afraid, I've stopped playing Arena so this isn't on my priority list any more.

If you've got any notes on what you've done to this point, I don't mind digging some more. All of the other agents are doing it somehow. They must be using a different log. I cannot find any evidence of collection cards in that log.