barasher / go-exiftool

Golang wrapper for Exiftool : extract as much metadata as possible (EXIF, ...) from files (pictures, pdf, office documents, ...)
GNU General Public License v3.0
245 stars 43 forks source link

Custom extraInitArgs #61

Closed agorman closed 1 year ago

agorman commented 2 years ago

Would you be open to a pull request that allowed a user of the module to set their own extraInitArgs? Something like:

func Args(args ...string) func(*Exiftool) error {
    return func(e *Exiftool) error {
        e.extraInitArgs = append(e.extraInitArgs, args...)
        return nil
    }
}

That way a user that knows what they're doing could put any fields they want. For example if I wanted to get the Orientation tag as a number.

et, err := exiftool.NewExiftool(
    exiftool.Args("-Orientation#"),
)
barasher commented 2 years ago

Hi,

That could be interesting for "power users" but documentation should explicitly mention that unsuitable parameter can break go-exiftool. For instance, if a parameter that change exiftool's formating (JSON), go-exiftool won't be able to unmarshal exiftool's responses.

I also won't be able to fix any issue involving such extra parameters.

So, don't hesitate to send a PR :)

barasher commented 2 years ago

@agorman , do you still want to send a PR for this feature ?

agorman commented 2 years ago

@barasher I got a bit sidetracked with something else. Looking at all the options that will break things I'm not so sure it's a good idea. You can close this issue and if I figure something out I'll create a pill request. Thanks!