-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
932 additions
and
2,220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
[](https://www.codefactor.io/repository/github/coulisse/spiderweb) | ||
|
||
|
||
- **Release:** v2.5.2 | ||
- **Release:** v2.5.3 | ||
- **Author:** Corrado Gerbaldo - [IU1BOW](https://www.qrz.com/db/IU1BOW) | ||
- **Mail:** <[email protected]> | ||
- **Licensing:** Gpl V3.0 see [LICENSE](LICENSE) file. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
}, | ||
"mycallsign":"XXXXXX", | ||
"mail":"[email protected]", | ||
"mail_token": "foobar", | ||
"enable_cq_filter":"n", | ||
"telnet": { | ||
"host": "mysite", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v2.5.2 | ||
v2.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
# find id in json : ie frequency / continent | ||
def find_id_json(json_object, name): | ||
return [obj for obj in json_object if obj["id"] == name][0] | ||
|
||
def query_build_callsign(logger,callsign): | ||
|
||
query_string = "" | ||
if len(callsign) <= 14: | ||
query_string = ( | ||
"(SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from spot WHERE spotter='" | ||
+ callsign | ||
+ "'" | ||
) | ||
query_string += " ORDER BY rowid desc limit 10)" | ||
query_string += " UNION " | ||
query_string += ( | ||
"(SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from spot WHERE spotcall='" | ||
+ callsign | ||
+ "'" | ||
) | ||
query_string += " ORDER BY rowid desc limit 10);" | ||
else: | ||
logger.warning("callsign too long") | ||
return query_string | ||
|
||
|
||
def query_build(logger,parameters,band_frequencies,modes_frequencies,continents_cq,enable_cq_filter): | ||
|
||
try: | ||
last_rowid = str(parameters["lr"]) # Last rowid fetched by front end | ||
|
||
get_param = lambda parameters, parm_name: parameters[parm_name] if (parm_name in parameters) else [] | ||
dxcalls=get_param(parameters, "dxcalls") | ||
band=get_param(parameters, "band") | ||
dere=get_param(parameters, "de_re") | ||
dxre=get_param(parameters, "dx_re") | ||
mode=get_param(parameters, "mode") | ||
exclft8=get_param(parameters, "exclft8") | ||
exclft4=get_param(parameters, "exclft4") | ||
|
||
decq = [] | ||
if "cqdeInput" in parameters: | ||
decq[0] = parameters["cqdeInput"] | ||
|
||
dxcq = [] | ||
if "cqdxInput" in parameters: | ||
dxcq[0] = parameters["cqdxInput"] | ||
|
||
query_string = "" | ||
|
||
#construct callsign of spot dx callsign | ||
dxcalls_qry_string = " AND spotcall IN (" + ''.join(map(lambda x: "'" + x + "'," if x != dxcalls[-1] else "'" + x + "'", dxcalls)) + ")" | ||
# construct band query decoding frequencies with json file | ||
band_qry_string = " AND ((" | ||
for i, item_band in enumerate(band): | ||
freq = find_id_json(band_frequencies["bands"], item_band) | ||
if i > 0: | ||
band_qry_string += ") OR (" | ||
|
||
band_qry_string += ( | ||
"freq BETWEEN " + str(freq["min"]) + " AND " + str(freq["max"]) | ||
) | ||
|
||
band_qry_string += "))" | ||
# construct mode query | ||
mode_qry_string = " AND ((" | ||
for i, item_mode in enumerate(mode): | ||
single_mode = find_id_json(modes_frequencies["modes"], item_mode) | ||
if i > 0: | ||
mode_qry_string += ") OR (" | ||
for j in range(len(single_mode["freq"])): | ||
if j > 0: | ||
mode_qry_string += ") OR (" | ||
mode_qry_string += ( | ||
"freq BETWEEN " | ||
+ str(single_mode["freq"][j]["min"]) | ||
+ " AND " | ||
+ str(single_mode["freq"][j]["max"]) | ||
) | ||
|
||
mode_qry_string += "))" | ||
|
||
#Exluding FT8 or FT4 connection | ||
ft8_qry_string = " AND (" | ||
if exclft8: | ||
ft8_qry_string += "(comment NOT LIKE '%FT8%')" | ||
single_mode = find_id_json(modes_frequencies["modes"], "digi-ft8") | ||
for j in range(len(single_mode["freq"])): | ||
ft8_qry_string += ( | ||
" AND (freq NOT BETWEEN " | ||
+ str(single_mode["freq"][j]["min"]) | ||
+ " AND " | ||
+ str(single_mode["freq"][j]["max"]) | ||
+ ")" | ||
) | ||
ft8_qry_string += ")" | ||
|
||
ft4_qry_string = " AND (" | ||
if exclft4: | ||
ft4_qry_string += "(comment NOT LIKE '%FT4%')" | ||
single_mode = find_id_json(modes_frequencies["modes"], "digi-ft4") | ||
for j in range(len(single_mode["freq"])): | ||
ft4_qry_string += ( | ||
" AND (freq NOT BETWEEN " | ||
+ str(single_mode["freq"][j]["min"]) | ||
+ " AND " | ||
+ str(single_mode["freq"][j]["max"]) | ||
+ ")" | ||
) | ||
ft4_qry_string += ")" | ||
|
||
# construct DE continent region query | ||
dere_qry_string = " AND spottercq IN (" | ||
for i, item_dere in enumerate(dere): | ||
continent = find_id_json(continents_cq["continents"], item_dere) | ||
if i > 0: | ||
dere_qry_string += "," | ||
dere_qry_string += str(continent["cq"]) | ||
dere_qry_string += ")" | ||
|
||
# construct DX continent region query | ||
dxre_qry_string = " AND spotcq IN (" | ||
for i, item_dxre in enumerate(dxre): | ||
continent = find_id_json(continents_cq["continents"], item_dxre) | ||
if i > 0: | ||
dxre_qry_string += "," | ||
dxre_qry_string += str(continent["cq"]) | ||
dxre_qry_string += ")" | ||
|
||
if enable_cq_filter == "Y": | ||
# construct de cq query | ||
decq_qry_string = "" | ||
if len(decq) == 1: | ||
if decq[0].isnumeric(): | ||
decq_qry_string = " AND spottercq =" + decq[0] | ||
# construct dx cq query | ||
dxcq_qry_string = "" | ||
if len(dxcq) == 1: | ||
if dxcq[0].isnumeric(): | ||
dxcq_qry_string = " AND spotcq =" + dxcq[0] | ||
|
||
if last_rowid is None: | ||
last_rowid = "0" | ||
if not last_rowid.isnumeric(): | ||
last_rowid = 0 | ||
|
||
query_string = "SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from spot WHERE rowid > "+(str(last_rowid)) | ||
|
||
|
||
if dxcalls: | ||
query_string += dxcalls_qry_string | ||
|
||
if len(band) > 0: | ||
query_string += band_qry_string | ||
|
||
if len(mode) > 0: | ||
query_string += mode_qry_string | ||
|
||
if exclft8: | ||
query_string += ft8_qry_string | ||
|
||
if exclft4: | ||
query_string += ft4_qry_string | ||
|
||
if len(dere) > 0: | ||
query_string += dere_qry_string | ||
|
||
if len(dxre) > 0: | ||
query_string += dxre_qry_string | ||
|
||
if enable_cq_filter == "Y": | ||
if len(decq_qry_string) > 0: | ||
query_string += decq_qry_string | ||
|
||
if len(dxcq_qry_string) > 0: | ||
query_string += dxcq_qry_string | ||
|
||
query_string += " ORDER BY rowid desc limit 50;" | ||
|
||
logger.debug (query_string) | ||
|
||
except Exception as e: | ||
logger.error(e) | ||
query_string = "" | ||
|
||
return query_string | ||
|
||
|
||
def query_build_callsing_list(): | ||
query_string = "SELECT spotcall AS dx FROM (select spotcall from spot order by rowid desc limit 50000) s1 GROUP BY spotcall ORDER BY count(spotcall) DESC, spotcall LIMIT 100;" | ||
return query_string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,41 @@ | ||
blinker==1.7.0 | ||
charset-normalizer==3.3.2 | ||
click==8.1.7 | ||
Flask==3.0.0 | ||
Flask-Minify==0.42 | ||
Flask-WTF==1.2.1 | ||
astroid==2.12.14 | ||
blinker==1.6.2 | ||
charset-normalizer==2.1.1 | ||
click==8.1.3 | ||
dill==0.3.6 | ||
docopt-ng==0.8.1 | ||
easywatch==0.0.5 | ||
Flask==2.3.3 | ||
Flask-Consent==0.0.3 | ||
Flask-Minify==0.41 | ||
Flask-WTF==1.1.1 | ||
htmlmin==0.1.12 | ||
idna==3.4 | ||
isort==5.11.4 | ||
itsdangerous==2.1.2 | ||
Jinja2==3.1.2 | ||
Jinja2==3.1.3 | ||
jsmin==3.0.1 | ||
lazy-object-proxy==1.9.0 | ||
lesscpy==0.15.1 | ||
MarkupSafe==2.1.3 | ||
markup==0.2 | ||
MarkupSafe==2.1.1 | ||
mccabe==0.7.0 | ||
mysql-connector-python>=8.2.0 | ||
numpy==1.26.1 | ||
pandas==2.1.3 | ||
numpy==1.24.1 | ||
pandas==1.5.2 | ||
platformdirs==2.6.2 | ||
ply==3.11 | ||
protobuf==4.21.12 | ||
python-dateutil==2.8.2 | ||
pytz==2023.3.post1 | ||
rcssmin==1.1.2 | ||
pytz==2022.7 | ||
rcssmin==1.1.1 | ||
requests==2.31.0 | ||
six==1.16.0 | ||
tzdata==2023.3 | ||
tomlkit==0.11.6 | ||
urllib3==2.0.7 | ||
Werkzeug==3.0.1 | ||
WTForms==3.1.1 | ||
watchdog==3.0.0 | ||
Werkzeug==2.3.8 | ||
wrapt==1.14.1 | ||
WTForms==3.0.1 | ||
xmltodict==0.13.0 | ||
xxhash==3.4.1 | ||
xxhash==3.1.0 |
Oops, something went wrong.