Browse Source

redid how creating a new exif parser works

Signed-off-by: gryffyn <me@neveris.one>
feature/autoindex
gryffyn 11 months ago
parent
commit
fd378b62a5
Signed by: gryffyn GPG Key ID: 6948DD6514D02BEF
  1. 5
      main.go
  2. 8
      parser/exif.go

5
main.go

@ -10,8 +10,7 @@ import (
func main() {
format := `%DateTimeOriginal%-gryffyn.jpg`
path := "test.jpg"
exifData := parser.Exif{}
exifData.Open(path)
exifData := parser.NewExif(path)
_ = exifData.Parse()
err := os.Rename(path, parser.ParseFormat(format, exifData.Tags))
if err != nil {
@ -19,4 +18,4 @@ func main() {
}
}
// gfn-fRen -n '%DateTimeOriginal%-gryffyn.jpg' test.jpg
// gfn-fRen -f '%DateTimeOriginal%-gryffyn.jpg' test.jpg

8
parser/exif.go

@ -21,7 +21,13 @@ type walker struct {
Tags Tags
}
func (e *Exif) Open(path string) {
func NewExif(path string) *Exif {
e := new(Exif)
e.open(path)
return e
}
func (e *Exif) open(path string) {
f, err := os.Open(path)
defer f.Close()
if err != nil {

Loading…
Cancel
Save