-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from l3uddz/develop
initial code commit
- Loading branch information
Showing
45 changed files
with
5,096 additions
and
0 deletions.
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,17 @@ | ||
# misc | ||
/.idea/ | ||
/.vscode/ | ||
|
||
# configuration | ||
config.json | ||
*.db | ||
|
||
# vendor files | ||
/vendor/ | ||
|
||
# dist folder | ||
/dist/ | ||
|
||
# Web package | ||
web/rice-box.go | ||
web/trackarr-ui/package-lock.json |
Large diffs are not rendered by default.
Oops, something went wrong.
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,90 @@ | ||
.DEFAULT_GOAL := build | ||
CMD := mediarr | ||
GOARCH := $(shell go env GOARCH) | ||
GOOS := $(shell go env GOOS) | ||
TARGET := ${GOOS}_${GOARCH} | ||
DIST_PATH := dist | ||
BUILD_PATH := ${DIST_PATH}/${CMD}_${TARGET} | ||
DESTDIR := /usr/local/bin | ||
GO_FILES := $(shell find . -path ./vendor -prune -or -type f -name '*.go' -print) | ||
GO_PACKAGES := $(shell go list -mod vendor ./...) | ||
GIT_COMMIT := $(shell git rev-parse --short HEAD) | ||
# GIT_BRANCH := $(shell git symbolic-ref --short HEAD) | ||
TIMESTAMP := $(shell date +%s) | ||
VERSION ?= 0.0.0-dev | ||
|
||
# Deps | ||
.PHONY: check_golangci | ||
check_golangci: | ||
@command -v golangci-lint >/dev/null || (echo "golangci-lint is required."; exit 1) | ||
.PHONY: check_goreleaser | ||
check_goreleaser: | ||
@command -v goreleaser >/dev/null || (echo "goreleaser is required."; exit 1) | ||
|
||
.PHONY: all ## Run tests, linting and build | ||
all: test lint build | ||
|
||
.PHONY: test-all ## Run tests and linting | ||
test-all: test lint | ||
|
||
.PHONY: test | ||
test: ## Run tests | ||
@echo "*** go test ***" | ||
go test -cover -mod vendor -v -race ${GO_PACKAGES} | ||
|
||
.PHONY: lint | ||
lint: check_golangci ## Run linting | ||
@echo "*** golangci-lint ***" | ||
golangci-lint run | ||
|
||
.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: fetch ${BUILD_PATH}/${CMD} ## Build application | ||
|
||
# Binary | ||
${BUILD_PATH}/${CMD}: ${GO_FILES} go.sum | ||
@echo "Building for ${TARGET}..." && \ | ||
mkdir -p ${BUILD_PATH} && \ | ||
CGO_ENABLED=1 go build \ | ||
-mod vendor \ | ||
-trimpath \ | ||
-ldflags "-s -w -X github.com/l3uddz/mediarr/build.Version=${VERSION} -X github.com/l3uddz/mediarr/build.GitCommit=${GIT_COMMIT} -X github.com/l3uddz/mediarr/build.Timestamp=${TIMESTAMP}" \ | ||
-o ${BUILD_PATH}/${CMD} \ | ||
. | ||
|
||
.PHONY: install | ||
install: build ## Install binary | ||
install -m 0755 ${BUILD_PATH}/${CMD} ${DESTDIR}/${CMD} | ||
|
||
.PHONY: clean | ||
clean: ## Cleanup | ||
rm -rf ${DIST_PATH} | ||
|
||
.PHONY: fetch | ||
fetch: ## Fetch vendor files | ||
go mod vendor | ||
|
||
.PHONY: release | ||
release: check_goreleaser fetch ## Generate a release, but don't publish | ||
goreleaser --skip-validate --skip-publish --rm-dist | ||
|
||
.PHONY: publish | ||
publish: check_goreleaser fetch ## Generate a release, and publish | ||
goreleaser --rm-dist | ||
|
||
.PHONY: snapshot | ||
snapshot: check_goreleaser fetch ## Generate a snapshot release | ||
goreleaser --snapshot --skip-validate --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,121 @@ | ||
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-blue.svg?style=flat-square)](https://www.python.org/) | ||
[![License: GPL v3](https://img.shields.io/badge/License-GPL%203-blue.svg?style=flat-square)](https://github.com/l3uddz/mediarr/blob/master/LICENSE.md) | ||
[![last commit (develop)](https://img.shields.io/github/last-commit/l3uddz/mediarr/develop.svg?colorB=177DC1&label=Last%20Commit&style=flat-square)](https://github.com/l3uddz/mediarr/commits/develop) | ||
[![Discord](https://img.shields.io/discord/381077432285003776.svg?colorB=177DC1&label=Discord&style=flat-square)](https://discord.io/cloudbox) | ||
[![Contributing](https://img.shields.io/badge/Contributing-gray.svg?style=flat-square)](CONTRIBUTING.md) | ||
[![Donate](https://img.shields.io/badge/Donate-gray.svg?style=flat-square)](#donate) | ||
|
||
# mediarr | ||
|
||
CLI tool to add media to different PVR's in the *arr family from different providers. | ||
|
||
## Example Configuration | ||
|
||
```yaml | ||
pvr: | ||
sonarr: | ||
type: sonarr | ||
url: https://sonarr.domain.com | ||
api_key: your-api-key | ||
quality_profile: WEBDL-1080p | ||
root_folder: /mnt/unionfs/Media/TV | ||
filters: | ||
ignores: | ||
# tvmaze | ||
- 'Provider == "tvmaze" && "English" not in Languages' | ||
- 'Provider == "tvmaze" && "Scripted" not in Genres' | ||
|
||
# trakt | ||
- 'Provider == "trakt" && "en" not in Languages' | ||
- 'Provider == "trakt" && Runtime < 15' | ||
- 'Provider == "trakt" && Network == ""' | ||
- 'Provider == "trakt" && not (any(Country, {# in ["us", "gb", "au", "ca"]}))' | ||
|
||
# generic | ||
- 'Year < (Now().Year() - 5)' | ||
- 'Year > Now().Year()' | ||
- 'Title contains "WWE"' | ||
- 'Title contains "Wrestling"' | ||
- '"animation" in Genres || "talk-show" in Genres' | ||
- 'len(Genres) == 0' | ||
- 'Network in ["Twitch", "Xbox Video", "YouTube"]' | ||
- 'Summary contains "transgend" || Summary contains "LGBT" || Summary contains "gay"' | ||
- 'Title matches "(?i)ru ?paul.+drag.+"' | ||
radarr: | ||
type: radarr | ||
url: https://radarr.domain.com | ||
api_key: your-api-key | ||
quality_profile: Remux | ||
root_folder: /mnt/unionfs/Media/Movies | ||
filters: | ||
ignores: | ||
# trakt | ||
- 'Provider == "trakt" && Runtime < 60' | ||
- 'Provider == "trakt" && ("music" in Genres || "documentary" in Genres)' | ||
- 'Provider == "trakt" && "en" not in Languages' | ||
|
||
# tmdb | ||
- 'Provider == "tmdb" && "en" not in Languages' | ||
|
||
# generic | ||
- 'Year < (Now().Year() - 5)' | ||
- 'Year > Now().Year()' | ||
- 'len(Genres) == 0' | ||
- 'Title startsWith "Untitled"' | ||
- 'Title contains "WWE" || Title contains "NXT"' | ||
- 'Title contains "Live:" || Title contains "Concert"' | ||
- 'Title contains "Musical"' | ||
- 'Title contains " Edition)"' | ||
- 'Summary contains "transgend" || Summary contains "LGBT" || Summary contains "gay"' | ||
- 'Title matches "^UFC.?\\d.+\\:"' | ||
provider: | ||
tmdb: | ||
api_key: your-tmdb-api-key | ||
trakt: | ||
client_id: your-trakt-app-client-id | ||
``` | ||
## Example Commands | ||
1. Movies | ||
`mediarr movies radarr trakt -t person --language en --query nicolas-cage --limit 5` | ||
|
||
`mediarr movies radarr trakt -t anticipated --language en --country en,us,gb,ca,au --limit 5` | ||
|
||
`mediarr movies radarr trakt -t popular --language en --country en,us,gb,ca,au --genre science-fiction --limit 10` | ||
|
||
2. TV | ||
|
||
`mediarr shows sonarr trakt -t popular --language en --country en,us,gb,ca,au --genre science-fiction --year 2019-2020 --limit 1` | ||
|
||
`mediarr shows sonarr trakt -t anticipated --language en --country en,us,gb,ca,au` | ||
|
||
|
||
## Additional Details | ||
|
||
All commands support the `--dry-run` flag to mimic the entire run process with the exception of actually adding media to the PVR. | ||
|
||
# Planned Features | ||
|
||
1. Additions | ||
|
||
- Provider(new): simkl | ||
|
||
2. Enhancements | ||
|
||
- Provider(trakt): support lists | ||
- Provider(tmdb): support tv | ||
|
||
|
||
*** | ||
|
||
# Donate | ||
|
||
If you find this project helpful, feel free to make a small donation to the developer: | ||
|
||
- [Monzo](https://monzo.me/today): Credit Cards, Apple Pay, Google Pay | ||
|
||
- [Paypal: [email protected]](https://www.paypal.me/l3uddz) | ||
|
||
- 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,53 @@ | ||
version: 1.0.{build} | ||
|
||
image: | ||
- Ubuntu1804 | ||
- macOS | ||
|
||
platform: x64 | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
|
||
deploy: | ||
- provider: GitHub | ||
auth_token: | ||
secure: japCKJyRSrHvPJV0hqZZGcRM9ZSR9GsTVh8SCCwbqiyuKTyB3OCcRMc6ICztczfV | ||
artifact: mediarr | ||
force_update: true | ||
on: | ||
branch: master | ||
APPVEYOR_REPO_TAG: true | ||
|
||
# no need for caching as it does not appear to work right now | ||
#cache: | ||
# - vendor -> go.mod, appveyor.yml | ||
|
||
artifacts: | ||
- path: dist/**/*.tar.tgz | ||
name: mediarr | ||
|
||
environment: | ||
GO111MODULE: on | ||
|
||
install: | ||
- go version | ||
- go env | ||
|
||
before_build: | ||
- |- | ||
if [ ${APPVEYOR_REPO_TAG} = "true" ]; then | ||
export VERSION=${APPVEYOR_REPO_TAG_NAME} | ||
fi | ||
build_script: | ||
- make build | ||
|
||
after_build: | ||
- |- | ||
export build=$(find dist/* -type d | sed 's!.*/!!') | ||
cd dist/$build | ||
tar -czf $build.tar.tgz mediarr | ||
cd ../.. |
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,8 @@ | ||
package build | ||
|
||
var ( | ||
// Build Vars | ||
Version string | ||
Timestamp string | ||
GitCommit string | ||
) |
Oops, something went wrong.