1
1
#! /bin/bash
2
- # Scan2Thunderbird GUI #
3
- # v0.2 #
4
- # #
2
+ # Scan2Thunderbird GUI #
3
+ # v1.0 #
4
+ # #
5
5
# To run, this script needs this packages : #
6
6
# sane, imagemagick, gzip, thunderbird, zenity & shred #
7
7
# #
8
8
# GNU Public License v3 #
9
9
# #
10
10
# Copyright © 2012 Aurélien PIERRE #
11
- # https://aurelienpierre.com - [email protected] #
11
+ # https://aurelienpierre.com - [email protected] #
12
12
# #
13
13
# #
14
14
# Scan2Thunderbird is free software: you can redistribute it and/or modify #
15
- # it under the terms of the GNU General Public License as published by #
16
- # the Free Software Foundation, either version 3 of the License, or #
17
- # (at your option) any later version. #
18
- # #
19
- # This program is distributed in the hope that it will be useful, #
15
+ # it under the terms of the GNU General Public License as published by #
16
+ # the Free Software Foundation, either version 3 of the License, or #
17
+ # (at your option) any later version. #
18
+ # #
19
+ # This program is distributed in the hope that it will be useful,#
20
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
21
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
22
22
# GNU General Public License for more details. #
@@ -142,7 +142,6 @@ rescan() {
142
142
clean () {
143
143
shred -n 35 -z -u /tmp/$name -* .tiff
144
144
shred -n 35 -z -u /tmp/$name -* .jpeg
145
- shred -n 35 -z -u /tmp/$name .pdf.gz
146
145
shred -n 35 -z -u /tmp/$name * .pdf
147
146
}
148
147
@@ -258,14 +257,9 @@ quit "$?"
258
257
--auto-close
259
258
quit " $? "
260
259
261
- # Compress the PDF file
262
-
263
- cp /tmp/$name .pdf /tmp/$name -2.pdf
264
- gzip --best -f /tmp/$name .pdf
265
-
266
260
# Check file weight
267
261
268
- FILESIZE=$( stat -c%s " /tmp/$name .pdf.gz " )
262
+ FILESIZE=$( stat -c%s " /tmp/$name .pdf" )
269
263
270
264
qual=$quality
271
265
@@ -281,23 +275,21 @@ quit "$?"
281
275
rescan " $min_resolution " " $min_crop " " $pages " " $couleur " " $qual "
282
276
merge " $min_resolution " " $min_crop " " $pages " " $couleur " " $qual "
283
277
284
- cp /tmp/$name .pdf /tmp/$name -2.pdf
285
- gzip --best -f /tmp/$name .pdf
286
-
287
- FILESIZE=$( stat -c%s " /tmp/$name .pdf.gz" )
278
+ FILESIZE=$( stat -c%s " /tmp/$name .pdf" )
288
279
289
280
qual=$(( $qual - 1 ))
290
281
done
291
282
292
283
# Preview and send
293
284
294
- evince /tmp/$name -2 .pdf &
295
- thunderbird -compose " to='',subject='',body='$txt9 ',attachment='file:///tmp/$name .pdf.gz '"
285
+ evince /tmp/$name .pdf &
286
+ thunderbird -compose " to='',subject='',body='',attachment='file:///tmp/$name .pdf'"
296
287
wait $!
297
288
298
- if [ ps -p $! ]; then
299
- sleep 500
300
- fi
289
+ while [ ps -p $! ]
290
+ do
291
+ sleep 500
292
+ done
301
293
302
294
303
295
delete=` zenity --question --text=" $txt24 $name .pdf ?" `
@@ -306,7 +298,6 @@ quit "$?"
306
298
307
299
if [ " $? " -eq " 0" ]; then
308
300
file=` zenity --file-selection --save --filename=/$HOME /$USER / --title=" $txt25 ?" `
309
- cp /tmp/$name -2.pdf /$file .pdf
310
301
clean
311
302
else
312
303
clean
0 commit comments