Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install hexagonit.swfheader

How to install hexagonit.swfheader

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install hexagonit.swfheader
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.1
1.2Never BuiltWhy not?
1.1 Available View build log
1.0.1 Available View build log
Windows (64-bit)
1.1
1.2Never BuiltWhy not?
1.1 Available View build log
1.0.1 Available View build log
Mac OS X (10.5+)
1.1
1.2Never BuiltWhy not?
1.1 Available View build log
1.0.1 Available View build log
Linux (32-bit)
1.2 Available View build log
1.1 Available View build log
1.0.1 Available View build log
Linux (64-bit)
1.2 Available View build log
1.1 Available View build log
1.0.1 Available View build log
 
License
GPL
Dependencies
Lastest release
version 1.2 on Nov 30th, 2012

The hexagonit.swfheader package provides a single function -- parse -- that is able to parse the metadata in a SWF (Flash animation) file. The main use case is to interrogate the dimensions of a SWF file to help in embedding the file in a HTML page.

Usage

Using the parser is very simple, simply call the hexagonit.swfheader.parse function and call it with either a filesystem path or a file-like object.

>>> 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}

The parse function returns a dictionary that contains the following items:

version (int)

The version of the Flash format, e.g. 7.

compressed (bool)

True, if the contents of the file are compressed using zlib compression, False 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

When installed with setuptools a script named swfheader is placed in your bin directory which can be used to easily introspect SWF files on the filesystem:

$ 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)
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]

Subscribe to package updates

Last updated Nov 30th, 2012

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.