mirror of
https://github.com/mtan93/Apps-Community.git
synced 2026-03-08 05:31:59 +00:00
Create nzbget-mp4.yml
NzbGet, with build in sickbeard_mp4_automator and ffmpeg build script Built for PGBlitz version 8.5.6 Should be fine for versions above this too
This commit is contained in:
402
apps/nzbget-mp4.yml
Normal file
402
apps/nzbget-mp4.yml
Normal file
@@ -0,0 +1,402 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# NzbGet, with build in sickbeard_mp4_automator and ffmpeg build script
|
||||
# Built for PGBlitz version 8.5.6
|
||||
# Should be fine for versions above this too
|
||||
#
|
||||
# Title: PGBlitz (Reference Title File)
|
||||
# Author(s): Admin9705
|
||||
# URL: https://pgblitz.com - http://github.pgblitz.com
|
||||
# GNU: General Public License v3.0
|
||||
#################################################################################
|
||||
---
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
# FACTS #######################################################################
|
||||
|
||||
- name: 'Set Known Facts'
|
||||
set_fact:
|
||||
pgrole: 'nzbget'
|
||||
intport: '6789'
|
||||
extport: '6789'
|
||||
image: 'linuxserver/nzbget'
|
||||
|
||||
# CORE (MANDATORY) ############################################################
|
||||
- name: 'Including cron job'
|
||||
include_tasks: '/opt/coreapps/apps/_core.yml'
|
||||
|
||||
- name: 'Including folders'
|
||||
include_tasks: '/opt/coreapps/apps/_downloaders.yml'
|
||||
|
||||
- name: Create nzb folder
|
||||
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000'
|
||||
with_items:
|
||||
- '{{path.stdout}}/nzb'
|
||||
# force: yes
|
||||
|
||||
- name: 'Including plugins'
|
||||
include_tasks: '/opt/coreapps/apps/_plugins.yml'
|
||||
|
||||
- name: 'Checking for existing app data'
|
||||
stat:
|
||||
path: /opt/appdata/{{pgrole}}/nzbget.conf
|
||||
register: confcheck
|
||||
|
||||
# EXTRAS FOR MP4 MODS ##########################################################
|
||||
- name: 'Create {{pgrole}} mp4 directories'
|
||||
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000 recurse=yes'
|
||||
with_items:
|
||||
- '/opt/appdata/{{pgrole}}'
|
||||
- '/opt/appdata/{{pgrole}}/cont-init.d'
|
||||
- '/opt/appdata/{{pgrole}}/installer'
|
||||
- '/opt/appdata/{{pgrole}}/scripts'
|
||||
- '/opt/appdata/{{pgrole}}/scripts/MP4_Automator'
|
||||
- '/opt/appdata/{{pgrole}}/ffmpeg-build'
|
||||
- '/opt/appdata/{{pgrole}}/services.d'
|
||||
|
||||
- name: 'Copy custom init scripts into directory for {{pgrole}}'
|
||||
copy:
|
||||
src: /opt/communityapps/apps/templates/nzbget-mp4/cont-init.d/30-config
|
||||
dest: /opt/appdata/{{pgrole}}/cont-init.d
|
||||
directory_mode: yes
|
||||
force: yes
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: 0755
|
||||
|
||||
- name: 'Copy custom install scripts into directory for {{pgrole}}'
|
||||
copy:
|
||||
src: /opt/communityapps/apps/templates/nzbget-mp4/installer/installer.sh
|
||||
dest: /opt/appdata/{{pgrole}}/installer
|
||||
directory_mode: yes
|
||||
force: yes
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: 0755
|
||||
|
||||
- name: 'Copy custom mp4 config into directory for {{pgrole}}'
|
||||
copy:
|
||||
src: /opt/communityapps/apps/templates/nzbget-mp4/MP4_Automator/autoProcess.ini
|
||||
dest: /opt/appdata/{{pgrole}}/scripts/MP4_Automator
|
||||
directory_mode: yes
|
||||
force: yes
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: 0755
|
||||
|
||||
- name: 'Copy custom NZBGetPostProcess script config into directory for {{pgrole}}'
|
||||
copy:
|
||||
src: /opt/communityapps/apps/templates/nzbget-mp4/MP4_Automator/TEMPLATEPPScript
|
||||
dest: /opt/appdata/{{pgrole}}/
|
||||
directory_mode: yes
|
||||
force: yes
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: 0755
|
||||
|
||||
- name: 'Copy ffmpeg build script into directory for {{pgrole}}'
|
||||
copy:
|
||||
src: /opt/communityapps/apps/templates/nzbget-mp4/ffmpeg-build/web-install.sh
|
||||
dest: /opt/appdata/{{pgrole}}/ffmpeg-build
|
||||
directory_mode: yes
|
||||
force: yes
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: 0755
|
||||
|
||||
- name: 'Copy ffmpeg build script into directory for {{pgrole}}'
|
||||
copy:
|
||||
src: /opt/communityapps/apps/templates/nzbget-mp4/ffmpeg-build/build-ffmpeg
|
||||
dest: /opt/appdata/{{pgrole}}/ffmpeg-build
|
||||
directory_mode: yes
|
||||
force: yes
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: 0755
|
||||
|
||||
- name: 'Copy custom init scripts into directory for {{pgrole}}'
|
||||
copy:
|
||||
src: /opt/communityapps/apps/templates/nzbget-mp4/services.d/run
|
||||
dest: /opt/appdata/{{pgrole}}/services.d
|
||||
directory_mode: yes
|
||||
force: yes
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: 0755
|
||||
|
||||
# LABELS ######################################################################
|
||||
- name: 'Adding Traefik'
|
||||
set_fact:
|
||||
pg_labels:
|
||||
traefik.enable: 'true'
|
||||
traefik.port: '{{intport}}'
|
||||
traefik.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'
|
||||
traefik.frontend.auth.forward.address: '{{gauth}}'
|
||||
|
||||
- name: 'Setting PG Volumes'
|
||||
set_fact:
|
||||
pg_volumes:
|
||||
- '/etc/localtime:/etc/localtime:ro'
|
||||
- '/opt/appdata/{{pgrole}}:/config'
|
||||
- '{{path.stdout}}:{{path.stdout}}'
|
||||
- '/mnt:/mnt'
|
||||
- '/tmp:/tmp'
|
||||
- '/opt/appdata/{{pgrole}}/cont-init.d:/etc/cont-init.d'
|
||||
- '/opt/appdata/{{pgrole}}/services.d:/etc/services.d/nzbget'
|
||||
|
||||
- name: 'Setting PG ENV'
|
||||
set_fact:
|
||||
pg_env:
|
||||
PUID: '1000'
|
||||
PGID: '1000'
|
||||
LC_ALL: 'C'
|
||||
|
||||
# MAIN DEPLOYMENT #############################################################
|
||||
- name: 'Deploying {{pgrole}}'
|
||||
docker_container:
|
||||
name: '{{pgrole}}'
|
||||
image: '{{image}}'
|
||||
pull: yes
|
||||
published_ports:
|
||||
- '{{ports.stdout}}{{extport}}:{{intport}}'
|
||||
volumes: '{{pg_volumes}}'
|
||||
env: '{{pg_env}}'
|
||||
restart_policy: unless-stopped
|
||||
networks:
|
||||
- name: plexguide
|
||||
aliases:
|
||||
- '{{pgrole}}'
|
||||
state: started
|
||||
labels: '{{pg_labels}}'
|
||||
|
||||
# CONFIGURATION #############################################################
|
||||
- name: 'Waiting for {{pgrole}} to initialize'
|
||||
wait_for:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
state: present
|
||||
delay: 5
|
||||
|
||||
- name: 'Stopping {{pgrole}}'
|
||||
docker_container:
|
||||
name: '{{pgrole}}'
|
||||
state: stopped
|
||||
|
||||
- name: Set Main Location
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^MainDir\s*=.*'
|
||||
line: 'MainDir=/config'
|
||||
state: present
|
||||
|
||||
- name: Set download location
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^DestDir\s*=.*'
|
||||
line: 'DestDir={{path.stdout}}/downloads/{{pgrole}}'
|
||||
state: present
|
||||
|
||||
- name: Set incomplete location
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^InterDir\s*=.*'
|
||||
line: 'InterDir={{path.stdout}}/incomplete/{{pgrole}}'
|
||||
state: present
|
||||
|
||||
- name: Set TempDir
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^TempDir\s*=.*'
|
||||
line: 'TempDir=/tmp'
|
||||
state: present
|
||||
|
||||
- name: Set NzbDir Location
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^NzbDir\s*=.*'
|
||||
line: 'NzbDir={{path.stdout}}/nzb'
|
||||
state: present
|
||||
|
||||
- name: ScriptDir
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^ScriptDir\s*=.*'
|
||||
line: 'ScriptDir=${MainDir}/scripts'
|
||||
state: present
|
||||
|
||||
# FIRST TIME CONFIGURATION #############################################################
|
||||
- name: 'Configuring {{pgrole}} for first time use'
|
||||
block:
|
||||
- name: Lowercase & Set Movie Category
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category1.Name\s*=.*'
|
||||
line: 'Category1.Name=movies'
|
||||
state: present
|
||||
|
||||
- name: Set Location of Movies
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category1.DestDir\s*=.*'
|
||||
line: 'Category1.DestDir='
|
||||
state: present
|
||||
|
||||
- name: Set postprocess of Movies
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category1.Extensions\s*=.*'
|
||||
line: 'Category1.Extensions=MP4_Automator/NZBGetPostProcess.py'
|
||||
state: present
|
||||
|
||||
- name: Lowercase & Set TV Category
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category2.Name\s*=.*'
|
||||
line: 'Category2.Name=tv'
|
||||
state: present
|
||||
|
||||
- name: Set Location of TV
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category2.DestDir\s*=.*'
|
||||
line: 'Category2.DestDir='
|
||||
state: present
|
||||
|
||||
- name: Set postprocess of TV
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category2.Extensions\s*=.*'
|
||||
line: 'Category2.Extensions=MP4_Automator/NZBGetPostProcess.py'
|
||||
state: present
|
||||
|
||||
- name: Lowercase & Set Music Category
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category3.Name\s*=.*'
|
||||
line: 'Category3.Name=music'
|
||||
state: present
|
||||
|
||||
- name: Set Location of Music
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category3.DestDir\s*=.*'
|
||||
line: 'Category3.DestDir='
|
||||
state: present
|
||||
|
||||
- name: Lowercase & Set EBook Category
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category4.Name\s*=.*'
|
||||
line: 'Category4.Name=ebooks'
|
||||
state: present
|
||||
|
||||
- name: Set Location of EBooks
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Category4.DestDir\s*=.*'
|
||||
line: 'Category4.DestDir='
|
||||
state: present
|
||||
|
||||
- name: Lowercase & Set abook Category
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: 'Category5.Name\s*=.*'
|
||||
line: 'Category5.Name=abooks'
|
||||
state: present
|
||||
|
||||
- name: Set Location of aBooks
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: 'Category5.DestDir\s*=.*'
|
||||
line: 'Category5.DestDir='
|
||||
state: present
|
||||
|
||||
- name: Set Global Extensions
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^Extensions\s*=.*'
|
||||
line: 'Extensions=unzip.py'
|
||||
state: present
|
||||
|
||||
- name: Set ScriptOrder
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^ScriptOrder\s*=.*'
|
||||
line: 'ScriptOrder=unzip.py, MP4_Automator/NZBGetPostProcess.py'
|
||||
state: present
|
||||
|
||||
- name: Set mp4 script location
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^MP4_Automator/NZBGetPostProcess.py:MP4_FOLDER\s*=.*'
|
||||
line: 'MP4_Automator/NZBGetPostProcess.py:MP4_FOLDER=/config/scripts/MP4_Automator/'
|
||||
state: present
|
||||
|
||||
- name: Set mp4 conversion true
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^MP4_Automator/NZBGetPostProcess.py:SHOULDCONVERT\s*=.*'
|
||||
line: 'MP4_Automator/NZBGetPostProcess.py:SHOULDCONVERT=True'
|
||||
state: present
|
||||
|
||||
- name: Default User
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^ControlUsername\s*=.*'
|
||||
line: 'ControlUsername='
|
||||
state: present
|
||||
|
||||
- name: Default Password
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: 'ControlPassword\s*=.*'
|
||||
line: 'ControlPassword='
|
||||
state: present
|
||||
|
||||
- name: DirectUnpack Set to On
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^DirectUnpack\s*=.*'
|
||||
line: 'DirectUnpack=yes'
|
||||
state: present
|
||||
|
||||
- name: HealthCheck
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^HealthCheck\s*=.*'
|
||||
line: 'HealthCheck=Delete'
|
||||
state: present
|
||||
|
||||
- name: Set DiskSpace
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '^DiskSpace\s*=.*'
|
||||
line: 'DiskSpace=25000'
|
||||
state: present
|
||||
|
||||
- name: Remove Generic Task
|
||||
lineinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
regexp: '{{ item.regexp }}'
|
||||
state: absent
|
||||
with_items:
|
||||
- { regexp: '.Task1\.Time\=' }
|
||||
- { regexp: '.Task1\.WeekDays\=' }
|
||||
- { regexp: '.Task1\.Command\=' }
|
||||
- { regexp: '.Task1\.Param\=' }
|
||||
|
||||
- name: Unpause
|
||||
blockinfile:
|
||||
path: '/opt/appdata/{{pgrole}}/nzbget.conf'
|
||||
block: |
|
||||
Task1.Time=*,*:00,*:30
|
||||
Task1.WeekDays=1-7
|
||||
Task1.Command=UnpauseDownload
|
||||
Task1.Param=
|
||||
insertafter: '^### SCHEDULER'
|
||||
when: not confcheck.stat.exists
|
||||
|
||||
- name: Restart {{pgrole}}
|
||||
docker_container:
|
||||
name: '{{pgrole}}'
|
||||
state: started
|
||||
Reference in New Issue
Block a user