add lang in weather block
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Simon Vieille 2022-09-02 16:37:05 +02:00
parent 039bb2c2b1
commit eb82aba33c
Signed by: deblan
GPG Key ID: 579388D585F70417
2 changed files with 5 additions and 3 deletions

View File

@ -89,7 +89,7 @@ Show the weather of the given location ([https://fr.wttr.in/](https://fr.wttr.in
```
[weather]
command=/path/to/weather -loc=Paris
command=/path/to/weather -loc=Paris -lang=fr
format=json
markup=pango
interval=1800

View File

@ -22,13 +22,15 @@ func main() {
var wg sync.WaitGroup
argLocation := flag.String("loc", "", "location")
argLang := flag.String("lang", "fr", "lang")
flag.Parse()
url := fmt.Sprintf("https://fr.wttr.in/%s?format=%%l+%%c+%%t+%%m", *argLocation)
url := fmt.Sprintf("https://%s.wttr.in/%s?format=%%l+%%c+%%t+%%m", *argLang, *argLocation)
if os.Getenv("BLOCK_BUTTON") == "1" {
url2 := fmt.Sprintf("https://%s.wttr.in/%s", *argLang, *argLocation)
wg.Add(1)
go openBrowser(&wg, url)
go openBrowser(&wg, url2)
}
resp, err := http.Get(url)