diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/README.md b/README.md index 859d4fc..8483d84 100644 --- a/README.md +++ b/README.md @@ -24,91 +24,63 @@ Welcome to the Alfred Smart WebP Compression repository: **An Alfred Workflowk** ## 🧙‍♂ïļ Invoke the Workflow -You can invoke the workflow by writing `webp` onto the Alfred search box. You can change this value within the workflow [optionnal]. If you'd like to change the value, follow the steps below: - -![double_click](src/images/double_click.png) - -![trigger](src/images/trigger.png) +You can invoke the workflow by writing `webp` onto the Alfred search box. You can change this value by changing the `ðŸ•đïļ Workflow trigger` variable in workflow configuration panel [optionnal]. ## 🧰 Setup the workflow -Note that all the following commands can be triggered within the workflow ðŸĪ“ +### ðŸ‘Ļ‍ðŸ’ŧ Install dependencies #### Open the Terminal of you Mac and run the following commands -1. ☑ïļ Install Homebrew +1. ☑ïļ Install Homebrew. ```shell /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -2. ☑ïļ Install cwebp jq and cpanm - -```shell -brew install webp | brew install jq | brew install cpanm -``` - -3. ☑ïļ Install Mojolicious +2. ☑ïļ Install cwebp and jq. ```shell -cpanm Mojolicious --sudo +brew install webp | brew install jq ``` #### Check your installation under the Setup toolbox of the workflow ![toolbox](src/images/toolbox_dark_mode.png) -If something is not installed you'll have the following message +If something is not installed you'll have the following message : ![jq_not_installed](src/images/jq_not_installed.png) -#### CWebP version can be seen in the home menu. +#### CWebP version can be seen in the home menu ![cwebp_home_dark_mode](src/images/cwebp_home_dark_mode.png) - The workflow is also looking for cwebp updates each time you run the workflow âœĻ +âœĻ The workflow is also checking the cwebp version each time you run it. ![cwebp_update](src/images/cwebp_update.png) -## 👷‍♂ïļ Environment variables - -### 📖 Documentation folder - -❗ This variable cannot be empty. It's not recommended to change it. - -It contains the content of cwebp documentation within Alfred. You can refresh this documentation in the workflow - -![refresh_docs](src/images/refresh_docs_dark_mode.png) - -### 📂 Presets and Logs folder +### 📂 Data (Presets and Logs) folder -❗ This variable cannot be empty. You can change it at your convenience. +❗ This variable cannot be empty. You can change it at your convenience in the workflow configuration panel. It contains the presets created within the workflow + output logs of the cwebp compression. -![preset_log_folder](src/images/preset_log_folder.png) +> ðŸ’Ą Note that if you change the `Data folder` location after creating presets and logs, you should probably move the files created along in the new folder. -### 🖞ïļ Images folder +![data_folder](src/images/data_folder.png) -⚠ïļ This variable must be set before running the compression. - -This is the target folder where images are placed for the compression. You can change it within the workflow in the home menu. - -![image_home_dark_mode](src/images/image_home_dark_mode.png) - -### ⚒ïļ Selected Preset - -⚠ïļ This variable must be set before running the compression. +## ðŸĪ– Usage of the workflow -The preset selected preset within the workflow holds all the cwebp [options] used for the compression. The preset selected is shown as the subtitle in the home menu. +### ⚒ïļ Handling presets -![preset_home_dark_mode](src/images/preset_home_dark_mode.png) +Go under the home menu and open the `presets section`. -## ðŸĪ– Usage of the workflow +![presets_home_dark_mode](src/images/presets_home_dark_mode.png) -### 🆕 Create a preset +#### Create a preset -Go under the preset section and click on "Add a preset" +Go under the `presets section` and click on "Add a preset". ![add_preset_1](src/images/add_preset_1.png) @@ -120,15 +92,9 @@ The created preset can be seen under the preset section. New presets are put on ![add_preset_3](src/images/add_preset_3.png) -### 👉 Select a preset - -Under the preset section, click on a preset to select it. - -![select_preset](src/images/select_preset.png) +#### Modify a preset -### ✍ïļ Modify a preset - -Under the preset section, click on "Modify a preset". +Under the `presets section`, click on "Modify a preset". ![modify_preset_1](src/images/modify_preset_1.png) @@ -136,13 +102,13 @@ Select the preset you want to modify. ![modify_preset_2](src/images/modify_preset_2.png) -Change its name/value and press enter. Don't remove the separator (`,`). +Change its name/value and press enter ⏎. Don't remove the separator (`,`). ![modify_preset_3](src/images/modify_preset_3.png) -### ❌ Remove a preset +#### Remove a preset -Under the preset section, click on "Remove a preset". +Under the `presets section`, click on "Remove a preset". ![remove_preset_1](src/images/remove_preset_1.png) @@ -150,24 +116,77 @@ Select the preset you want to remove. ![remove_preset_2](src/images/remove_preset_2.png) -## 🖞ïļ Modify the images folder +### 📖 Check the documentation + +Go under the `documentation section` from the home menu : -*See also environment variables above* 👆 +![docs_home_dark_mode](src/images/docs_home_dark_mode.png) -Select the "Images Folder" under the main menu and search for the new one under Alfred. You can also manually change it under the configuration panel of the workflow. +Go to the online documentation or click on one of the options to copy it ! -![img_folder_select](src/images/img_folder_select.png) +![docs_detail](src/images/docs_detail.png) -## 🚀 Start the compression +### 🚀 Start the compression -Once the preset and the images folder are set correctly, click on "Start the compression" under the home menu. +#### Using Workflow File Filter + +Under the home menu, click on "Start the compression". ![start_compress](src/images/start_compress.png) -Check the logs of your compression under the 📂 Presets and Logs folder. The log file contains the 2 part. In the orange box there is the {date}, {time}, {var:img_folder} and {var:the_preset}. the output of the terminal is shown under the green box. Each compression is separated by a line. +Select the folder with images or directly the image you want to compress and press enter ⏎. + +> ðŸ’Ą Note that when selecting a folder, images within subdirectories aren't selected. Only images with `png|jpg|jpeg|tif|tiff|webp` file extensions are selected. In addition, they aren't case sensitive, meaning that the image extension can be `PNG|JpG|tifF...` + +![direct_compress](src/images/direct_compress.png) + +Alternatively, use the `Alfred Buffer` to select folder(s) and image(s) at the same time !! Basic commands are : + +* âŒĨ↑ to add a file to the buffer from Alfred's results. +* âŒĨ↓ to add a file and move to the next item in your list of results. +* âŒĨ← to remove the last item from the buffer. +* âŒĨ→ to action all items in the buffer. +* âŒĨâŒŦ to remove all items from the buffer. + +To know more on how to use `Alfred Buffer`, follow this [link](https://www.alfredapp.com/help/features/file-search/#file-buffer). + +> ðŸ’Ą Note that `Alfred Buffer` is preferred compare to the `{query}`, meaning that if you select a folder/image (by clicking on it or by pressing enter ⏎) that is not included in the buffer, **it will not be compressed**. + +![alfred_buffer](src/images/alfred_buffer.png) + +Choose the cwebp options by selecting a preset or input it manually by pressing "Manual options". + +![choice_options](src/images/choice_options.png) + +Check the logs of the compression. To know more on how to read logs, see the `Logs output` section below. + +#### Using Alfred Universal Actions + +Select the folder(s) / image(s) you want to compress within alfred using `Quick Search` and run `Universal Actions` with → or âŒĨ→ if you used the `Alfred buffer`. Select "Compress images to WebP". + +![universal_action](src/images/universal_action.png) + +> ðŸ’Ą Note that the workflow is type sensitive, meaning that if you select a file that is not part of the following types, the action "Compress images to WebP" will not be available + +![types](src/images/types.png) + +If you want to know more on how to use Alfred Universal Actions, follow this [link](https://www.alfredapp.com/help/features/universal-actions/). + +#### Logs output + +Check the logs of your compression under the `Data folder`. The log file contains the 2 part. + +1. In the orange box there is : + * `{date:short}` : Date of the compression with a `yyyy/MM/dd` pattern. + * `{time}` : Exact time of the compression with a `HH:mm:ss` pattern. + * `user input : {var:_links_list}` : Folder(s) + image(s) path(s) selected with a tab â‡Ĩ separator. + * `cwebp options : {var:_the_preset}` : Preset or manual input. Preset will be displayed as `preset_name,preset_detail` whereas manual input will be displayed raw. +2. In the green box there is the `{query}` which correspond to cwebp output. + +> ðŸ’Ą Note that each compression is separated by a line. ![log_detail](src/images/log_detail.png) ## ⚖ïļ License -[MIT License](LICENSE.md) ÂĐ Benjamin Oddou +[MIT License](LICENSE) ÂĐ Benjamin Oddou diff --git a/dist/Smart WebP Compression.alfredworkflow b/dist/Smart WebP Compression.alfredworkflow index ba1d845..17ab72c 100644 Binary files a/dist/Smart WebP Compression.alfredworkflow and b/dist/Smart WebP Compression.alfredworkflow differ diff --git a/dist/update_doc.alfredworkflow b/dist/update_doc.alfredworkflow new file mode 100644 index 0000000..da59762 Binary files /dev/null and b/dist/update_doc.alfredworkflow differ diff --git a/src/0CC2B59D-DDCA-43EF-83D0-4F9E70866E77.png b/src/0CC2B59D-DDCA-43EF-83D0-4F9E70866E77.png deleted file mode 100644 index 259f0ba..0000000 Binary files a/src/0CC2B59D-DDCA-43EF-83D0-4F9E70866E77.png and /dev/null differ diff --git a/src/36746137-2858-4981-968C-2DDC0B19B7E8.png b/src/36746137-2858-4981-968C-2DDC0B19B7E8.png new file mode 100644 index 0000000..49cb5f7 Binary files /dev/null and b/src/36746137-2858-4981-968C-2DDC0B19B7E8.png differ diff --git a/src/3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45.png b/src/3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45.png new file mode 100644 index 0000000..9a14dd2 Binary files /dev/null and b/src/3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45.png differ diff --git a/src/B857BE3A-4375-4247-9082-05CDEC4E3BB4.png b/src/B857BE3A-4375-4247-9082-05CDEC4E3BB4.png index fddbb2a..52d8819 100644 Binary files a/src/B857BE3A-4375-4247-9082-05CDEC4E3BB4.png and b/src/B857BE3A-4375-4247-9082-05CDEC4E3BB4.png differ diff --git a/src/BFF0D19D-FF9E-4090-BC0C-152BE08D3580.png b/src/BFF0D19D-FF9E-4090-BC0C-152BE08D3580.png deleted file mode 100644 index 32562d3..0000000 Binary files a/src/BFF0D19D-FF9E-4090-BC0C-152BE08D3580.png and /dev/null differ diff --git a/src/docs.txt b/src/docs.txt new file mode 100644 index 0000000..76d8f8b --- /dev/null +++ b/src/docs.txt @@ -0,0 +1,470 @@ +{ + "uid": "-o string", + "title": "-o string", + "subtitle": "Specify the name of the output WebP file. If omitted, cwebp will perform compression but only report statistics. Using \"-\" as output name will direct output to 'stdout'.", + "arg": "-o string", + "autocomplete": "-o string", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-- string", + "title": "-- string", + "subtitle": "Explicitly specify the input file. This option is useful if the input file starts with an '-' for instance. This option must appear last. Any other options afterward will be ignored.", + "arg": "-- string", + "autocomplete": "-- string", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-h, -help", + "title": "-h, -help", + "subtitle": "A short usage summary.", + "arg": "-h, -help", + "autocomplete": "-h, -help", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-H, -longhelp", + "title": "-H, -longhelp", + "subtitle": "A summary of all the possible options.", + "arg": "-H, -longhelp", + "autocomplete": "-H, -longhelp", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-version", + "title": "-version", + "subtitle": "Print the version number (as major.minor.revision) and exit.", + "arg": "-version", + "autocomplete": "-version", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-lossless", + "title": "-lossless", + "subtitle": "Encode the image without any loss. For images with fully transparent area, the invisible pixel values (R/G/B or Y/U/V) will be preserved only if the -exact option is used.", + "arg": "-lossless", + "autocomplete": "-lossless", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-near_lossless int", + "title": "-near_lossless int", + "subtitle": "Specify the level of near-lossless image preprocessing. This option adjusts pixel values to help compressibility, but has minimal impact on the visual quality. It triggers lossless compression mode automatically. The range is 0 (maximum preprocessing) to 100 (no preprocessing, the default). The typical value is around 60. Note that lossy with -q 100 can at times yield better results.", + "arg": "-near_lossless int", + "autocomplete": "-near_lossless int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-q float", + "title": "-q float", + "subtitle": "Specify the compression factor for RGB channels between 0 and 100. The default is 75. In case of lossy compression (default), a small factor produces a smaller file with lower quality. Best quality is achieved by using a value of 100. In case of lossless compression (specified by the -lossless option), a small factor enables faster compression speed, but produces a larger file. Maximum compression is achieved by using a value of 100.", + "arg": "-q float", + "autocomplete": "-q float", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-z int", + "title": "-z int", + "subtitle": "Switch on lossless compression mode with the specified level between 0 and 9, with level 0 being the fastest, 9 being the slowest. Fast mode produces larger file size than slower ones. A good default is -z 6. This option is actually a shortcut for some predefined settings for quality and method. If options -q or -m are subsequently used, they will invalidate the effect of this option.", + "arg": "-z int", + "autocomplete": "-z int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-alpha_q int", + "title": "-alpha_q int", + "subtitle": "Specify the compression factor for alpha compression between 0 and 100. Lossless compression of alpha is achieved using a value of 100, while the lower values result in a lossy compression. The default is 100.", + "arg": "-alpha_q int", + "autocomplete": "-alpha_q int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-preset string", + "title": "-preset string", + "subtitle": "Specify a set of pre-defined parameters to suit a particular type of source material. Possible values are: default, photo, picture, drawing, icon, text. Since -preset overwrites the other parameters' values (except the -q one), this option should preferably appear first in the order of the arguments.", + "arg": "-preset string", + "autocomplete": "-preset string", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-m int", + "title": "-m int", + "subtitle": "Specify the compression method to use. This parameter controls the trade off between encoding speed and the compressed file size and quality. Possible values range from 0 to 6. Default value is 4. When higher values are used, the encoder will spend more time inspecting additional encoding possibilities and decide on the quality gain. Lower value can result in faster processing time at the expense of larger file size and lower compression quality.", + "arg": "-m int", + "autocomplete": "-m int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-crop x_position y_position width height", + "title": "-crop x_position y_position width height", + "subtitle": "Crop the source to a rectangle with top-left corner at coordinates (x_position, y_position) and size width x height. This cropping area must be fully contained within the source rectangle. Note: the cropping is applied before any scaling.", + "arg": "-crop x_position y_position width height", + "autocomplete": "-crop x_position y_position width height", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-resize width height", + "title": "-resize width height", + "subtitle": "Resize the source to a rectangle with size width x height. If either (but not both) of the width or height parameters is 0, the value will be calculated preserving the aspect-ratio. Note: scaling is applied after cropping.", + "arg": "-resize width height", + "autocomplete": "-resize width height", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-mt", + "title": "-mt", + "subtitle": "Use multi-threading for encoding, if possible.", + "arg": "-mt", + "autocomplete": "-mt", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-low_memory", + "title": "-low_memory", + "subtitle": "Reduce memory usage of lossy encoding by saving four times the compressed size (typically). This will make the encoding slower and the output slightly different in size and distortion. This flag is only effective for methods 3 and up, and is off by default. Note that leaving this flag off will have some side effects on the bitstream: it forces certain bitstream features like number of partitions (forced to 1). Note that a more detailed report of bitstream size is printed by cwebp when using this option.", + "arg": "-low_memory", + "autocomplete": "-low_memory", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-size int", + "title": "-size int", + "subtitle": "Specify a target size (in bytes) to try and reach for the compressed output. The compressor will make several passes of partial encoding in order to get as close as possible to this target. If both -size and -psnr are used, -size value will prevail.", + "arg": "-size int", + "autocomplete": "-size int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-psnr float", + "title": "-psnr float", + "subtitle": "Specify a target PSNR (in dB) to try and reach for the compressed output. The compressor will make several passes of partial encoding in order to get as close as possible to this target. If both -size and -psnr are used, -size value will prevail.", + "arg": "-psnr float", + "autocomplete": "-psnr float", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-pass int", + "title": "-pass int", + "subtitle": "Set a maximum number of passes to use during the dichotomy used by options -size or -psnr. Maximum value is 10, default is 1. If options -size or -psnr were used, but -pass wasn't specified, a default value of '6' passes will be used.", + "arg": "-pass int", + "autocomplete": "-pass int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-af", + "title": "-af", + "subtitle": "Turns auto-filter on. This algorithm will spend additional time optimizing the filtering strength to reach a well-balanced quality.", + "arg": "-af", + "autocomplete": "-af", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-jpeg_like", + "title": "-jpeg_like", + "subtitle": "Change the internal parameter mapping to better match the expected size of JPEG compression. This flag will generally produce an output file of similar size to its JPEG equivalent (for the same -q setting), but with less visual distortion.", + "arg": "-jpeg_like", + "autocomplete": "-jpeg_like", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-f int", + "title": "-f int", + "subtitle": "Specify the strength of the deblocking filter, between 0 (no filtering) and 100 (maximum filtering). A value of 0 will turn off any filtering. Higher value will increase the strength of the filtering process applied after decoding the picture. The higher the value the smoother the picture will appear. Typical values are usually in the range of 20 to 50.", + "arg": "-f int", + "autocomplete": "-f int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-sharpness int", + "title": "-sharpness int", + "subtitle": "Specify the sharpness of the filtering (if used). Range is 0 (sharpest) to 7 (least sharp). Default is 0.", + "arg": "-sharpness int", + "autocomplete": "-sharpness int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-strong", + "title": "-strong", + "subtitle": "Use strong filtering (if filtering is being used thanks to the -f option). Strong filtering is on by default.", + "arg": "-strong", + "autocomplete": "-strong", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-nostrong", + "title": "-nostrong", + "subtitle": "Disable strong filtering (if filtering is being used thanks to the -f option) and use simple filtering instead.", + "arg": "-nostrong", + "autocomplete": "-nostrong", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-sharp_yuv", + "title": "-sharp_yuv", + "subtitle": "Use more accurate and sharper RGB->YUV conversion if needed. Note that this process is slower than the default 'fast' RGB->YUV conversion.", + "arg": "-sharp_yuv", + "autocomplete": "-sharp_yuv", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-sns int", + "title": "-sns int", + "subtitle": "Specify the amplitude of the spatial noise shaping. Spatial noise shaping (or sns for short) refers to a general collection of built-in algorithms used to decide which area of the picture should use relatively less bits, and where else to better transfer these bits. The possible range goes from 0 (algorithm is off) to 100 (the maximal effect). The default value is 50.", + "arg": "-sns int", + "autocomplete": "-sns int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-segments int", + "title": "-segments int", + "subtitle": "Change the number of partitions to use during the segmentation of the sns algorithm. Segments should be in range 1 to 4. Default value is 4. This option has no effect for methods 3 and up, unless -low_memory is used.", + "arg": "-segments int", + "autocomplete": "-segments int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-partition_limit int", + "title": "-partition_limit int", + "subtitle": "Degrade quality by limiting the number of bits used by some macroblocks. Range is 0 (no degradation, the default) to 100 (full degradation). Useful values are usually around 30-70 for moderately large images. In the VP8 format, the so-called control partition has a limit of 512k and is used to store the following information: whether the macroblock is skipped, which segment it belongs to, whether it is coded as intra 4x4 or intra 16x16 mode, and finally the prediction modes to use for each of the sub-blocks. For a very large image, 512k only leaves room to few bits per 16x16 macroblock. The absolute minimum is 4 bits per macroblock. Skip, segment, and mode information can use up almost all these 4 bits (although the case is unlikely), which is problematic for very large images. The partition_limit factor controls how frequently the most bit-costly mode (intra 4x4) will be used. This is useful in case the 512k limit is reached and the following message is displayed: Error code: 6 (PARTITION0_OVERFLOW: Partition #0 is too big to fit 512k). If using -partition_limit is not enough to meet the 512k constraint, one should use less segments in order to save more header bits per macroblock. See the -segments option.", + "arg": "-partition_limit int", + "autocomplete": "-partition_limit int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-v", + "title": "-v", + "subtitle": "Print extra information (encoding time in particular).", + "arg": "-v", + "autocomplete": "-v", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-print_psnr", + "title": "-print_psnr", + "subtitle": "Compute and report average PSNR (Peak-Signal-To-Noise ratio).", + "arg": "-print_psnr", + "autocomplete": "-print_psnr", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-print_ssim", + "title": "-print_ssim", + "subtitle": "Compute and report average SSIM (structural similarity metric, see https://en.wikipedia.org/wiki/SSIM for additional details).", + "arg": "-print_ssim", + "autocomplete": "-print_ssim", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-print_lsim", + "title": "-print_lsim", + "subtitle": "Compute and report local similarity metric (sum of lowest error amongst the collocated pixel neighbors).", + "arg": "-print_lsim", + "autocomplete": "-print_lsim", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-progress", + "title": "-progress", + "subtitle": "Report encoding progress in percent.", + "arg": "-progress", + "autocomplete": "-progress", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-quiet", + "title": "-quiet", + "subtitle": "Do not print anything.", + "arg": "-quiet", + "autocomplete": "-quiet", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-short", + "title": "-short", + "subtitle": "Only print brief information (output file size and PSNR) for testing purposes.", + "arg": "-short", + "autocomplete": "-short", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-map int", + "title": "-map int", + "subtitle": "Output additional ASCII-map of encoding information. Possible map values range from 1 to 6. This is only meant to help debugging.", + "arg": "-map int", + "autocomplete": "-map int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-s width height", + "title": "-s width height", + "subtitle": "Specify that the input file actually consists of raw Y'CbCr samples following the ITU-R BT.601 recommendation, in 4:2:0 linear format. The luma plane has size width x height.", + "arg": "-s width height", + "autocomplete": "-s width height", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-pre int", + "title": "-pre int", + "subtitle": "Specify some pre-processing steps. Using a value of 2 will trigger quality-dependent pseudo-random dithering during RGBA->YUVA conversion (lossy compression only).", + "arg": "-pre int", + "autocomplete": "-pre int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-alpha_filter string", + "title": "-alpha_filter string", + "subtitle": "Specify the predictive filtering method for the alpha plane. One of none, fast or best, in increasing complexity and slowness order. Default is fast. Internally, alpha filtering is performed using four possible predictions (none, horizontal, vertical, gradient). The best mode will try each mode in turn and pick the one which gives the smaller size. The fast mode will just try to form an a priori guess without testing all modes.", + "arg": "-alpha_filter string", + "autocomplete": "-alpha_filter string", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-alpha_method int", + "title": "-alpha_method int", + "subtitle": "Specify the algorithm used for alpha compression: 0 or 1. Algorithm 0 denotes no compression, 1 uses WebP lossless format for compression. The default is 1.", + "arg": "-alpha_method int", + "autocomplete": "-alpha_method int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-exact", + "title": "-exact", + "subtitle": "Preserve RGB values in transparent area. The default is off, to help compressibility.", + "arg": "-exact", + "autocomplete": "-exact", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-blend_alpha int", + "title": "-blend_alpha int", + "subtitle": "This option blends the alpha channel (if present) with the source using the background color specified in hexadecimal as 0xrrggbb. The alpha channel is afterward reset to the opaque value 255.", + "arg": "-blend_alpha int", + "autocomplete": "-blend_alpha int", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-noalpha", + "title": "-noalpha", + "subtitle": "Using this option will discard the alpha channel.", + "arg": "-noalpha", + "autocomplete": "-noalpha", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-hint string", + "title": "-hint string", + "subtitle": "Specify the hint about input image type. Possible values are: photo, picture or graph.", + "arg": "-hint string", + "autocomplete": "-hint string", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-metadata string", + "title": "-metadata string", + "subtitle": "A comma separated list of metadata to copy from the input to the output if present. Valid values: all, none, exif, icc, xmp. The default is none. Note that each input format may not support all combinations.", + "arg": "-metadata string", + "autocomplete": "-metadata string", + "icon": { + "path": "page-icon.png" + } +} +{ + "uid": "-noasm", + "title": "-noasm", + "subtitle": "Disable all assembly optimizations.", + "arg": "-noasm", + "autocomplete": "-noasm", + "icon": { + "path": "page-icon.png" + } +} diff --git a/src/images/alfred_buffer.png b/src/images/alfred_buffer.png new file mode 100644 index 0000000..6b60b80 Binary files /dev/null and b/src/images/alfred_buffer.png differ diff --git a/src/images/choice_options.png b/src/images/choice_options.png new file mode 100644 index 0000000..b182780 Binary files /dev/null and b/src/images/choice_options.png differ diff --git a/src/images/cwebp_home_dark_mode.png b/src/images/cwebp_home_dark_mode.png index 8b134ed..0fee836 100644 Binary files a/src/images/cwebp_home_dark_mode.png and b/src/images/cwebp_home_dark_mode.png differ diff --git a/src/images/preset_log_folder.png b/src/images/data_folder.png similarity index 100% rename from src/images/preset_log_folder.png rename to src/images/data_folder.png diff --git a/src/images/direct_compress.png b/src/images/direct_compress.png new file mode 100644 index 0000000..cafba14 Binary files /dev/null and b/src/images/direct_compress.png differ diff --git a/src/images/docs_detail.png b/src/images/docs_detail.png new file mode 100644 index 0000000..ecc32c0 Binary files /dev/null and b/src/images/docs_detail.png differ diff --git a/src/images/docs_home_dark_mode.png b/src/images/docs_home_dark_mode.png new file mode 100644 index 0000000..7adea82 Binary files /dev/null and b/src/images/docs_home_dark_mode.png differ diff --git a/src/images/double_click.png b/src/images/double_click.png deleted file mode 100644 index 74a37a2..0000000 Binary files a/src/images/double_click.png and /dev/null differ diff --git a/src/images/image_home_dark_mode.png b/src/images/image_home_dark_mode.png deleted file mode 100644 index cc76613..0000000 Binary files a/src/images/image_home_dark_mode.png and /dev/null differ diff --git a/src/images/img_folder_select.png b/src/images/img_folder_select.png deleted file mode 100644 index 98afa23..0000000 Binary files a/src/images/img_folder_select.png and /dev/null differ diff --git a/src/images/jq_not_installed.png b/src/images/jq_not_installed.png index 42057b8..2170748 100644 Binary files a/src/images/jq_not_installed.png and b/src/images/jq_not_installed.png differ diff --git a/src/images/log_detail.png b/src/images/log_detail.png index f698c66..8d99f12 100644 Binary files a/src/images/log_detail.png and b/src/images/log_detail.png differ diff --git a/src/images/preset_home_dark_mode.png b/src/images/preset_home_dark_mode.png deleted file mode 100644 index c3d2268..0000000 Binary files a/src/images/preset_home_dark_mode.png and /dev/null differ diff --git a/src/images/presets_home_dark_mode.png b/src/images/presets_home_dark_mode.png new file mode 100644 index 0000000..1f40577 Binary files /dev/null and b/src/images/presets_home_dark_mode.png differ diff --git a/src/images/refresh_docs_dark_mode.png b/src/images/refresh_docs_dark_mode.png deleted file mode 100644 index 4fcb388..0000000 Binary files a/src/images/refresh_docs_dark_mode.png and /dev/null differ diff --git a/src/images/select_preset.png b/src/images/select_preset.png deleted file mode 100644 index f6d25b6..0000000 Binary files a/src/images/select_preset.png and /dev/null differ diff --git a/src/images/start_compress.png b/src/images/start_compress.png index e7481c2..8f06601 100644 Binary files a/src/images/start_compress.png and b/src/images/start_compress.png differ diff --git a/src/images/toolbox_dark_mode.png b/src/images/toolbox_dark_mode.png index 5e389cb..d518d76 100644 Binary files a/src/images/toolbox_dark_mode.png and b/src/images/toolbox_dark_mode.png differ diff --git a/src/images/trigger.png b/src/images/trigger.png deleted file mode 100644 index 7ff3fac..0000000 Binary files a/src/images/trigger.png and /dev/null differ diff --git a/src/images/types.png b/src/images/types.png new file mode 100644 index 0000000..166e25f Binary files /dev/null and b/src/images/types.png differ diff --git a/src/images/universal_action.png b/src/images/universal_action.png new file mode 100644 index 0000000..a5039dd Binary files /dev/null and b/src/images/universal_action.png differ diff --git a/src/images/workflow.png b/src/images/workflow.png index c81cee4..1eb0414 100644 Binary files a/src/images/workflow.png and b/src/images/workflow.png differ diff --git a/src/info.plist b/src/info.plist index 829bdc5..40f3851 100644 --- a/src/info.plist +++ b/src/info.plist @@ -4,23 +4,8 @@ bundleid com.benjamino.smart_webp_compression - category - Tools connections - 02196C93-1D05-40FE-B21B-513520F9346D - - - destinationuid - CE84884F-0D18-4E0D-AA0C-C65A9E52A5F4 - modifiers - 0 - modifiersubtext - - vitoclose - - - 04D038F9-4BA3-44DE-9961-74A17474DB6D @@ -59,16 +44,6 @@ vitoclose - - destinationuid - B2ED758E-2C2B-4709-BAF1-2D6A6236303C - modifiers - 0 - modifiersubtext - - vitoclose - - 0CC2B59D-DDCA-43EF-83D0-4F9E70866E77 @@ -108,16 +83,6 @@ vitoclose - - destinationuid - 595747D0-9789-4ECE-B171-19C89A5A5296 - modifiers - 0 - modifiersubtext - - vitoclose - - 1B42C30F-88AE-47B5-B31D-B8BAF47130F4 @@ -132,11 +97,13 @@ - 1D587362-EF39-4930-8AEC-C83A00037F71 + 1F94198E-A0AE-4609-A7AB-18F2EA5BD61E + + 20555D55-EC80-4B6B-A627-BFB69508C68B destinationuid - 5ABD8595-9ED9-4626-A339-3E5F97ECB442 + 65FDBA59-C0EB-4475-A3FE-94595BBB1EFD modifiers 0 modifiersubtext @@ -145,38 +112,24 @@ - 1DC28B4A-CE6E-42D7-9870-23191353528A + 303F768B-D7FE-4A18-91F0-0261BD528F2A destinationuid - 750A55C9-C8A2-49BB-8AB3-7E17DD1FE602 - modifiers - 0 - modifiersubtext - - sourceoutputuid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B - vitoclose - - - - destinationuid - 756748B7-4D28-48DF-BBA9-2EA452BB0611 + 7EE9CE94-B507-40B3-A060-BC337D689A6E modifiers 0 modifiersubtext - sourceoutputuid - 48BA939C-0394-4A5B-84BD-AE430C803E1B vitoclose - 1F94198E-A0AE-4609-A7AB-18F2EA5BD61E + 30F44CB0-C58D-48C6-B23A-AA81E4A3CD16 destinationuid - F5093F85-53E7-4E65-BECB-DAA22C5B8DD1 + 04D038F9-4BA3-44DE-9961-74A17474DB6D modifiers 0 modifiersubtext @@ -185,11 +138,11 @@ - 303F768B-D7FE-4A18-91F0-0261BD528F2A + 36746137-2858-4981-968C-2DDC0B19B7E8 destinationuid - 7EE9CE94-B507-40B3-A060-BC337D689A6E + 4E7EBAA0-241E-45D4-8BF4-D8DD2B14C7B5 modifiers 0 modifiersubtext @@ -198,57 +151,53 @@ - 30F44CB0-C58D-48C6-B23A-AA81E4A3CD16 + 3E2FD780-20D4-4517-A4C7-3AB654D065CA destinationuid - 04D038F9-4BA3-44DE-9961-74A17474DB6D + 36746137-2858-4981-968C-2DDC0B19B7E8 modifiers 0 modifiersubtext + sourceoutputuid + B04F7F98-F4C6-4E61-986D-68F6986FEA93 vitoclose - - 3249F739-3D81-4D23-9667-C2DD7429B5E8 - destinationuid - 1D587362-EF39-4930-8AEC-C83A00037F71 + 20555D55-EC80-4B6B-A627-BFB69508C68B modifiers 0 modifiersubtext - sourceoutputuid - 2499EC30-993E-455E-9B3B-CBDF81F69684 vitoclose - 49BEB4B9-ED4B-4C09-AD1B-98D642860B6D + 3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45 destinationuid - 30F44CB0-C58D-48C6-B23A-AA81E4A3CD16 + 3E2FD780-20D4-4517-A4C7-3AB654D065CA modifiers 0 modifiersubtext - sourceoutputuid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B vitoclose + + 4E7EBAA0-241E-45D4-8BF4-D8DD2B14C7B5 + destinationuid - 6A8FBE54-FA7D-4A95-8007-8661D0997072 + A0772B13-46E4-4B82-9F55-7E1454E9D3AB modifiers 0 modifiersubtext - sourceoutputuid - 48BA939C-0394-4A5B-84BD-AE430C803E1B vitoclose @@ -269,19 +218,20 @@ destinationuid - F3F45CB5-7506-4071-887D-9E482B8F5CFB + AF4D7687-5A37-4236-B166-A78D77CAB6A5 modifiers 0 modifiersubtext - sourceoutputuid - 48BA939C-0394-4A5B-84BD-AE430C803E1B vitoclose + + 65FDBA59-C0EB-4475-A3FE-94595BBB1EFD + destinationuid - AF4D7687-5A37-4236-B166-A78D77CAB6A5 + A0772B13-46E4-4B82-9F55-7E1454E9D3AB modifiers 0 modifiersubtext @@ -290,26 +240,24 @@ - 595747D0-9789-4ECE-B171-19C89A5A5296 + 6E3869D0-4B82-40F7-9D79-109E01C84A8E destinationuid - A5A2AF5F-E9C4-4398-AD34-4BB96ACD3D06 + 73938F12-DE09-4CE5-B723-3B05299685FE modifiers 0 modifiersubtext - sourceoutputuid - 2499EC30-993E-455E-9B3B-CBDF81F69684 vitoclose - 5ABD8595-9ED9-4626-A339-3E5F97ECB442 + 71E64FC2-2DAA-4FAF-A464-54D8B3567EAC destinationuid - 1EC557CA-45DF-485F-B2D2-E9B611448E07 + A555A4F7-613D-4316-B22A-968A6E69CB70 modifiers 0 modifiersubtext @@ -318,24 +266,23 @@ - 71E64FC2-2DAA-4FAF-A464-54D8B3567EAC + 798BDC7B-0FA4-46EE-A5F2-56861741B720 destinationuid - A555A4F7-613D-4316-B22A-968A6E69CB70 + 8C24C2F6-569F-446F-A73C-2C71FCF62E95 modifiers 0 modifiersubtext + sourceoutputuid + 40F21FC1-5AB6-4DD3-BBB7-CDD2D7B59B8F vitoclose - - 756748B7-4D28-48DF-BBA9-2EA452BB0611 - destinationuid - 8C61ECE1-9688-4CC2-AD32-0A344DB310A9 + F76BC3A9-80D0-4768-88D5-0BF9C16DC0EB modifiers 0 modifiersubtext @@ -370,11 +317,11 @@ - 8C61ECE1-9688-4CC2-AD32-0A344DB310A9 + 8C24C2F6-569F-446F-A73C-2C71FCF62E95 destinationuid - 73938F12-DE09-4CE5-B723-3B05299685FE + 3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45 modifiers 0 modifiersubtext @@ -395,22 +342,12 @@ vitoclose - - destinationuid - 3249F739-3D81-4D23-9667-C2DD7429B5E8 - modifiers - 0 - modifiersubtext - - vitoclose - - - 9741013C-6FB7-4382-93A5-C6B81A57CF93 + 99F304D7-85C9-481C-B520-9003FD19B70D destinationuid - 9026F71A-CC9B-41BA-ACD0-2F1E39DBF2E2 + 91898FBD-AF59-44AC-9750-B83CD3A8A694 modifiers 0 modifiersubtext @@ -419,11 +356,11 @@ - 99F304D7-85C9-481C-B520-9003FD19B70D + A0772B13-46E4-4B82-9F55-7E1454E9D3AB destinationuid - 91898FBD-AF59-44AC-9750-B83CD3A8A694 + 6E3869D0-4B82-40F7-9D79-109E01C84A8E modifiers 0 modifiersubtext @@ -445,11 +382,11 @@ - B0630315-06B0-4A9E-9CAD-54819448B18C + AF4D7687-5A37-4236-B166-A78D77CAB6A5 destinationuid - C73B8C4E-A0A8-4564-9AF9-7AA8C1DE4A52 + 15BCCE87-A6D5-4601-AA9A-F6EAD6B853D0 modifiers 0 modifiersubtext @@ -458,11 +395,11 @@ - B2ED758E-2C2B-4709-BAF1-2D6A6236303C + B0630315-06B0-4A9E-9CAD-54819448B18C destinationuid - 1D587362-EF39-4930-8AEC-C83A00037F71 + C73B8C4E-A0A8-4564-9AF9-7AA8C1DE4A52 modifiers 0 modifiersubtext @@ -475,7 +412,7 @@ destinationuid - C8D719F8-DD29-4338-B775-A476F2437FAB + EF19D858-3E32-4423-AD95-F96100EC2A82 modifiers 0 modifiersubtext @@ -498,18 +435,6 @@ vitoclose - - destinationuid - CA89FD68-A173-4BA5-A981-DB447D2E51D3 - modifiers - 0 - modifiersubtext - - sourceoutputuid - 2B93A876-A711-4FD7-8C0A-2B3DBADF4936 - vitoclose - - destinationuid CB9B4DE3-0575-43F8-A28E-3B18C623C590 @@ -524,19 +449,7 @@ destinationuid - B857BE3A-4375-4247-9082-05CDEC4E3BB4 - modifiers - 0 - modifiersubtext - - sourceoutputuid - A3C12F25-0355-421E-BFAB-A4C9A2F9AA54 - vitoclose - - - - destinationuid - 49BEB4B9-ED4B-4C09-AD1B-98D642860B6D + 30F44CB0-C58D-48C6-B23A-AA81E4A3CD16 modifiers 0 modifiersubtext @@ -548,7 +461,7 @@ destinationuid - 1DC28B4A-CE6E-42D7-9870-23191353528A + B857BE3A-4375-4247-9082-05CDEC4E3BB4 modifiers 0 modifiersubtext @@ -572,19 +485,6 @@ - C8D719F8-DD29-4338-B775-A476F2437FAB - - - destinationuid - 9741013C-6FB7-4382-93A5-C6B81A57CF93 - modifiers - 0 - modifiersubtext - - vitoclose - - - CB9B4DE3-0575-43F8-A28E-3B18C623C590 @@ -611,11 +511,11 @@ - D0BCADEA-4B48-4681-BF5A-3A99963BCB69 + CF62D56A-4851-4B82-806F-903137C1AC35 destinationuid - 99F304D7-85C9-481C-B520-9003FD19B70D + 798BDC7B-0FA4-46EE-A5F2-56861741B720 modifiers 0 modifiersubtext @@ -624,11 +524,11 @@ - E927BA1E-77BB-466D-A594-C260C2CA3651 + D0BCADEA-4B48-4681-BF5A-3A99963BCB69 destinationuid - 02196C93-1D05-40FE-B21B-513520F9346D + 99F304D7-85C9-481C-B520-9003FD19B70D modifiers 0 modifiersubtext @@ -637,11 +537,11 @@ - F3F45CB5-7506-4071-887D-9E482B8F5CFB + DDFB0521-4230-42EE-9FEA-C57F71CDBA82 destinationuid - E927BA1E-77BB-466D-A594-C260C2CA3651 + F76BC3A9-80D0-4768-88D5-0BF9C16DC0EB modifiers 0 modifiersubtext @@ -650,35 +550,24 @@ - F5093F85-53E7-4E65-BECB-DAA22C5B8DD1 + EF19D858-3E32-4423-AD95-F96100EC2A82 destinationuid - 488DDF1E-8133-41BF-8753-0E3BA64EB974 - modifiers - 0 - modifiersubtext - - sourceoutputuid - 987B61E6-3C9B-4CC1-A323-5AA0192DBDE4 - vitoclose - - - - destinationuid - 8DBB0399-4117-43EA-BB62-E8C9B92B16F1 + CF62D56A-4851-4B82-806F-903137C1AC35 modifiers 0 modifiersubtext - sourceoutputuid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B vitoclose + + F76BC3A9-80D0-4768-88D5-0BF9C16DC0EB + destinationuid - CA89FD68-A173-4BA5-A981-DB447D2E51D3 + 3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45 modifiers 0 modifiersubtext @@ -698,36 +587,6 @@ Smart WebP Compression objects - - config - - escaping - 0 - script - cpanm Mojolicious --sudo - - type - alfred.workflow.action.terminalcommand - uid - 488DDF1E-8133-41BF-8753-0E3BA64EB974 - version - 1 - - - config - - escaping - 0 - script - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - - type - alfred.workflow.action.terminalcommand - uid - 8DBB0399-4117-43EA-BB62-E8C9B92B16F1 - version - 1 - config @@ -776,7 +635,7 @@ Checking versions... script #!/bin/bash -packages=( "jq" "cpanm" ) +packages=( "jq" ) c=0 if [[ $(brew --version | sed 1q) != "command not found: brew" ]] @@ -788,18 +647,11 @@ then then package[c++]="$(brew list --versions ${i}) ✅" else - package[c++]="${i} is not installed 🚧 | Hit Enter to install ⮇ïļ | Need Homebrew to be installed ⚠ïļ" + package[c++]="${i} is not installed 🚧 | It needs Homebrew to be installed ⚠ïļ" fi done else - brewv="Hombrew is not installed 🚧 | Hit Enter to install ⮇ïļ" -fi - -if [[ $(2>&1 perldoc -l Mojolicious) != "No documentation found for \"Mojolicious\"." ]] -then - package_mojo="Mojolicious $(perl -MMojolicious -e 'print $Mojolicious::VERSION ."\n"') ✅" -else - package_mojo="Mojolicious is not installed 🚧 | Hit Enter to install ⮇ïļ | Need Cpanm to be installed ⚠ïļ" + brewv="Hombrew is not installed 🚧" fi cat << EOB @@ -822,24 +674,6 @@ cat << EOB "icon": { "path": "jq-icon.png" } - }, - { - "title": "Cpanm", - "subtitle": "${package[1]}", - "arg": "cpanm", - "autocomplete": "Cpanm", - "icon": { - "path": "perl-icon.png" - } - }, - { - "title": "Mojolicious", - "subtitle": "${package_mojo}", - "arg": "mojo", - "autocomplete": "Mojolicious", - "icon": { - "path": "mojo-icon.png" - } } ] } @@ -884,11 +718,11 @@ EOB matchmode 0 matchstring - mojo + tools outputlabel uid - 987B61E6-3C9B-4CC1-A323-5AA0192DBDE4 + 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B inputstring @@ -898,402 +732,136 @@ EOB matchmode 0 matchstring - brew + doc outputlabel uid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B + 046B128E-3352-4012-83A4-44FD918EE4E5 + + + inputstring + {query} + matchcasesensitive + + matchmode + 0 + matchstring + presets + outputlabel + + uid + 045A2544-20E0-421A-B17F-ED08F558D2E1 + + + inputstring + {query} + matchcasesensitive + + matchmode + 0 + matchstring + compress + outputlabel + + uid + 1BF300BB-6515-4042-BC86-E62DD65CB460 elselabel else hideelse - + type alfred.workflow.utility.conditional uid - F5093F85-53E7-4E65-BECB-DAA22C5B8DD1 + B884E15A-B55E-46D8-9372-5B3565E9FA28 version 1 config - concurrently - + alfredfiltersresults + + alfredfiltersresultsmatchmode + 0 + argumenttreatemptyqueryasnil + + argumenttrimmode + 0 + argumenttype + 1 escaping + 102 + keyword + {var:trigger} + queuedelaycustom + 3 + queuedelayimmediatelyinitially + + queuedelaymode 0 + queuemode + 1 + runningsubtext + Initialisation... script - #!/usr/bin/env perl + #!/bin/bash +setup_tools=( "brew" "jq" ) -use strict; -use warnings; -use Mojo::UserAgent; - -# Get HTML page of cwebp documentation -my $url = Mojo::URL->new('https://developers.google.com/speed/webp/docs/cwebp'); -my $ua = Mojo::UserAgent->new; -my $dom = $ua->get($url)->result->dom; - -# Title of options are under dt > code tags -my $titles = $dom->find('dt > code')->map('text')->join("|"); - -# Put a delimiter for next script -print $titles, '&&&&&'; - -# Description of options are under dd tags -for my $descr ($dom->find('dd')->each) { - print $descr->all_text, '|'; -} - scriptargtype - 0 - scriptfile - parse.pl - type - 4 - - inboundconfig - - externalid - {query} - usecustominputarg - - - type - alfred.workflow.action.script - uid - F3F45CB5-7506-4071-887D-9E482B8F5CFB - version - 2 - - - config - - concurrently - - escaping - 102 - script - v#!/bin/bash -html_parse="{query}" - -# Supress last pipe and convert &&&&& into new line -clean_parse=$(echo $html_parse | sed 's/\(.*\)|/\1/' | sed 's/&&&&&/\n/') - -# Transform first line as key and second as value to group title and descrp of option -pair_json=$(jq -Rn ' -( input | split("|") ) as $keys | -( inputs | split("|") ) as $vals | -[[$keys, $vals] | transpose[] | {key:.[0],value:.[1]}] | from_entries -' <<<"$clean_parse") - -jq -r '. | to_entries[] | {uid: .key, title: .key, subtitle: .value, arg: .key, autocomplete: .key, icon:{path:"page-icon.png"}}' <<< "${pair_json}" - scriptargtype - 0 - scriptfile - - type - 0 - - type - alfred.workflow.action.script - uid - E927BA1E-77BB-466D-A594-C260C2CA3651 - version - 2 - - - config - - adduuid - - allowemptyfiles - - createintermediatefolders - - filename - {var:doc_folder}/docs.txt - filetext - {query} - ignoredynamicplaceholders - - relativepathmode - 0 - type - 1 - - type - alfred.workflow.output.writefile - uid - 02196C93-1D05-40FE-B21B-513520F9346D - version - 1 - - - config - - conditions - - - inputstring - {query} - matchcasesensitive - - matchmode - 0 - matchstring - tools - outputlabel - - uid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B - - - inputstring - {query} - matchcasesensitive - - matchmode - 0 - matchstring - webp - outputlabel - - uid - 2B93A876-A711-4FD7-8C0A-2B3DBADF4936 - - - inputstring - {query} - matchcasesensitive - - matchmode - 0 - matchstring - doc - outputlabel - - uid - 046B128E-3352-4012-83A4-44FD918EE4E5 - - - inputstring - {query} - matchcasesensitive - - matchmode - 0 - matchstring - imgfolder - outputlabel - - uid - A3C12F25-0355-421E-BFAB-A4C9A2F9AA54 - - - inputstring - {query} - matchcasesensitive - - matchmode - 4 - matchstring - presets - outputlabel - - uid - 045A2544-20E0-421A-B17F-ED08F558D2E1 - - - inputstring - {query} - matchcasesensitive - - matchmode - 4 - matchstring - compress - outputlabel - - uid - 1BF300BB-6515-4042-BC86-E62DD65CB460 - - - elselabel - else - hideelse - - - type - alfred.workflow.utility.conditional - uid - B884E15A-B55E-46D8-9372-5B3565E9FA28 - version - 1 - - - config - - escaping - 0 - script - brew install {query} - - type - alfred.workflow.action.terminalcommand - uid - CA89FD68-A173-4BA5-A981-DB447D2E51D3 - version - 1 - - - config - - lastpathcomponent - - onlyshowifquerypopulated - - removeextension - - text - - title - Documentation updated 📖 - - type - alfred.workflow.output.notification - uid - CE84884F-0D18-4E0D-AA0C-C65A9E52A5F4 - version - 1 - - - config - - alfredfiltersresults - - alfredfiltersresultsmatchmode - 0 - argumenttreatemptyqueryasnil - - argumenttrimmode - 0 - argumenttype - 1 - escaping - 102 - keyword - webp - queuedelaycustom - 3 - queuedelayimmediatelyinitially - - queuedelaymode - 0 - queuemode - 1 - runningsubtext - Initialisation... - script - #!/bin/bash -setup_tools=( "brew" "jq" ) - -for i in {1..3} -do - check[$i]="non" -done - -for i in "${setup_tools[@]}" -do - if [[ "$(command -v ${i})" == "" ]] - then - status="Cannot check CWebP version -> go to the setup toolbox and check Homebrew and jq installation 🚧" - break - fi - if [[ "${i}" == "jq" && "$(command -v cwebp)" != "" ]] - then - online_version="$(curl -s https://formulae.brew.sh/api/formula/webp.json | jq -r '.versions.stable')" - local_version="$(cwebp -version)" +for i in "${setup_tools[@]}" +do + if [[ "$(command -v ${i})" == "" ]] + then + status="Cannot check cwebp version -> go to the setup toolbox and check Homebrew and jq installation 🚧" + break + fi + if [[ "${i}" == "jq" && "$(command -v cwebp)" != "" ]] + then + online_version="$(curl -s https://formulae.brew.sh/api/formula/webp.json | jq -r '.versions.stable')" + local_version="$(cwebp -version)" if [[ "${online_version}" == "${local_version}" ]] then - status="CWebP is up to date ✅ | $local_version" - check[1]="oui" + status="cwebp is up to date ✅ | $local_version" elif [[ "$local_version" != "" ]] then status="Update available âœĻ | $local_version to $online_version" - check[1]="oui" fi else - status="CWebP is not installed ❌ | Hit Enter to install ⮇ïļ | Need Homebrew to be installed ⚠ïļ" + status="cwebp is not installed ❌ | It needs Homebrew to be installed ⚠ïļ" fi done -if [[ "${img_folder}" != "" ]] -then - pathimg="${img_folder} ✅" - check[2]="oui" -else - pathimg="No folder selected ❌" -fi - if [[ "${the_preset}" != "" ]] then preset_s="$(echo "${the_preset}" | sed 's/,/ | /') ✅" - check[3]="oui" else preset_s="No preset selected ❌" fi -for i in {1..3} -do - if [[ "${check[$i]}" == "non" ]] - then - arg_compress="compress,non" - break - else - arg_compress="compress,oui" - fi -done - -if [[ "${check[1]}" == "non" ]] -then - arg_preset="presets,non" -else - arg_preset="presets,oui" -fi - cat << EOB { "items": [ { "title": "Start the compression", - "subtitle": "Run the CWebP compression with your parameters", - "arg": "${arg_compress}", + "subtitle": "Run the cwebp compression with your parameters", + "arg": "compress", "autocomplete": "Start the compression", "icon": { "path": "rocket-icon.png" } }, { - "title": "Preset", - "subtitle": "${preset_s}", - "arg": "${arg_preset}", - "autocomplete": "Preset", + "title": "Presets", + "subtitle": "Create, modify or remove presets", + "arg": "presets", + "autocomplete": "Presets", "icon": { "path": "30F44CB0-C58D-48C6-B23A-AA81E4A3CD16.png" } }, - { - "title": "Images Folder", - "subtitle": "${pathimg}", - "arg": "imgfolder", - "autocomplete": "Images Folder", - "icon": { - "path": "B857BE3A-4375-4247-9082-05CDEC4E3BB4.png" - } - }, { "title": "CWebP documentation", "subtitle": "Show cwebp documentation", @@ -1344,25 +912,6 @@ EOB version 3 - - config - - autopaste - - clipboardtext - {query} - ignoredynamicplaceholders - - transient - - - type - alfred.workflow.output.clipboard - uid - AF4D7687-5A37-4236-B166-A78D77CAB6A5 - version - 3 - config @@ -1392,9 +941,8 @@ EOB #!/bin/bash raw=' {"uid":"Online documention","title":"Online documention","subtitle":"Open online cwebp documentation","arg":"online","autocomplete":"Online documention","icon":{"path":"globe-icon.png"}} -{"uid":"Refresh documentation","title":"Refresh documentation","subtitle":"Refresh Alfred cwebp documentation","arg":"refresh","autocomplete":"Refresh documentation","icon":{"path":"refresh-icon.png"}} ' -doc_json=$(jq '.' ${doc_folder}/docs.txt) +doc_json=$(jq '.' ./docs.txt) temp=$(echo "$raw$doc_json") final=$(jq -s '{items : .}' <<< $temp) @@ -1428,137 +976,6 @@ EOB version 3 - - config - - conditions - - - inputstring - {query} - matchcasesensitive - - matchmode - 0 - matchstring - online - outputlabel - - uid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B - - - inputstring - {query} - matchcasesensitive - - matchmode - 0 - matchstring - refresh - outputlabel - - uid - 48BA939C-0394-4A5B-84BD-AE430C803E1B - - - elselabel - else - hideelse - - - type - alfred.workflow.utility.conditional - uid - 522260BF-CEF1-48EF-B0CE-684F4733601A - version - 1 - - - config - - anchorfields - - argumenttrimmode - 0 - argumenttype - 0 - daterange - 0 - fields - - - field - kMDItemDisplayName - not - - split - - value - {query} - words - - - - field - kMDItemAlternateNames - not - - split - - value - {query} - words - - - - field - kMDItemFinderComment - not - - split - - value - {query} - words - - - - includesystem - - limit - 0 - runningsubtext - - scopes - - sortmode - 0 - subtext - Loading Folders.... - title - Choose folder for compression - types - - public.folder - - withspace - - - inboundconfig - - externalid - {query} - usecustominputarg - - - type - alfred.workflow.input.filefilter - uid - B857BE3A-4375-4247-9082-05CDEC4E3BB4 - version - 2 - config @@ -1569,59 +986,65 @@ EOB removeextension text - {var:_img_folder} + {query} title - Images Folder set up ✅ + Copied to clipboard 📋 type alfred.workflow.output.notification uid - 9026F71A-CC9B-41BA-ACD0-2F1E39DBF2E2 + 15BCCE87-A6D5-4601-AA9A-F6EAD6B853D0 version 1 config - concurrently + autopaste - escaping - 102 - script - set _img_folder to "{query}" - -tell application id "com.runningwithcrayons.Alfred" to set configuration "img_folder" to value _img_folder in workflow "com.benjamino.smart_webp_compression" - scriptargtype - 0 - scriptfile - - type - 6 + clipboardtext + {query} + ignoredynamicplaceholders + + transient + type - alfred.workflow.action.script + alfred.workflow.output.clipboard uid - 9741013C-6FB7-4382-93A5-C6B81A57CF93 + AF4D7687-5A37-4236-B166-A78D77CAB6A5 version - 2 + 3 config - argument - {query} - passthroughargument + conditions + + + inputstring + {query} + matchcasesensitive + + matchmode + 0 + matchstring + online + outputlabel + + uid + 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B + + + elselabel + else + hideelse - variables - - _img_folder - {query} - type - alfred.workflow.utility.argument + alfred.workflow.utility.conditional uid - C8D719F8-DD29-4338-B775-A476F2437FAB + 522260BF-CEF1-48EF-B0CE-684F4733601A version 1 @@ -1708,7 +1131,7 @@ jq -R 'split(",") | {title: .[0], subtitle: .[1], arg: (.[0] + "," + .[1]), auto createintermediatefolders filename - {var:preset_log_folder}/presets.txt + {var:data_folder}/presets.txt filetext {query} ignoredynamicplaceholders @@ -1838,7 +1261,7 @@ raw=' {"title":"Remove a preset","subtitle":"Select the preset you want to remove and press enter","arg":"delete","autocomplete":"Remove a preset","icon":{"path":"154BFBB1-825A-4E5D-A989-907CC91E90B1.png"}} {"title":"Modify a preset","subtitle":"Select the preset you want to modify and change its value","arg":"modify","autocomplete":"Modify a preset","icon":{"path":"D0BCADEA-4B48-4681-BF5A-3A99963BCB69.png"}} ' -presets=$(jq '.' ${preset_log_folder}/presets.txt) +presets=$(jq '.' ${data_folder}/presets.txt) temp=$(echo "$raw$presets") final=$(jq -s '{items : .}' <<< $temp) @@ -1875,46 +1298,27 @@ EOB config - conditions - - - inputstring - {query} - matchcasesensitive - - matchmode - 4 - matchstring - oui - outputlabel - - uid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B - - - inputstring - {query} - matchcasesensitive - - matchmode - 4 - matchstring - non - outputlabel - - uid - 48BA939C-0394-4A5B-84BD-AE430C803E1B - - - elselabel - else - hideelse + adduuid + + allowemptyfiles + + createintermediatefolders + filename + {var:data_folder}/presets.txt + filetext + {query} + ignoredynamicplaceholders + + relativepathmode + 0 + type + 1 type - alfred.workflow.utility.conditional + alfred.workflow.output.writefile uid - 49BEB4B9-ED4B-4C09-AD1B-98D642860B6D + B0630315-06B0-4A9E-9CAD-54819448B18C version 1 @@ -1929,7 +1333,7 @@ EOB #!/bin/bash arg="{query}" -dirty=$(jq --arg key "$arg" 'del(select(.arg == $key))' ${preset_log_folder}/presets.txt) +dirty=$(jq --arg key "$arg" 'del(select(.arg == $key))' ${data_folder}/presets.txt) clean=$(echo $dirty | sed 's/null//') @@ -1948,33 +1352,6 @@ jq '.' <<< "${clean}" version 2 - - config - - adduuid - - allowemptyfiles - - createintermediatefolders - - filename - {var:preset_log_folder}/presets.txt - filetext - {query} - ignoredynamicplaceholders - - relativepathmode - 0 - type - 1 - - type - alfred.workflow.output.writefile - uid - B0630315-06B0-4A9E-9CAD-54819448B18C - version - 1 - config @@ -2023,7 +1400,7 @@ jq '.' <<< "${clean}" Loading Presets... script #!/bin/bash -presets=$(jq -s '{items : .}' ${preset_log_folder}/presets.txt) +presets=$(jq -s '{items : .}' ${data_folder}/presets.txt) cat << EOB ${presets} @@ -2076,6 +1453,33 @@ EOB version 1 + + config + + adduuid + + allowemptyfiles + + createintermediatefolders + + filename + {var:data_folder}/presets.txt + filetext + {query} + ignoredynamicplaceholders + + relativepathmode + 0 + type + 1 + + type + alfred.workflow.output.writefile + uid + 0D2BC16E-A86B-434C-B357-9BA0F382A204 + version + 1 + config @@ -2086,14 +1490,14 @@ EOB removeextension text - Please install correctly Hombrew, Jq and CWebP + name : {var:_presetmf1} | value : {var:_presetmf2} title - Oups... something went wrong ❌ + Preset modified ✍ïļ type alfred.workflow.output.notification uid - 6A8FBE54-FA7D-4A95-8007-8661D0997072 + FEF31982-CE2C-4D53-A108-2F06FE07A9DD version 1 @@ -2105,195 +1509,144 @@ EOB escaping 102 script - tell application id "com.runningwithcrayons.Alfred" to remove configuration "the_preset" in workflow "com.benjamino.smart_webp_compression" + #!/bin/bash +old_preset="${_old_preset}" +temp_new_preset="{query}" +new_preset=$(jq -R 'split(",") | {title: .[0], subtitle: .[1], arg: (.[0] + "," + .[1]), autocomplete: .[0], icon:{path:"preset-icon.png"}}' <<< "${temp_new_preset}") + +jq --arg key1 "$old_preset" --argjson key2 "$new_preset" 'select(.arg == $key1) |= $key2' "${data_folder}/presets.txt" scriptargtype 0 scriptfile type - 6 + 0 type alfred.workflow.action.script uid - A5A2AF5F-E9C4-4398-AD34-4BB96ACD3D06 + C8333BF6-C873-4B46-A39F-9FDAC8311F9F version 2 config - conditions - - - inputstring - {query} - matchcasesensitive - - matchmode - 0 - matchstring - {var:the_preset} - outputlabel - - uid - 2499EC30-993E-455E-9B3B-CBDF81F69684 - - - elselabel - else - hideelse - - - type - alfred.workflow.utility.conditional - uid - 595747D0-9789-4ECE-B171-19C89A5A5296 - version - 1 - - - config - - lastpathcomponent - - onlyshowifquerypopulated - - removeextension - + argumenttype + 0 + subtext + Modify the preset_name,preset_detail and press Enter â†Đïļ text - Please check the workflow documentation - title - Oups... config is not correct ❌ - - type - alfred.workflow.output.notification - uid - 750A55C9-C8A2-49BB-8AB3-7E17DD1FE602 - version - 1 - - - config - - conditions - - - inputstring - {query} - matchcasesensitive - - matchmode - 4 - matchstring - non - outputlabel - - uid - 1891A02A-6CF8-4BBC-B8F9-97BD1B09BF5B - - - inputstring - {query} - matchcasesensitive - - matchmode - 4 - matchstring - oui - outputlabel - - uid - 48BA939C-0394-4A5B-84BD-AE430C803E1B - - - elselabel - else - hideelse + Modify the preset + withspace type - alfred.workflow.utility.conditional + alfred.workflow.input.keyword uid - 1DC28B4A-CE6E-42D7-9870-23191353528A + 91898FBD-AF59-44AC-9750-B83CD3A8A694 version 1 config - adduuid - - allowemptyfiles + alfredfiltersresults - createintermediatefolders + alfredfiltersresultsmatchmode + 0 + argumenttreatemptyqueryasnil - filename - {var:preset_log_folder}/presets.txt - filetext - {query} - ignoredynamicplaceholders - - relativepathmode + argumenttrimmode 0 - type + argumenttype + 2 + escaping + 102 + queuedelaycustom + 3 + queuedelayimmediatelyinitially + + queuedelaymode + 0 + queuemode + 1 + runningsubtext + Loading Presets... + script + #!/bin/bash +presets=$(jq -s '{items : .}' ${data_folder}/presets.txt) + +cat << EOB +${presets} +EOB + scriptargtype 1 + scriptfile + + subtext + Modify the preset_name,preset_detail and press Enter â†Đïļ + title + Modify a preset + type + 0 + withspace + + + inboundconfig + + externalid + {query} + usecustominputarg + type - alfred.workflow.output.writefile + alfred.workflow.input.scriptfilter uid - 0D2BC16E-A86B-434C-B357-9BA0F382A204 + D0BCADEA-4B48-4681-BF5A-3A99963BCB69 version - 1 + 3 config - lastpathcomponent - - onlyshowifquerypopulated - - removeextension + delimiter + , + discardemptyarguments - text - name : {var:_presetmf1} | value : {var:_presetmf2} - title - Preset modified ✍ïļ + outputas + 0 + trimarguments + + variableprefix + _presetmf type - alfred.workflow.output.notification + alfred.workflow.utility.split uid - FEF31982-CE2C-4D53-A108-2F06FE07A9DD + A93876C1-0937-4F57-BCC3-5B2964742411 version 1 config - concurrently + argument + {query} + passthroughargument - escaping - 102 - script - #!/bin/bash -old_preset="${_old_preset}" -temp_new_preset="{query}" -new_preset=$(jq -R 'split(",") | {title: .[0], subtitle: .[1], arg: (.[0] + "," + .[1]), autocomplete: .[0], icon:{path:"preset-icon.png"}}' <<< "${temp_new_preset}") - -jq --arg key1 "$old_preset" --argjson key2 "$new_preset" 'select(.arg == $key1) |= $key2' "${preset_log_folder}/presets.txt" - scriptargtype - 0 - scriptfile - - type - 0 + variables + + _old_preset + {query} + type - alfred.workflow.action.script + alfred.workflow.utility.argument uid - C8333BF6-C873-4B46-A39F-9FDAC8311F9F + 99F304D7-85C9-481C-B520-9003FD19B70D version - 2 + 1 config @@ -2301,16 +1654,23 @@ jq --arg key1 "$old_preset" --argjson key2 "$new_preset" 'select(.arg == $key1) argumenttype 0 subtext - Modify the preset_name,preset_detail and press Enter â†Đïļ + Write the cwebp options and press Enter â†Đïļ text - Modify the preset + Input your cwebp options withspace + inboundconfig + + externalid + {query} + usecustominputarg + + type alfred.workflow.input.keyword uid - 91898FBD-AF59-44AC-9750-B83CD3A8A694 + 36746137-2858-4981-968C-2DDC0B19B7E8 version 1 @@ -2338,22 +1698,27 @@ jq --arg key1 "$old_preset" --argjson key2 "$new_preset" 'select(.arg == $key1) queuemode 1 runningsubtext - Loading Presets... + script #!/bin/bash -presets=$(jq -s '{items : .}' ${preset_log_folder}/presets.txt) +raw=' +{"title":"Manual options","subtitle":"Run the cwebp compression with your manual input","arg":"manual","autocomplete":"Manual options","icon":{"path":"36746137-2858-4981-968C-2DDC0B19B7E8.png"}} +' +presets=$(jq '.' ${data_folder}/presets.txt) +temp=$(echo "$raw$presets") +final=$(jq -s '{items : .}' <<< $temp) cat << EOB -${presets} +${final} EOB scriptargtype 1 scriptfile subtext - Modify the preset_name,preset_detail and press Enter â†Đïļ + Select the preset you want to use for the compression or put your own cwebp options title - Modify a preset + Select a preset or input your options type 0 withspace @@ -2369,28 +1734,113 @@ EOB type alfred.workflow.input.scriptfilter uid - D0BCADEA-4B48-4681-BF5A-3A99963BCB69 + 3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45 version 3 config - delimiter - , - discardemptyarguments + anchorfields + + argumenttrimmode + 0 + argumenttype + 0 + daterange + 0 + fields + + + field + kMDItemDisplayName + not + + split + + value + {query} + words + + + + field + kMDItemAlternateNames + not + + split + + value + {query} + words + + + + field + kMDItemFinderComment + not + + split + + value + {query} + words + + + + includesystem - outputas + limit 0 - trimarguments + runningsubtext + + scopes + + sortmode + 0 + subtext + Loading Images and Folders.... + title + Choose images / folders for compression + types + + org.webmproject.webp + public.folder + public.jpeg + public.png + public.tiff + + withspace + + + inboundconfig + + externalid + {query} + usecustominputarg - variableprefix - _presetmf type - alfred.workflow.utility.split + alfred.workflow.input.filefilter uid - A93876C1-0937-4F57-BCC3-5B2964742411 + B857BE3A-4375-4247-9082-05CDEC4E3BB4 + version + 2 + + + config + + addfilestobuffer + + clearbuffer + + outputtype + 0 + + type + alfred.workflow.action.buffer + uid + CF62D56A-4851-4B82-806F-903137C1AC35 version 1 @@ -2400,55 +1850,123 @@ EOB argument {query} passthroughargument - + variables - _old_preset + _the_preset {query} type alfred.workflow.utility.argument uid - 99F304D7-85C9-481C-B520-9003FD19B70D + 4E7EBAA0-241E-45D4-8BF4-D8DD2B14C7B5 version 1 config - concurrently + conditions + + + inputstring + {query} + matchcasesensitive + + matchmode + 0 + matchstring + manual + outputlabel + + uid + B04F7F98-F4C6-4E61-986D-68F6986FEA93 + + + elselabel + else + hideelse - escaping - 102 - script - #!/bin/bash -PARAMS=$(echo ${the_preset} | sed -e 's/^.*,//g' | tr -d "'") - -for FILE in ${img_folder}/* -do - 2>&1 cwebp eval " ${PARAMS}" "${FILE}" -o "${FILE%.*}.webp" -done - scriptargtype - 0 - scriptfile - - type - 0 - inboundconfig + type + alfred.workflow.utility.conditional + uid + 3E2FD780-20D4-4517-A4C7-3AB654D065CA + version + 1 + + + config - externalid + argument {query} - usecustominputarg - + passthroughargument + + variables + + _links_list + {var:_link_no_buffer} + type - alfred.workflow.action.script + alfred.workflow.utility.argument uid - 756748B7-4D28-48DF-BBA9-2EA452BB0611 + 8C24C2F6-569F-446F-A73C-2C71FCF62E95 version - 2 + 1 + + + config + + conditions + + + inputstring + {query} + matchcasesensitive + + matchmode + 0 + matchstring + + outputlabel + + uid + 40F21FC1-5AB6-4DD3-BBB7-CDD2D7B59B8F + + + elselabel + else + hideelse + + + type + alfred.workflow.utility.conditional + uid + 798BDC7B-0FA4-46EE-A5F2-56861741B720 + version + 1 + + + config + + argument + {query} + passthroughargument + + variables + + _link_no_buffer + {query} + + + type + alfred.workflow.utility.argument + uid + EF19D858-3E32-4423-AD95-F96100EC2A82 + version + 1 config @@ -2460,29 +1978,68 @@ done createintermediatefolders filename - {var:preset_log_folder}/logs.txt + {var:data_folder}/logs.txt filetext - {date} -{time} -Folder modified : {var:img_folder} -Preset : {var:the_preset} + {date:YYYY/MM/dd} +{time:HH:mm:ss} +user input : {var:_links_list} +cwebp options : {var:_the_preset} + +{query} +______________________ + + ignoredynamicplaceholders + + relativepathmode + 0 + type + 2 + + type + alfred.workflow.output.writefile + uid + 6E3869D0-4B82-40F7-9D79-109E01C84A8E + version + 1 + + + config + + concurrently + + escaping + 102 + script + #!/bin/bash +RAW=( $_links_list ) +IMAGES=() +PARAMS="{query}" + +for LINK in "${RAW[@]}"; do + if [[ -d "${LINK}" ]] + then + IMAGES+=("$(find -E "${LINK}" /dev -maxdepth 1 -iregex '.*\.(png|jpg|jpeg|tif|tiff|webp)')") + else + IMAGES+=("${LINK}") + fi +done -{query} -______________________ - - ignoredynamicplaceholders - - relativepathmode +for IMAGE in "${IMAGES[@]}"; do + 2>&1 cwebp eval " ${PARAMS}" "${IMAGE}" -o "${IMAGE%.*}.webp" +done + scriptargtype 0 + scriptfile + type - 2 + 0 type - alfred.workflow.output.writefile + alfred.workflow.action.script uid - 8C61ECE1-9688-4CC2-AD32-0A344DB310A9 + A0772B13-46E4-4B82-9F55-7E1454E9D3AB version - 1 + 2 config @@ -2494,7 +2051,7 @@ ______________________ removeextension text - {var:preset_log_folder}/logs.txt + {var:data_folder}/logs.txt title See the logs here 📃 @@ -2508,86 +2065,64 @@ ______________________ config - conditions - - - inputstring - {var:_old_preset} - matchcasesensitive - - matchmode - 0 - matchstring - {var:the_preset} - outputlabel - - uid - 2499EC30-993E-455E-9B3B-CBDF81F69684 - - - elselabel - else - hideelse - - - type - alfred.workflow.utility.conditional - uid - 3249F739-3D81-4D23-9667-C2DD7429B5E8 - version - 1 - - - config - - concurrently + matchmode + 1 + matchstring + ^[^,]+, + regexcaseinsensitive - escaping - 102 - script - set _the_preset to "{query}" - -tell application id "com.runningwithcrayons.Alfred" to set configuration "the_preset" to value _the_preset in workflow "com.benjamino.smart_webp_compression" - scriptargtype - 0 - scriptfile + regexmultiline + + replacestring - type - 6 type - alfred.workflow.action.script + alfred.workflow.utility.replace uid - 5ABD8595-9ED9-4626-A339-3E5F97ECB442 + 65FDBA59-C0EB-4475-A3FE-94595BBB1EFD version 2 config - lastpathcomponent - - onlyshowifquerypopulated - - removeextension - - text - {var:_the_preset} - title - Preset selected ✅ + argument + {query} + passthroughargument + + variables + + _the_preset + {query} + type - alfred.workflow.output.notification + alfred.workflow.utility.argument uid - 1EC557CA-45DF-485F-B2D2-E9B611448E07 + 20555D55-EC80-4B6B-A627-BFB69508C68B version 1 + config + + acceptsmulti + 1 + filetypes + + org.webmproject.webp + public.folder + public.jpeg + public.png + public.tiff + + name + Compress images to WebP + type - alfred.workflow.utility.junction + alfred.workflow.trigger.action uid - B2ED758E-2C2B-4709-BAF1-2D6A6236303C + DDFB0521-4230-42EE-9FEA-C57F71CDBA82 version 1 @@ -2600,14 +2135,14 @@ tell application id "com.runningwithcrayons.Alfred" to set configuration "the_pr variables - _the_preset + _links_list {query} type alfred.workflow.utility.argument uid - 1D587362-EF39-4930-8AEC-C83A00037F71 + F76BC3A9-80D0-4768-88D5-0BF9C16DC0EB version 1 @@ -2621,90 +2156,68 @@ tell application id "com.runningwithcrayons.Alfred" to set configuration "the_pr ## ✅ Prerequisite -* 🍎 MacOS +* 🍎 MacOS. * ðŸŽĐ Alfred 5. Note that the [Alfred Powerpack](https://www.alfredapp.com/powerpack/) is required to use workflows. -## 🧙‍♂ïļ Invoke the Workflow +## â„đïļ information -You can invoke the workflow by writing `webp` onto the Alfred search box. You can change this value within the workflow [optionnal]. If you'd like to change the value, follow the steps below: +* 🏎ïļ Under the hood, the compression is made with [cwebp](https://developers.google.com/speed/webp/docs/cwebp) (made by Google), a tool that allows to compress images into the WebP format, which is generally lighter ðŸŠķ, and broadly used to share images on the web. -![double_click](./images/double_click.png) +## 🧙‍♂ïļ Invoke the Workflow -![trigger](./images/trigger.png) +You can invoke the workflow by writing `webp` onto the Alfred search box. You can change this value by changing the `ðŸ•đïļ Workflow trigger` variable in workflow configuration panel [optionnal]. ## 🧰 Setup the workflow -Note that all the following commands can be triggered within the workflow ðŸĪ“ +### ðŸ‘Ļ‍ðŸ’ŧ Install dependencies #### Open the Terminal of you Mac and run the following commands -1. ☑ïļ Install Homebrew +1. ☑ïļ Install Homebrew. `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` -2. ☑ïļ Install cwebp jq and cpanm - -`brew install webp | brew install jq | brew install cpanm` +2. ☑ïļ Install cwebp and jq. -3. ☑ïļ Install Mojolicious - -`cpanm Mojolicious --sudo` +`brew install webp | brew install jq` #### Check your installation under the Setup toolbox of the workflow ![toolbox](./images/toolbox_dark_mode.png) -If something is not installed you'll have the following message +If something is not installed you'll have the following message : ![jq_not_installed](./images/jq_not_installed.png) -#### CWebP version can be seen in the home menu. +#### CWebP version can be seen in the home menu ![cwebp_home_dark_mode](./images/cwebp_home_dark_mode.png) - The workflow is also looking for cwebp updates each time you run the workflow âœĻ +âœĻ The workflow is also checking the cwebp version each time you run it. ![cwebp_update](./images/cwebp_update.png) -## 👷‍♂ïļ Environment variables - -### 📖 Documentation folder +### 📂 Data (Presets and Logs) folder -❗ This variable cannot be empty. It's not recommended to change it. - -It contains the content of cwebp documentation within Alfred. You can refresh this documentation in the workflow - -![refresh_docs](./images/refresh_docs_dark_mode.png) - -### 📂 Presets and Logs folder - -❗ This variable cannot be empty. You can change it at your convenience. +❗ This variable cannot be empty. You can change it at your convenience in the workflow configuration panel. It contains the presets created within the workflow + output logs of the cwebp compression. -![preset_log_folder](./images/preset_log_folder.png) - -### 🖞ïļ Images folder - -⚠ïļ This variable must be set before running the compression. - -This is the target folder where images are placed for the compression. You can change it within the workflow in the home menu. - -![image_home_dark_mode](./images/image_home_dark_mode.png) +ðŸ’Ą Note that if you change the `Data folder` location after creating presets and logs, you should probably move the files created along in the new folder. -### ⚒ïļ Selected Preset +![data_folder](./images/data_folder.png) -⚠ïļ This variable must be set before running the compression. +## ðŸĪ– Usage of the workflow -The preset selected preset within the workflow holds all the cwebp [options] used for the compression. The preset selected is shown as the subtitle in the home menu. +### ⚒ïļ Handling presets -![preset_home_dark_mode](./images/preset_home_dark_mode.png) +Go under the home menu and open the `presets section`. -## ðŸĪ– Usage of the workflow +![presets_home_dark_mode](./images/presets_home_dark_mode.png) -### 🆕 Create New preset +#### Create a preset -Go under the preset section and click on "Add a preset" +Go under the `presets section` and click on "Add a preset". ![add_preset_1](./images/add_preset_1.png) @@ -2716,15 +2229,9 @@ The created preset can be seen under the preset section. New presets are put on ![add_preset_3](./images/add_preset_3.png) -### 👉 Select a preset - -Under the preset section, click on a preset to select it. - -![select_preset](./images/select_preset.png) +#### Modify a preset -### ✍ïļ Modify a preset - -Under the preset section, click on "Modify a preset". +Under the `presets section`, click on "Modify a preset". ![modify_preset_1](./images/modify_preset_1.png) @@ -2732,13 +2239,13 @@ Select the preset you want to modify. ![modify_preset_2](./images/modify_preset_2.png) -Change its name/value and press enter. Don't remove the separator (`,`). +Change its name/value and press enter ⏎. Don't remove the separator (`,`). ![modify_preset_3](./images/modify_preset_3.png) -### ❌ Remove a preset +#### Remove a preset -Under the preset section, click on "Remove a preset". +Under the `presets section`, click on "Remove a preset". ![remove_preset_1](./images/remove_preset_1.png) @@ -2746,414 +2253,388 @@ Select the preset you want to remove. ![remove_preset_2](./images/remove_preset_2.png) -## 🖞ïļ Modify the images folder +### 📖 Check the documentation + +Go under the `documentation section` from the home menu : -*See also environment variables above* 👆 +![docs_home_dark_mode](./images/docs_home_dark_mode.png) -Select the "Images Folder" under the main menu and search for the new one under Alfred. You can also manually change it under the configuration panel of the workflow. +Go to the online documentation or click on one of the options to copy it ! -![img_folder_select](./images/img_folder_select.png) +![docs_detail](./images/docs_detail.png) -## 🚀 Start the compression +### 🚀 Start the compression -Once the workflow the preset and the images folder are set correctly, click on "Start the compression" under the home menu. +#### Using Workflow File Filter + +Under the home menu, click on "Start the compression". ![start_compress](./images/start_compress.png) -Check the logs of your compression under the 📂 Presets and Logs folder. The log file contains the 2 part. In the orange box there is the {date}, {time}, {var:img_folder} and {var:the_preset}. the output of the terminal is shown under the green box. Each compression is separated by a line. +Select the folder with images or directly the image you want to compress and press enter ⏎. + +ðŸ’Ą Note that when selecting a folder, images within subdirectories aren't selected. Only images with `png|jpg|jpeg|tif|tiff|webp` file extensions are selected. In addition, they aren't case sensitive, meaning that the image extension can be `PNG|JpG|tifF...` + +![direct_compress](./images/direct_compress.png) + +Alternatively, use the `Alfred Buffer` to select folder(s) and image(s) at the same time !! Basic commands are : + +* âŒĨ↑ to add a file to the buffer from Alfred's results. +* âŒĨ↓ to add a file and move to the next item in your list of results. +* âŒĨ← to remove the last item from the buffer. +* âŒĨ→ to action all items in the buffer. +* âŒĨâŒŦ to remove all items from the buffer. + +To know more on how to use `Alfred Buffer`, follow this [link](https://www.alfredapp.com/help/features/file-search/#file-buffer). + +ðŸ’Ą Note that `Alfred Buffer` is preferred compare to the `{query}`, meaning that if you select a folder/image (by clicking on it or by pressing enter ⏎) that is not included in the buffer, **it will not be compressed**. + +![alfred_buffer](./images/alfred_buffer.png) + +Choose the cwebp options by selecting a preset or input it manually by pressing "Manual options". + +![choice_options](./images/choice_options.png) + +Check the logs of the compression. To know more on how to read logs, see the `Logs output` section below. + +#### Using Alfred Universal Actions + +Select the folder(s) / image(s) you want to compress within alfred using `Quick Search` and run `Universal Actions` with → or âŒĨ→ if you used the `Alfred buffer`. Select "Compress images to WebP". + +![universal_action](./images/universal_action.png) + +ðŸ’Ą Note that the workflow is type sensitive, meaning that if you select a file that is not part of the following types, the action "Compress images to WebP" will not be available + +![types](./images/types.png) + +If you want to know more on how to use Alfred Universal Actions, follow this [link](https://www.alfredapp.com/help/features/universal-actions/). + +#### Logs output + +Check the logs of your compression under the `Data folder`. The log file contains the 2 part. + +1. In the orange box there is : + * `{date:short}` : Date of the compression with a `yyyy/MM/dd` pattern. + * `{time}` : Exact time of the compression with a `HH:mm:ss` pattern. + * `user input : {var:_links_list}` : Folder(s) + image(s) path(s) selected with a tab â‡Ĩ separator. + * `cwebp options : {var:_the_preset}` : Preset or manual input. Preset will be displayed as `preset_name,preset_detail` whereas manual input will be displayed raw. +2. In the green box there is the `{query}` which correspond to cwebp output. + +ðŸ’Ą Note that each compression is separated by a line. ![log_detail](./images/log_detail.png) uidata - 02196C93-1D05-40FE-B21B-513520F9346D - - xpos - 1890 - ypos - 280 - 04D038F9-4BA3-44DE-9961-74A17474DB6D xpos - 960 + 800 ypos - 710 + 450 0CC2B59D-DDCA-43EF-83D0-4F9E70866E77 note Please submit issues and feature requests at https://github.com/BenjaminOddou/alfred-smart-webp-compression xpos - 65 + 45 ypos - 320 + 185 0D2BC16E-A86B-434C-B357-9BA0F382A204 xpos - 1890 + 1705 ypos - 1050 + 665 154BFBB1-825A-4E5D-A989-907CC91E90B1 xpos - 1175 - ypos - 800 - - 1B42C30F-88AE-47B5-B31D-B8BAF47130F4 - - colorindex - 10 - xpos - 1725 + 1000 ypos - 800 + 540 - 1D587362-EF39-4930-8AEC-C83A00037F71 + 15BCCE87-A6D5-4601-AA9A-F6EAD6B853D0 xpos - 1655 + 1870 ypos - 1220 + 290 - 1DC28B4A-CE6E-42D7-9870-23191353528A + 1B42C30F-88AE-47B5-B31D-B8BAF47130F4 + colorindex + 10 xpos - 385 + 1540 ypos - 1005 + 540 - 1EC557CA-45DF-485F-B2D2-E9B611448E07 + 1F94198E-A0AE-4609-A7AB-18F2EA5BD61E xpos - 2055 + 650 ypos - 1190 + 145 - 1F94198E-A0AE-4609-A7AB-18F2EA5BD61E + 20555D55-EC80-4B6B-A627-BFB69508C68B xpos - 475 + 1270 ypos - 155 + 930 303F768B-D7FE-4A18-91F0-0261BD528F2A xpos - 1340 + 1175 ypos - 705 + 445 30F44CB0-C58D-48C6-B23A-AA81E4A3CD16 xpos - 810 + 650 ypos - 720 + 460 - 3249F739-3D81-4D23-9667-C2DD7429B5E8 + 36746137-2858-4981-968C-2DDC0B19B7E8 xpos - 1575 + 1260 ypos - 1155 + 790 - 488DDF1E-8133-41BF-8753-0E3BA64EB974 + 3E2FD780-20D4-4517-A4C7-3AB654D065CA - colorindex - 3 xpos - 815 + 1175 ypos - 30 + 825 - 49BEB4B9-ED4B-4C09-AD1B-98D642860B6D + 3E7A5A98-8BE4-4FE9-AC90-4DD898D1AF45 xpos - 685 + 1000 ypos - 755 + 805 - 522260BF-CEF1-48EF-B0CE-684F4733601A + 4E7EBAA0-241E-45D4-8BF4-D8DD2B14C7B5 xpos - 970 + 1440 ypos - 410 + 825 - 595747D0-9789-4ECE-B171-19C89A5A5296 + 522260BF-CEF1-48EF-B0CE-684F4733601A xpos - 1340 + 800 ypos - 955 + 295 - 5ABD8595-9ED9-4626-A339-3E5F97ECB442 + 65FDBA59-C0EB-4475-A3FE-94595BBB1EFD - colorindex - 7 xpos - 1725 + 1440 ypos - 1190 + 930 - 6A8FBE54-FA7D-4A95-8007-8661D0997072 + 6E3869D0-4B82-40F7-9D79-109E01C84A8E xpos - 815 + 1705 ypos - 845 + 900 71E64FC2-2DAA-4FAF-A464-54D8B3567EAC xpos - 1890 + 1705 ypos - 675 + 415 73938F12-DE09-4CE5-B723-3B05299685FE xpos - 815 - ypos - 1095 - - 750A55C9-C8A2-49BB-8AB3-7E17DD1FE602 - - xpos - 815 + 1870 ypos - 970 + 900 - 756748B7-4D28-48DF-BBA9-2EA452BB0611 + 798BDC7B-0FA4-46EE-A5F2-56861741B720 - colorindex - 10 xpos - 480 + 800 ypos - 1095 + 840 7EE9CE94-B507-40B3-A060-BC337D689A6E colorindex 10 xpos - 1725 + 1540 ypos - 675 + 415 816424E4-D414-4244-AACE-55015741C929 xpos - 1340 - ypos - 830 - - 8C61ECE1-9688-4CC2-AD32-0A344DB310A9 - - xpos - 650 - ypos - 1095 - - 8DBB0399-4117-43EA-BB62-E8C9B92B16F1 - - colorindex - 3 - xpos - 815 + 1175 ypos - 155 + 570 - 9026F71A-CC9B-41BA-ACD0-2F1E39DBF2E2 + 8C24C2F6-569F-446F-A73C-2C71FCF62E95 xpos - 2055 + 895 ypos - 550 + 835 91898FBD-AF59-44AC-9750-B83CD3A8A694 xpos - 1420 - ypos - 1050 - - 9741013C-6FB7-4382-93A5-C6B81A57CF93 - - colorindex - 7 - xpos - 1725 + 1260 ypos - 550 + 665 99F304D7-85C9-481C-B520-9003FD19B70D xpos - 1340 + 1175 ypos - 1080 + 695 - A555A4F7-613D-4316-B22A-968A6E69CB70 + A0772B13-46E4-4B82-9F55-7E1454E9D3AB + colorindex + 10 xpos - 2055 + 1540 ypos - 675 + 900 - A5A2AF5F-E9C4-4398-AD34-4BB96ACD3D06 + A555A4F7-613D-4316-B22A-968A6E69CB70 - colorindex - 7 xpos - 1725 + 1870 ypos - 925 + 415 A93876C1-0937-4F57-BCC3-5B2964742411 xpos - 1575 + 1440 ypos - 1080 + 695 AF4D7687-5A37-4236-B166-A78D77CAB6A5 xpos - 1165 + 1000 ypos - 405 + 290 B0630315-06B0-4A9E-9CAD-54819448B18C xpos - 1890 - ypos - 800 - - B2ED758E-2C2B-4709-BAF1-2D6A6236303C - - xpos - 1175 + 1705 ypos - 1220 + 540 B857BE3A-4375-4247-9082-05CDEC4E3BB4 xpos - 815 + 365 ypos - 550 + 820 B884E15A-B55E-46D8-9372-5B3565E9FA28 xpos - 270 + 250 ypos - 280 + 175 C73B8C4E-A0A8-4564-9AF9-7AA8C1DE4A52 xpos - 2055 + 1870 ypos - 800 + 540 C8333BF6-C873-4B46-A39F-9FDAC8311F9F colorindex 10 xpos - 1725 - ypos - 1050 - - C8D719F8-DD29-4338-B775-A476F2437FAB - - xpos - 1340 - ypos - 580 - - CA89FD68-A173-4BA5-A981-DB447D2E51D3 - - colorindex - 3 - xpos - 815 + 1540 ypos - 280 + 665 CB9B4DE3-0575-43F8-A28E-3B18C623C590 xpos - 815 + 650 ypos - 405 + 275 CE6A52F7-0196-452F-ACAB-DC1A45F35E0B xpos - 1175 + 1000 ypos - 675 + 415 - CE84884F-0D18-4E0D-AA0C-C65A9E52A5F4 + CF62D56A-4851-4B82-806F-903137C1AC35 xpos - 2055 + 650 ypos - 280 + 820 D0BCADEA-4B48-4681-BF5A-3A99963BCB69 xpos - 1175 + 1000 ypos - 1050 + 665 D904832A-634D-4FAD-9DEA-31793271385A xpos - 1165 + 1000 ypos - 155 + 145 - E927BA1E-77BB-466D-A594-C260C2CA3651 + DDFB0521-4230-42EE-9FEA-C57F71CDBA82 - colorindex - 10 xpos - 1725 + 365 ypos - 280 + 960 - F3F45CB5-7506-4071-887D-9E482B8F5CFB + EF19D858-3E32-4423-AD95-F96100EC2A82 - colorindex - 2 xpos - 1165 + 550 ypos - 280 + 850 - F5093F85-53E7-4E65-BECB-DAA22C5B8DD1 + F76BC3A9-80D0-4768-88D5-0BF9C16DC0EB xpos - 660 + 895 ypos - 160 + 990 FEF31982-CE2C-4D53-A108-2F06FE07A9DD xpos - 2055 + 1870 ypos - 1050 + 665 userconfigurationconfig @@ -3162,91 +2643,49 @@ Check the logs of your compression under the 📂 Presets and Logs folder. The l config default - ~/Library/Application Support/Alfred/Workflow Data/com.benjamino.smart_webp_compression - filtermode - 1 + webp placeholder required - - description - This folder contains the cwebp documentation. - label - 📖 Documentation folder - type - filepicker - variable - doc_folder - - - config - - default - ~/Documents/Alfred/Smart_WebP - filtermode - 1 - placeholder - - required + trim description - This folder contains presets and logs of this workflow. + Keyword that launch the workflow label - 📂 Presets and Logs folder + ðŸ•đïļ Workflow trigger type - filepicker + textfield variable - preset_log_folder + trigger config default - + ~/Library/Application Support/Alfred/Workflow Data/com.benjamino.smart_webp_compression filtermode 1 placeholder required - - - description - This folder holds images that needs to be converted. You can modify this value within the wokflow. - label - 🖞ïļ Images folder - type - filepicker - variable - img_folder - - - config - - default - - required - - trim - verticalsize - 3 description - Create presets by inputing preset_name,preset_detail and select the one needed for the compression within the workflow. + This folder contains presets and logs outputs label - ⚒ïļ Selected preset + 📂 Data folder type - textarea + filepicker variable - the_preset + data_folder variablesdontexport version - 1.0 + 2.0 webaddress https://github.com/BenjaminOddou/alfred-smart-webp-compression diff --git a/src/mojo-icon.png b/src/mojo-icon.png deleted file mode 100644 index 10f5a41..0000000 Binary files a/src/mojo-icon.png and /dev/null differ diff --git a/src/perl-icon.png b/src/perl-icon.png deleted file mode 100644 index bcd0d39..0000000 Binary files a/src/perl-icon.png and /dev/null differ diff --git a/src/prefs.plist b/src/prefs.plist index 0c67376..fe74331 100644 --- a/src/prefs.plist +++ b/src/prefs.plist @@ -1,5 +1,8 @@ - + + data_folder + ~/Documents/Alfred/Smart_WebP + diff --git a/src/refresh-icon.png b/src/refresh-icon.png deleted file mode 100644 index 9158677..0000000 Binary files a/src/refresh-icon.png and /dev/null differ