Amarok 1.4 脚本:知道谁在运行你
我已经使用 Amarok 1.4 很长时间了,当 KDE 停止支持它时,我切换到 Bogdan Butnaru 的软件包,现在我正在尝试 Pana。
我意识到我用 Python 为 Amarok 1.4 编写的脚本在 Pana 下如果不进行更改就不会立即运行。但不是转换我的脚本,这基本上可以归结为替换“amarok” “如果我使用的路径中包含“pana”,我宁愿使其与原始 Amarok 1.4 和 Pana 兼容,这样我就可以只分发该脚本的单个版本(并且可能会在以后修改它,如果其他叉子变得流行)。
那么,有没有一种(Python(ic))方法可以让我的脚本从播放器内部运行来找出哪个程序启动了它?
I've been using Amarok 1.4 for a long time, switching to Bogdan Butnaru's packages when KDE stopped supporting it, and I'm now giving Pana a try.
I realised that a script I wrote in Python for Amarok 1.4 will not immediately run without changes under Pana. But instead of converting my script, which basically comes down to replacing "amarok" with "pana" in the paths I use, I'd rather make it compatible with both the original Amarok 1.4 and Pana, so that I could be able to distribute only a single version of that script (and possibly modifying it later if other forks become popular).
So, is there a (Python(ic)) way for my script, running from within the player, to find out which program launched it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您正在运行 Linux。不确定这里是否需要 getppid() 还是 getpid()。
也许不那么Pythonic。
Assuming you are running Linux. Not sure if you need getppid() or getpid() here.
Not so pythonic maybe.