1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-28 10:48:57 -05:00

scriptsapi: removed obsolete config.py -I option

This commit is contained in:
f4exb 2022-08-17 11:41:28 +02:00
parent e23b053ab2
commit 00c98fe455

View File

@ -16,7 +16,6 @@ import requests, traceback, sys, json, time
from optparse import OptionParser
base_url = "http://127.0.0.1:8091/sdrangel"
app_gui = False
nb_devicesets = 0
requests_methods = {
@ -34,7 +33,6 @@ def getInputOptions():
parser.add_option("-a", "--address", dest="address", help="Address and port. Default: 127.0.0.1:8091", metavar="ADDRESS", type="string")
parser.add_option("-j", "--json-file", dest="json_file", help="JSON file containing commands. Mandatory", metavar="FILE", type="string")
parser.add_option("-i", "--init", dest="initialize", help="Initialize instance before running script", action="store_true")
parser.add_option("-1", "--ignore-first-posts", dest="ignore_first_posts", help="Ignore first deviceset post in sequence", action="store_true")
parser.add_option("-d", "--delay", dest="delay_ms", help="force delay after each command (ms)", metavar="TIME", type="int")
(options, args) = parser.parse_args()
@ -46,11 +44,9 @@ def getInputOptions():
# ======================================================================
def get_instance_details():
global app_gui
global nb_devicesets
r = requests_methods["GET"](url=base_url)
if r.status_code // 100 == 2:
app_gui = r.json()["appname"] == "SDRangel"
nb_devicesets = r.json()["devicesetlist"]["devicesetcount"]
# ======================================================================
@ -79,8 +75,6 @@ def main():
if options.initialize:
initialize()
nb_deviceset_posts = 0
with open(options.json_file) as json_file:
commands = json.load(json_file)
for command in commands:
@ -89,11 +83,6 @@ def main():
continue
url = base_url + endpoint
http_method = command.get('method', None)
if endpoint == "/deviceset" and http_method == "POST":
nb_deviceset_posts += 1
if nb_deviceset_posts == 1 and options.ignore_first_posts:
print("First deviceset creation ignored")
continue
method = requests_methods.get(http_method, None) if http_method is not None else None
if method is not None:
request_params = command.get('params', None)