Skip to content

Commit 4f714df

Browse files
committed
solved the linting error in already existing other scripts video_cropper and pdf_watermarkadder
1 parent 9e772ef commit 4f714df

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

pdf_watermarkadder/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def makepdf():
2323
pdf_file = input("PDF file: ")
2424
watermark = 'watermark.pdf'
2525
merged = "finalDraft.pdf"
26-
with open(pdf_file, "rb") as input_file,\
26+
with open(pdf_file, "rb") as input_file, \
2727
open(watermark, "rb") as watermark_file:
2828
input_pdf = PdfFileReader(input_file)
2929
watermark_pdf = PdfFileReader(watermark_file)

video_cropper/video_cropper.py

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def to_int(a, rel_to):
1111
If string contains "%" it converts it to a float and multiplies by rel_to
1212
EG: 50% -> 0.5*rel_to
1313
'''
14-
if type(a) == int:
14+
15+
if isinstance(a):
1516
return a
1617
else:
1718
if '%' in a:
@@ -25,13 +26,41 @@ def to_int(a, rel_to):
2526
parser = argparse.ArgumentParser()
2627

2728
parser.add_argument('-i', '--input', type=str, help='the file to crop')
28-
parser.add_argument('-c', '--crop', type=str, help='the amount to crop in the format "TOP,BOTTOM,LEFT,RIGHT"')
29-
parser.add_argument('-t', '--top', type=str, help='the amount to crop off the top of the video')
30-
parser.add_argument('-b', '--bottom', type=str, help='the amount to crop off the bottom of the video')
31-
parser.add_argument('-l', '--left', type=str, help='the amount to crop off the left of the video')
32-
parser.add_argument('-r', '--right', type=str, help='the amount to crop off the right of the video')
33-
parser.add_argument('-o', '--output', type=str, help='the file to output to (cannot be the same as input file)')
34-
parser.add_argument('-y', '--yes', action='store_true', help='skip the prompt to confirm overwriting a file')
29+
parser.add_argument(
30+
'-c',
31+
'--crop',
32+
type=str,
33+
help='the amount to crop in the format "TOP,BOTTOM,LEFT,RIGHT"')
34+
parser.add_argument(
35+
'-t',
36+
'--top',
37+
type=str,
38+
help='the amount to crop off the top of the video')
39+
parser.add_argument(
40+
'-b',
41+
'--bottom',
42+
type=str,
43+
help='the amount to crop off the bottom of the video')
44+
parser.add_argument(
45+
'-l',
46+
'--left',
47+
type=str,
48+
help='the amount to crop off the left of the video')
49+
parser.add_argument(
50+
'-r',
51+
'--right',
52+
type=str,
53+
help='the amount to crop off the right of the video')
54+
parser.add_argument(
55+
'-o',
56+
'--output',
57+
type=str,
58+
help='the file to output to (cannot be the same as input file)')
59+
parser.add_argument(
60+
'-y',
61+
'--yes',
62+
action='store_true',
63+
help='skip the prompt to confirm overwriting a file')
3564

3665
args = parser.parse_args()
3766

@@ -107,7 +136,11 @@ def to_int(a, rel_to):
107136
sys.exit(1)
108137

109138
# call ffmpeg with the required args
110-
cmd = 'ffmpeg -hide_banner -loglevel error -i "{}" -c:a copy -filter:v "crop={}:{}:{}:{}" {}{}'
139+
cmd = (
140+
'ffmpeg -hide_banner -loglevel error -i "{}" -c:a copy '
141+
'-filter:v "crop={}:{}:{}:{}" {}{}'
142+
)
143+
111144
cmd = cmd.format(
112145
args.input,
113146
width,

0 commit comments

Comments
 (0)