Skip to content

Commit

Permalink
chore - Fix typos, rename sample files, add GPL-3.0 header to source …
Browse files Browse the repository at this point in the history
…code
  • Loading branch information
cdefgah committed Feb 12, 2021
1 parent 671890b commit 6771a0e
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 16 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -26,35 +26,35 @@ 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.
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.
Expand Down
17 changes: 12 additions & 5 deletions WhatsAppJpegRepair.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
SPDX-License-Identifier: GPL-3.0-only
Copyright (c) 2020 - 2021 by Rafael Osipov <rafael.osipov@outlook.com>
*/

package main

import (
Expand Down Expand Up @@ -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
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 6771a0e

Please sign in to comment.