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
|
||||
if first_item
|
||||
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
|
||||
XRForge.log("❌ did not find post", logfile)
|
||||
exit 0
|
||||
|
|
@ -68,25 +68,9 @@ begin
|
|||
if img and img[1] and img[1].match(/(png|jpg)/)
|
||||
imgurl = img[1]
|
||||
end
|
||||
|
||||
cmd = "cp -r /root/assets/template/mastodon-post .xrforge/. && rm .xrforge/mastodon-post/mastodon-post.png && "
|
||||
|
||||
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
|
||||
# generate the final .glb
|
||||
system("/root/templates/mastodon-post/mastodon-post.sh", description, feed.channel.title, feed.channel.link, APHandle, "#{dir}/mastodon-post.glb")
|
||||
|
||||
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
|
||||
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
|
||||
mydir="$(dirname $(readlink -f $0))"
|
||||
cd $mydir
|
||||
|
|
@ -14,17 +14,16 @@ rm $tmpdir/mastodon-post.png # IMPORTANT: prevent newer/older imagemagick -clobb
|
|||
|
||||
set -x
|
||||
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 \
|
||||
-pointsize 18 \
|
||||
-fill \#FFFFFF -gravity NorthWest -annotate +152+100 "$4" \
|
||||
-fill \#9c9cc9 -gravity NorthWest -annotate +152+130 "$2" \
|
||||
-fill \#9c9cc9 -gravity NorthWest -annotate +40+470 "$3" \
|
||||
PNG8:$tmpdir/mastodon-post.png
|
||||
|
||||
# -define png:compression-level=9 \
|
||||
# -define png:compression-filter=5 \
|
||||
# -define png:compression-strategy=1 \
|
||||
-pointsize 20 \
|
||||
-fill \#FFFFFF -gravity NorthWest -annotate +152+130 "$4" \
|
||||
-fill \#9c9cc9 -gravity NorthWest -annotate +152+160 "$2" \
|
||||
-fill \#9c9cc9 -gravity NorthWest -annotate +52+460 "$3" \
|
||||
-define png:compression-level=9 \
|
||||
-define png:compression-filter=5 \
|
||||
-define png:compression-strategy=1 \
|
||||
$tmpdir/mastodon-post.png
|
||||
|
||||
cd $tmpdir
|
||||
assimp export mastodon-post.gltf $out
|
||||
assimp export mastodon-post.gltf $out --embed-textures
|
||||
|
|
|
|||
|
|
@ -38,18 +38,18 @@ let
|
|||
finalImageTag = "latest";
|
||||
};
|
||||
|
||||
# # generate the reproducable blob below via:
|
||||
# # $ nix-shell -p nix-prefetch-github --command 'nix-prefetch-github assimp assimp --rev e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5'
|
||||
# assimpSrc = pkgs.fetchFromGitHub {
|
||||
# "owner" = "assimp";
|
||||
# "repo" = "assimp";
|
||||
# "rev" = "e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5";
|
||||
# "hash" = "sha256-ja5pFwpnzLT2MDIR8ISwC6+eA5UXyqRZW2CMCCrF1Q0=";
|
||||
# };
|
||||
# myAssimp = pkgs.pkgsStatic.assimp.overrideAttrs (oldAttrs: {
|
||||
# inherit assimpSrc; # Set the source to the fetched commit
|
||||
# src = assimpSrc;
|
||||
# });
|
||||
# generate the reproducable blob below via:
|
||||
# $ nix-shell -p nix-prefetch-github --command 'nix-prefetch-github assimp assimp --rev e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5'
|
||||
assimpSrc = pkgs.fetchFromGitHub {
|
||||
"owner" = "assimp";
|
||||
"repo" = "assimp";
|
||||
"rev" = "e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5";
|
||||
"hash" = "sha256-ja5pFwpnzLT2MDIR8ISwC6+eA5UXyqRZW2CMCCrF1Q0=";
|
||||
};
|
||||
myAssimp = pkgs.pkgsStatic.assimp.overrideAttrs (oldAttrs: {
|
||||
inherit assimpSrc; # Set the source to the fetched commit
|
||||
src = assimpSrc;
|
||||
});
|
||||
|
||||
|
||||
in
|
||||
|
|
@ -76,8 +76,7 @@ rec
|
|||
pkgs.pkgsStatic.inotify-tools # inotifywait e.g.
|
||||
pkgs.pkgsStatic.zip # inotifywait e.g.
|
||||
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