2013-02-19 00:11:43 +00:00
|
|
|
import hexagonitswfheader
|
2013-08-07 22:25:18 +00:00
|
|
|
import HydrusConstants as HC
|
2013-02-19 00:11:43 +00:00
|
|
|
import traceback
|
|
|
|
|
|
|
|
# to all out there who write libraries:
|
|
|
|
# hexagonit.swfheader is a perfect library. it is how you are supposed to do it.
|
2013-08-07 22:25:18 +00:00
|
|
|
def GetFlashProperties( path ):
|
2013-02-19 00:11:43 +00:00
|
|
|
|
2013-08-07 22:25:18 +00:00
|
|
|
with HC.o( path, 'rb' ) as f:
|
|
|
|
|
|
|
|
metadata = hexagonitswfheader.parse( f )
|
|
|
|
|
|
|
|
width = metadata[ 'width' ]
|
|
|
|
height = metadata[ 'height' ]
|
|
|
|
|
|
|
|
num_frames = metadata[ 'frames' ]
|
|
|
|
fps = metadata[ 'fps' ]
|
|
|
|
|
|
|
|
duration = ( 1000 * num_frames ) / fps
|
|
|
|
|
|
|
|
return ( ( width, height ), duration, num_frames )
|
|
|
|
|
2013-02-19 00:11:43 +00:00
|
|
|
|