Skip to content

Commit

Permalink
Update README (#73)
Browse files Browse the repository at this point in the history
Commits:

* Markdown Lint Stuff

* Outline how I want the README to be structured

* Change svg out for png

* Check-in

* Readme just needs some badges now

* Add badges

* Diagnose failing tests

* Hmmm

* Make the config dir after loading settings

* Remove /config

* Remove debug echo

* Go version badge
  • Loading branch information
BrenekH authored Apr 8, 2021
1 parent bb6affe commit a6c319f
Show file tree
Hide file tree
Showing 24 changed files with 680 additions and 66 deletions.
19 changes: 11 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,16 +25,18 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser (if applicable) [e.g. chrome, safari]
- Controller Version [e.g. 0.1.0]
- Runner Version (If applicable) [e.g. 0.1.0]

- OS: [e.g. iOS]
- Browser (if applicable) [e.g. chrome, safari]
- Controller Version [e.g. 0.1.0]
- Runner Version (If applicable) [e.g. 0.1.0]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"MD013": false,
"MD033": false,
"MD041": false
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cSpell.words": [
"encodarr",
"mediainfo",
"ncodarr",
"popen",
"pymediainfo"
Expand Down
6 changes: 3 additions & 3 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ the community.

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at
[https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ When a Git tag is pushed to the repo, special actions are ran that deploy the co

## Code of Conduct

This project holds all contributors, maintainers, and participants to the standards outlined by the Contributor Covenant, a copy of which can be found in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
This project holds all maintainers, contributors, and participants to the standards outlined by the Contributor Covenant, a copy of which can be found in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
172 changes: 150 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,171 @@
# Encodarr
<p align="center">
<img src="images/Encodarr-Text-Logo.png" height="175"/>
</p>

Docker-based webapp for encoding video files to the HEVC \(H.265\) standard.
[![https://img.shields.io/badge/license-MPL--2.0-blue](https://img.shields.io/badge/license-MPL--2.0-blue)](https://github.com/BrenekH/encodarr/blob/master/LICENSE)
![GitHub all releases](https://img.shields.io/github/downloads/brenekh/encodarr/total?label=github%20downloads)
![Docker Pulls](https://img.shields.io/docker/pulls/brenekh/encodarr-controller?label=controller%20docker%20pulls)
![Docker Pulls](https://img.shields.io/docker/pulls/brenekh/encodarr-runner?label=runner%20docker%20pulls)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/brenekh/encodarr-controller/latest?label=controller%20image%20size)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/brenekh/encodarr-runner/latest?label=runner%20image%20size)
![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/brenekh/encodarr?filename=controller%2Fgo.mod)
[![Controller CI/CD](https://github.com/BrenekH/encodarr/actions/workflows/controller.yaml/badge.svg)](https://github.com/BrenekH/encodarr/actions/workflows/controller.yaml)
[![Runner CI/CD](https://github.com/BrenekH/encodarr/actions/workflows/runner.yaml/badge.svg)](https://github.com/BrenekH/encodarr/actions/workflows/runner.yaml)

## Docker Compose
## What is Encodarr?

Recommended `docker-compose.yaml` \(Assumes the docker image was built with the tag `brenekh/encodarr:latest`\)
Encodarr is a self-hosted web application that encodes video files to a target format using distributed computing.

```yaml
## Why use Encodarr?
<!-- TODO: Why use Encodarr? (other than easy to setup) -->

### Easy to Setup

Encodarr bypasses the need to share media across the network by instead transmitting the file to be operated on to the Runners.
This means that Encodarr is much easier to setup than other solutions.

## Dependencies

The container images come with the dependencies installed, so if you go that route, all you need is [Docker](https://docs.docker.com/get-docker/).

If you are not using containers, you will need [mediainfo](https://mediaarea.net/en/MediaInfo/Download) and [FFmpeg](https://ffmpeg.org/download.html) in the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) variable.

## Installing

Container images are available from Docker Hub([Controller](https://hub.docker.com/r/brenekh/encodarr-controller), [Runner](https://hub.docker.com/repository/docker/brenekh/encodarr-runner)) and the GitHub Container Registry([Controller](https://github.com/users/BrenekH/packages/container/package/encodarr-controller), [Runner](https://github.com/users/BrenekH/packages/container/package/encodarr-runner)).

Pre-built executables are available via the [Releases](https://github.com/BrenekH/encodarr/releases/latest) page.

## Usage

### Docker/Docker Compose

The latest Controller version can be run using the following `docker run` command:

```bash
docker run -d \
--name Encodarr-Controller \
-e TZ=Europe/London \
-v <path to data>:/config:rw \
-v <path to media>:/media:rw \
-p 8123:8123 \
--restart unless-stopped \
--user 1000:1000 \
brenekh/encodarr-controller:latest
```

or if you prefer Docker Compose:

```yml
version: "2.2"
services:
encodarr:
image: brenekh/encodarr:latest
container_name: Encodarr
encodarr-controller:
image: brenekh/encodarr-controller:latest
container_name: Encodarr-Controller
environment:
- TZ=Europe/London
volumes:
- /config:/config:rw
- /media/folder/to/search:/usr/app/tosearch:rw
- <path to controller data>:/config:rw
- <path to media>:/media:rw
ports:
- 5000:5000
- 8123:8123
restart: unless-stopped
cpus: 2.00
stop_signal: SIGINT
user: "1000:1000"
```
The latest Runner version is similar.
Docker run:
```bash
docker run -d \
--name Encodarr-Runner \
-v <path to runner data>:/config:rw \
-e "ENCODARR_RUNNER_NAME=Runner 1" \
-e ENCODARR_RUNNER_CONTROLLER_IP=<Controller IP> \
-e ENCODARR_RUNNER_CONTROLLER_PORT=8123 \
--restart unless-stopped \
brenekh/encodarr-runner:latest
```

## Environment Variables
Docker Compose:

```yml
version: "2.2"
services:
encodarr-runner:
image: brenekh/encodarr-runner:latest
container_name: Encodarr-Runner
volumes:
- <path to runner data>:/config:rw
environment:
- ENCODARR_RUNNER_NAME=Runner 1
- ENCODARR_RUNNER_CONTROLLER_IP=<Controller IP>
- ENCODARR_RUNNER_CONTROLLER_PORT=8123
restart: unless-stopped
```
The Controller `path to media` and the corresponding mount inside the container can be anything you want and you can have as many as you want.
For example, `/mnt/disk/tv:/tv:rw` and `/mnt/disk/movies:/movies:rw`.

In addition, the paths to data that are mounted to `/config` in the container should be separate folders, ideally with full paths\(`/home/user/docker` instead of `~/docker`\).

### Startup Configuration

Startup values configured either through environment variables, or command line arguments.
All of the command line variants expect a value after a space (`--port 8123`) expect the Runner `--debug` flag.
It is a boolean flag.

#### Controller

`ENCODARR_PORT`, `--port` sets the port for the HTTP web server.
For containers, it is recommended to modify the external port (`8124:8123`) instead of setting this value.
(default: `8123`)

`ENCODARR_CONFIG_DIR`, `--config-dir` sets the directory that the configuration files are saved to.
This includes the log file.
In a container, this is pre-set to `/config`.
(default: `<platform user config directory>/encodarr/controller/config`)

#### Runner

`ENCODARR_DEBUG`, `--debug` enables outputting debug messages to the log.
If the environment variable is set to `True`, then debug messages are turned on.
(default: `False`)

`ENCODARR_LOG_FILE` sets the location of the runner log file.
(default: `/config/runner.log`)

`ENCODARR_RUNNER_NAME`, `--name` sets the name to be shown in the Web UI when referring to this runner.
(default: `Runner-<random 3 digit number>`)

`ENCODARR_RUNNER_CONTROLLER_IP`, `--controller-ip` sets the IP for connecting to the Controller.
(default: `localhost`)

`ENCODARR_RUNNER_CONTROLLER_PORT`, `--controller-port` sets the port for connecting to the Controller.
(default: `8123`)

## Contributing

If you want to contribute to this project, head over to [CONTRIBUTING.md](CONTRIBUTING.md) to get started.
Do note that the project is going to be rewritten soon to more closely follow clean architecture guidelines, so contributing to the `master` or `development` branches is not recommended at this time.

## Code of Conduct

### Common
This project holds all maintainers, contributors, and participants to the standards outlined by the Contributor Covenant, a copy of which can be found in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).

- ENCODARR_DEBUG (bool)
## Future Plans

- ENCODARR_LOG_FILE (string)
* Rewrite Runner from Python to Go (following Clean Architecture guidelines)

### Runner
* Rewrite Controller to conform to Clean Architecture guidelines

- ENCODARR_RUNNER_NAME (string)
* Instead of configuring with dropdowns and checkboxes, use a plugin system

- ENCODARR_RUNNER_CONTROLLER_IP (string)
* Massive frontend overhaul

- ENCODARR_RUNNER_CONTROLLER_PORT (integer)
* Scheduled working times

## Attributions

`controller/controller/mediainfo.go` was modified from [pascoej/go-mediainfo](https://github.com/pascoej/go-mediainfo/blob/509f5adb9998a8fe497be4eed69c73d75161709e/mediainfo.go)
`controller/mediainfo/mediainfo.go` was modified from [pascoej/go-mediainfo](https://github.com/pascoej/go-mediainfo/blob/509f5adb9998a8fe497be4eed69c73d75161709e/mediainfo.go).
24 changes: 9 additions & 15 deletions controller/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,16 @@ var port string = "8123"
var configDirConst optionConst = optionConst{"ENCODARR_CONFIG_DIR", "config-dir"}
var configDir string = ""

// TODO: Remove. Search directory is no longer needed because each library has its own.
var searchDirConst optionConst = optionConst{"ENCODARR_SEARCH_DIR", "search-dir"}
var searchDir string = ""

var inputsParsed bool = false

var logger logange.Logger

func init() {
cwd, _ := os.Getwd()
searchDir = cwd

cDir, err := os.UserConfigDir()
if err != nil {
log.Fatalln(err)
}
configDir = cDir + "/encodarr/config"
configDir = cDir + "/encodarr/controller/config"

logger = logange.NewLogger("options")
}
Expand All @@ -55,9 +48,7 @@ func parseInputs() {
stringVarFromEnv(&configDir, configDirConst.EnvVar)
stringVar(&configDir, configDirConst.CmdLine, "")

// Search directory
stringVarFromEnv(&searchDir, searchDirConst.EnvVar)
stringVar(&searchDir, searchDirConst.CmdLine, "")
makeConfigDir()

parseCL()

Expand Down Expand Up @@ -86,8 +77,11 @@ func ConfigDir() string {
return configDir
}

// SearchDir returns the passed search directory
func SearchDir() string {
parseInputs()
return searchDir
// makeConfigDir creates the options.configDir
func makeConfigDir() {
err := os.MkdirAll(configDir, 0644)
if err != nil {
fmt.Println(err)
logger.Critical(fmt.Sprintf("Failed to create config directory '%v' because of error: %v", configDir, err.Error()))
}
}
22 changes: 11 additions & 11 deletions controller/server/webfiles/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"files": {
"main.css": "/static/css/main.a0813476.chunk.css",
"main.js": "/static/js/main.2ca6d08d.chunk.js",
"main.js.map": "/static/js/main.2ca6d08d.chunk.js.map",
"main.css": "/static/css/main.930f940a.chunk.css",
"main.js": "/static/js/main.abe7b6e2.chunk.js",
"main.js.map": "/static/js/main.abe7b6e2.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.2dd4e8a6.js",
"runtime-main.js.map": "/static/js/runtime-main.2dd4e8a6.js.map",
"static/css/2.2c2d1656.chunk.css": "/static/css/2.2c2d1656.chunk.css",
Expand All @@ -12,19 +12,19 @@
"static/js/3.010aea4f.chunk.js.map": "/static/js/3.010aea4f.chunk.js.map",
"index.html": "/index.html",
"static/css/2.2c2d1656.chunk.css.map": "/static/css/2.2c2d1656.chunk.css.map",
"static/css/main.a0813476.chunk.css.map": "/static/css/main.a0813476.chunk.css.map",
"static/css/main.930f940a.chunk.css.map": "/static/css/main.930f940a.chunk.css.map",
"static/js/2.af4dfa24.chunk.js.LICENSE.txt": "/static/js/2.af4dfa24.chunk.js.LICENSE.txt",
"static/media/Encodarr-Logo.4b0cc1bf.svg": "/static/media/Encodarr-Logo.4b0cc1bf.svg",
"static/media/Info-I.ffc9d3a2.svg": "/static/media/Info-I.ffc9d3a2.svg",
"static/media/addLibraryIcon.dd5f1d29.svg": "/static/media/addLibraryIcon.dd5f1d29.svg",
"static/media/headphones.f1e7bde3.svg": "/static/media/headphones.f1e7bde3.svg",
"static/media/play_button.415684ac.svg": "/static/media/play_button.415684ac.svg"
"static/media/Encodarr-Logo.b8d2df4b.svg": "/static/media/Encodarr-Logo.b8d2df4b.svg",
"static/media/Info-I.4eaee4f4.svg": "/static/media/Info-I.4eaee4f4.svg",
"static/media/addLibraryIcon.22f57e9e.svg": "/static/media/addLibraryIcon.22f57e9e.svg",
"static/media/headphones.d0211b61.svg": "/static/media/headphones.d0211b61.svg",
"static/media/play_button.a97890f5.svg": "/static/media/play_button.a97890f5.svg"
},
"entrypoints": [
"static/js/runtime-main.2dd4e8a6.js",
"static/css/2.2c2d1656.chunk.css",
"static/js/2.af4dfa24.chunk.js",
"static/css/main.a0813476.chunk.css",
"static/js/main.2ca6d08d.chunk.js"
"static/css/main.930f940a.chunk.css",
"static/js/main.abe7b6e2.chunk.js"
]
}
Loading

0 comments on commit a6c319f

Please sign in to comment.