与acestream引擎和http api交互

acestream的Python项目详细描述


python acestream

与acestream引擎和http api交互的python接口。

安装

pip install acestream

用法

importosimporttimeimportsubprocessfromacestream.serverimportServerfromacestream.engineimportEnginefromacestream.streamimportStream# Create an engine instanceengine=Engine('acestreamengine',client_console=True)# Connect to a remote serverserver=Server(host='streams.com',port=6880)# If the remote server is not available, connect to a local serverifnotserver.available:server=Server(host='127.0.0.1',port=6878)# Start engine if the local server is not availableifnotserver.available:engine.start()# Wait for engine to startwhilenotengine.running:time.sleep(1)# Start a stream using an acestream channel IDstream=Stream(server,id='ff36fce40a7d2042e327eaf9f215a1e9cb622b56')stream.start()# Open a media player to play the streamplayer=subprocess.Popen(['mpv',stream.playback_url],preexec_fn=os.setsid)# Wait for player to close and stop the streamplayer.communicate()stream.stop()# Stop acestream engineengine.stop()

搜索

importosimporttimeimportrandomimportsubprocessfromacestream.serverimportServerfromacestream.engineimportEnginefromacestream.searchimportSearch# Create an engine instanceengine=Engine('acestreamengine',client_console=True)# Connect to a local serverserver=Server(host='127.0.0.1',port=6878)# Start engine if the local server is not availableifnotserver.available:engine.start(stdout=subprocess.PIPE,stderr=subprocess.PIPE)# Wait for engine to startwhilenotengine.running:time.sleep(1)# Start a search for the sport categorysearch=Search(server,category='sport')search.get(page=1)# Iterate and print search resultsforresultinsearch.results:print(result.name.ljust(40),str(result.bitrate).ljust(10),result.infohash)# Start a random stream from the search resultsstream=random.choice(search.results).streamstream.start()# Open a media player to play the streamplayer=subprocess.Popen(['mpv',stream.playback_url],preexec_fn=os.setsid)# Wait for player to close and stop the streamplayer.communicate()stream.stop()# Stop acestream engineengine.stop()

贡献

github上的https://github.com/jonian/python-acestream欢迎错误报告和请求拉取。

许可证

python acestream在GPLv3

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何加载。java文件到编译器?   java写入文件和I/O   java日历返回错误的当前日期安卓   if语句if变量等于1(java)   java很难让Joda有时间使用我的bukkit插件   json如何创建基于java的应用程序,该应用程序将从网站获取输入   java如何在多页中打印大型JPanel   java my spinner在添加从firebase数据库中选择的多个值时被覆盖   java用Play框架覆盖HTTP方法   试图获取所有用户时,java错误请求400。Dto和表格   java支持bean加载图像后javascript自动调用JS函数   java在MTOM的@StreamingAttachment(Metro)中,Parsely的意思是什么   具有可抢占线程队列的多线程java执行器   Java Opencv connectedComponentsWithStats   java如何向数组中添加2D数组的数目   eclipse为什么我的Java Zork克隆不能正确循环?   java在哪里放置定制的第二个web。xml   java如何更改最近应用列表中显示的快照?   java Browser#getText()返回空字符串