Skip to content

Commit

Permalink
Bug fixes for Exif variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoisaiah committed May 6, 2021
1 parent de8e164 commit 4051e9e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Other installation methods including downloading pre-compiled binaries are
- F2 is very fast and won't waste your time. See [benchmarks](#benchmarks).
- F2 allows you to [revert any renaming operation](https://github.com/ayoisaiah/f2/wiki/Undoing-a-renaming-operation) performed with the program. This means you don't have to worry about making a mistake because you can always get back to the previous state without breaking a sweat.
- F2 has good test coverage with equal attention paid to all supported platforms (Linux, Windows and macOS).
- F2 is [well documented](https://github.com/ayoisaiah/f2/wiki) so that you won't have to scratch your head while figuring out what you can do with it. Lots of [realistic examples](https://github.com/ayoisaiah/f2/wiki/Renaming-Recipes) are provided to aid comprehension.
- F2 is [well documented](https://github.com/ayoisaiah/f2/wiki) so that you won't have to scratch your head while figuring out what you can do with it. Lots of [realistic examples](https://github.com/ayoisaiah/f2/wiki/Real-world-examples) are provided to aid comprehension.

## Main features

Expand Down
2 changes: 1 addition & 1 deletion src/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func GetApp() *cli.App {
},
Usage: "F2 is a command-line tool for batch renaming multiple files and directories quickly and safely",
UsageText: "FLAGS [OPTIONS] [PATHS...]",
Version: "v1.5.8",
Version: "v1.5.9",
EnableBashCompletion: true,
Flags: []cli.Flag{
&cli.StringFlag{
Expand Down
3 changes: 2 additions & 1 deletion src/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ func getExifVar(str string) (exifVar, error) {

x.regex = regex

if strings.Contains(submatch[0], "exif.dt") {
if strings.Contains(submatch[0], "exif.dt") ||
strings.Contains(submatch[0], "x.dt") {
submatch = append(submatch[:1], submatch[1+1:]...)
}

Expand Down
20 changes: 11 additions & 9 deletions src/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,16 +433,18 @@ func replaceExifVariables(
case "dt":
date := exifData.DateTimeOriginal
arr := strings.Split(date, " ")
var dt time.Time
d := strings.ReplaceAll(arr[0], ":", "-")
t := arr[1]
var err error
dt, err = time.Parse(time.RFC3339, d+"T"+t+"Z")
if err != nil {
return "", err
}
if len(arr) > 1 {
var dt time.Time
d := strings.ReplaceAll(arr[0], ":", "-")
t := arr[1]
var err error
dt, err = time.Parse(time.RFC3339, d+"T"+t+"Z")
if err != nil {
return "", err
}

value = dt.Format(dateTokens[current.timeStr])
value = dt.Format(dateTokens[current.timeStr])
}
case "model":
value = strings.ReplaceAll(exifData.Model, "/", "_")
case "lens":
Expand Down

0 comments on commit 4051e9e

Please sign in to comment.