Support for local telemetry files
timbennett opened this issue · comments
I downloaded a few thousand telemetry files without using pubg-python, but then I wanted to use pubg-python to process them handily. So I added the following code into base.py:
11 import json
55 def telemetryStatic(self, telemetryJson):
56 data = json.loads(open(telemetryJson,"r").read())
57 return Telemetry(data, telemetryJson)
Now, this really doesn't follow the rest of the library's style, so I haven't submitted a pull request. But it allows me to do this, which is valuable to me:
static = "telemetry-files/c8228bc5-4f28-11e8-9fbb-0a5864768b15-telemetry.json"
telemetry = api.telemetryStatic(static)
From there, I can work with the file as if I'd requested it through the API. This saves requests and guards against PUBG deleting historical replays. I thought this might be useful to people trying to solve the same problem, or as inspiration for a future feature (e.g. a function to cache the JSON file when we API request it).
That's a pretty good idea.
I'll be adding it soon, thanks!
@timbennett It is going to be available on version 0.2.12
, i'll be uploading it in a few minutes.