Skip to content

Commit

Permalink
docs: Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
szh committed Sep 25, 2024
1 parent ca834a5 commit 6845d1b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Hi there! 👋

This is a simple project I put together for fun to allow me to pull photos and
videos from my wildlife camera (built using
[github.com/interactionresearchstudio/NaturewatchCameraServer](https://github.com/interactionresearchstudio/NaturewatchCameraServer),
full tutorial available on their [website](https://mynaturewatch.net/make)) to
my Raspberry Pi NAS.

To use this, you need to connect your wildlife camera to a local WiFi network
and run this Go program on a Raspberry Pi (or any other computer) on the same
network. You can build and run the code yourself, or if you're using a Raspberry
Pi you can download the pre-built binary from the
[releases](https://github.com/szh/naturewatch-fetcher/releases) here on GitHub.

## Configuration

There are a few configuration options you need to set in an `app.env` file in
the same directory as the binary, and you can find an example of this file
[here](app.env). The configuration options are as follows:

- NATUREWATCH_URL The URL of the NatureWatch server on your local network. This
can be an IP address or a hostname but must include the protocol (generally
`http://`).

- FETCH_INTERVAL_SECONDS The number of seconds to wait between fetches. If this
is 0 or negative, the process will exit after the first fetch.

- OUTPUT_PATH The output path on the local filesystem where photos and videos
will be saved. This path must already exist. However, the `photos` and
`videos` subdirectories will be created if they do not exist.

## Building

Just run `go build` in the root of the repository to build the binary. You can
then run the binary with `./naturewatch-fetcher`.

## Contributing

If you have any suggestions or improvements, feel free to open an issue or a
pull request.

## License

This poroject is licensed under the GPL-3.0 license. You can find the full text
of the license in the [LICENSE](LICENSE) file.
13 changes: 10 additions & 3 deletions pkg/util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ import (
)

type ConfigStruct struct {
NatureWatchURL string `mapstructure:"NATUREWATCH_URL"`
FetchIntervalSeconds int `mapstructure:"FETCH_INTERVAL_SECONDS"`
OutputPath string `mapstructure:"OUTPUT_PATH"`
// The URL of the NatureWatch server. This can be an IP address or a hostname
// but must include the protocol (generally "http://")
NatureWatchURL string `mapstructure:"NATUREWATCH_URL"`
// The number of seconds to wait between fetches. If this is 0 or negative,
// the process will exit after the first fetch.
FetchIntervalSeconds int `mapstructure:"FETCH_INTERVAL_SECONDS"`
// The output path on the local filesystem where photos and videos will be saved.
// This path must already exist. However, the photos and videos subdirectories
// will be created if they do not exist.
OutputPath string `mapstructure:"OUTPUT_PATH"`
}

var Config ConfigStruct
Expand Down

0 comments on commit 6845d1b

Please sign in to comment.