From 3493cd74a1f6942566fbad4b89f4d3c84f964868 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Mar 2020 20:06:22 +0100 Subject: irc-announce: fix more portable cat2 --- krebs/5pkgs/simple/irc-announce/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/irc-announce/default.nix b/krebs/5pkgs/simple/irc-announce/default.nix index dea30a056..a90814aa9 100644 --- a/krebs/5pkgs/simple/irc-announce/default.nix +++ b/krebs/5pkgs/simple/irc-announce/default.nix @@ -24,7 +24,12 @@ pkgs.writeDashBin "irc-announce" '' # echo2 and cat2 are used output to both, stdout and stderr # This is used to see what we send to the irc server. (debug output) echo2() { echo "$*"; echo "$*" >&2; } - cat2() { (read x ; echo "$x" ; echo "$x" >&2) } + cat2() { + while read -r line; do + echo "$line" + echo "$line" >&2 + done + } # privmsg_cat transforms stdin to a privmsg privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } -- cgit v1.2.3 From 1e915baafbc56c4c626a3c3d042ac0e7d6276561 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Mar 2020 20:51:18 +0100 Subject: irc-announce cat2: use awk --- krebs/5pkgs/simple/irc-announce/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/irc-announce/default.nix b/krebs/5pkgs/simple/irc-announce/default.nix index a90814aa9..52cf12862 100644 --- a/krebs/5pkgs/simple/irc-announce/default.nix +++ b/krebs/5pkgs/simple/irc-announce/default.nix @@ -25,10 +25,10 @@ pkgs.writeDashBin "irc-announce" '' # This is used to see what we send to the irc server. (debug output) echo2() { echo "$*"; echo "$*" >&2; } cat2() { - while read -r line; do - echo "$line" - echo "$line" >&2 - done + awk '{ + print $0 + print $0 > "/dev/stderr" + }' } # privmsg_cat transforms stdin to a privmsg -- cgit v1.2.3 From ee59d7d72a29cc2b6c69a0d68a815eacfd980263 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 09:55:43 +0100 Subject: grib2json: init --- krebs/5pkgs/simple/grib2json/default.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 krebs/5pkgs/simple/grib2json/default.nix (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/grib2json/default.nix b/krebs/5pkgs/simple/grib2json/default.nix new file mode 100644 index 000000000..2a7959a75 --- /dev/null +++ b/krebs/5pkgs/simple/grib2json/default.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchzip, makeWrapper, jre }: + +stdenv.mkDerivation { + name = "grib2json"; + src = fetchzip { + url = "https://github.com/krebs/grib2json-bin/archive/31efe677b40fe491c988d50f96b59b1b7e2d46f7.zip"; + sha256 = "1h3yxg270bvac7kaqsbsv4f8nln1i03rfz4cm8cp7llhjj3s6a6b"; + }; + installPhase = '' + mkdir -p $out/bin + cp -r lib $out/ + cat > $out/bin/grib2json << EOF + #!/bin/sh + set -x + ${jre}/bin/java -jar $out/lib/grib2json-0.8.0-SNAPSHOT.jar "\$@" + EOF + chmod +x $out/bin/grib2json + ''; +} -- cgit v1.2.3 From 539f783a7eba249f4221c4013032a05839ac3282 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 09:55:58 +0100 Subject: nomads-cloud: init --- krebs/5pkgs/simple/nomads-cloud/default.nix | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 krebs/5pkgs/simple/nomads-cloud/default.nix (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/nomads-cloud/default.nix b/krebs/5pkgs/simple/nomads-cloud/default.nix new file mode 100644 index 000000000..2af74dc44 --- /dev/null +++ b/krebs/5pkgs/simple/nomads-cloud/default.nix @@ -0,0 +1,43 @@ +{ writers, coreutils, grib2json, curl, jq, findutils, imagemagick }: +writers.writeDashBin "nomads-cloud" '' + prefix=$(mktemp -d) + grib_path=$prefix.grib + json_path=$prefix.json + pgm_path=$prefix.pgm + png_path="$1" + + mkdir -p "$prefix" + + date=$(${coreutils}/bin/date +%Y%m%d) + for hour in 18 12 06 00; do + url="https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?file=gfs.t''${hour}z.pgrb2.0p25.anl&lev_entire_atmosphere_%5C%28considered_as_a_single_layer%5C%29=on&var_CWAT=on&leftlon=-180&rightlon=180&toplat=90&bottomlat=-90&dir=%2Fgfs.$date%2F$hour" + ${curl}/bin/curl -fsS "$url" > "$grib_path" + if [ "$?" -eq 0 ]; then + break + fi + done + ${grib2json}/bin/grib2json --data "$grib_path" > "$json_path" + + width=$(${jq}/bin/jq '.[0].header.nx' < "$json_path") + height=$(${jq}/bin/jq '.[0].header.ny' < "$json_path") + + # The maximum gray value. Must be bigger than 0 and less than 65536. + maxval=256 + + # pgm - Netpbm grayscale image format + # http://netpbm.sourceforge.net/doc/pgm.html + { + echo P2 + echo "$width $height" + echo "$maxval" + cat "$json_path" | + ${jq}/bin/jq --argjson maxval "$maxval" -c ' + .[0].data[] * $maxval | round + ' | + ${findutils}/bin/xargs -n "$width" + } > "$pgm_path" + + ${imagemagick}/bin/convert -roll +50% "$pgm_path" "$png_path" + + rm -r "$prefix" +'' -- cgit v1.2.3 From 2552d6321c309291147e3d7cc53501480b69f295 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 09:57:54 +0100 Subject: realwallpaper: add nomad-clouds as cloud provider --- krebs/5pkgs/simple/realwallpaper/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index ef83d2e59..3f75e9e1e 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -1,5 +1,5 @@ { pkgs, ... }: -pkgs.writeDashBin "generate-wallpaper" '' +pkgs.writers.writeDashBin "generate-wallpaper" '' set -euf # usage: getimg FILENAME URL @@ -68,15 +68,15 @@ pkgs.writeDashBin "generate-wallpaper" '' "$nightmap_url" & fetch daymap-raw.png \ "$daymap_url" & - fetch clouds-raw.jpg \ - "$cloudmap_url" & fetch marker.json \ "$marker_url" & wait + ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png + check_type nightmap-raw.jpg image check_type daymap-raw.png image - check_type clouds-raw.jpg image + check_type clouds-raw.png image in_size=2048x1024 xplanet_out_size=1466x1200 @@ -87,7 +87,7 @@ pkgs.writeDashBin "generate-wallpaper" '' for raw in \ nightmap-raw.jpg \ daymap-raw.png \ - clouds-raw.jpg \ + clouds-raw.png \ ; do normal=''${raw%-raw.*}.png -- cgit v1.2.3 From cab3be8a19d445d3292454099dbc1ca97bca60c5 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 09:58:10 +0100 Subject: realwallpaper: add subsolar/lunar points --- krebs/5pkgs/simple/realwallpaper/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 3f75e9e1e..b46cf08c1 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -128,6 +128,8 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' # create marker file from json if [ -s marker.json ]; then jq -r 'to_entries[] | @json "\(.value.latitude) \(.value.longitude)"' marker.json > marker_file + echo 'position=sun image=subsolar.png transparent={255,255,255}' >> marker_file + echo 'position=moon image=sublunar.png transparent={255,255,255}' >> marker_file fi # make all unmodified files as final -- cgit v1.2.3 From e4816a16f9144f4267856f87aa2879fff277730d Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 13:05:43 +0100 Subject: realwallpaper: use new sun/moon icons --- krebs/5pkgs/simple/realwallpaper/default.nix | 30 ++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index b46cf08c1..62d88e1e9 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -64,12 +64,17 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' cd "$working_dir" # fetch source images in parallel - fetch nightmap-raw.jpg \ - "$nightmap_url" & - fetch daymap-raw.png \ - "$daymap_url" & - fetch marker.json \ - "$marker_url" & + # fetch basic images which should not change + test -e nightmap-raw.jpg || fetch nightmap-raw.jpg "$nightmap_url" & + test -e sun-raw.png || fetch sun-raw.png \ + "http://simpleicon.com/wp-content/uploads/sun-64x64.png" & + + test -e moon-raw.png || fetch moon-raw.png \ + "http://simpleicon.com/wp-content/uploads/moon__star-64x64.png" & + + # regular fetches + fetch daymap-raw.png "$daymap_url" & + fetch marker.json "$marker_url" & wait ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png @@ -112,6 +117,14 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' convert nightmap.png -threshold 25% nightmap-lightmask.png fi + if needs_rebuild sun.png sun-raw.png; then + convert sun-raw.png -fill gold -opaque black -resize 50% PNG64:sun.png + fi + + if needs_rebuild moon.png moon-raw.png; then + convert moon-raw.png -fill royalblue -opaque black -resize 50% PNG64:moon.png + fi + # create layers make_layer nightmap-snowlayer.png nightmap-fullsnow.png daymap-snowmask.png make_layer nightmap-lightlayer.png nightmap.png nightmap-lightmask.png @@ -125,11 +138,12 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' nightmap-lightsnowlayer.png \ nightmap.png + # create marker file from json if [ -s marker.json ]; then jq -r 'to_entries[] | @json "\(.value.latitude) \(.value.longitude)"' marker.json > marker_file - echo 'position=sun image=subsolar.png transparent={255,255,255}' >> marker_file - echo 'position=moon image=sublunar.png transparent={255,255,255}' >> marker_file + echo 'position=sun image=sun.png' >> marker_file + echo 'position=moon image=moon.png' >> marker_file fi # make all unmodified files as final -- cgit v1.2.3 From e2ef8aba938fb39f826014de919471c7ce751d83 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 13:05:55 +0100 Subject: fetch clouds only every 3h --- krebs/5pkgs/simple/realwallpaper/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 62d88e1e9..f81f96efe 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -77,7 +77,10 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fetch marker.json "$marker_url" & wait - ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png + # fetch clouds if they are older than 3h + if ! test "$(find clouds-raw.png -mmin -180)"; then + ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png + fi check_type nightmap-raw.jpg image check_type daymap-raw.png image -- cgit v1.2.3 From 119b56956c8bcb992c86ca8d0e854884e7c44695 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 18:47:23 +0100 Subject: nomads-cloud: double sqrt for better clouds --- krebs/5pkgs/simple/nomads-cloud/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/nomads-cloud/default.nix b/krebs/5pkgs/simple/nomads-cloud/default.nix index 2af74dc44..9c39de891 100644 --- a/krebs/5pkgs/simple/nomads-cloud/default.nix +++ b/krebs/5pkgs/simple/nomads-cloud/default.nix @@ -22,7 +22,7 @@ writers.writeDashBin "nomads-cloud" '' height=$(${jq}/bin/jq '.[0].header.ny' < "$json_path") # The maximum gray value. Must be bigger than 0 and less than 65536. - maxval=256 + maxval=1000 # pgm - Netpbm grayscale image format # http://netpbm.sourceforge.net/doc/pgm.html @@ -32,7 +32,7 @@ writers.writeDashBin "nomads-cloud" '' echo "$maxval" cat "$json_path" | ${jq}/bin/jq --argjson maxval "$maxval" -c ' - .[0].data[] * $maxval | round + ((.[0].data[] | sqrt | sqrt) * $maxval | round) ' | ${findutils}/bin/xargs -n "$width" } > "$pgm_path" -- cgit v1.2.3 From e5cbe0cbe17a63854efc0271c1ae0d922a23572d Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 23 Mar 2020 20:28:29 +0100 Subject: realwallpaper: use cloud_gamme instead of sqrt hack --- krebs/5pkgs/simple/nomads-cloud/default.nix | 2 +- krebs/5pkgs/simple/realwallpaper/default.nix | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/nomads-cloud/default.nix b/krebs/5pkgs/simple/nomads-cloud/default.nix index 9c39de891..6e4ace484 100644 --- a/krebs/5pkgs/simple/nomads-cloud/default.nix +++ b/krebs/5pkgs/simple/nomads-cloud/default.nix @@ -32,7 +32,7 @@ writers.writeDashBin "nomads-cloud" '' echo "$maxval" cat "$json_path" | ${jq}/bin/jq --argjson maxval "$maxval" -c ' - ((.[0].data[] | sqrt | sqrt) * $maxval | round) + ((.[0].data[]) * $maxval | round) ' | ${findutils}/bin/xargs -n "$width" } > "$pgm_path" diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index f81f96efe..d28f20cb6 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -169,7 +169,8 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' map=daymap-final.png night_map=nightmap-final.png cloud_map=clouds-final.png - cloud_threshold=10 + cloud_threshold=1 + cloud_gamma=2.5 shade=15 ''} @@ -181,7 +182,8 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' map=daymap-final.png night_map=nightmap-final.png cloud_map=clouds-final.png - cloud_threshold=10 + cloud_threshold=1 + cloud_gamma=2.5 marker_file=marker_file shade=15 ''} -- cgit v1.2.3 From 4337f9dbce769cf64eba0c9ade8097145e782a83 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 24 Mar 2020 10:12:23 +0100 Subject: realwallpaper: add chlora water layer --- krebs/5pkgs/simple/realwallpaper/default.nix | 49 +++++++++++++++++++++------- 1 file changed, 37 insertions(+), 12 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index d28f20cb6..9be8f7c7c 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -73,8 +73,22 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' "http://simpleicon.com/wp-content/uploads/moon__star-64x64.png" & # regular fetches - fetch daymap-raw.png "$daymap_url" & fetch marker.json "$marker_url" & + + # fetch daymap twice daily + if ! test "$(find daymap-raw.png -mmin -720)"; then + fetch daymap-raw.png "$daymap_url" & + fi + + # fetch cholrophyl once every week + chlora_url=$(curl -Ss \ + 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MY1DMM_CHLORA&date=2999-12-31' \ + | grep '3600 x 1800' | sed 's/.*href="\([^"]*\)".*/\1/') + + if ! test "$(find chlora-raw.jpg -mtime -7)"; then + fetch chlora-raw.jpg "$chlora_url" & + fi + wait # fetch clouds if they are older than 3h @@ -96,6 +110,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' nightmap-raw.jpg \ daymap-raw.png \ clouds-raw.png \ + chlora-raw.jpg \ ; do normal=''${raw%-raw.*}.png @@ -105,7 +120,26 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fi done - # create nightmap-fullsnow + if needs_rebuild sun.png sun-raw.png; then + convert sun-raw.png -fill gold -opaque black -resize 50% PNG64:sun.png + fi + + if needs_rebuild moon.png moon-raw.png; then + convert moon-raw.png -fill royalblue -opaque black -resize 50% PNG64:moon.png + fi + + # -- Daymap -- + + # merge with water chlora layer + convert daymap.png chlora.png -compose lighten -composite daymap-final.png + + # -- Nightmap -- + + # merge with water chlora layer + convert nightmap.png \( -fill black -colorize 70% chlora.png \) \ + -compose lighten -composite nightmap-chlora.png + + # create nightmap-fullsnow, a big blue picture if needs_rebuild nightmap-fullsnow.png; then convert -size $in_size xc:$nightsnow_color nightmap-fullsnow.png fi @@ -120,14 +154,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' convert nightmap.png -threshold 25% nightmap-lightmask.png fi - if needs_rebuild sun.png sun-raw.png; then - convert sun-raw.png -fill gold -opaque black -resize 50% PNG64:sun.png - fi - - if needs_rebuild moon.png moon-raw.png; then - convert moon-raw.png -fill royalblue -opaque black -resize 50% PNG64:moon.png - fi - # create layers make_layer nightmap-snowlayer.png nightmap-fullsnow.png daymap-snowmask.png make_layer nightmap-lightlayer.png nightmap.png nightmap-lightmask.png @@ -139,7 +165,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' flatten nightmap-final.png \ nightmap-lightsnowlayer.png \ - nightmap.png + nightmap-chlora.png # create marker file from json @@ -151,7 +177,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' # make all unmodified files as final for normal in \ - daymap.png \ clouds.png \ ; do -- cgit v1.2.3 From c76f1618940ff188258212a0988d3de7525f9e9e Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 15:39:25 +0100 Subject: realwallpaper: redesign with new image sources --- krebs/5pkgs/simple/realwallpaper/default.nix | 164 ++++++++++++--------------- 1 file changed, 73 insertions(+), 91 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 9be8f7c7c..dfe03ff35 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -17,24 +17,28 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fi } - # usage: image_size FILENAME - image_size() { - identify "$1" | awk '{print$3}' + # check if file exists and fetch only if missing + fetch_once() { + name=$1 + url=$2 + test -e "$name" || fetch "$name" "$url" } - # usage: make_mask DST SRC MASK - make_layer() { - if needs_rebuild "$@"; then - echo "make $1 (apply mask)" >&2 - convert "$2" "$3" -alpha off -compose copy_opacity -composite "$1" + fetch_older_min() { + min=$1 + name=$2 + url=$3 + if ! test "$(find $name -mmin -$min)"; then + fetch "$name" "$url" fi } - # usage: flatten DST HILAYER LOLAYER - flatten() { - if needs_rebuild "$@"; then - echo "make $1 (flatten)" >&2 - composite "$2" "$3" "$1" + fetch_older_days() { + days=$1 + name=$2 + url=$3 + if ! test "$(find $name -mmin -$days)"; then + fetch "$name" "$url" fi } @@ -60,35 +64,36 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' return $result } + get_neo_url() { + url=$1 + curl -Ss "$url" | grep '3600 x 1800' | sed 's/.*href="\([^"]*\)".*/\1/' + } + main() { cd "$working_dir" # fetch source images in parallel - # fetch basic images which should not change - test -e nightmap-raw.jpg || fetch nightmap-raw.jpg "$nightmap_url" & - test -e sun-raw.png || fetch sun-raw.png \ - "http://simpleicon.com/wp-content/uploads/sun-64x64.png" & - - test -e moon-raw.png || fetch moon-raw.png \ - "http://simpleicon.com/wp-content/uploads/moon__star-64x64.png" & + fetch_once sun-raw.png \ + 'http://simpleicon.com/wp-content/uploads/sun-64x64.png' & + fetch_once moon-raw.png \ + 'http://simpleicon.com/wp-content/uploads/moon__star-64x64.png' & + fetch_once nightmap-raw.jpg \ + 'https://eoimages.gsfc.nasa.gov/images/imagerecords/144000/144898/BlackMarble_2016_3km.jpg' & + fetch_once daymap-raw.tif \ + 'https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_8192.tif' & + + fetch_older_min 720 ice-raw.jpg $(get_neo_url \ + 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=NISE_D') & + fetch_older_days 3 snow-raw.jpg $(get_neo_url \ + 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD10C1_E_SNOW') & + fetch_older_days 7 chlora-raw.jpg $(get_neo_url \ + 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MY1DMM_CHLORA') & + fetch_older_days 3 fire-raw.jpg $(get_neo_url \ + 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD14A1_E_FIRE') & # regular fetches fetch marker.json "$marker_url" & - # fetch daymap twice daily - if ! test "$(find daymap-raw.png -mmin -720)"; then - fetch daymap-raw.png "$daymap_url" & - fi - - # fetch cholrophyl once every week - chlora_url=$(curl -Ss \ - 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MY1DMM_CHLORA&date=2999-12-31' \ - | grep '3600 x 1800' | sed 's/.*href="\([^"]*\)".*/\1/') - - if ! test "$(find chlora-raw.jpg -mtime -7)"; then - fetch chlora-raw.jpg "$chlora_url" & - fi - wait # fetch clouds if they are older than 3h @@ -96,21 +101,26 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png fi + check_type sun-raw.png image + check_type moon-raw.png image check_type nightmap-raw.jpg image - check_type daymap-raw.png image + check_type daymap-raw.tif image + check_type ice-raw.jpg image + check_type snow-raw.jpg image + check_type chlora-raw.jpg image + check_type fire-raw.jpg image check_type clouds-raw.png image - in_size=2048x1024 + in_size=3600x1800 xplanet_out_size=1466x1200 out_geometry=1366x768+100+160 - nightsnow_color='#0c1a49' # nightmap - for raw in \ nightmap-raw.jpg \ - daymap-raw.png \ - clouds-raw.png \ + daymap-raw.tif \ + snow-raw.jpg \ chlora-raw.jpg \ + clouds-raw.png \ ; do normal=''${raw%-raw.*}.png @@ -120,6 +130,16 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fi done + # remove snow from ice map + if needs_rebuild ice.png ice-raw.jpg; then + convert ice-raw.jpg -fuzz 20% -fill black -opaque white -scale "$in_size" ice.png + fi + + # make fire more red + if needs_rebuild fire.png fire-raw.jpg; then + convert fire-raw.jpg -fuzz 20% -fill '#ef840c' -opaque white -scale "$in_size" fire.png + fi + if needs_rebuild sun.png sun-raw.png; then convert sun-raw.png -fill gold -opaque black -resize 50% PNG64:sun.png fi @@ -131,60 +151,22 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' # -- Daymap -- # merge with water chlora layer - convert daymap.png chlora.png -compose lighten -composite daymap-final.png - - # -- Nightmap -- - - # merge with water chlora layer - convert nightmap.png \( -fill black -colorize 70% chlora.png \) \ - -compose lighten -composite nightmap-chlora.png - - # create nightmap-fullsnow, a big blue picture - if needs_rebuild nightmap-fullsnow.png; then - convert -size $in_size xc:$nightsnow_color nightmap-fullsnow.png - fi - - # extract daymap-snowmask from daymap-final - if needs_rebuild daymap-snowmask.png daymap.png; then - convert daymap.png -threshold 95% daymap-snowmask.png - fi - - # extract nightmap-lightmask from nightmap - if needs_rebuild nightmap-lightmask.png nightmap.png; then - convert nightmap.png -threshold 25% nightmap-lightmask.png + if needs_rebuild daymap-final.png daymap.png fire.png snow.png ice.png chlora.png; then + convert daymap.png fire.png -compose lighten -composite daymap-1.png + convert daymap-1.png ice.png -compose lighten -composite daymap-2.png + convert daymap-2.png snow.png -compose lighten -composite daymap-3.png + convert daymap-3.png chlora.png -compose lighten -composite daymap-final.png fi - # create layers - make_layer nightmap-snowlayer.png nightmap-fullsnow.png daymap-snowmask.png - make_layer nightmap-lightlayer.png nightmap.png nightmap-lightmask.png - - # apply layers - flatten nightmap-lightsnowlayer.png \ - nightmap-lightlayer.png \ - nightmap-snowlayer.png - - flatten nightmap-final.png \ - nightmap-lightsnowlayer.png \ - nightmap-chlora.png - + # -- Nightmap -- - # create marker file from json - if [ -s marker.json ]; then - jq -r 'to_entries[] | @json "\(.value.latitude) \(.value.longitude)"' marker.json > marker_file - echo 'position=sun image=sun.png' >> marker_file - echo 'position=moon image=moon.png' >> marker_file + if needs_rebuild nightmap-final.png nightmap.png fire.png snow.png ice.png chlora.png; then + convert nightmap.png fire.png -compose lighten -composite nightmap-1.png + convert nightmap-1.png \( -fill black -colorize 70% ice.png \) -compose lighten -composite nightmap-2.png + convert nightmap-2.png \( -fill black -colorize 70% snow.png \) -compose lighten -composite nightmap-3.png + convert nightmap-3.png \( -fill black -colorize 70% chlora.png \) -compose lighten -composite nightmap-final.png fi - # make all unmodified files as final - for normal in \ - clouds.png \ - ; - do - final=''${normal%.png}-final.png - needs_rebuild $final && - ln $normal $final - done - # rebuild every time to update shadow xplanet --num_times 1 --geometry $xplanet_out_size \ --output xplanet-output.png --projection merc \ @@ -193,7 +175,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' "Earth" map=daymap-final.png night_map=nightmap-final.png - cloud_map=clouds-final.png + cloud_map=clouds.png cloud_threshold=1 cloud_gamma=2.5 shade=15 @@ -206,7 +188,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' "Earth" map=daymap-final.png night_map=nightmap-final.png - cloud_map=clouds-final.png + cloud_map=clouds.png cloud_threshold=1 cloud_gamma=2.5 marker_file=marker_file -- cgit v1.2.3 From a0347a6443ac07bbb986080dafe44af4a25e0f98 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 18:14:04 +0100 Subject: realwallpaper: add HD version with planets and krebs --- krebs/5pkgs/simple/realwallpaper/default.nix | 90 ++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 4 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index dfe03ff35..1dd5e00e8 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -82,6 +82,24 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fetch_once daymap-raw.tif \ 'https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_8192.tif' & + fetch_once mercury-raw.svg \ + 'https://upload.wikimedia.org/wikipedia/commons/2/2e/Mercury_symbol.svg' & + fetch_once venus-raw.svg \ + 'https://upload.wikimedia.org/wikipedia/commons/6/66/Venus_symbol.svg' & + fetch_once mars-raw.svg \ + 'https://upload.wikimedia.org/wikipedia/commons/b/b7/Mars_symbol.svg' & + fetch_once jupiter-raw.svg \ + 'https://upload.wikimedia.org/wikipedia/commons/2/26/Jupiter_symbol.svg' & + fetch_once saturn-raw.svg \ + 'https://upload.wikimedia.org/wikipedia/commons/7/74/Saturn_symbol.svg' & + fetch_once uranus-raw.svg \ + 'https://upload.wikimedia.org/wikipedia/commons/f/f1/Uranus_symbol.svg' & + fetch_once neptune-raw.svg \ + 'https://upload.wikimedia.org/wikipedia/commons/4/47/Neptune_symbol.svg' & + + fetch_once krebs-raw.svg \ + 'https://raw.githubusercontent.com/krebs/painload/master/cholerab/bling/krebs_aquarium.svg' & + fetch_older_min 720 ice-raw.jpg $(get_neo_url \ 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=NISE_D') & fetch_older_days 3 snow-raw.jpg $(get_neo_url \ @@ -111,9 +129,19 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' check_type fire-raw.jpg image check_type clouds-raw.png image + check_type mercury-raw.svg image + check_type venus-raw.svg image + check_type mars-raw.svg image + check_type jupiter-raw.svg image + check_type saturn-raw.svg image + check_type uranus-raw.svg image + check_type neptune-raw.svg image + + check_type krebs-raw.svg image + in_size=3600x1800 - xplanet_out_size=1466x1200 - out_geometry=1366x768+100+160 + xplanet_out_size=3600x2950 + out_geometry=3200x1800+300+400 for raw in \ nightmap-raw.jpg \ @@ -141,11 +169,52 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fi if needs_rebuild sun.png sun-raw.png; then - convert sun-raw.png -fill gold -opaque black -resize 50% PNG64:sun.png + convert sun-raw.png -fill gold -opaque black PNG64:sun.png fi if needs_rebuild moon.png moon-raw.png; then - convert moon-raw.png -fill royalblue -opaque black -resize 50% PNG64:moon.png + convert moon-raw.png -fill royalblue -opaque black PNG64:moon.png + fi + + # -- Planets -- + + if needs_rebuild mercury.png mercury-raw.svg; then + sed -i 's/#000/#A6A6A6/g' mercury-raw.svg + inkscape -z -e mercury.png -w 40 -h 40 mercury-raw.svg + fi + + if needs_rebuild venus.png venus-raw.svg; then + sed -i 's/#000/#C40B98/g' venus-raw.svg + inkscape -z -e venus.png -w 40 -h 40 venus-raw.svg + fi + + if needs_rebuild mars.png mars-raw.svg; then + sed -i 's/#000/#E35A5C/g' mars-raw.svg + inkscape -z -e mars.png -w 40 -h 40 mars-raw.svg + fi + + if needs_rebuild jupiter.png jupiter-raw.svg; then + sed -i 's/#000/#DEA182/g' jupiter-raw.svg + inkscape -z -e jupiter.png -w 40 -h 40 jupiter-raw.svg + fi + + if needs_rebuild saturn.png saturn-raw.svg; then + sed -i 's/#000/#E4C282/g' saturn-raw.svg + inkscape -z -e saturn.png -w 40 -h 40 saturn-raw.svg + fi + + if needs_rebuild uranus.png uranus-raw.svg; then + sed -i 's/#000/#97BCC2/g' uranus-raw.svg + inkscape -z -e uranus.png -w 40 -h 40 uranus-raw.svg + fi + + if needs_rebuild neptune.png neptune-raw.svg; then + sed -i 's/#000/#274687/g' neptune-raw.svg + inkscape -z -e neptune.png -w 40 -h 40 neptune-raw.svg + fi + + if needs_rebuild krebs.png krebs-raw.svg; then + inkscape -z -e krebs.png -w 16 -h 16 krebs-raw.svg fi # -- Daymap -- @@ -167,6 +236,19 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' convert nightmap-3.png \( -fill black -colorize 70% chlora.png \) -compose lighten -composite nightmap-final.png fi + # create marker file from json + if [ -s marker.json ]; then + jq -r 'to_entries[] | @json "\(.value.latitude) \(.value.longitude) image=krebs.png"' marker.json > marker_file + echo 'position=sun image=sun.png' >> marker_file + echo 'position=moon image=moon.png' >> marker_file + echo 'position=mercury image=mercury.png' >> marker_file + echo 'position=venus image=venus.png' >> marker_file + echo 'position=mars image=mars.png' >> marker_file + echo 'position=jupiter image=jupiter.png' >> marker_file + echo 'position=uranus image=uranus.png' >> marker_file + echo 'position=neptune image=neptune.png' >> marker_file + fi + # rebuild every time to update shadow xplanet --num_times 1 --geometry $xplanet_out_size \ --output xplanet-output.png --projection merc \ -- cgit v1.2.3 From a998c96889dd314c8b58c39adac5747ae2cc0c72 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 19:11:53 +0100 Subject: realwallpaper: fix fetch_older_days --- krebs/5pkgs/simple/realwallpaper/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 1dd5e00e8..ce0c6067e 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -37,7 +37,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' days=$1 name=$2 url=$3 - if ! test "$(find $name -mmin -$days)"; then + if ! test "$(find $name -mtime -$days)"; then fetch "$name" "$url" fi } -- cgit v1.2.3 From 013fcd7d47c7526254963888fa6d4476d9e55d14 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 19:12:18 +0100 Subject: realwallpaper: show more earth --- krebs/5pkgs/simple/realwallpaper/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index ce0c6067e..c2ca0498b 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -140,8 +140,8 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' check_type krebs-raw.svg image in_size=3600x1800 - xplanet_out_size=3600x2950 - out_geometry=3200x1800+300+400 + xplanet_out_size=3200x2500 + out_geometry=3200x1800+100+350 for raw in \ nightmap-raw.jpg \ -- cgit v1.2.3 From c08493708f789de9046f6fae00d89092b3786cf0 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 19:12:31 +0100 Subject: realwallpaper: more clouds --- krebs/5pkgs/simple/realwallpaper/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index c2ca0498b..d2e49fcaf 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -259,7 +259,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' night_map=nightmap-final.png cloud_map=clouds.png cloud_threshold=1 - cloud_gamma=2.5 + cloud_gamma=6 shade=15 ''} @@ -272,7 +272,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' night_map=nightmap-final.png cloud_map=clouds.png cloud_threshold=1 - cloud_gamma=2.5 + cloud_gamma=6 marker_file=marker_file shade=15 ''} -- cgit v1.2.3 From a91fff125a3b46533db667d45493e107e9d83eea Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 20:07:45 +0100 Subject: realwallpaper: show full horizontal size --- krebs/5pkgs/simple/realwallpaper/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index d2e49fcaf..9298ef8ed 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -141,7 +141,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' in_size=3600x1800 xplanet_out_size=3200x2500 - out_geometry=3200x1800+100+350 + out_geometry=3200x1800+0+350 for raw in \ nightmap-raw.jpg \ -- cgit v1.2.3 From 6b3c216571f75ab39653f2a2bad5bc20c83b5c27 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 20:08:03 +0100 Subject: realwallpaper: darker snow --- krebs/5pkgs/simple/realwallpaper/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 9298ef8ed..81c4c0f67 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -146,7 +146,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' for raw in \ nightmap-raw.jpg \ daymap-raw.tif \ - snow-raw.jpg \ chlora-raw.jpg \ clouds-raw.png \ ; @@ -163,6 +162,10 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' convert ice-raw.jpg -fuzz 20% -fill black -opaque white -scale "$in_size" ice.png fi + if needs_rebuild snow.png snow-raw.jpg; then + convert snow-raw.jpg -fuzz 20% -fill '#DEDEDE' -opaque white -scale "$in_size" snow.png + fi + # make fire more red if needs_rebuild fire.png fire-raw.jpg; then convert fire-raw.jpg -fuzz 20% -fill '#ef840c' -opaque white -scale "$in_size" fire.png -- cgit v1.2.3 From b7b84cd4c9b41b4452bffb988650f49abdd10a79 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 Mar 2020 20:08:18 +0100 Subject: realwallpaper: add missing saturn --- krebs/5pkgs/simple/realwallpaper/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 81c4c0f67..65493d18e 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -248,6 +248,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' echo 'position=venus image=venus.png' >> marker_file echo 'position=mars image=mars.png' >> marker_file echo 'position=jupiter image=jupiter.png' >> marker_file + echo 'position=saturn image=saturn.png' >> marker_file echo 'position=uranus image=uranus.png' >> marker_file echo 'position=neptune image=neptune.png' >> marker_file fi -- cgit v1.2.3 From c9490c38abccb9ea085fb315d7a8d0085a61e495 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 26 Mar 2020 17:00:27 +0100 Subject: realwallpaper: even more clouds --- krebs/5pkgs/simple/realwallpaper/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 65493d18e..141e29117 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -263,7 +263,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' night_map=nightmap-final.png cloud_map=clouds.png cloud_threshold=1 - cloud_gamma=6 + cloud_gamma=10 shade=15 ''} @@ -276,7 +276,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' night_map=nightmap-final.png cloud_map=clouds.png cloud_threshold=1 - cloud_gamma=6 + cloud_gamma=10 marker_file=marker_file shade=15 ''} -- cgit v1.2.3 From 274424528464d7f09e65df27a255c2a88af8547f Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 30 Mar 2020 18:45:28 +0200 Subject: realwallpaper: render moon.png with xplanet --- krebs/5pkgs/simple/realwallpaper/default.nix | 60 ++++++++-------------------- 1 file changed, 16 insertions(+), 44 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 141e29117..a900a849b 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -75,8 +75,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' # fetch source images in parallel fetch_once sun-raw.png \ 'http://simpleicon.com/wp-content/uploads/sun-64x64.png' & - fetch_once moon-raw.png \ - 'http://simpleicon.com/wp-content/uploads/moon__star-64x64.png' & fetch_once nightmap-raw.jpg \ 'https://eoimages.gsfc.nasa.gov/images/imagerecords/144000/144898/BlackMarble_2016_3km.jpg' & fetch_once daymap-raw.tif \ @@ -120,7 +118,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fi check_type sun-raw.png image - check_type moon-raw.png image check_type nightmap-raw.jpg image check_type daymap-raw.tif image check_type ice-raw.jpg image @@ -175,51 +172,18 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' convert sun-raw.png -fill gold -opaque black PNG64:sun.png fi - if needs_rebuild moon.png moon-raw.png; then - convert moon-raw.png -fill royalblue -opaque black PNG64:moon.png - fi - - # -- Planets -- - - if needs_rebuild mercury.png mercury-raw.svg; then - sed -i 's/#000/#A6A6A6/g' mercury-raw.svg - inkscape -z -e mercury.png -w 40 -h 40 mercury-raw.svg - fi - - if needs_rebuild venus.png venus-raw.svg; then - sed -i 's/#000/#C40B98/g' venus-raw.svg - inkscape -z -e venus.png -w 40 -h 40 venus-raw.svg - fi - - if needs_rebuild mars.png mars-raw.svg; then - sed -i 's/#000/#E35A5C/g' mars-raw.svg - inkscape -z -e mars.png -w 40 -h 40 mars-raw.svg - fi - - if needs_rebuild jupiter.png jupiter-raw.svg; then - sed -i 's/#000/#DEA182/g' jupiter-raw.svg - inkscape -z -e jupiter.png -w 40 -h 40 jupiter-raw.svg - fi - - if needs_rebuild saturn.png saturn-raw.svg; then - sed -i 's/#000/#E4C282/g' saturn-raw.svg - inkscape -z -e saturn.png -w 40 -h 40 saturn-raw.svg - fi - - if needs_rebuild uranus.png uranus-raw.svg; then - sed -i 's/#000/#97BCC2/g' uranus-raw.svg - inkscape -z -e uranus.png -w 40 -h 40 uranus-raw.svg - fi - - if needs_rebuild neptune.png neptune-raw.svg; then - sed -i 's/#000/#274687/g' neptune-raw.svg - inkscape -z -e neptune.png -w 40 -h 40 neptune-raw.svg - fi - if needs_rebuild krebs.png krebs-raw.svg; then inkscape -z -e krebs.png -w 16 -h 16 krebs-raw.svg fi + # -- Planets -- + for planet in mercury venus mars jupiter saturn uranus neptune; do + if needs_rebuild "$planet".png "$planet"-raw.svg; then + sed -i 's/#000/#FFFF00/g' "$planet"-raw.svg + inkscape -z -e "$planet".png -w 40 -h 40 "$planet"-raw.svg + fi + done + # -- Daymap -- # merge with water chlora layer @@ -253,6 +217,14 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' echo 'position=neptune image=neptune.png' >> marker_file fi + # generate moon + xplanet -body moon --num_times 1 -origin earth \ + --transpng moon.png --geometry 50x50 \ + -config ${pkgs.writeText "moon.config" '' + [moon] + shade=10 + ''} + # rebuild every time to update shadow xplanet --num_times 1 --geometry $xplanet_out_size \ --output xplanet-output.png --projection merc \ -- cgit v1.2.3 From 07592647d1c19ce4997be05b882f63fb6b562f47 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 31 Mar 2020 17:26:09 +0200 Subject: realwallpaper: get sun image from sdo --- krebs/5pkgs/simple/realwallpaper/default.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index a900a849b..00c185391 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -73,8 +73,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' cd "$working_dir" # fetch source images in parallel - fetch_once sun-raw.png \ - 'http://simpleicon.com/wp-content/uploads/sun-64x64.png' & fetch_once nightmap-raw.jpg \ 'https://eoimages.gsfc.nasa.gov/images/imagerecords/144000/144898/BlackMarble_2016_3km.jpg' & fetch_once daymap-raw.tif \ @@ -109,6 +107,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' # regular fetches fetch marker.json "$marker_url" & + fetch sun-raw.jpg 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_0171.jpg' & wait @@ -117,7 +116,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png fi - check_type sun-raw.png image + check_type sun-raw.jpg image check_type nightmap-raw.jpg image check_type daymap-raw.tif image check_type ice-raw.jpg image @@ -168,8 +167,11 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' convert fire-raw.jpg -fuzz 20% -fill '#ef840c' -opaque white -scale "$in_size" fire.png fi - if needs_rebuild sun.png sun-raw.png; then - convert sun-raw.png -fill gold -opaque black PNG64:sun.png + # cut out sun with alpha transparency + if needs_rebuild sun.png sun-raw.jpg; then + convert sun-raw.jpg \ + \( +clone -colorspace HSB -fill white -draw "circle 256,256 256,54" -separate -delete 0,1 \) \ + -compose copyopacity -composite -crop 512x472+0+20 -scale "100x100" sun.png fi if needs_rebuild krebs.png krebs-raw.svg; then @@ -179,7 +181,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' # -- Planets -- for planet in mercury venus mars jupiter saturn uranus neptune; do if needs_rebuild "$planet".png "$planet"-raw.svg; then - sed -i 's/#000/#FFFF00/g' "$planet"-raw.svg + sed -i 's/#000/#FE8019/g' "$planet"-raw.svg inkscape -z -e "$planet".png -w 40 -h 40 "$planet"-raw.svg fi done -- cgit v1.2.3 From 5c6e007dbeb691cdadafa6615c5b23b40b6b77af Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 31 Mar 2020 17:26:28 +0200 Subject: realwallpaper: archive old wallpapers --- krebs/5pkgs/simple/realwallpaper/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 00c185391..2b0f4bd53 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -266,6 +266,8 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' convert xplanet-krebs-output.png -crop $out_geometry \ realwallpaper-krebs-tmp.png mv realwallpaper-krebs-tmp.png realwallpaper-krebs.png + mkdir -p archive + convert realwallpaper-krebs.png archive/"$(date -Is)".jpg fi } -- cgit v1.2.3 From 05cc4b81bb2a2571ff4486fe9149f465a2b54c0e Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 11 Apr 2020 17:07:30 +0200 Subject: realwallpaper: check_type via needs_rebuild --- krebs/5pkgs/simple/realwallpaper/default.nix | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 2b0f4bd53..c511458f9 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -52,9 +52,11 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' else result=1 for b; do - if test "$b" -nt "$a"; then - #echo " $b is newer than $a" >&2 - result=0 + if check_type "$b" image; then + if test "$b" -nt "$a"; then + #echo " $b is newer than $a" >&2 + result=0 + fi fi done fi @@ -116,25 +118,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png fi - check_type sun-raw.jpg image - check_type nightmap-raw.jpg image - check_type daymap-raw.tif image - check_type ice-raw.jpg image - check_type snow-raw.jpg image - check_type chlora-raw.jpg image - check_type fire-raw.jpg image - check_type clouds-raw.png image - - check_type mercury-raw.svg image - check_type venus-raw.svg image - check_type mars-raw.svg image - check_type jupiter-raw.svg image - check_type saturn-raw.svg image - check_type uranus-raw.svg image - check_type neptune-raw.svg image - - check_type krebs-raw.svg image - in_size=3600x1800 xplanet_out_size=3200x2500 out_geometry=3200x1800+0+350 -- cgit v1.2.3