mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
meteo: remove
This commit is contained in:
@@ -153,7 +153,6 @@ in {
|
||||
niveumPackages.mpv-iptv
|
||||
niveumPackages.devanagari
|
||||
niveumPackages.betacode # ancient greek betacode to unicode converter
|
||||
niveumPackages.meteo
|
||||
niveumPackages.jq-lsp
|
||||
niveumPackages.swallow # window swallowing
|
||||
niveumPackages.literature-quote
|
||||
|
||||
@@ -391,7 +391,6 @@
|
||||
mansplain = pkgs.callPackage packages/mansplain.nix {};
|
||||
manual-sort = pkgs.callPackage packages/manual-sort.nix {};
|
||||
menu-calc = pkgs.callPackage packages/menu-calc.nix {};
|
||||
meteo = pkgs.callPackage packages/meteo.nix {};
|
||||
noise-waves = pkgs.callPackage packages/noise-waves.nix {};
|
||||
mpv-radio = pkgs.callPackage packages/mpv-radio.nix {di-fm-key-file = "/dev/null";};
|
||||
mpv-tuner = pkgs.callPackage packages/mpv-tuner.nix {di-fm-key-file = "/dev/null";};
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
{
|
||||
writers,
|
||||
lib,
|
||||
jq,
|
||||
curl,
|
||||
xdotool,
|
||||
nsxiv,
|
||||
gnused,
|
||||
defaultStation ? 103840,
|
||||
}:
|
||||
writers.writeDashBin "meteo" ''
|
||||
# usage: meteo --list
|
||||
# usage: meteo --update
|
||||
# usage: meteo STATION
|
||||
set -efu
|
||||
|
||||
PATH=$PATH:${lib.makeBinPath [jq curl xdotool nsxiv gnused]}
|
||||
|
||||
# TODO XDG
|
||||
CONFIG_DIR=$HOME/.config/wetter
|
||||
STATIONS_FILE=$CONFIG_DIR/stations.json
|
||||
|
||||
case ''${1-} in
|
||||
--list)
|
||||
sed -n 's/^\s*\(--[^)]\+\))$/\1/p' "$0"
|
||||
jq -r -n \
|
||||
--slurpfile stations_file "$STATIONS_FILE" \
|
||||
'
|
||||
$stations_file[0] as $known_stations |
|
||||
|
||||
$known_stations | keys[]
|
||||
'
|
||||
exit
|
||||
;;
|
||||
--update)
|
||||
mkdir -p "$(dirname "$STATIONS_FILE")"
|
||||
exec >"$STATIONS_FILE"
|
||||
|
||||
curl -fsSL http://wetterstationen.meteomedia.de/ |
|
||||
jq -Rrs '
|
||||
def decodeHTML:
|
||||
gsub("ä";"ä") |
|
||||
gsub("ö";"ö") |
|
||||
gsub("ü";"ü") |
|
||||
gsub("Ä";"Ä") |
|
||||
gsub("Ö";"Ö") |
|
||||
gsub("Ü";"Ü") |
|
||||
gsub("ß";"ß")
|
||||
;
|
||||
[
|
||||
match(".*<option value=\"/\\?map=Deutschland&station=(?<station>[0-9]+)\">(?<name>[^<]+)</option>";"g")
|
||||
.captures |
|
||||
map({"\(.name)":(.string)}) |
|
||||
add |
|
||||
{"\(.name|decodeHTML)":(.station|tonumber)}
|
||||
] |
|
||||
add
|
||||
'
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# set -x
|
||||
|
||||
station=''${1-${toString defaultStation}}
|
||||
station=$(jq -e -n \
|
||||
--arg station "$station" \
|
||||
--slurpfile stations_file "$STATIONS_FILE" \
|
||||
'
|
||||
$stations_file[0] as $known_stations |
|
||||
|
||||
$station |
|
||||
if test("^[0-9]+$") then
|
||||
tonumber
|
||||
else
|
||||
$known_stations[.]
|
||||
end
|
||||
')
|
||||
cache="/tmp/''${LOGNAME}_wetter_$station.png"
|
||||
curl -sSL \
|
||||
"http://wetterstationen.meteomedia.de/messnetz/vorhersagegrafik/$station.png" \
|
||||
-o "$cache"
|
||||
|
||||
if window_id=$(xdotool search --name "^nsxiv - $cache$"); then
|
||||
xdotool key --window "$window_id" r
|
||||
else
|
||||
nsxiv "$cache" &
|
||||
fi
|
||||
''
|
||||
@@ -79,7 +79,6 @@
|
||||
niveumPackages.mpv-tv
|
||||
telegram-desktop
|
||||
(niveumPackages.mpv-radio.override { di-fm-key-file = config.age.secrets.di-fm-key.path; })
|
||||
niveumPackages.meteo
|
||||
spotify
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user