Last active
September 6, 2021 07:35
-
-
Save Bastilms/71d5c6c920de99880d19cef3b59486ae to your computer and use it in GitHub Desktop.
KWGT widget that shows the amount of toilet paper which is available at your next dm drugstore
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
##KUSTOMCLIP## | |
{ | |
"clip_version": 1, | |
"KUSTOM_GLOBAL": { | |
"url": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "url", | |
"value": "https://products.dm.de/store-availability/DE/availability?dans\u003d595420,708997,137425,28171,485698,799358,863567,452740,610544,846857,709006,452753,879536,452744,485695,853483,594080,504606,593761,525943,842480,535981,127048,524535\u0026storeNumbers\u003d$gv(storeID)$", | |
"key": "url" | |
}, | |
"storeid": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "storeID", | |
"value": "2820", | |
"key": "storeid" | |
}, | |
"anzahl": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "anzahl", | |
"value": "$sh(\"curl -s \u0027\"+gv(url)+\"\u0027 | tr \u0027,\u0027 \u0027\\n\u0027 | grep stockLevel | tr -d [:alpha:] | cut -d: -f2 | awk \u0027{s+\u003d$1} END {print s}\u0027\")$", | |
"key": "anzahl" | |
}, | |
"ids": { | |
"index": 0, | |
"type": "LIST", | |
"title": "IDs", | |
"value": "595420", | |
"entries": "595420,708997,137425,28171,485698,799358,863567,452740,610544,846857,709006,452753,879536,452744,485695,853483,594080,504606,593761,525943,842480,535981,127048,524535", | |
"key": "ids" | |
}, | |
"urlstore": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "urlStore", | |
"value": "https://store-data-service.services.dmtech.com/stores/item/de/$gv(storeID)$", | |
"key": "urlstore" | |
}, | |
"vorrat": { | |
"index": 0, | |
"type": "COLOR", | |
"title": "Vorrat", | |
"global_formula": "$if(gv(anzahl)\u003e300, #FF00F70F, gv(anzahl)\u003e50, #FFFCAD00, #FFFF0000)$", | |
"toggles": 10, | |
"key": "vorrat" | |
}, | |
"open": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "open", | |
"value": "$tc(nfmt,tc(reg, wg(gv(urlStore), json, gv(openpars)), \":\", \"\" ))$", | |
"key": "open" | |
}, | |
"closing": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "closing", | |
"value": "$tc(reg, wg(gv(urlStore), json, gv(clospars)), \":\", \"\" )$", | |
"key": "closing" | |
}, | |
"openpars": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "openPars", | |
"value": ".openingHours[$df(f)-1$].timeRanges[0].opening", | |
"key": "openpars" | |
}, | |
"clospars": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "closPars", | |
"value": ".openingHours[$df(f)-1$].timeRanges[0].closing", | |
"key": "clospars" | |
}, | |
"calcopen": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "calcOpen", | |
"value": "$if(df(f)\u003c7, if(df(hmm)\u003e\u003dgv(open)\u0026df(hmm)\u003c\u003dgv(closing), Geöffnet,Geschlossen), Geschlosse)$", | |
"key": "calcopen" | |
}, | |
"colorsta": { | |
"index": 0, | |
"type": "COLOR", | |
"title": "colorSta", | |
"global_formula": "$if(gv(calcopen)\u003dGeöffnet,#FF00F707,#FFFF0000)$", | |
"toggles": 10, | |
"key": "colorsta" | |
}, | |
"adresse": { | |
"index": 0, | |
"type": "TEXT", | |
"title": "Adresse", | |
"value": "$wg(gv(urlStore), json, .address.street)$\n$wg(gv(urlStore), json, .address.zip)$ $wg(gv(urlStore), json, .address.city)$", | |
"key": "adresse" | |
} | |
} | |
} | |
##KUSTOMCLIP## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hahaha!