swf元数据分析器
hexagonit.swfheader的Python项目详细描述
hexagonit.swfheader包提供单个函数- parse–能够解析swf(flash)中的元数据 动画)文件。主要用例是询问 帮助将文件嵌入HTML页面的SWF文件。
内容
Usage
使用解析器非常简单,只需调用 hexagonit.swfheader.parse函数并用 文件系统路径或类似文件的对象。
>>> import hexagonit.swfheader >>> metadata = hexagonit.swfheader.parse(TEST_SWF) >>> pprint(metadata) {'compressed': False, 'fps': 12, 'frames': 1, 'height': 400, 'size': 153, 'version': 5, 'width': 550, 'xmax': 550, 'xmin': 0, 'ymax': 400, 'ymin': 0}
函数parse返回包含 以下项目:
version (int)
The version of the Flash format, e.g. 7.
compressed (bool)
^{tt7}$, if the contents of the file are compressed using zlib compression, ^{tt8}$ otherwise.
size (int)
Byte size of the (uncompressed) contents of the SWF file.
xmin (int)
The lesser x-coordinate of the bounding rectangle of the contents.
xmax (int)
The greater x-coordinate of the bounding rectangle of the contents.
ymin (int)
The lesser y-coordinate of the bounding rectangle of the contents.
ymax (int)
The greater y-coordinate of the bounding rectangle of the contents.
width (int)
The width of the SWF file in pixels.
height (int)
The height of the SWF file in pixels.
frames (int)
The number of frames in the SWF file.
fps (int)
Frames per second.
Command line
与setuptools一起安装时,将放置名为swfheader的脚本 在您的bin目录中,可以使用它轻松地内省swf文件 在文件系统上:
$ swfheader some_file.swf SWF header ---------- Version: 7 Compression: False Dimensions: 1105 x 1629 Bounding box: (0, 1105, 0, 1629) Frames: 64 FPS: 1
Change history
1.2 (2012-07-18)
- Only close file handles explicitly opened by the parser itself. Fixes an issue where file handles that were passed in as parameters were prematurely closed. See https://github.com/dokai/hexagonit-swfheader/pull/1 [aleksandr-rakov]
1.1 (2010-05-08)
- Fixed a bug with parsing the “fps” and “frames” fields. The order of the fields were reversed and additionally the “fps” field was parsed incorrectly. Bug reported by Valeriy Zmiyevskoy. [dokai]
1.0.1 (2008-04-29)
- Refacted a reversed() call to make the package Python 2.3 compatible.
1.0 (2008-04-16)
- First public release [dokai]