File tree Expand file tree Collapse file tree 3 files changed +35
-25
lines changed Expand file tree Collapse file tree 3 files changed +35
-25
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python3
2
2
3
- import mimetypes
4
3
import sys
5
4
from pathlib import Path
6
5
6
+ WHITELIST_EXT = [
7
+ 'png' ,
8
+ 'jpeg' ,
9
+ 'jpg'
10
+ 'gif' ,
11
+ 'tiff' ,
12
+ 'bmp' ,
13
+ 'psd' ,
14
+ 'heic'
15
+ ]
16
+
7
17
image_files = []
8
18
for f in sys .argv [1 ::]:
9
- mt , n = mimetypes .guess_type (f )
10
- ext = Path (f ).suffix
11
- if ext .lower () == '.heic' or (mt != None and "image" in mt ):
19
+ ext = Path (f ).suffix .replace ('.' , '' ).lower ()
20
+ if ext in WHITELIST_EXT :
12
21
image_files .append (f )
13
22
14
23
files = "\t " .join (image_files )
Original file line number Diff line number Diff line change 330
330
<string >public.heic </string >
331
331
<string >public.jpeg </string >
332
332
<string >public.png </string >
333
+ <string >public.svg-image </string >
333
334
<string >public.tiff </string >
334
335
</array >
335
336
<key >name </key >
@@ -465,6 +466,26 @@ python3 ./filecheck.py $argv</string>
465
466
<key >version </key >
466
467
<integer >1 </integer >
467
468
</dict >
469
+ <dict >
470
+ <key >config </key >
471
+ <dict >
472
+ <key >argument </key >
473
+ <string >{var:fpath} </string >
474
+ <key >passthroughargument </key >
475
+ <false />
476
+ <key >variables </key >
477
+ <dict >
478
+ <key >size </key >
479
+ <string >{query} </string >
480
+ </dict >
481
+ </dict >
482
+ <key >type </key >
483
+ <string >alfred.workflow.utility.argument </string >
484
+ <key >uid </key >
485
+ <string >8E04C74A-AFA3-45A5-AB78-FBD21C7699C8 </string >
486
+ <key >version </key >
487
+ <integer >1 </integer >
488
+ </dict >
468
489
<dict >
469
490
<key >config </key >
470
491
<dict >
@@ -486,26 +507,6 @@ python3 ./filecheck.py $argv</string>
486
507
<key >version </key >
487
508
<integer >1 </integer >
488
509
</dict >
489
- <dict >
490
- <key >config </key >
491
- <dict >
492
- <key >argument </key >
493
- <string >{var:fpath} </string >
494
- <key >passthroughargument </key >
495
- <false />
496
- <key >variables </key >
497
- <dict >
498
- <key >size </key >
499
- <string >{query} </string >
500
- </dict >
501
- </dict >
502
- <key >type </key >
503
- <string >alfred.workflow.utility.argument </string >
504
- <key >uid </key >
505
- <string >8E04C74A-AFA3-45A5-AB78-FBD21C7699C8 </string >
506
- <key >version </key >
507
- <integer >1 </integer >
508
- </dict >
509
510
<dict >
510
511
<key >config </key >
511
512
<dict >
@@ -930,7 +931,7 @@ Click on `Configure Workflow` to:
930
931
<key >variablesdontexport </key >
931
932
<array />
932
933
<key >version </key >
933
- <string >1.4 </string >
934
+ <string >1.4.1 </string >
934
935
<key >webaddress </key >
935
936
<string >https://github.com/Acidham/alfred-image-shrinker </string >
936
937
</dict >
You can’t perform that action at this time.
0 commit comments