fixed returning 0 systems in dense areas by specifying weight on edsm api call

This commit is contained in:
TanguyPcFixe 2024-05-31 21:20:38 +02:00
parent 479854809d
commit dbe371f024

View File

@ -8,16 +8,17 @@ import sys
#IMPORTANT BITS #IMPORTANT BITS
###This is the name of the sector you want to search into (Do not use caps!) ###This is the name of the sector you want to search into (Do not use caps!)
sectorName = "Phoi Auwsy" sectorName = "Stuemeae"
### "weights" to query, beware of big results when searching for lighter systems in more dense area ### "weights" to query, beware of big results when searching for lighter systems in more dense area
weightsToQuery = ["f","g","h"] #weightsToQuery = ["f","g","h"]
weightsToQuery = ["d"]
### postFix List, modify as needed ### postFix List, modify as needed
postFixList =["AA-A","BA-A","CL-Y","DL-Y","EG-Y","FG-Y","YE-A","ZE-A"] #postFixList =["AA-A","BA-A","CL-Y","DL-Y","EG-Y","FG-Y","YE-A","ZE-A"]
#postFixList =["WP-X"] postFixList =["FG-Y"]
@ -32,7 +33,7 @@ def fetchEdsmSystems(sectorName, postFix, weight):
hasMultipleHyphens = False hasMultipleHyphens = False
systemList = [] systemList = []
pattern = re.compile(f".*{postFix} {weight}.*") pattern = re.compile(f".*{postFix} {weight}.*")
for system in json.loads(apiCall(sectorName +" "+postFix).content): for system in json.loads(apiCall(sectorName +" "+postFix+" "+weight).content):
if pattern.match(system['name']): if pattern.match(system['name']):
systemList.append(system['name']) systemList.append(system['name'])
hasMultipleHyphens = system['name'].count("-") > 1 # if at least one of those has multiple hyphens, we consider all of them do hasMultipleHyphens = system['name'].count("-") > 1 # if at least one of those has multiple hyphens, we consider all of them do