Merge branch 'master' of seb.lautre.net/git/seb/scripts...
...Merge branch 'master' of http://seb.lautre.net/git/seb/scripts
... | ... |
@@ -5,7 +5,7 @@ hangar[path]=$HOME/.fgfs/flightgear-fgaddon/Aircraft |
5 | 5 |
hangar[name]=FGADDON |
6 | 6 |
hangar[source]=sourceforge |
7 | 7 |
hangar[type]=svn |
8 |
-hangar[url]=https://svn.code.sf.net/p/flightgear/fgaddon/trunk/Aircraft |
|
8 |
+hangar[url]=https://svn.code.sourceforge.net/p/flightgear/fgaddon/trunk/Aircraft |
|
9 | 9 |
hangar[active]=1 |
10 | 10 |
|
11 | 11 |
function getfromrepo () { |
... | ... |
@@ -14,6 +14,8 @@ cmake -DVSP_USE_SYSTEM_LIBXML2=true \ |
14 | 14 |
-DPYTHON_INCLUDE_DIR='/usr/include/python3.9' \ |
15 | 15 |
-DPYTHON_INCLUDE_PATH='/usr/include' \ |
16 | 16 |
-DCMAKE_BUILD_TYPE=Release \ |
17 |
+ -DCMAKE_CXX_COMPILER=g++-11 \ |
|
18 |
+ -DCMAKE_CC_COMPILER=gcc-11 \ |
|
17 | 19 |
$fgfs_source/OpenVSP/Libraries \ |
18 | 20 |
&& make -j$simultaneous \ |
19 | 21 |
&& cmake_options+=("-DVSP_LIBRARY_PATH=$fgfs_build/OpenVSPlibs") \ |
... | ... |
@@ -4,26 +4,34 @@ pdf="$1" |
4 | 4 |
size=$(pdfinfo "$pdf" | awk '/^Page size:/{ |
5 | 5 |
a = $3 |
6 | 6 |
b = $5 |
7 |
- if (a >= 419 && a <= 421 && b >= 594 && b <= 596 ) print "a5" |
|
8 |
- if (a >= 594 && a <= 596 && b >= 419 && b <= 421 ) print "a5" |
|
9 |
- if (a >= 594 && a <= 596 && b >= 841 && b <= 843 ) print "a4" |
|
10 |
- if (a >= 841 && a <= 843 && b >= 594 && b <= 596 ) print "a4" |
|
11 |
- if (a >= 841 && a <= 843 && b >= 1189 && b <= 1191) print "a3" |
|
12 |
- if (a >= 1189 && a <= 1191 && b >= 841 && b <= 843 ) print "a3" |
|
7 |
+ if (a >= 419 && a <= 421 && b >= 594 && b <= 596 ) print "a5 portrait" |
|
8 |
+ if (a >= 594 && a <= 596 && b >= 419 && b <= 421 ) print "a5 paysage" |
|
9 |
+ if (a >= 594 && a <= 596 && b >= 841 && b <= 843 ) print "a4 portrait" |
|
10 |
+ if (a >= 841 && a <= 843 && b >= 594 && b <= 596 ) print "a4 paysage" |
|
11 |
+ if (a >= 841 && a <= 843 && b >= 1189 && b <= 1191) print "a3 portrait" |
|
12 |
+ if (a >= 1189 && a <= 1191 && b >= 841 && b <= 843 ) print "a3 paysage" |
|
13 | 13 |
}') |
14 | 14 |
pages=$(pdfinfo "$pdf" | awk '/Pages:/{print $2}') |
15 | 15 |
output=$(mktemp --dry-run /dev/shm/XXXXXXXX.pdf) |
16 | 16 |
recto=$(mktemp --directory /dev/shm/XXXXXXXX) |
17 | 17 |
verso=$(mktemp --directory /dev/shm/XXXXXXXX) |
18 | 18 |
|
19 |
-if test "${size,,}" != "a5"; then |
|
19 |
+if test "${size% *}" != "a5"; then |
|
20 | 20 |
gs -o $output -sDEVICE=pdfwrite -sPAPERSIZE=a5 -dFIXEDMEDIA -dPDFFitPage -dCompatibilityLevel=1.6 "$pdf" |
21 | 21 |
else |
22 | 22 |
cp "$pdf" $output |
23 | 23 |
fi |
24 |
-pdfjam --paper a4paper --nup '2x1' --landscape --outfile $recto -- "$output" 1 "$output" 1 |
|
24 |
+if test "${size#* }" = "portrait"; then |
|
25 |
+ pdfjam --paper a4paper --nup '2x1' --landscape --outfile $recto -- "$output" 1 "$output" 1 |
|
26 |
+else |
|
27 |
+ pdfjam --paper a4paper --nup '1x2' --no-landscape --outfile $recto -- "$output" 1 "$output" 1 |
|
28 |
+fi |
|
25 | 29 |
if test $pages -eq 2; then |
26 |
- pdfjam --paper a4paper --nup '2x1' --landscape --outfile $verso -- "$output" 2 "$output" 2 |
|
30 |
+ if test "${size#* }" = "portrait"; then |
|
31 |
+ pdfjam --paper a4paper --nup '2x1' --landscape --outfile $verso -- "$output" 2 "$output" 2 |
|
32 |
+ else |
|
33 |
+ pdfjam --paper a4paper --nup '1x2' --no-landscape --outfile $verso -- "$output" 2 "$output" 2 |
|
34 |
+ fi |
|
27 | 35 |
pdftk A=$(find $recto -name "*pdf") B=$(find $verso -name "*pdf") cat A B output "$output" |
28 | 36 |
else |
29 | 37 |
mv $(find $recto -name "*pdf") $output |
... | ... |
@@ -120,3 +120,24 @@ function piwigo_private () { |
120 | 120 |
_turn 20 || return |
121 | 121 |
test "$(curl --silent 'http://192.168.0.71/photos/ws.php?format=json&method=pwg.categories.getList' | sum)" = "00569 1" || echo "albums visibles publiquement" |
122 | 122 |
} |
123 |
+ |
|
124 |
+function snappymail_version () { |
|
125 |
+ _turn 24 || return |
|
126 |
+ local installed_version=$(</var/www/rainloop/data/VERSION) |
|
127 |
+ local release_url='https://api.github.com/repos/the-djmaze/snappymail/releases/latest' |
|
128 |
+ local version=$(curl -sL -H "Accept: application/vnd.github+json" $release_url | jq -r '.name | ltrimstr("v")') |
|
129 |
+ if test $version != $installed_version; then |
|
130 |
+ echo "nouvelle version dispo: $version" |
|
131 |
+ fi |
|
132 |
+} |
|
133 |
+ |
|
134 |
+function navidrome_version () { |
|
135 |
+ _turn 24 || return |
|
136 |
+ local installed_version=$(find ~navidrome/navidrome -printf "%C@") |
|
137 |
+ local release_url='https://api.github.com/repos/navidrome/navidrome/releases/latest' |
|
138 |
+ local version=$(curl -sL -H "Accept: application/vnd.github+json" $release_url \ |
|
139 |
+ | jq -r '.assets | .[] | select(.name | contains("linux_armv7")) | .updated_at | fromdateiso8601') |
|
140 |
+ if test $version -gt ${installed_version%.*}; then |
|
141 |
+ echo "nouvelle version dispo" |
|
142 |
+ fi |
|
143 |
+} |
... | ... |
@@ -38,16 +38,14 @@ for i in 2 3; do |
38 | 38 |
${prtInputMaxCapacity}.$i \ |
39 | 39 |
${prtInputCurrentLevel}.$i \ |
40 | 40 |
${prtInputMediaDimFeedDirChosen}.$i \ |
41 |
- ${prtInputMediaDimXFeedDirChosen}.$i | awk -v inputslot=$((i - 1)) ' |
|
41 |
+ ${prtInputMediaDimXFeedDirChosen}.$i | awk -v inputslot=$((i - 1)) -v output=${1:-normal} ' |
|
42 | 42 |
BEGIN { |
43 | 43 |
i = 0 |
44 | 44 |
format["82667 x 116900"] = "A4 portrait / A5 paysage" |
45 | 45 |
format["116900 x 82667"] = "A4 paysage" |
46 | 46 |
format["165333 x 117000"] = "A3 paysage" |
47 |
- is[1] = "A" |
|
48 |
- is[2] = "B" |
|
49 |
- is[3] = "C" |
|
50 |
- is[4] = "D" |
|
47 |
+ is[1] = "B" |
|
48 |
+ is[2] = "A" |
|
51 | 49 |
} |
52 | 50 |
{ |
53 | 51 |
a[i] = $NF |
... | ... |
@@ -56,7 +54,10 @@ for i in 2 3; do |
56 | 54 |
END { |
57 | 55 |
size = a[2] " x " a[3] |
58 | 56 |
f = format[size] ? format[size] : "format inconnu : " a[2] " x " a[3] |
59 |
- printf("bac %d (InputSlot=PF730%s): %d%% (%s)\n", inputslot, is[inputslot], a[1]/a[0]*100, f) |
|
57 |
+ if (output == "normal") |
|
58 |
+ printf("bac %d (InputSlot=PF500%s): %d%% (%s)\n", inputslot, is[inputslot], a[1]/a[0]*100, f) |
|
59 |
+ else |
|
60 |
+ printf("bac %d (%s): %d%%\n", inputslot, f, a[1]/a[0]*100) |
|
60 | 61 |
} |
61 | 62 |
' |
62 | 63 |
done |
... | ... |
@@ -46,8 +46,8 @@ function help (rc) { |
46 | 46 |
if (/^#help:BEGIN/) help_started = 1 |
47 | 47 |
if (/^#help:END/) help_started = 0 |
48 | 48 |
if (help_started) { |
49 |
- if (/^[[:blank:]]*case \/\^(.+)\$\/[[:blank:]]*\:[[:blank:]]*$/) { |
|
50 |
- option = gensub(/^[[:blank:]]*case \/\^(.+)\$\/[[:blank:]]*\:[[:blank:]]*$/, "\\1", "1") |
|
49 |
+ if (/^[[:blank:]]*case \/\^(.+)\$\/[[:blank:]]*:[[:blank:]]*$/) { |
|
50 |
+ option = gensub(/^[[:blank:]]*case \/\^(.+)\$\/[[:blank:]]*:[[:blank:]]*$/, "\\1", "1") |
|
51 | 51 |
line = line "\n\n\033[1m" option "\033[0m" |
52 | 52 |
} |
53 | 53 |
else if (/^#help:/ && option != "") { |
... | ... |
@@ -1,5 +1,9 @@ |
1 | 1 |
#!/bin/bash |
2 | 2 |
|
3 |
+set -e |
|
4 |
+ |
|
5 |
+test $USER = www-data |
|
6 |
+ |
|
3 | 7 |
thumbnailsconf=${1:-${0##*/}.conf} |
4 | 8 |
test -r "$thumbnailsconf" || exit 1 |
5 | 9 |
shift |
... | ... |
@@ -13,6 +17,7 @@ imgsize[medium]=" 792 594" |
13 | 17 |
imgsize[small]=" 576 432" |
14 | 18 |
imgsize[xsmall]=" 432 324" |
15 | 19 |
imgsize[2small]=" 240 180" |
20 |
+imgsize[square]=" 120 120" |
|
16 | 21 |
|
17 | 22 |
if test $# -gt 0; then |
18 | 23 |
filter=$(echo $@ | sed 's/ /|/g') |
... | ... |
@@ -47,7 +52,7 @@ if ! which convert > /dev/null; then |
47 | 52 |
exit 1 |
48 | 53 |
fi |
49 | 54 |
|
50 |
-sqlcmd="select path from ${dbprefix}images |
|
55 |
+sqlcmd="select distinct path from ${dbprefix}images |
|
51 | 56 |
where id in ( |
52 | 57 |
select distinct image_id from ${dbprefix}image_category |
53 | 58 |
where category_id in ( |
... | ... |
@@ -55,35 +60,60 @@ sqlcmd="select path from ${dbprefix}images |
55 | 60 |
) |
56 | 61 |
)" |
57 | 62 |
|
58 |
-IFS=$'\n' |
|
59 |
-for file in $(mysql -N -u $dbuser -p${dbpasswd} $dbname <<< $sqlcmd); do |
|
60 |
- format="" |
|
61 |
- fnNoExt="${file%.*}" |
|
62 |
- fnExt="${file##*.}" |
|
63 |
- fnPath="${file%/*}" |
|
64 |
- test $fnExt = 'mp4' && continue |
|
65 |
- cmd="sudo -u www-data convert \"$site/$file\" -write mpr:image +delete " |
|
66 |
- count=0 |
|
67 |
- for size in ${!imgsize[@]}; do |
|
68 |
- if ! test -e "${destDir}/${fnNoExt}-${size:0:2}.$fnExt" -a -z "$FORCE"; then |
|
69 |
- format+="$size " |
|
70 |
- cmd+="mpr:image -filter Lanczos -auto-orient -strip -quality 95 -interlace line -sampling-factor 4:2:2 " |
|
71 |
- cmd+="-resize ${width[$size]}x${height[$size]} -write \"${destDir}/${fnNoExt}-${size:0:2}.$fnExt\" +delete " |
|
72 |
- let count++ |
|
73 |
- fi |
|
63 |
+function get_ext_fn () { |
|
64 |
+ fnNoExt="${1%.*}" |
|
65 |
+ fnExt="${1##*.}" |
|
66 |
+ fnPath="${1%/*}" |
|
67 |
+} |
|
68 |
+ |
|
69 |
+function get_formats () { |
|
70 |
+ local IFS=$'\n' |
|
71 |
+ for file in $(mysql -N -u $dbuser -p${dbpasswd} $dbname <<< $sqlcmd); do |
|
72 |
+ get_ext_fn "$file" |
|
73 |
+ test $fnExt = 'mp4' && continue |
|
74 |
+ for size in ${!imgsize[@]}; do |
|
75 |
+ if ! test -e "${destDir}/${fnNoExt}-${size:0:2}.$fnExt" -a -z "$FORCE"; then |
|
76 |
+ formats[$file]+="$size " |
|
77 |
+ let total_ext++ |
|
78 |
+ fi |
|
79 |
+ done |
|
74 | 80 |
done |
75 |
- if test -n "$format"; then |
|
76 |
- echo "$site/$file : $format" |
|
77 |
- if test -n "$LIST"; then |
|
78 |
- continue |
|
79 |
- fi |
|
80 |
- echo -n "please wait... " |
|
81 |
- cmd=$(sed -r 's/^(.+) -write (.*) \+delete $/\1 \2/' <<< $cmd) |
|
82 |
- eval $(echo -e nice -20 $cmd) |
|
81 |
+} |
|
82 |
+ |
|
83 |
+function calc_left () { |
|
84 |
+ local format=(${formats[$file]}) |
|
85 |
+ unset formats[$file] |
|
86 |
+ total_ext=$(( $total_ext - ${#format[@]} )) |
|
87 |
+} |
|
88 |
+ |
|
89 |
+declare -A formats |
|
90 |
+total_ext=1 |
|
91 |
+get_formats |
|
92 |
+let total_ext-- |
|
93 |
+ |
|
94 |
+if test -n "$LIST"; then |
|
95 |
+ for file in "${!formats[@]}"; do |
|
96 |
+ echo "[${#formats[@]}/$total_ext] $file : ${formats[$file]}" |
|
97 |
+ calc_left |
|
98 |
+ done |
|
99 |
+else |
|
100 |
+ for file in "${!formats[@]}"; do |
|
101 |
+ unset cmd |
|
102 |
+ sleep_duration=1 |
|
103 |
+ get_ext_fn "$file" |
|
104 |
+ for size in ${formats[$file]}; do |
|
105 |
+ cmd+=(mpr:image -resize ${width[$size]}x${height[$size]} -write "${destDir}/${fnNoExt}-${size:0:2}.$fnExt" +delete) |
|
106 |
+ let sleep_duration++ |
|
107 |
+ done |
|
108 |
+ printf "\r\033[K[${#formats[@]}/$total_ext] $file : ${formats[$file]}" |
|
109 |
+ cmd[-1]="null:" |
|
110 |
+ nice -20 convert \ |
|
111 |
+ -filter Lanczos -strip -auto-orient -quality 95 -interlace line -sampling-factor 4:2:2 \ |
|
112 |
+ "$site/$file" +write "${cmd[@]}" |
|
83 | 113 |
for size in ${!imgsize[@]}; do |
84 |
- test -s "${destDir}/${fnNoExt}-${size:0:2}.$fnExt" || echo "missing extension ${size:0:2}.$fnExt" |
|
114 |
+ test -s "${destDir}/${fnNoExt}-${size:0:2}.$fnExt" || echo -e "\nmissing extension ${size:0:2}.$fnExt" |
|
85 | 115 |
done |
86 |
- echo "done, sleeping..." |
|
87 |
- sleep $(( 2 + $count )) |
|
88 |
- fi |
|
89 |
-done |
|
116 |
+ sleep $sleep_duration |
|
117 |
+ calc_left |
|
118 |
+ done |
|
119 |
+fi |