jegasus / world-manager Goto Github PK
View Code? Open in Web Editor NEWA Python-based tool that helps manage FoundryVTT Worlds.
License: GNU General Public License v3.0
A Python-based tool that helps manage FoundryVTT Worlds.
License: GNU General Public License v3.0
For users that use Docker (and Docker Volumes) to host Foundry, it would be much more convenient to use.
I attempted to use this on one of my worlds and it errors out with:
Traceback (most recent call last):
File "C:\world-manager-0.0.2\jwm_cli.py", line 61, in
my_world_refs = jwm.one_liner_compress_world(
File "C:\world-manager-0.0.2\jegasus_world_manager.py", line 1748, in one_liner_compress_world
my_world_refs.fix_incorrect_file_extensions()
File "C:\world-manager-0.0.2\jegasus_world_manager.py", line 941, in fix_incorrect_file_extensions
new_img_path_for_ref = find_filename_that_doesnt_exist_yet(new_img_file_path_before_extension,
File "C:\world-manager-0.0.2\jegasus_world_manager.py", line 1686, in find_filename_that_doesnt_exist_yet
current_filename = file_path_before_extension + '.' + extension
TypeError: can only concatenate str (not "NoneType") to str
I attempted to use this tool to compress a Tomb of Annihilation world that was converted from roll20 using KaKaRoTo's converter. However, the background images for nearly every scene were deleted.
The background images are stored in worlds/toa/scenes/backgrounds:
Files before
Files after
Here's a sample scene whose background was deleted:
Scene before
Scene after
Console errors after
After running the command, the command line reported the following:
Fixed 1361 broken refs by pointing to `worlds` folder instead of `modules` folder.
The world used to obtain the information above was version 0.1.0 of ToA from the 5etools/Plutonium Foundry world conversions. Prior to running the tool, the world was launched once to raise its system version to dnd5e 0.7.9. Similar results occurred when I ran the tool on my personal ToA world, which was also converted from roll20 using KaKaRoTo's converter. The results were the same regardless of whether "delete unreferenced images" was set to "y" or "n".
OS: Windows 10
Or use a heuristic like 'if greater than 4mb try to reduce size'.
I did it using cwebp and a command like:
for img in $( find . -type f -iname "*.webp" ); do cwebp.exe $img -q 95 -o ${img}.webp; done;
for img in $( find . -type f -iname "*.webp.webp" ); do mv ${img} ${img%.*}; done;
I did it as a two-parter so I could check it the results, but it could probably be done in place.
I couldn't see any difference in image appearance, but the webp files were reduced by 25-75% in size so it seemed well worth it. (Though, it could be that I ran with -q 75 rather than 95 for the above size reduction. Try both and see what seems best.)
Hi. Great work.
I use these two files to convert MP4 to webm. Last time I used I got 4,5gb to 2,6gb.
I used Google settings (https://developers.google.com/media/vp9/settings/vod)
Do you think you can add this in a better way?
Thank you.
#!/bin/sh
for file in *.mp4
do
echo "================================"
echo "./conversor \"$file\""
./conversor "$file"
echo "================================"
done
#!/bin/sh
## Requirements
# Linux
# apt -y install mediainfo
# apt -y install ffmpeg
## Usage
# optimize NOMEDOARQUIVO.FORMATO
# Example: ./optimize.sh meuvideo.mp4
## Definições
extensao="mp4"
arquivo=$1
arquivosaida="out-2pass.webm"
arquivosaidasemsom="out-2pass-nosound.webm"
tamanho="hd" # pode ser 4k ou hd
## Ativação Opcional
taxadequadros="-framerate 30"
escalar="-vf scale=1920x1080" # Apenas ative se você quer que o vídeo tenha seu tamanho alterado
#escalar="-vf scale=3840x2160" # Apenas ative se você quer que o vídeo tenha seu tamanho alterado
### Principal
echo "====================="
echo 'Otimizar v0.04'
echo "====================="
if [ "$1" != "" ]; then
echo '===================================================='
mediainfo $1
echo '===================================================='
else
echo "You need to provide a filename."
exit
fi
## Executa a conversão
if [ $tamanho = "hd" ]; then
echo '===================================================='
echo "Comando Executado:"
echo "ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k -minrate 1500k -maxrate 2500k -quality good -crf 31 -c:a libvorbis -pass 1 -speed 4 $arquivosaida && ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k -minrate 1500k -maxrate 2500k -quality good -crf 31 -c:a libvorbis -pass 2 -speed 4 -y $arquivosaida"
echo "ffmpeg -i $arquivosaida -vcodec copy -an $arquivosaidasemsom"
echo '===================================================='
# Configuração para HD 1920 x 1080
ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k \
-minrate 1500k -maxrate 2500k -quality good \
-crf 31 -c:a libvorbis \
-pass 1 -speed 4 $arquivosaida && \
ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k \
-minrate 1500k -maxrate 2500k -quality good \
-crf 31 -c:a libvorbis \
-pass 2 -speed 4 -y $arquivosaida
else
echo '===================================================='
echo "Comando Executado:"
echo "ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k -minrate 6000k -maxrate 17400k -quality good -crf 15 -c:a libvorbis -pass 1 -speed 4 $arquivosaida && ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k -minrate 6000k -maxrate 17400k -quality good -crf 15 -c:a libvorbis -pass 2 -speed 4 -y $arquivosaida"
echo "ffmpeg -i $arquivosaida -vcodec copy -an $arquivosaidasemsom"
echo '===================================================='
# Configuração para 4K 3840 x 2160 (overkill para VTT)
ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k \
-minrate 6000k -maxrate 17400k -quality good \
-crf 15 -c:a libvorbis \
-pass 1 -speed 4 $arquivosaida && \
ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k \
-minrate 6000k -maxrate 17400k -quality good \
-crf 15 -c:a libvorbis \
-pass 2 -speed 4 -y $arquivosaida
fi
mkdir -p original
mkdir -p otimizado
mv $1 original
#mv $arquivosaida otimizado/$1
mv -- "$arquivosaida" otimizado/"$(basename -- "$1" ."$extensao").webm"
rm ffmpeg2pass-0.log
echo "Finalizado ${1}"
echo '===================================================='
In my case, my original world somehow ended up with two different images with the same name but different extensions:
image.png
image.jpg
After compressing the world using your tool, only one of the images got converted to .webp
- the other image got deleted.
Maybe some sort of warning, or renaming, could occur if multiple images share the same name but have different extensions?
This appears to cause duplicative file names (even in different directories) to get cleared out after the first one is processed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.