📄 setup.py
字号:
from distutils.core import setup, Extensionimport os# Get build variables (buildir, srcdir)try: top_builddir=os.environ['top_builddir']except KeyError: # Note: do not initialize here, so that we get # a correct default value if the env. var is # defined but empty top_builddir=Noneif not top_builddir: top_builddir = os.path.join( '..', '..' ) os.environ['top_builddir'] = top_builddirtry: srcdir=os.environ['srcdir']except KeyError: # Note: same as above srcdir=Noneif not srcdir: srcdir = '.'#if os.sys.platform in ('win32', 'darwin'): # Do not use PIC version on win32 and Mac OS Xif True: # PIC version seems to be disabled on all platforms vlclib=os.path.join( top_builddir, 'src', 'libvlc.a' ) picflag=''else: vlclib=os.path.join( top_builddir, 'src', 'libvlc_pic.a' ) picflag='pic'def get_vlcconfig(): vlcconfig=None for n in ( 'vlc-config', os.path.join( top_builddir, 'vlc-config' )): if os.path.exists(n): vlcconfig=n break if vlcconfig is None: print "*** Warning *** Cannot find vlc-config" elif os.sys.platform == 'win32': # Win32 does not know how to invoke the shell itself. vlcconfig="sh %s" % vlcconfig return vlcconfigdef get_vlc_version(): vlcconfig=get_vlcconfig() if vlcconfig is None: return "" else: version=os.popen('%s --version' % vlcconfig, 'r').readline().strip() return version def get_cflags(): vlcconfig=get_vlcconfig() if vlcconfig is None: return [] else: cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split() return cflagsdef get_ldflags(): vlcconfig=get_vlcconfig() if vlcconfig is None: return [] else: ldflags = [] if os.sys.platform == 'darwin': ldflags = "-read_only_relocs warning".split() ldflags.extend(os.popen('%s --libs vlc %s builtin' % (vlcconfig, picflag), 'r').readline().rstrip().split()) if os.sys.platform == 'darwin': ldflags.append('-lstdc++') return ldflags# To compile in a local vlc treevlclocal = Extension('vlc', sources = [ os.path.join( srcdir, 'vlcglue.c'), os.path.join( srcdir, '../../src/control/mediacontrol_init.c')], include_dirs = [ top_builddir, os.path.join( srcdir, '../../include'), os.path.join( srcdir, '../../', '/usr/win32/include') ], extra_objects = [ vlclib ], extra_compile_args = get_cflags(), extra_link_args = [ '-L' + top_builddir ] + get_ldflags(), )setup (name = 'MediaControl', version = get_vlc_version(), scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ], keywords = [ 'vlc', 'video' ], license = "GPL", description = """VLC bindings for python.This module provides a MediaControl object, which implements an APIinspired from the OMG Audio/Video Stream 1.0 specification. Moreover,the module provides a Object type, which gives a low-level access tothe vlc objects and their variables.Documentation can be found on the VLC wiki : http://wiki.videolan.org/index.php/PythonBindingExample session:import vlcmc=vlc.MediaControl(['--verbose', '1'])mc.playlist_add_item('movie.mpg')# Start the movie at 2000msp=vlc.Position()p.origin=vlc.RelativePositionp.key=vlc.MediaTimep.value=2000mc.start(p)# which could be abbreviated as# mc.start(2000)# for the default conversion from int is to make a RelativePosition in MediaTime# Display some text during 2000msmc.display_text('Some useless information', 0, 2000)# Pause the videomc.pause(0)# Get status informationmc.get_stream_information()# Access lowlevel objetso=vlc.Object(1)o.info()i=o.find_object('input')i.list()i.get('time') """, ext_modules = [ vlclocal ])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -