badger/README.md

95 lines
5.7 KiB
Markdown
Raw Permalink Normal View History

2023-03-14 09:53:33 +01:00
# badger
a management tool for your audio library written in go
## requirements
**currently only 64bit x86 linux systems are supported!**
- [golang](https://go.dev/) >= 1.19
- [sqlite3](https://www.sqlite.org/index.html)
- [ffprobe](https://ffmpeg.org/ffprobe.html) (*optional*)
- [fpcalc](https://acoustid.org/chromaprint) (*optional*)
## how to build
1. `git clone https://git.velvettear.de/velvettear/badger.git`
2. `cd badger`
3. `go build`
4. `go clean --cache`
**note:**
the resulting binary file is relatively large. this is because the binaries for `ffprobe` and `fpcalc` are bundled within the binary itself and get extracted on the first run.
if `ffprobe` and `fpcalc` is already installed on your system and you wish to use the system provided binaries instead it is recommended to build and use the minified version.
to do so replace the line 3 with: `go build cmd/badger-min/badger-min.go`.
## arguments
there are just a two arguments to pass to `badger`:
| argument | description |
| ---------------- | ----------------------------------- |
| `-h`, `--help` | print the help |
| `-c`, `--config` | specify the path to the config file |
## configuration
configuration is done within a '[.yaml](https://yaml.org/)' file.
to get a first impression just take a look at the provided [config](https://git.velvettear.de/velvettear/badger/src/branch/master/config.yml).
### directories
| name | type | default | description |
| ---------- | -------| ---------------------- | ---------------------------------------------------------- |
| home | string | $TMP/badger | directory where `badger` stores its data |
| library | string | $TMP/badger/library | directory where your audio files reside |
| import | string | $TMP/badger/import | directory from which to import audio files to your library |
| duplicates | string | $TMP/badger/duplicates | directory into which duplicates are moved or linked |
### database
| name | type | default | description |
| ----------- | -------| ------------------------- | ---------------------------------------------------------------------------------------------- |
| file | string | $TMP/badger/badger.sqlite | path to the sqlite database file |
| inMemory | bool | true | use an in memory sqlite database |
| chunkSize | int | 1000 | chunk size of database entries to copy into the in memory sqlite database |
| busyTimeout | int | 10000 | [busy timeout](https://www.sqlite.org/pragma.html#pragma_busy_timeout) for the sqlite database |
| journalMode | string | off | [journal mode](https://www.sqlite.org/pragma.html#pragma_journal_mode) for the sqlite database |
### library
| name | type | default | description |
| ------------------------- | -------------- | ------------------- | ------------------------------------------------- |
| formats | array [string] | flac, mp3 | array of file formats to parse |
| changedetection.modified | bool | true | check for file changes by the modified time stamp |
| changedetection.size | bool | true | check for file changes by the file size |
| changedetection.checksum | bool | false | check for file changes by checksum<br>**(this will dramatically increase update duration)** |
| duplicates.action | string | log | action to perform on found duplicates:<br>`ignore`, `log`, `link`, `move`, `delete` |
| duplicates.formatMismatch | bool | true | check only files with non matching file formats |
| duplicates.useFingerprint | bool | true | check for duplicates by comparing audio fingerprints<br>if set to `false` a hash sum of the metadata will be used for comparison<br>**(audio fingerprints are more precise, but a lot slower)** |
| duplicates.fingerprintThreshold | float64 | 0.95 | threshold score for the fingerprint comparison |
### api
| name | type | default | description |
| ------ | ------ | --------- | -------------------------------- |
| listen | string | 0.0.0.0 | listen address of the api server |
| port | int | 3333 | port of the api server |
### other
| name | type | default | description |
| ----------- | ---- | ---------------------- | ----------------------------------------------------------------------------------------------- |
| concurrency | int | number of cpu cores | amount of concurrent ffprobe/fpcalc processes or goroutines for fingerprint comparison to spawn |
| debug | bool | true | enable or disable debug mode |
## credits
thanks to all these amazing people and their projects!
without them this would not be possible.
- [Chromaprint](https://acoustid.org/chromaprint)
- [FFmpeg](https://ffmpeg.org/)
- [GORM](https://gorm.io/)
- [viper](https://github.com/spf13/viper/tree/b89e554a96abde447ad13a26dcc59fd00375e555)
- [xxhash](https://github.com/cespare/xxhash)