mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-24 17:08:36 -05:00
scriptsapi: removed obsolete config.py -I option
This commit is contained in:
parent
e23b053ab2
commit
00c98fe455
@ -16,7 +16,6 @@ import requests, traceback, sys, json, time
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
base_url = "http://127.0.0.1:8091/sdrangel"
|
base_url = "http://127.0.0.1:8091/sdrangel"
|
||||||
app_gui = False
|
|
||||||
nb_devicesets = 0
|
nb_devicesets = 0
|
||||||
|
|
||||||
requests_methods = {
|
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("-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("-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("-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")
|
parser.add_option("-d", "--delay", dest="delay_ms", help="force delay after each command (ms)", metavar="TIME", type="int")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
@ -46,11 +44,9 @@ def getInputOptions():
|
|||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def get_instance_details():
|
def get_instance_details():
|
||||||
global app_gui
|
|
||||||
global nb_devicesets
|
global nb_devicesets
|
||||||
r = requests_methods["GET"](url=base_url)
|
r = requests_methods["GET"](url=base_url)
|
||||||
if r.status_code // 100 == 2:
|
if r.status_code // 100 == 2:
|
||||||
app_gui = r.json()["appname"] == "SDRangel"
|
|
||||||
nb_devicesets = r.json()["devicesetlist"]["devicesetcount"]
|
nb_devicesets = r.json()["devicesetlist"]["devicesetcount"]
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
@ -79,8 +75,6 @@ def main():
|
|||||||
if options.initialize:
|
if options.initialize:
|
||||||
initialize()
|
initialize()
|
||||||
|
|
||||||
nb_deviceset_posts = 0
|
|
||||||
|
|
||||||
with open(options.json_file) as json_file:
|
with open(options.json_file) as json_file:
|
||||||
commands = json.load(json_file)
|
commands = json.load(json_file)
|
||||||
for command in commands:
|
for command in commands:
|
||||||
@ -89,11 +83,6 @@ def main():
|
|||||||
continue
|
continue
|
||||||
url = base_url + endpoint
|
url = base_url + endpoint
|
||||||
http_method = command.get('method', None)
|
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
|
method = requests_methods.get(http_method, None) if http_method is not None else None
|
||||||
if method is not None:
|
if method is not None:
|
||||||
request_params = command.get('params', None)
|
request_params = command.get('params', None)
|
||||||
|
Loading…
Reference in New Issue
Block a user