master: work in progress [might break]
This commit is contained in:
parent
28dbc2dd7d
commit
d4cdb4af61
4 changed files with 28 additions and 46 deletions
|
|
@ -54,7 +54,7 @@ begin
|
||||||
first_item = feed.items.first
|
first_item = feed.items.first
|
||||||
if first_item
|
if first_item
|
||||||
description = CGI.unescapeHTML(first_item.description.to_s).gsub(/<[^>]*>/, '')
|
description = CGI.unescapeHTML(first_item.description.to_s).gsub(/<[^>]*>/, '')
|
||||||
description = description.length > 150 ? description = description[0,200] + " (..)" : description
|
description = description.length > 130 ? description = description[0,130] + " (..)" : description
|
||||||
else
|
else
|
||||||
XRForge.log("❌ did not find post", logfile)
|
XRForge.log("❌ did not find post", logfile)
|
||||||
exit 0
|
exit 0
|
||||||
|
|
@ -69,24 +69,8 @@ begin
|
||||||
imgurl = img[1]
|
imgurl = img[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
cmd = "cp -r /root/assets/template/mastodon-post .xrforge/. && rm .xrforge/mastodon-post/mastodon-post.png && "
|
# generate the final .glb
|
||||||
|
system("/root/templates/mastodon-post/mastodon-post.sh", description, feed.channel.title, feed.channel.link, APHandle, "#{dir}/mastodon-post.glb")
|
||||||
text = "\n\"#{description}\""
|
|
||||||
textFile = ".xrforge/mastodon-post/mastodon-post.txt"
|
|
||||||
File.open(textFile,'w') do |file|
|
|
||||||
file.puts text
|
|
||||||
end
|
|
||||||
|
|
||||||
cmd = cmd + "magick -size 800x800 -background white -pointsize 48 -interline-spacing 10 -fill \\#555 -gravity center -font /usr/local/lib/ruby/3.4.0/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf caption:@#{textFile}"
|
|
||||||
cmd = cmd + " -pointsize 18 -fill \\#FFFFFF -gravity NorthWest -annotate +152+100 #{APHandle} "
|
|
||||||
cmd = cmd + " -fill \\#9c9cc9 -gravity NorthWest -annotate +152+130 #{feed.channel.title} "
|
|
||||||
cmd = cmd + " -fill \\#9c9cc9 -gravity NorthWest -annotate +40+470 #{feed.channel.link} "
|
|
||||||
cmd = cmd + " PNG8:.xrforge/mastodon-post/mastodon-post.png &&"
|
|
||||||
cmd = cmd + "cd .xrforge/mastodon-post && assimp export mastodon-post.gltf mastodon-post.glb && mv mastodon-post.glb ../../."
|
|
||||||
ret = system(cmd)
|
|
||||||
if ret != 0
|
|
||||||
XRForge.log("❌ something went wrong :(", logfile)
|
|
||||||
end
|
|
||||||
|
|
||||||
XRForge.log(" ", logfile)
|
XRForge.log(" ", logfile)
|
||||||
|
|
||||||
|
|
|
||||||
BIN
manyfold/root/templates/mastodon-post/Montserrat-SemiBold.ttf
Normal file
BIN
manyfold/root/templates/mastodon-post/Montserrat-SemiBold.ttf
Normal file
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
test -n "$6" || { echo "usage: ./mastodon-post.sh <text> <title> <link> <handle> <ttf-file> </abs/path/to/out.glb>"; exit 0; }
|
test -n "$5" || { echo "usage: ./mastodon-post.sh <text> <title> <link> <handle> </abs/path/to/out.glb>"; exit 0; }
|
||||||
|
|
||||||
out="$6"
|
out="$5"
|
||||||
tmpdir=/tmp/.mastodon-post
|
tmpdir=/tmp/.mastodon-post
|
||||||
mydir="$(dirname $(readlink -f $0))"
|
mydir="$(dirname $(readlink -f $0))"
|
||||||
cd $mydir
|
cd $mydir
|
||||||
|
|
@ -14,17 +14,16 @@ rm $tmpdir/mastodon-post.png # IMPORTANT: prevent newer/older imagemagick -clobb
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
magick $tmpdir/mastodon-post-bg.png \
|
magick $tmpdir/mastodon-post-bg.png \
|
||||||
\( -background none -pointsize 48 -interline-spacing 10 -fill \#FFF -font "$5" "caption:$1" \) \
|
\( -size 580x -background none -pointsize 32 -interline-spacing 10 -fill \#FFF -font Montserrat-SemiBold.ttf "caption:$1" \) \
|
||||||
-gravity center -composite \
|
-gravity center -composite \
|
||||||
-pointsize 18 \
|
-pointsize 20 \
|
||||||
-fill \#FFFFFF -gravity NorthWest -annotate +152+100 "$4" \
|
-fill \#FFFFFF -gravity NorthWest -annotate +152+130 "$4" \
|
||||||
-fill \#9c9cc9 -gravity NorthWest -annotate +152+130 "$2" \
|
-fill \#9c9cc9 -gravity NorthWest -annotate +152+160 "$2" \
|
||||||
-fill \#9c9cc9 -gravity NorthWest -annotate +40+470 "$3" \
|
-fill \#9c9cc9 -gravity NorthWest -annotate +52+460 "$3" \
|
||||||
PNG8:$tmpdir/mastodon-post.png
|
-define png:compression-level=9 \
|
||||||
|
-define png:compression-filter=5 \
|
||||||
# -define png:compression-level=9 \
|
-define png:compression-strategy=1 \
|
||||||
# -define png:compression-filter=5 \
|
$tmpdir/mastodon-post.png
|
||||||
# -define png:compression-strategy=1 \
|
|
||||||
|
|
||||||
cd $tmpdir
|
cd $tmpdir
|
||||||
assimp export mastodon-post.gltf $out
|
assimp export mastodon-post.gltf $out --embed-textures
|
||||||
|
|
|
||||||
|
|
@ -38,18 +38,18 @@ let
|
||||||
finalImageTag = "latest";
|
finalImageTag = "latest";
|
||||||
};
|
};
|
||||||
|
|
||||||
# # generate the reproducable blob below via:
|
# generate the reproducable blob below via:
|
||||||
# # $ nix-shell -p nix-prefetch-github --command 'nix-prefetch-github assimp assimp --rev e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5'
|
# $ nix-shell -p nix-prefetch-github --command 'nix-prefetch-github assimp assimp --rev e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5'
|
||||||
# assimpSrc = pkgs.fetchFromGitHub {
|
assimpSrc = pkgs.fetchFromGitHub {
|
||||||
# "owner" = "assimp";
|
"owner" = "assimp";
|
||||||
# "repo" = "assimp";
|
"repo" = "assimp";
|
||||||
# "rev" = "e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5";
|
"rev" = "e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5";
|
||||||
# "hash" = "sha256-ja5pFwpnzLT2MDIR8ISwC6+eA5UXyqRZW2CMCCrF1Q0=";
|
"hash" = "sha256-ja5pFwpnzLT2MDIR8ISwC6+eA5UXyqRZW2CMCCrF1Q0=";
|
||||||
# };
|
};
|
||||||
# myAssimp = pkgs.pkgsStatic.assimp.overrideAttrs (oldAttrs: {
|
myAssimp = pkgs.pkgsStatic.assimp.overrideAttrs (oldAttrs: {
|
||||||
# inherit assimpSrc; # Set the source to the fetched commit
|
inherit assimpSrc; # Set the source to the fetched commit
|
||||||
# src = assimpSrc;
|
src = assimpSrc;
|
||||||
# });
|
});
|
||||||
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
@ -76,8 +76,7 @@ rec
|
||||||
pkgs.pkgsStatic.inotify-tools # inotifywait e.g.
|
pkgs.pkgsStatic.inotify-tools # inotifywait e.g.
|
||||||
pkgs.pkgsStatic.zip # inotifywait e.g.
|
pkgs.pkgsStatic.zip # inotifywait e.g.
|
||||||
pkgs.pkgsStatic.ts # job management
|
pkgs.pkgsStatic.ts # job management
|
||||||
pkgs.pkgsStatic.assimp # job management
|
myAssimp # cli 3D editing/conversion
|
||||||
# myAssimp # cli 3D editing/conversion
|
|
||||||
./..
|
./..
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue