All Projects → HearthSim → Python Hsreplay

HearthSim / Python Hsreplay

Licence: mit
Python library for creating and parsing HSReplay XML files

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Hsreplay

Litedb Webshell
Web Shell console application for LiteDB
Stars: ✭ 8 (-81.4%)
Mutual labels:  xml
Phaserhearthstone
Learn Phaser Game Engine
Stars: ✭ 30 (-30.23%)
Mutual labels:  hearthstone
Xml
No longer maintained
Stars: ✭ 36 (-16.28%)
Mutual labels:  xml
Xml Js
Converter utility between XML text and Javascript object / JSON text.
Stars: ✭ 874 (+1932.56%)
Mutual labels:  xml
Yaidom
Yet another immutable XML DOM-like API
Stars: ✭ 27 (-37.21%)
Mutual labels:  xml
Wikiforia
A Utility Library for Wikipedia dumps
Stars: ✭ 31 (-27.91%)
Mutual labels:  xml
Essa
Embeddable SCADA for Small Applications
Stars: ✭ 7 (-83.72%)
Mutual labels:  xml
View shaper
A library to help create shaped views and layouts in Android
Stars: ✭ 42 (-2.33%)
Mutual labels:  xml
Evreflection
Reflection based (Dictionary, CKRecord, NSManagedObject, Realm, JSON and XML) object mapping with extensions for Alamofire and Moya with RxSwift or ReactiveSwift
Stars: ✭ 954 (+2118.6%)
Mutual labels:  xml
Xml
XML without worries
Stars: ✭ 35 (-18.6%)
Mutual labels:  xml
Supervisord
Async first supervisord HTTP API Client for PHP 7
Stars: ✭ 14 (-67.44%)
Mutual labels:  xml
Treefrog Framework
TreeFrog Framework : High-speed C++ MVC Framework for Web Application
Stars: ✭ 885 (+1958.14%)
Mutual labels:  xml
Xml2tex
one-off xml-to-latex-converter generator
Stars: ✭ 31 (-27.91%)
Mutual labels:  xml
Gulp Xslt
XSLT transformation plugin for gulp
Stars: ✭ 9 (-79.07%)
Mutual labels:  xml
Onthefly
🔗 Generate TinySVG, HTML and CSS on the fly
Stars: ✭ 37 (-13.95%)
Mutual labels:  xml
Xmlbuilder Js
An XML builder for node.js
Stars: ✭ 843 (+1860.47%)
Mutual labels:  xml
Texture
A visual editor for research.
Stars: ✭ 958 (+2127.91%)
Mutual labels:  xml
Node Prince
Node API for executing PrinceXML via prince(1) CLI
Stars: ✭ 42 (-2.33%)
Mutual labels:  xml
Xom
XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with Java that strives for correctness, simplicity, and performance, in that order.
Stars: ✭ 38 (-11.63%)
Mutual labels:  xml
Amateras Html Editor
Eclipse plugin for HTML/JSP/XML/JavaScript Editing
Stars: ✭ 34 (-20.93%)
Mutual labels:  xml

python-hsreplay

Build Status PyPI

A python module for HSReplay support.

https://hearthsim.info/hsreplay/

Installation

The library is available on PyPI. pip install hsreplay will install it.

Dependencies:

  • hearthstone
  • hslog
  • lxml (optional) for faster XML parsing and writing. Will use xml.etree if not available.
  • aniso8601 or dateutil for timestamp parsing

Usage

The main document class is hsreplay.document.HSReplayDocument. That class contains all the necessary functionality to import and export HSReplay files.

Reading/Writing HSReplay XML files

The classmethod from_xml_file(fp) takes a file-like object and will return a document. If you already have an ElementTree object, you can call the from_xml(xml) classmethod instead.

To export to an HSReplay XML document, the HSReplayDocument.toxml(pretty=False) method can be used to obtain a UTF8-encoded string containing the document.

Reading directly from a log file

The library integrates directly with the python-hearthstone library to produce HSReplayDocument objects directly from a log file or a parser instance.

Use the helper classmethods from_log_file(fp, processor="GameState", date=None, build=None) and from_parser(parser, build=None), respectively.

Exporting back to a PacketTree

It is possible to export HSReplayDocument objects back into a PacketTree with the to_packet_tree() method. This therefore allows lossless conversion from a PacketTree, into HSReplayDocument, then back into a PacketTree.

This is especially interesting because of the native functionality in python-hearthstone which is able to export to a Game tree and allows exploring the game state. By converting HSReplayDocument objects to a PacketTree, it's very easy to follow the replay at a gameplay level, explore the state of the various entities and even hook into the exporter in order to programmatically analyze it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].