Make sb-doppler work for Europe and Africa

This commit is contained in:
krisdoodle45 2021-10-04 20:56:57 +02:00 committed by GitHub
parent 163738e6ad
commit a3e76f32b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,194 +1,248 @@
#!/bin/sh #!/bin/sh
# Show a Doppler RADAR of an American user's preferred location. # Show a Doppler RADAR of a user's preferred location.
secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds. secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds.
radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar" radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar"
doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif" doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif"
pickloc() { chosen="$(echo "Northeast pickloc() { chosen="$(echo "US: Northeast
Southeast US: Southeast
PacNorthWest US: PacNorthWest
PacSouthWest US: PacSouthWest
UpperMissVly US: UpperMissVly
SouthMissVly US: SouthMissVly
SouthPlains US: SouthPlains
NorthRockies US: NorthRockies
SouthRockies US: SouthRockies
Alaska US: Alaska
Carib US: Carib
Hawaii US: Hawaii
CentGrLakes US: CentGrLakes
Conus-Large US: Conus-Large
KABR: Aberdeen, SD US: KABR: Aberdeen, SD
KBIS: Bismarck, ND US: KBIS: Bismarck, ND
KFTG: Denver/Boulder, CO US: KFTG: Denver/Boulder, CO
KDMX: Des Moines, IA US: KDMX: Des Moines, IA
KDTX: Detroit, MI US: KDTX: Detroit, MI
KDDC: Dodge City, KS US: KDDC: Dodge City, KS
KDLH: Duluth, MN US: KDLH: Duluth, MN
KCYS: Cheyenne, WY US: KCYS: Cheyenne, WY
KLOT: Chicago, IL US: KLOT: Chicago, IL
KGLD: Goodland, KS US: KGLD: Goodland, KS
KUEX: Hastings, NE US: KUEX: Hastings, NE
KGJX: Grand Junction, CO US: KGJX: Grand Junction, CO
KGRR: Grand Rapids, MI US: KGRR: Grand Rapids, MI
KMVX: Fargo/Grand Forks, ND US: KMVX: Fargo/Grand Forks, ND
KGRB: Green Bay, WI US: KGRB: Green Bay, WI
KIND: Indianapolis, IN US: KIND: Indianapolis, IN
KJKL: Jackson, KY US: KJKL: Jackson, KY
KARX: La Crosse, WI US: KARX: La Crosse, WI
KILX: Lincoln/Central Illinois, IL US: KILX: Lincoln/Central Illinois, IL
KLVX: Louisville, KY US: KLVX: Louisville, KY
KMQT: Marquette US: KMQT: Marquette
KMKX: Milwaukee, WI US: KMKX: Milwaukee, WI
KMPX: Minneapolis, MN US: KMPX: Minneapolis, MN
KAPX: Gaylord/Alpena, MI US: KAPX: Gaylord/Alpena, MI
KLNX: North Platte, NE US: KLNX: North Platte, NE
KIWX: N. Webster/Northern, IN US: KIWX: N. Webster/Northern, IN
KOAX: Omaha, NE US: KOAX: Omaha, NE
KPAH: Paducah, KY US: KPAH: Paducah, KY
KEAX: Pleasant Hill, MO US: KEAX: Pleasant Hill, MO
KPUX: Pueblo, CO US: KPUX: Pueblo, CO
KDVN: Quad Cities, IA US: KDVN: Quad Cities, IA
KUDX: Rapid City, SD US: KUDX: Rapid City, SD
KRIW: Riverton, WY US: KRIW: Riverton, WY
KSGF: Springfield, MO US: KSGF: Springfield, MO
KLSX: St. LOUIS, MO US: KLSX: St. LOUIS, MO
KFSD: Sioux Falls, IA US: KFSD: Sioux Falls, IA
KTWX: Topeka, KS US: KTWX: Topeka, KS
KICT: Wichita, KS US: KICT: Wichita, KS
KVWX: Paducah, KY US: KVWX: Paducah, KY
ICAO: Responsible Wfo US: ICAO: Responsible Wfo
KLTX: WILMINGTON, NC US: KLTX: WILMINGTON, NC
KCCX: State College/Central, PA US: KCCX: State College/Central, PA
KLWX: Sterling, VA US: KLWX: Sterling, VA
KFCX: Blacksburg/Roanoke, VA US: KFCX: Blacksburg/Roanoke, VA
KRAX: Raleigh/Durham, NC US: KRAX: Raleigh/Durham, NC
KGYX: Portland, ME US: KGYX: Portland, ME
KDIX: Mt Holly/Philadelphia, PA US: KDIX: Mt Holly/Philadelphia, PA
KPBZ: Pittsburgh, PA US: KPBZ: Pittsburgh, PA
KAKQ: Wakefield, VA US: KAKQ: Wakefield, VA
KMHX: Morehead City, NC US: KMHX: Morehead City, NC
KGSP: Greer/Greenville/Sprtbg, SC US: KGSP: Greer/Greenville/Sprtbg, SC
KILN: Wilmington/Cincinnati, OH US: KILN: Wilmington/Cincinnati, OH
KCLE: Cleveland, OH US: KCLE: Cleveland, OH
KCAE: Columbia, SC US: KCAE: Columbia, SC
KBGM: Binghamton, NY US: KBGM: Binghamton, NY
KENX: Albany, NY US: KENX: Albany, NY
KBUF: Buffalo, NY US: KBUF: Buffalo, NY
KCXX: Burlington, VT US: KCXX: Burlington, VT
KCBW: Caribou, ME US: KCBW: Caribou, ME
KBOX: Boston /Taunton, MA US: KBOX: Boston /Taunton, MA
KOKX: New York City, NY US: KOKX: New York City, NY
KCLX: Charleston, SC US: KCLX: Charleston, SC
KRLX: Charleston, WV US: KRLX: Charleston, WV
ICAO: Responsible WFO US: ICAO: Responsible WFO
KBRO: Brownsville, TX US: KBRO: Brownsville, TX
KABX: Albuquerque, NM US: KABX: Albuquerque, NM
KAMA: Amarillo, TX US: KAMA: Amarillo, TX
KFFC: Peachtree City/Atlanta, GA US: KFFC: Peachtree City/Atlanta, GA
KEWX: Austin/Sanantonio, TX US: KEWX: Austin/Sanantonio, TX
KBMX: Birmingham, AL US: KBMX: Birmingham, AL
KCRP: Corpus Christi, TX US: KCRP: Corpus Christi, TX
KFWS: Dallas / Ft. Worth, TX US: KFWS: Dallas / Ft. Worth, TX
KEPZ: El Paso, TX US: KEPZ: El Paso, TX
KHGX: Houston/ Galveston, TX US: KHGX: Houston/ Galveston, TX
KJAX: Jacksonville, FL US: KJAX: Jacksonville, FL
KBYX: Key West, FL US: KBYX: Key West, FL
KMRX: Morristown/knoxville, TN US: KMRX: Morristown/knoxville, TN
KLBB: Lubbock, TX US: KLBB: Lubbock, TX
KLZK: Little Rock, AR US: KLZK: Little Rock, AR
KLCH: Lake Charles, LA US: KLCH: Lake Charles, LA
KOHX: Nashville, TN US: KOHX: Nashville, TN
KMLB: Melbourne, FL US: KMLB: Melbourne, FL
KNQA: Memphis, TN US: KNQA: Memphis, TN
KAMX: Miami, FL US: KAMX: Miami, FL
KMAF: Midland/odessa, TX US: KMAF: Midland/odessa, TX
KTLX: Norman, OK US: KTLX: Norman, OK
KHTX: Huntsville, AL US: KHTX: Huntsville, AL
KMOB: Mobile, AL US: KMOB: Mobile, AL
KTLH: Tallahassee, FL US: KTLH: Tallahassee, FL
KTBW: Tampa Bay Area, FL US: KTBW: Tampa Bay Area, FL
KSJT: San Angelo, TX US: KSJT: San Angelo, TX
KINX: Tulsa, OK US: KINX: Tulsa, OK
KSRX: Tulsa, OK US: KSRX: Tulsa, OK
KLIX: New Orleans/slidell, LA US: KLIX: New Orleans/slidell, LA
KDGX: Jackson, MS US: KDGX: Jackson, MS
KSHV: Shreveport, LA US: KSHV: Shreveport, LA
ICAO: Responsible WFO US: ICAO: Responsible WFO
KLGX: Seattle / Tacoma, WA US: KLGX: Seattle / Tacoma, WA
KOTX: Spokane, WA US: KOTX: Spokane, WA
KEMX: Tucson, AZ US: KEMX: Tucson, AZ
KYUX: Phoenix, AZ US: KYUX: Phoenix, AZ
KNKX: San Diego, CA US: KNKX: San Diego, CA
KMUX: Monterey/san Francisco, CA US: KMUX: Monterey/san Francisco, CA
KHNX: San Joaquin/hanford, CA US: KHNX: San Joaquin/hanford, CA
KSOX: San Diego, CA US: KSOX: San Diego, CA
KATX: Seattle / Tacoma, WA US: KATX: Seattle / Tacoma, WA
KIWA: Phoenix, AZ US: KIWA: Phoenix, AZ
KRTX: Portland, OR US: KRTX: Portland, OR
KSFX: Pocatello, ID US: KSFX: Pocatello, ID
KRGX: Reno, NV US: KRGX: Reno, NV
KDAX: Sacramento, CA US: KDAX: Sacramento, CA
KMTX: Salt Lake City, UT US: KMTX: Salt Lake City, UT
KPDT: Pendleton, OR US: KPDT: Pendleton, OR
KMSX: Missoula, MT US: KMSX: Missoula, MT
KESX: Las Vegas, NV US: KESX: Las Vegas, NV
KVTX: Los Angeles, CA US: KVTX: Los Angeles, CA
KMAX: Medford, OR US: KMAX: Medford, OR
KFSX: Flagstaff, AZ US: KFSX: Flagstaff, AZ
KGGW: Glasgow, MT US: KGGW: Glasgow, MT
KLRX: Elko, NV US: KLRX: Elko, NV
KBHX: Eureka, CA US: KBHX: Eureka, CA
KTFX: Great Falls, MT US: KTFX: Great Falls, MT
KCBX: Boise, ID US: KCBX: Boise, ID
KBLX: Billings, MT US: KBLX: Billings, MT
KICX: Salt Lake City, UT US: KICX: Salt Lake City, UT
ICAO: Responsible Wfo W/ MSCF US: ICAO: Responsible Wfo W/ MSCF
PABC: Anchorage, AK US: PABC: Anchorage, AK
PAPD: Fairbanks, AK US: PAPD: Fairbanks, AK
PHKM: Honolulu, HI US: PHKM: Honolulu, HI
PAHG: Anchorage, AK US: PAHG: Anchorage, AK
PAKC: Anchorage, AK US: PAKC: Anchorage, AK
PAIH: Anchorage, AK US: PAIH: Anchorage, AK
PHMO: Honolulu, HI US: PHMO: Honolulu, HI
PAEC: Fairbanks, AK US: PAEC: Fairbanks, AK
TJUA: San Juan, PR US: TJUA: San Juan, PR
PACG: Juneau, AK US: PACG: Juneau, AK
PHKI: Honolulu, HI US: PHKI: Honolulu, HI
PHWA: Honolulu, HI US: PHWA: Honolulu, HI
ICAO: Responsible Wfo W/ MSCF US: ICAO: Responsible Wfo W/ MSCF
KFDR: Norman, OK US: KFDR: Norman, OK
PGUA: Guam US: PGUA: Guam
KBBX: Sacramento, CA US: KBBX: Sacramento, CA
KFDX: Albuquerque, NM US: KFDX: Albuquerque, NM
KGWX: Jackson, MS US: KGWX: Jackson, MS
KDOX: Wakefield, VA US: KDOX: Wakefield, VA
KDYX: San Angelo, TX US: KDYX: San Angelo, TX
KEYX: Las Vegas, NV US: KEYX: Las Vegas, NV
KEVX: Mobile, AL US: KEVX: Mobile, AL
KHPX: Paducah, KY US: KHPX: Paducah, KY
KTYX: Burlington, VT US: KTYX: Burlington, VT
KGRK: Dallas / Ft. Worth, TX US: KGRK: Dallas / Ft. Worth, TX
KPOE: Lake Charles, LA US: KPOE: Lake Charles, LA
KEOX: Tallahassee, FL US: KEOX: Tallahassee, FL
KHDX: El Paso, TX US: KHDX: El Paso, TX
KDFX: San Antonio, TX US: KDFX: San Antonio, TX
KMXX: Birmingham, AL US: KMXX: Birmingham, AL
KMBX: Bismarck, ND US: KMBX: Bismarck, ND
KVAX: Jacksonville, FL US: KVAX: Jacksonville, FL
KJGX: Peachtree City/atlanta, GA US: KJGX: Peachtree City/atlanta, GA
KVNX: Norman, OK US: KVNX: Norman, OK
KVBX: Vandenberg Afb: Orcutt, CA" | dmenu -r -i -l 50 -p "Select a National Weather Service radar to use as default:" | sed "s/:.*//" | tr "[:lower:]" "[:upper:]")" US: KVBX: Vandenberg Afb: Orcutt, CA
EU: Europe
EU: GB: Great Brittain
EU: SCAN: Scandinavia
EU: ALPS: The Alps
EU: NL: The Netherlands
EU: DE: Germany
EU: SP: Spain
EU: FR: France
EU: IT: Italy
EU: PL: Poland
EU: GR: Greece
EU: TU: Turkey
EU: RU: Russia
EU: BA: Bahrain
EU: BC: Botswana
EU: SE: Republic of Seychelles
EU: HU: Hungary
EU: UK: Ukraine
AF: AF: Africa
AF: WA: West Africa
AF: ZA: South Africa
AF: DZ: Algeria
AF: CE: Canary Islands
AF: NG: Nigeria
AF: TD: Chad
AF: CG: Democratic Republic of Congo
AF: EG: Egypt
AF: ET: Ethiopia
AF: CM: Cameroon
AF: IS: Israel
AF: LY: Libya
AF: MG: Madagascar
AF: MO: Morocco
AF: BW: Namibia
AF: SA: Saudi Arabia
AF: SO: Somalia
AF: SD: Sudan
AF: TZ: Tanzania
AF: TN: Tunisia
AF: ZM: Zambia
AF: KE: Kenya
AF: AO: Angola" | dmenu -r -i -l 50 -p "Select a radar to use as default:" | tr "[:lower:]" "[:upper:]")"
# Set continent code and radar code.
continentcode=$(echo "$chosen" | sed "s/:.*//")
radarcode=$(echo "$chosen" | sed "s/..: // ; s/:.*//")
# Sanity check of selection and ensure user did not escape. # Sanity check of selection and ensure user did not escape.
echo "$chosen" | grep -q "^[A-Z]\+$" && echo "$chosen" > "$radarloc" ;} echo "$radarcode" | grep -q "^[A-Z]\+$" && printf "$continentcode,$radarcode" | cut -d' ' -f1 > "$radarloc" ;}
getdoppler() { getdoppler() {
loc="$(cat "$radarloc")" cont="$(cat "$radarloc" | sed "s/,.*//")"
loc="$(cat "$radarloc" | cut -c 4-)"
notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc." notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc."
curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;} if [ $cont == "US" ] ; then
curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;
elif [ $cont == "EU" ] ; then
curl -sL "https://api.sat24.com/animated/${loc}/rainTMC/2/" > "$doppler" ;
elif [ $cont == "AF" ] ; then
curl -sL "https://api.sat24.com/animated/${loc}/rain/2/" > "$doppler" ;
fi
}
showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;} showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;}
@ -198,7 +252,7 @@ case $BLOCK_BUTTON in
showdoppler ;; showdoppler ;;
2) pickloc && getdoppler && showdoppler ;; 2) pickloc && getdoppler && showdoppler ;;
3) notify-send "🗺️ Doppler RADAR module" "\- Left click for local Doppler RADAR. 3) notify-send "🗺️ Doppler RADAR module" "\- Left click for local Doppler RADAR.
- Middle click to update change RADAR location. - Middle click to update RADAR location.
After $secs seconds, new clicks will also automatically update the doppler RADAR." ;; After $secs seconds, new clicks will also automatically update the doppler RADAR." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac