From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3E75B45C4D for ; Wed, 29 Mar 2023 04:06:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 430ED68C1B4; Wed, 29 Mar 2023 07:06:51 +0300 (EEST) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 87C3C68C1DB for ; Wed, 29 Mar 2023 07:06:44 +0300 (EEST) Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7458c36b699so18122785a.0 for ; Tue, 28 Mar 2023 21:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680062802; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=DsD69brsKg7OCucKIjXTzPhl4+sO/K3UBNDgljZ4Kz8=; b=CPQFHd84ZNmkNn7C69BOono9gOrOqIzX6oDhnP/nQkDV853DHH+XRVo9Psdrg+Uks4 AQK4Txtb97+tisMzgQENNlwKQ51OUURavgOzZZkFhXmQQy/KlQt8UtgPiuVb61e3n9Jt 3wEnEA2uKJwmVYUAxPvUFk0XUOMj9/fET9/bry+Dw6yZ68G7GW3tjO6keAXtdP4W7Qq+ DNo6A0MEz766gb/BNTE2HeZ6x27TL8Jd17YO1RGP1k3p+oAc5kglFIOSWcRV0PSrkCwo I/8XE0skyk7aApG7TZf0Fg8NueiFhr2E9OVM3tXIU8Ui7U0G23zCl39fTe5STUHgSl3H SbsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680062802; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DsD69brsKg7OCucKIjXTzPhl4+sO/K3UBNDgljZ4Kz8=; b=RdqJpXThiK4kJD2QUlutN/cfCHSgv9Yf0JAhTdlQh8kispzsnJaUdl8iXB+MGTGnrK 7Q8erREPl6LL3oREM8mfStgjc5ZnSMPFTSw/A4ktBxrliZJeUvs0uVm3La919SQ8bgPU z7kZgBe6g9OcyKyCZpnVVj9kW9Y7YwHax9i6ET67T+R33/zi2Eo7jUgOBvn9UsVWa5Ir bN2c+2bDbAYgjFByGfFpEpmtI5R/iAC/BJfJH5kUyq88seEr0BwvWSXeqkmbHpDNXIpN 01ytWYJUtrmX/DYouOP+PoBcdEUIqXXwqfhTinNmPMlUtN36Kn2d3Gz8ptWhjteWJqVL Tjew== X-Gm-Message-State: AO0yUKViMGjb1tl6noXt69v2xWDNiR425hQU3cLHmWVUsMMp0ZAi+Lue gvrCue5uqjKS1A2UdswQ1+jlDqinjqeOUQ== X-Google-Smtp-Source: AK7set9b7I5YZzvmAzGh81EKQTaUrNq/oApM7x4oNf+AeVLfrMnk9gPIr5uAk2W+tKmMAd6E2RDg1w== X-Received: by 2002:ac8:7f82:0:b0:3bf:da3a:4e0f with SMTP id z2-20020ac87f82000000b003bfda3a4e0fmr22912579qtj.0.1680062802013; Tue, 28 Mar 2023 21:06:42 -0700 (PDT) Received: from [192.168.1.35] (c-98-224-219-15.hsd1.mi.comcast.net. [98.224.219.15]) by smtp.gmail.com with ESMTPSA id d184-20020a3768c1000000b0074688c36facsm12765601qkc.56.2023.03.28.21.06.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Mar 2023 21:06:41 -0700 (PDT) Message-ID: <12987507-17a9-d037-b196-223e0845b351@gmail.com> Date: Wed, 29 Mar 2023 00:06:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 To: ffmpeg-devel@ffmpeg.org References: <20230326213459.90011-1-stefasab@gmail.com> Content-Language: en-US-large From: Leo Izen In-Reply-To: <20230326213459.90011-1-stefasab@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] tools/zmqshell: port to python3 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 3/26/23 17:34, Stefano Sabatini wrote: > Also extend docs, use argparse and logging. > --- > tools/zmqshell.py | 63 ++++++++++++++++++++++++++++++++++++++--------- > 1 file changed, 52 insertions(+), 11 deletions(-) > > diff --git a/tools/zmqshell.py b/tools/zmqshell.py > index a7d1126006..8d941636e1 100755 > --- a/tools/zmqshell.py > +++ b/tools/zmqshell.py > @@ -1,6 +1,32 @@ > -#!/usr/bin/env python2 > +#!/usr/bin/env python3 > + > +import argparse > +import cmd > +import logging > +import sys > +import zmq > + > +HELP = ''' > +Provide a shell used to send interactive commands to a zmq filter. > + > +The command assumes there is a running zmq or azmq filter acting as a > +ZMQ server. > + > +You can send a command to it, follwing the syntax: > +TARGET COMMAND [COMMAND_ARGS] > + > +* TARGET is the target filter identifier to send the command to > +* COMMAND is the name of the command sent to the filter > +* COMMAND_ARGS is the optional specification of command arguments > + > +See the zmq/azmq filters documentation for more details, and the > +zeromq documentation at: > +https://zeromq.org/ > +''' > + > +logging.basicConfig(format='zmqshell|%(levelname)s> %(message)s', level=logging.INFO) > +log = logging.getLogger() > > -import sys, zmq, cmd > > class LavfiCmd(cmd.Cmd): > prompt = 'lavfi> ' > @@ -14,13 +40,28 @@ class LavfiCmd(cmd.Cmd): > def onecmd(self, cmd): > if cmd == 'EOF': > sys.exit(0) > - print 'Sending command:[%s]' % cmd > - self.requester.send(cmd) > - message = self.requester.recv() > - print 'Received reply:[%s]' % message > - > -try: > - bind_address = sys.argv[1] if len(sys.argv) > 1 else "tcp://localhost:5555" > - LavfiCmd(bind_address).cmdloop('FFmpeg libavfilter interactive shell') > -except KeyboardInterrupt: > + log.info(f"Sending command: {cmd}") > + self.requester.send_string(cmd) > + response = self.requester.recv_string() > + log.info(f"Received response: {response}") > + > + > +class Formatter( > + argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter > +): > pass > + > + > +def main(): > + parser = argparse.ArgumentParser(description=HELP, formatter_class=Formatter) > + parser.add_argument('--bind-address', '-b', default='tcp://localhost:5555', help='specify bind address used to communicate with ZMQ') > + This changes the interface to use `--bind-address` instead of just passing the address directly as argv[1]. Does this have the potential to break anything downstream? Or do we make no promises about this interface? - Leo Izen (thebombzen) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".