-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,923 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: l3uddz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# dependencies | ||
- name: goreleaser | ||
run: | | ||
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin | ||
# checkout | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# setup go | ||
- name: go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.16 | ||
|
||
- name: go info | ||
run: | | ||
go version | ||
go env | ||
# cache | ||
- name: cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# vendor | ||
- name: vendor | ||
run: | | ||
make vendor | ||
# git status | ||
- name: git status | ||
run: git status | ||
|
||
# build | ||
- name: build | ||
if: startsWith(github.ref, 'refs/tags/') == false | ||
run: | | ||
make snapshot | ||
# publish | ||
- name: publish | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_REF: ${{ github.ref }} | ||
run: | | ||
make publish | ||
# artifacts | ||
- name: artifact_linux | ||
uses: actions/upload-artifact@v2-preview | ||
with: | ||
name: build_linux | ||
path: dist/*linux* | ||
|
||
- name: artifact_darwin | ||
uses: actions/upload-artifact@v2-preview | ||
with: | ||
name: build_darwin | ||
path: dist/*darwin* | ||
|
||
- name: artifact_windows | ||
uses: actions/upload-artifact@v2-preview | ||
with: | ||
name: build_windows | ||
path: dist/*windows* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# misc | ||
/.idea/ | ||
/.vscode/ | ||
|
||
# configuration | ||
config.yml | ||
|
||
# vendor files | ||
/vendor/ | ||
|
||
# dist folder | ||
/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# https://goreleaser.com | ||
project_name: missarr | ||
|
||
# Build | ||
builds: | ||
- | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
main: ./cmd/missarr | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
- -s -w | ||
- -X "github.com/l3uddz/missarr/build.Version={{ .Version }}" | ||
- -X "github.com/l3uddz/missarr/build.GitCommit={{ .ShortCommit }}" | ||
- -X "github.com/l3uddz/missarr/build.Timestamp={{ .Timestamp }}" | ||
flags: | ||
- -trimpath | ||
|
||
# Archive | ||
archives: | ||
- | ||
name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" | ||
format: "binary" | ||
|
||
# Checksum | ||
checksum: | ||
name_template: "checksums.txt" | ||
algorithm: sha512 | ||
|
||
# Snapshot | ||
snapshot: | ||
name_template: "{{ .Major }}.{{ .Minor }}.{{ .Patch }}-dev+{{ .ShortCommit }}" | ||
|
||
# Changelog | ||
changelog: | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
- "^Merge branch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.DEFAULT_GOAL := build | ||
CMD := missarr | ||
TARGET := $(shell go env GOOS)_$(shell go env GOARCH) | ||
DIST_PATH := dist | ||
BUILD_PATH := ${DIST_PATH}/${CMD}_${TARGET} | ||
GO_FILES := $(shell find . -path ./vendor -prune -or -type f -name '*.go' -print) | ||
GIT_COMMIT := $(shell git rev-parse --short HEAD) | ||
TIMESTAMP := $(shell date +%s) | ||
VERSION ?= 0.0.0-dev | ||
CGO := 0 | ||
|
||
# Deps | ||
.PHONY: check_goreleaser | ||
check_goreleaser: | ||
@command -v goreleaser >/dev/null || (echo "goreleaser is required."; exit 1) | ||
|
||
.PHONY: test | ||
test: ## Run tests | ||
go test ./... -cover -v -race ${GO_PACKAGES} | ||
|
||
.PHONY: vendor | ||
vendor: ## Vendor files and tidy go.mod | ||
go mod vendor | ||
go mod tidy | ||
|
||
.PHONY: vendor_update | ||
vendor_update: ## Update vendor dependencies | ||
go get -u ./... | ||
${MAKE} vendor | ||
|
||
.PHONY: build | ||
build: vendor ${BUILD_PATH}/${CMD} ## Build application | ||
|
||
# Binary | ||
${BUILD_PATH}/${CMD}: ${GO_FILES} go.sum | ||
@echo "Building for ${TARGET}..." && \ | ||
mkdir -p ${BUILD_PATH} && \ | ||
CGO_ENABLED=${CGO} go build \ | ||
-mod vendor \ | ||
-trimpath \ | ||
-ldflags "-s -w -X github.com/l3uddz/missarr/build.Version=${VERSION} -X github.com/l3uddz/missarr/build.GitCommit=${GIT_COMMIT} -X github.com/l3uddz/missarr/build.Timestamp=${TIMESTAMP}" \ | ||
-o ${BUILD_PATH}/${CMD} \ | ||
./cmd/missarr | ||
|
||
.PHONY: release | ||
release: check_goreleaser ## Generate a release, but don't publish | ||
goreleaser --skip-validate --skip-publish --rm-dist | ||
|
||
.PHONY: publish | ||
publish: check_goreleaser ## Generate a release, and publish | ||
goreleaser --rm-dist | ||
|
||
.PHONY: snapshot | ||
snapshot: check_goreleaser ## Generate a snapshot release | ||
goreleaser --snapshot --skip-publish --rm-dist | ||
|
||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,63 @@ | ||
# missarr | ||
[![made-with-golang](https://img.shields.io/badge/Made%20with-Golang-blue.svg?style=flat-square)](https://golang.org/) | ||
[![License: GPL v3](https://img.shields.io/badge/License-GPL%203-blue.svg?style=flat-square)](https://github.com/l3uddz/missarr/blob/master/LICENSE.md) | ||
[![Discord](https://img.shields.io/discord/381077432285003776.svg?colorB=177DC1&label=Discord&style=flat-square)](https://discord.io/cloudbox) | ||
[![Donate](https://img.shields.io/badge/Donate-gray.svg?style=flat-square)](#donate) | ||
|
||
# Missarr | ||
|
||
missarr sends search requests for missing episodes to Sonarr | ||
|
||
## Table of contents | ||
|
||
- [Installing missarr](#installing-missarr) | ||
- [Full config file](#full-config-file) | ||
- [Example commands](#example-commands) | ||
- [Donate](#donate) | ||
|
||
## Installing missarr | ||
|
||
missarr offers [pre-compiled binaries](https://github.com/l3uddz/missarr/releases/latest) for Linux, MacOS and Windows for each official release. | ||
|
||
Alternatively, you can build the Missarr binary yourself. | ||
To build missarr on your system, make sure: | ||
|
||
1. Your machine runs Linux, macOS or Windows | ||
2. You have [Go](https://golang.org/doc/install) installed (1.16 or later preferred) | ||
3. Clone this repository and cd into it from the terminal | ||
4. Run `make build` from the terminal | ||
|
||
You should now have a binary with the name `missarr` in the appropriate dist sub-directory of the project. | ||
|
||
If you need to debug certain Missarr behaviour, either add the `-v` flag for debug mode or the `-vv` flag for trace mode to get even more details about internal behaviour. | ||
|
||
### Full config file | ||
|
||
```yaml | ||
sonarr: | ||
url: https://sonarr.your-domain.com | ||
api_key: your_api_key | ||
``` | ||
You can place this config file in the same folder as the missarr binary as `config.yml` | ||
|
||
Alternatively, you can place this config file in `~/.config/missarr/config.yml` | ||
|
||
### Example commands | ||
|
||
Update to latest version: `missarr --update` | ||
|
||
Search for 10 seasons: `missarr sonarr --limit 10` | ||
|
||
Search for 10 seasons (without updating seasons cache) `missarr sonarr --limit 10 --skip-refresh` | ||
|
||
## Donate | ||
|
||
If you find this project helpful, feel free to make a small donation: | ||
|
||
- [Monzo](https://monzo.me/today): Credit Cards, Apple Pay, Google Pay | ||
|
||
- [Paypal: [email protected]](https://www.paypal.me/l3uddz) | ||
|
||
- [GitHub Sponsor](https://github.com/sponsors/l3uddz): GitHub matches contributions for first 12 months. | ||
|
||
- BTC: 3CiHME1HZQsNNcDL6BArG7PbZLa8zUUgjL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package build | ||
|
||
var ( | ||
Version string | ||
Timestamp string | ||
GitCommit string | ||
|
||
UserAgent string | ||
) | ||
|
||
func init() { | ||
UserAgent = "missarr/" + Version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
func defaultConfigDirectory(app string, filename string) string { | ||
// binary path | ||
bcd := getBinaryPath() | ||
if _, err := os.Stat(filepath.Join(bcd, filename)); err == nil { | ||
// there is a config file in the binary path | ||
// so use this directory as the default | ||
return bcd | ||
} | ||
|
||
// config dir | ||
ucd, err := os.UserConfigDir() | ||
if err != nil { | ||
panic(fmt.Sprintf("userconfigdir: %v", err)) | ||
} | ||
|
||
acd := filepath.Join(ucd, app) | ||
if _, err := os.Stat(acd); os.IsNotExist(err) { | ||
if err := os.MkdirAll(acd, os.ModePerm); err != nil { | ||
panic(fmt.Sprintf("mkdirall: %v", err)) | ||
} | ||
} | ||
|
||
return acd | ||
} | ||
|
||
func getBinaryPath() string { | ||
// get current binary path | ||
dir, err := filepath.Abs(filepath.Dir(os.Args[0])) | ||
if err != nil { | ||
// get current working dir | ||
if dir, err = os.Getwd(); err != nil { | ||
panic(fmt.Sprintf("getwd: %v", err)) | ||
} | ||
} | ||
|
||
return dir | ||
} |
Oops, something went wrong.