Diskussion:DjVu
Zur Navigation springen
Zur Suche springen
Test script für DjVu
Benötigt
- https://github.com/WolfgangFahl/py-3rdparty-mediawiki
- https://pypi.org/project/pymediawikidocker/
- wikiuser mit id "gen" für das Originalwiki wird benötig - mit oder ohne passwort
#!/bin/bash
# WF 2024-04-27
wiki_id=genwiki
mw_version=1.39.7
#mw_version=1.35.13
# update local settings
local_settings() {
local l_container="$1"
docker exec $l_container bash -c "cat << 'EOF' >> /var/www/html/LocalSettings.php
\$wgLanguageCode = 'de';
\$wgEnableUploads = true;
\$wgFileExtensions[] = 'djvu';
\$wgFileExtensions[] = 'png';
\$wgFileExtensions[] = 'svg';
# Increase max number of pixels for thumbnail creation
\$wgMaxImageArea = 25e6; // 25 Megapixel
# use instant commons for testing
#\$wgUseInstantCommons = true;
# setup logging
\$wgDebugLogFile = '/var/log/mediawiki/$wiki_id.log';
EOF"
}
#
# prepare some djvu examples
#
djvu_examples()
{
wb=$HOME/wikibackup/$wiki_id
mkdir -p $wb
cd $wb
image=Aachen-Landkreis-AB-1950-51.djvu
if [ ! -f $image ]
then
wget https://wiki-devel.genealogy.net/images/6/60/$image
fi
wikiupload -t $wiki_id --files $image
cat<<EOF > $wb/Example1.wiki
[[File:$image]]
EOF
wikirestore -t $wiki_id -p Example1
image="Life_of_Sir_William_Petty_1623_–_1687.djvu"
if [ ! -f $image ]
then
wget https://upload.wikimedia.org/wikipedia/commons/4/4a/Life_of_Sir_William_Petty_1623_%E2%80%93_1687.djvu
fi
local_image="LifeOfSirWilliamPetty_1623_to_1687.djvu"
cp -p $image $local_image
wikiupload -t $wiki_id --files $local_image
cat<<EOF > $wb/Example2.wiki
[[File:$local_image]]
EOF
wikirestore -t $wiki_id -p Example2
cat<<EOF > $wb/Example3.wiki
[[File:$image]]
EOF
wikirestore -t $wiki_id -p Example3
cat << EOF > $wb/Example4.wiki
[[File:Skibinski_pamietnik0001.djvu]]
EOF
wikirestore -t $wiki_id -p Example4
}
date
# shut down existing docker containers
profiwiki -cn $wiki_id --down
# remove volumes
docker volume rm ${wiki_id}_mysql-data ${wiki_id}_wiki-www ${wiki_id}_wiki-etc
# remove configuration
rm -rf /home/wf/.pymediawikidocker/$wiki_id/
# recreate the cluster and start it
mwcluster -f -cn $wiki_id -vl $mw_version -el DjVu ParserFunctions --create
local_settings ${wiki_id}-mw
for script in install_djvu.sh fixPermissions.sh
do
docker exec ${wiki_id}-mw /bin/bash /root/$script
done
# create examples
djvu_examples
# push pages
wikipush -s gen -t $wiki_id -p Verlustliste_Stalingrad Landkreis_Aachen/Adressbuch_1950-51 "Template:Verlustliste Stalingrad Portalbox" "Template:Info Adressbuch" -wi -f -i
# time
date
# bash into to wiki docker container
docker exec -it genwiki-mw /bin/bash
Verzeichnis-Dateien versus Image Dateien
djvudump 100Jahre-SanktAgatha-Straberg.djvu
FORM:DJVM [215]
DIRM [203] Document directory (indirect, 32 files 32 pages)
Seiite_000_0001.djvu -> Seiite_000_0001.djvu
Seiite_001_0001.djvu -> Seiite_001_0001.djvu
Seiite_002_0001.djvu -> Seiite_002_0001.djvu
Seiite_003_0001.djvu -> Seiite_003_0001.djvu
Seiite_004_0001.djvu -> Seiite_004_0001.djvu
Seiite_005_0001.djvu -> Seiite_005_0001.djvu
Seiite_006_0001.djvu -> Seiite_006_0001.djvu
Seiite_007_0001.djvu -> Seiite_007_0001.djvu
Seiite_008_0001.djvu -> Seiite_008_0001.djvu
Seiite_009_0001.djvu -> Seiite_009_0001.djvu
Seiite_010_0001.djvu -> Seiite_010_0001.djvu
Seiite_011_0001.djvu -> Seiite_011_0001.djvu
Seiite_012_0001.djvu -> Seiite_012_0001.djvu
Seiite_013_0001.djvu -> Seiite_013_0001.djvu
Seiite_014_0001.djvu -> Seiite_014_0001.djvu
Seiite_015_0001.djvu -> Seiite_015_0001.djvu
Seiite_016_0001.djvu -> Seiite_016_0001.djvu
Seiite_017_0001.djvu -> Seiite_017_0001.djvu
Seiite_018_0001.djvu -> Seiite_018_0001.djvu
Seiite_019_0001.djvu -> Seiite_019_0001.djvu
Seiite_020_0001.djvu -> Seiite_020_0001.djvu
Seiite_021_0001.djvu -> Seiite_021_0001.djvu
Seiite_022_0001.djvu -> Seiite_022_0001.djvu
Seiite_023_0001.djvu -> Seiite_023_0001.djvu
Seiite_024_0001.djvu -> Seiite_024_0001.djvu
Seiite_025_0001.djvu -> Seiite_025_0001.djvu
Seiite_026_0001.djvu -> Seiite_026_0001.djvu
Seiite_027_0001.djvu -> Seiite_027_0001.djvu
Seiite_028_0001.djvu -> Seiite_028_0001.djvu
Seiite_029_0001.djvu -> Seiite_029_0001.djvu
Seiite_030_0001.djvu -> Seiite_030_0001.djvu
Seiite_031_0001.djvu -> Seiite_031_0001.djvu
djvudump Seiite_000_0001.djvu
FORM:DJVU [236967]
INFO [10] DjVu 1653x2335, v21, 300 dpi, gamma=2.2
BG44 [16945] IW4 data #1, 74 slices, v1.2 (color), 1653x2335
BG44 [36592] IW4 data #2, 10 slices
BG44 [45212] IW4 data #3, 4 slices
BG44 [138163] IW4 data #4, 9 slices
Zeitbedarf
time for file in *.djvu; do djvudump "$file"; done
75s für 2648 Dateien -> ca. 1/2 Tag für alle Dateien