【问题标题】:How to know that specific process is running in python?如何知道特定进程正在 python 中运行?
【发布时间】:2017-04-10 09:10:52
【问题描述】:

从网络摄像头收到警报后,我执行命令查看每个具有活动警报的摄像头的 15 秒实时流。 我的代码很简单:

if alarms:
#this is working and the cameras are displayed for 15 seconds
p=subprocess.Popen(["cvlc","rtsp://IP_ALARM:554","--run-time=15","--stop-time=15","vlc://quit"])

我只是想知道如何防止同一个摄像头多次显示。

如果我有来自同一摄像头的两个警报,则此摄像头将显示两次。在警报中,我有每个摄像机的索引。 谢谢。

【问题讨论】:

  • 你如何区分camaras,端口554?
  • 你好lapinkoira,在警报中,我为具有活动警报的摄像机提供索引。这是相机的IP。如果 index==1 则相机 IP=192.168.0.1 等
  • 我可以查看警报示例吗?如果警报是字典,它是如何工作的?

标签: python process subprocess


【解决方案1】:

为什么不给命令添加参数?

alarms = [{'ip': '192.168.0.1', 'offline': True}]
for alarm in alarms:
    if alarm['offline']:
        #this is working and the cameras are displayed for 15 seconds
        p=subprocess.Popen(["cvlc","rtsp://%s:554","--run-time=15","--stop-time=15","vlc://quit"] % alarm['ip'])

【讨论】:

    猜你喜欢
    • 2013-04-30
    • 2012-07-17
    • 2015-05-12
    • 1970-01-01
    • 2011-11-23
    • 1970-01-01
    • 2021-01-09
    • 2020-09-05
    • 1970-01-01
    相关资源
    最近更新 更多