Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 修改作用域以使用torrent streamer而不是默认客户端打开URI_Python_Ubuntu_Glib - Fatal编程技术网

Python 修改作用域以使用torrent streamer而不是默认客户端打开URI

Python 修改作用域以使用torrent streamer而不是默认客户端打开URI,python,ubuntu,glib,Python,Ubuntu,Glib,老实说,我不完全知道我在做什么,但我正试图让海盗湾范围开放其结果与Acestream播放器。问题之一是Acestream不知道如何处理磁性链接 下面的原始代码使用gvfs open以使用默认应用程序打开 def on_activate_uri(self、scope、uri): 如果uri.startswith(“更多”): 结果=self.scope.props.results\u模型 page=uri.split(“”“”)[2] search=uri.split(“”“”)[1] resul

老实说,我不完全知道我在做什么,但我正试图让海盗湾范围开放其结果与Acestream播放器。问题之一是Acestream不知道如何处理磁性链接

下面的原始代码使用
gvfs open
以使用默认应用程序打开

def on_activate_uri(self、scope、uri):
如果uri.startswith(“更多”):
结果=self.scope.props.results\u模型
page=uri.split(“”“”)[2]
search=uri.split(“”“”)[1]
results.remove(results.get_iter_at_行(results.get_n_行()-1))
self.update\u results\u模型(搜索、结果、页面)
返回Unity.ActivationResponse(handled=Unity.HandledType.SHOW\u DASH,goto\u uri=“”)
其他:
打印uri
GLib.spawn\u命令行\u异步('gvfs-open%s'%uri)
返回Unity.ActivationResponse(handled=Unity.HandledType.HIDE\u DASH,goto\u uri='')
我修改了一行,因此它是:

GLib.spawn命令行异步(“aria2c-d/path/.torrents--on download complete/path/.torrent.sh--bt metadata only=true--bt save metadata=true'%s'%uri) 我正在使用aria2c连接到磁链接并下载一个torrent文件,下载完文件后,aria2c运行一个bash脚本,用Acestream打开torrent文件。这个过程在命令行上运行良好。我猜我的语法错了

我可以看出,从作用域中选择torrent会运行aria2c并打开端口,但不会创建torrent文件,也不会执行我的脚本。奇怪的是,当我将
gnome-terminal-x
添加到命令行的前端时,它成功地创建了torrent文件,并且我的脚本打开Acestream一秒钟

非常感谢您的帮助


谢谢

最后,通过使用Popen拼写出我想要运行的每个命令,最终实现如下

其他:
打印uri
subprocess.Popen('rm/path/.torrents/*',shell=True)
subprocess.Popen('gnome-terminal-x aria2c--allow overwrite=true-d/path/.torrents--bt metadata only=true--bt save metadata=true\'%s\'%uri,shell=true)。等待()
torrent=subprocess.check_输出('ls/path/.torrents/*',shell=True).strip()
GLib.spawn\u命令行\u异步('acestreamplayer%s'%torrent)
返回Unity.ActivationResponse(handled=Unity.HandledType.HIDE\u DASH,goto\u uri='')
现在我只需要解析出成人的点击率。毕竟,这是为了家庭娱乐系统