Skip to main content

IL-2 FB Game Log Parser

pypi_package Supported versions of Python license

unix_build Build status of the master branch on Windows Test coverage

Codacy Code Review Scrutinizer Code Quality Code Health Requirements Status

Table of contents

Synopsis

This is a Python library which parses events from game log produced by dedicated server of «IL-2 Forgotten Battles» flight simulator. Resulting information about events is stored in special data structures.

Demo

You may see this library in action even if you do not understand its purpose.

All you need is just to visit project’s demo page.

That page allows you to test parser’s ability to process strings. If you do not know what to enter into a text area, you may click Insert test data and parse it.

If something goes wrong, you will be prompted to confirm automatic creation of bug report which will be listed on this page.

Known events

This library supports all known events produced by dedicated server (129 unique events).

To see their list, go to the demo page and click See the list of supported events link.

Installation

Get Python package from PyPI:

pip install il2fb-game-log-parser

Usage

If you need to be able to parse all events this library knows about, use GameLogEventParser.parse_string():

Import GameLogEventParser and create its instance:

from il2fb.parsers.game_log import GameLogEventParser

parser = GameLogEventParser()

Parse a string to get an instance of event:

event = parser.parse("[8:33:05 PM] User0 has connected")

Explore event’s internal structure:

print(event)
# <Event: HumanHasConnected>

print(event.time)
# datetime.time(20, 33, 5)

print(event.actor)
# <Human 'User0'>

print(event.actor.callsign)
# User0

Convert event into a dictionary:

import pprint

pprint.pprint(event.to_primitive())
# {'actor': {'callsign': 'User0'},
#  'name': 'HumanHasConnected',
#  'time': '20:33:05',
#  'verbose_name': 'Human has connected'}

Exceptions

If you try to parse unknown event, EventParsingException will be raised:

parser.parse("foo bar")
# Traceback (most recent call last):
# …
# EventParsingException: No event was found for string "foo bar"

Current list of supported events is rather full, but EventParsingException is quite possible, because server’s events are undocumented and this library may do not know about all of them.

In case you need to catch this error, its full name is il2fb.commons.events.EventParsingException.

Safe usage

You can set flag ignore_errors=True if you don’t care about any exceptions:

from il2fb.parsers.game_log import GameLogEventParser

parser = GameLogEventParser()
event = parser.parse("foo bar", ignore_errors=True)
print(event is None)
# True

Any error (except SystemExit and KeyboardInterrupt) will be muted and None will be returned.

Metadata

Release files for il2fb-game-log-parser 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for il2fb-game-log-parser 1.0.3
File Size Uploaded
il2fb-game-log-parser-1.0.3.tar.gz 22.6 kB Details

Release files / il2fb-game-log-parser-1.0.3.tar.gz

Download URL il2fb-game-log-parser-1.0.3.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
be88be7c2f1277994e5c3ec7fc146932c50734b8ff78dfd73974e06af60cde32
BLAKE2b-256 checksum
How to use checksums
605b9d3bd971c9644b7011dbbe9f9541b808c246ee50af5d9317308a66829356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file

1.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page