Skip to content

Commit

Permalink
Fix code style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jan 1, 2019
1 parent 0e2e0e8 commit bfa0c92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 10 additions & 9 deletions process
Expand Up @@ -6,10 +6,8 @@
# - fix content detection for romande energie
# - add http://www.graphicsmagick.org/GraphicsMagick.html#details-sharpen

import datetime
import glob
import os
import random
import re
import shutil
import subprocess
Expand Down Expand Up @@ -99,9 +97,9 @@ def transform(config, root_folder):
call(mogrify + ['-level', '15%,1,85%', img])
save(root_folder, img, '1-cleanup')

marging_horizontal=100
maring_vertical=100
crop(img, round(marging_horizontal/10/2.51*300), round(maring_vertical/10/2.51*300))
marging_horizontal = 100
maring_vertical = 100
crop(img, round(marging_horizontal / 10 / 2.51 * 300), round(maring_vertical / 10 / 2.51 * 300))
save(root_folder, img, '2-precrop')

try:
Expand All @@ -115,9 +113,9 @@ def transform(config, root_folder):
)

# Margin in mm
marging_horizontal=10
maring_vertical=7
crop(img, round(marging_horizontal/10/2.51*300), round(maring_vertical/10/2.51*300))
marging_horizontal = 10
maring_vertical = 7
crop(img, round(marging_horizontal / 10 / 2.51 * 300), round(maring_vertical / 10 / 2.51 * 300))
save(root_folder, img, '4-crop')

# sharpen
Expand All @@ -143,7 +141,8 @@ def transform(config, root_folder):
# is empty ?
w, h = [int(e) for e in output(convert + [img, '-format', '%w %h', 'info:-']).split(b' ')]
if output(
convert + [img, '-noise', '7', '-blur', '0x5', '-level', '20%,1,80%', '-draw', 'point {},{}'.format(w/2, h/2), '-format', '%@', 'info:-'])[0:4] == b'1x1+':
convert + [img, '-noise', '7', '-blur', '0x5', '-level', '20%,1,80%', '-draw', 'point {},{}'.format(w/2, h/2), '-format', '%@', 'info:-']
)[0:4] == b'1x1+':
print("Ignore image with no content: {}".format(img))
continue

Expand All @@ -168,6 +167,7 @@ def transform(config, root_folder):

return images


def finalise(config, root_folder):

full_name = config['full_name']
Expand Down Expand Up @@ -205,6 +205,7 @@ def finalise(config, root_folder):

# call(['chmod', '-R', 'go+rw', '/destination'])


mtime = time.ctime(os.path.getmtime('/opt/process'))

print('Welcome to scaned images document to paperless.')
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
@@ -0,0 +1,2 @@
[pep8]
max-line-length = 110

0 comments on commit bfa0c92

Please sign in to comment.