forked from wulczer/flvlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·129 lines (101 loc) · 4.07 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/python
"""flvlib
======
A library for manipulating, parsing and verifying FLV files.
It includes three example scripts, debug-flv, index-flv and retimestamp-flv
which demonstrate the possible applications of the library.
Provides an easy and extensible way of writing applications that parse
and transforming FLV files. Checks file correctness based on the
official specification released by Adobe.
Can be used as a drop-in replacement for FLVTool2, from which it is
typically much faster. Unlike FLVTool2 it works on audio-only files and
does not overwrite any previous metadata the file might have.
Example usage
-------------
**Printing FLV file information**
::
$ debug-flv file.flv | head -5
=== `file.flv' ===
#00001 <AudioTag at offset 0x0000000D, time 0, size 162, MP3>
#00002 <AudioTag at offset 0x000000BE, time 0, size 105, MP3>
#00003 <VideoTag at offset 0x00000136, time 0, size 33903, VP6 (keyframe)>
#00004 <AudioTag at offset 0x000085B4, time 26, size 105, MP3>
**Indexing and FLV file**
::
$ index-flv -U file.flv
$ debug-flv --metadata file.flv
=== `file.flv' ===
#00001 <ScriptTag onMetaData at offset 0x0000000D, time 0, size 259>
{'duration': 9.979000000000001,
'keyframes': {'filepositions': [407.0], 'times': [0.0]},
'metadatacreator': 'flvlib 0.x.x'}
**Retimestamping an FLV file**
::
$ debug-flv file.flv | head -5
=== `file.flv' ===
#00001 <AudioTag at offset 0x0000000D, time 100, size 162, MP3>
#00002 <AudioTag at offset 0x000000BE, time 100, size 105, MP3>
#00003 <VideoTag at offset 0x00000136, time 100, size 33903, VP6 (keyframe)>
#00004 <AudioTag at offset 0x000085B4, time 126, size 105, MP3>
$ retimestamp-flv -U file.flv
$ debug-flv file.flv | head -5
=== `file.flv' ===
#00001 <AudioTag at offset 0x0000000D, time 0, size 162, MP3>
#00002 <AudioTag at offset 0x000000BE, time 0, size 105, MP3>
#00003 <VideoTag at offset 0x00000136, time 0, size 33903, VP6 (keyframe)>
#00004 <AudioTag at offset 0x000085B4, time 26, size 105, MP3>
"""
import os
import sys
from distutils.core import setup, Command
# Make sure we import flvlib from the current directory, not some
# version that could have been installed earlier on the system
curdir = sys.path[0]
sys.path.insert(0, os.path.join(curdir, 'lib'))
from flvlib import __versionstr__
# Revert sys.path to the previous state
sys.path = sys.path[1:]
# Don't install man pages and the README on a non-Linux system
if sys.platform == 'linux2':
data_files = [('share/man/man1', ['man/debug-flv.1', 'man/index-flv.1',
'man/retimestamp-flv.1'])]
else:
data_files = []
# Define a `test' command to automatically run tests
class test(Command):
description = "run the automated test suite"
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
from test.test_flvlib import main
main()
setup(name="flvlib",
version=__versionstr__,
description="Parsing, manipulating and indexing FLV files",
long_description=__doc__,
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Multimedia",
"Topic :: Software Development :: Libraries :: Python Modules",
],
platforms=["any"],
license="MIT",
author="Jan Urbanski",
maintainer="Jan Urbanski",
author_email="[email protected]",
maintainer_email="[email protected]",
url="http://wulczer.org/flvlib/",
download_url="http://wulczer.org/flvlib/flvlib-latest.tar.bz2",
package_dir={'': 'lib'},
packages=["flvlib", "flvlib.scripts"],
scripts=["scripts/debug-flv", "scripts/index-flv",
"scripts/retimestamp-flv"],
data_files=data_files,
cmdclass={'test': test})