From 6771a0ecc9a16017f3609dc35f9ca511a529925b Mon Sep 17 00:00:00 2001 From: Rafael Osipov Date: Fri, 12 Feb 2021 11:28:28 +0300 Subject: [PATCH] chore - Fix typos, rename sample files, add GPL-3.0 header to source code --- README.md | 22 +++++++++++----------- WhatsAppJpegRepair.go | 17 ++++++++++++----- whatsapp-files/{01.jpg => sample-01.jpg} | Bin whatsapp-files/{02.jpg => sample-02.jpg} | Bin whatsapp-files/{03.jpg => sample-03.jpg} | Bin whatsapp-files/{04.jpg => sample-04.jpg} | Bin whatsapp-files/{05.jpg => sample-05.jpg} | Bin whatsapp-files/{06.jpg => sample-06.jpg} | Bin whatsapp-files/{07.jpg => sample-07.jpg} | Bin 9 files changed, 23 insertions(+), 16 deletions(-) rename whatsapp-files/{01.jpg => sample-01.jpg} (100%) rename whatsapp-files/{02.jpg => sample-02.jpg} (100%) rename whatsapp-files/{03.jpg => sample-03.jpg} (100%) rename whatsapp-files/{04.jpg => sample-04.jpg} (100%) rename whatsapp-files/{05.jpg => sample-05.jpg} (100%) rename whatsapp-files/{06.jpg => sample-06.jpg} (100%) rename whatsapp-files/{07.jpg => sample-07.jpg} (100%) diff --git a/README.md b/README.md index 70a43c5..3d77091 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ When you send jpeg files via WhatsApp and afterwards try to open received jpeg f For such cases users advised to open the broken file in MS Paint (or something similar on MacOS) and save it as jpeg file. Usually it helps, but when you have many broken image files, opening and saving every file is a kind of tedious work. -WhatsApp Jpeg Image Repair application solves this problem and can repair many broken files at once. +WhatsApp Jpeg Image Repair application solves this problem and can repair multiple broken files at once. Follow these steps: 1. Download application archive. Navigate to [the application releases](https://github.com/cdefgah/whatsapp-jpeg-repair/releases). Then expand `Assets` section and download application zip archive relevant to your operating system. -2. Unzip application archive to an arbitrary folder. I recommend to use your home folder, for example `Documents` or `Desktop` folder, to prevent filesystem access control issues upon running the application. If you use MacOS, please note that MacOS Gatekeeper blocks this application when you try to launch it. To run downloaded application on MacOS your should either [disable MacOS Gatekeeper](https://www.google.com/search?q=disable+MacOS+Gatekeeper) or build the application from the source code as described hereinafter, and replace existing executable in downloaded archive with new executable file you have built from the source code. +2. Unzip application archive to an arbitrary folder. I recommend to use your home folder, for example `Documents` or `Desktop` folder, to prevent filesystem access control issues upon running the application. If you use MacOS, please note that MacOS Gatekeeper blocks this application when you try to launch it. To run downloaded application on MacOS your should either [disable MacOS Gatekeeper](https://www.google.com/search?q=disable+MacOS+Gatekeeper) or build the application from the source code as described hereinafter, and replace existing executable in downloaded zip-archive with the new executable file you have built from the source code. 3. Open application folder `WhatsAppJpegRepair`. 4. Place broken jpeg files from WhatsApp to the `whatsapp-files` directory, located in the application folder. 5. Run the application. @@ -26,10 +26,10 @@ Currently this folder contains sample broken whatsapp jpeg images for demonstrat Example: ``` -WhatsAppJpegRepair -srcPath=/home/Documents/Photos/WhatsAppFiles +WhatsAppJpegRepair -srcPath=/home/username/Documents/Photos/WhatsAppFiles ``` -this call will use `/home/Documents/Photos/WhatsAppFiles` folder as the source path to get broken whatsapp files. +this call will use `/home/username/Documents/Photos/WhatsAppFiles` folder as the source path to get broken whatsapp files. `-destPath` - contains path to the folder, where fixed files will be stored. By default the application internal folder `fixed-files` is being used. @@ -37,24 +37,24 @@ If this folder does not exist, it will be created at runtime. Example: ``` -WhatsAppJpegRepair -srcPath=/home/Documents/Photos/WhatsAppFiles -destPath=/home/Documents/FixedPhotos +WhatsAppJpegRepair -srcPath=/home/username/Documents/Photos/WhatsAppFiles -destPath=/home/username/Documents/FixedPhotos ``` -this call will use `/home/Documents/Photos/WhatsAppFiles` folder to look for broken whatsapp files, and will use `/home/Documents/FixedPhotos` folder to store fixed images. +this call will use `/home/username/Documents/Photos/WhatsAppFiles` folder to look for broken whatsapp files, and will use `/home/username/Documents/FixedPhotos` folder to store fixed images. -`-dontWaitToClose` - if set to true, will close application just as it finished processing, otherwise it will wait until user presses 'Enter' key. By default its value is `false`. +`-dontWaitToClose` - if it is set to `true`, the application will be closed just as it finished processing, otherwise it will wait until user presses 'Enter' key. By default its value is `false`. Example: ``` -WhatsAppJpegRepair -srcPath=/home/Documents/Photos/WhatsAppFiles -dontWaitToClose=true +WhatsAppJpegRepair -srcPath=/home/username/Documents/Photos/WhatsAppFiles -dontWaitToClose=true ``` -this call will use folder `/home/Documents/Photos/WhatsAppFiles` as source file path, and application will be closes as it finished files processing. All fixed files will be stored to the default destination folder `fixed-files` (check `-destPath` option description above). +this call will use folder `/home/username/Documents/Photos/WhatsAppFiles` as a source files path, and application will be closed as it finished files processing. All fixed files will be stored to the default destination folder `fixed-files` (check `-destPath` option description above). -`-useCurrentModificationDateTime` - if it set to true, then created fixed files will get current date/time as file modification time. By default it is `false`, and all created fixed files get the same file modification date/time as source (broken) image files. +`-useCurrentModificationDateTime` - if it is set to `true`, then created fixed files will get current date/time as file modification time. By default it is `false`, and all created fixed files get the same file modification date/time as source (broken) image files. ``` WhatsAppJpegRepair -useCurrentModificationDateTime=true ``` -this call will use default source and destination folders (check `-srcPath` and `-destPath` options above), will wait until user presses Enter when the application completed the file processing, +this call will use default source and destination folders (check `-srcPath` and `-destPath` options above), the application will wait until user presses Enter to exit when all files are processed, and will set current date/time as file modification time for created fixed files. There are no mandatory options provided. You can run the application without parameters, or set arbitrary set of parameters, for the rest of parameters default values will be applied. diff --git a/WhatsAppJpegRepair.go b/WhatsAppJpegRepair.go index 0fd2312..130c866 100644 --- a/WhatsAppJpegRepair.go +++ b/WhatsAppJpegRepair.go @@ -1,3 +1,8 @@ +/* +SPDX-License-Identifier: GPL-3.0-only +Copyright (c) 2020 - 2021 by Rafael Osipov +*/ + package main import ( @@ -98,11 +103,13 @@ func main() { } } -// Repairs broken jpeg image files -// Gets location of broken files in sourceFolderPath variable -// and the location of folder, where fixed files will be stored, in the destinationFolderPath variable -// set useCurrentModificationDateTime as the relevant parameter value. -// Returns true, if there were no errors upon files processing, false otherwise. +/* +Repairs broken jpeg image files +Gets location of broken files in sourceFolderPath variable +and the location of folder, where fixed files will be stored, in the destinationFolderPath variable +set useCurrentModificationDateTime as the relevant parameter value. +Returns true, if there were no errors upon files processing, false otherwise. +*/ func repairImageFiles(sourceFolderPath string, destinationFolderPath string, useCurrentModificationDateTime bool) bool { var totalFilesCount int32 var processedFilesCount int32 diff --git a/whatsapp-files/01.jpg b/whatsapp-files/sample-01.jpg similarity index 100% rename from whatsapp-files/01.jpg rename to whatsapp-files/sample-01.jpg diff --git a/whatsapp-files/02.jpg b/whatsapp-files/sample-02.jpg similarity index 100% rename from whatsapp-files/02.jpg rename to whatsapp-files/sample-02.jpg diff --git a/whatsapp-files/03.jpg b/whatsapp-files/sample-03.jpg similarity index 100% rename from whatsapp-files/03.jpg rename to whatsapp-files/sample-03.jpg diff --git a/whatsapp-files/04.jpg b/whatsapp-files/sample-04.jpg similarity index 100% rename from whatsapp-files/04.jpg rename to whatsapp-files/sample-04.jpg diff --git a/whatsapp-files/05.jpg b/whatsapp-files/sample-05.jpg similarity index 100% rename from whatsapp-files/05.jpg rename to whatsapp-files/sample-05.jpg diff --git a/whatsapp-files/06.jpg b/whatsapp-files/sample-06.jpg similarity index 100% rename from whatsapp-files/06.jpg rename to whatsapp-files/sample-06.jpg diff --git a/whatsapp-files/07.jpg b/whatsapp-files/sample-07.jpg similarity index 100% rename from whatsapp-files/07.jpg rename to whatsapp-files/sample-07.jpg