From fe31a9a9d69ba1f94951f42ff0b2ecfad79c8205 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 19:45:50 -0400 Subject: [PATCH 01/11] Add files via upload --- root/scripts/update.py | 199 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 root/scripts/update.py diff --git a/root/scripts/update.py b/root/scripts/update.py new file mode 100644 index 0000000..46bb3e8 --- /dev/null +++ b/root/scripts/update.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python + +import os +import sys +import logging +import configparser +import xml.etree.ElementTree as ET + +xml = "/config/config.xml" +autoProcess = os.path.join(os.environ.get("SMA_PATH", "/usr/local/sma"), "config/autoProcess.ini") + + +def main(): + if not os.path.isfile(xml): + logging.error("No Sonarr/Radarr config file found") + sys.exit(1) + + if not os.path.isfile(autoProcess): + logging.error("autoProcess.ini does not exist") + sys.exit(1) + + tree = ET.parse(xml) + root = tree.getroot() + port = root.find("Port").text + try: + sslport = root.find("SslPort").text + except: + sslport = port + webroot = root.find("UrlBase").text + webroot = webroot if webroot else "" + ssl = root.find("EnableSsl").text + ssl = ssl.lower() in ["true", "yes", "t", "1", "y"] if ssl else False + apikey = root.find("ApiKey").text + section = os.environ.get("SMA_APP") + if not section: + logging.error("No Sonarr/Radarr specifying ENV variable") + sys.exit(1) + + safeConfigParser = configparser.ConfigParser() + safeConfigParser.read(autoProcess) + + # Set FFMPEG/FFProbe Paths + safeConfigParser.set("Converter", "ffmpeg", "ffmpeg") + safeConfigParser.set("Converter", "ffprobe", "ffprobe") + if os.environ.get("CONVERTER_THREADS"): + safeConfigParser.set("Converter", "threads", os.environ.get("CONVERTER_THREADS")) + if os.environ.get("CONVERTER_OUTPUT_FORMAT"): + safeConfigParser.set("Converter", "output-format", os.environ.get("CONVERTER_OUTPUT_FORMAT")) + if os.environ.get("CONVERTER_OUTPUT_EXTENSION"): + safeConfigParser.set("Converter", "output-extension", os.environ.get("CONVERTER_OUTPUT_EXTENSION")) + if os.environ.get("CONVERTER_SORT_STREAMS"): + safeConfigParser.set("Converter", "sort-streams", os.environ.get("CONVERTER_SORT_STREAMS")) + if os.environ.get("CONVERTER_PROCESS_SAME_EXTENSIONS"): + safeConfigParser.set("Converter", "process-same-extensions", os.environ.get("CONVERTER_PROCESS_SAME_EXTENSIONS")) + if os.environ.get("CONVERTER_FORCE_CONVERT"): + safeConfigParser.set("Converter", "force-convert", os.environ.get("CONVERTER_FORCE_CONVERT")) + if os.environ.get("CONVERTER_PREOPTS"): + safeConfigParser.set("Converter", "preopts", os.environ.get("CONVERTER_PREOPTS")) + if os.environ.get("CONVERTER_POSTOPTS"): + safeConfigParser.set("Converter", "postopts", os.environ.get("CONVERTER_POSTOPTS")) + + # SET Permissions + if os.environ.get("PERMISSIONS_CHMOD"): + safeConfigParser.set("Permissions", "chmod", os.environ.get("PERMISSIONS_CHMOD")) + + # Set Metadata Settings + if os.environ.get("METADATA_RELOCATE_MOV"): + safeConfigParser.set("Metadata", "relocate-moov", os.environ.get("METADATA_RELOCATE_MOV")) + if os.environ.get("METADATA_TAG"): + safeConfigParser.set("Metadata", "tag", os.environ.get("METADATA_TAG")) + if os.environ.get("METADATA_TAG_LANGUAGE"): + safeConfigParser.set("Metadata", "tag-language", os.environ.get("METADATA_TAG_LANGUAGE")) + if os.environ.get("METADATA_DOWNLOAD_ARTWORK"): + safeConfigParser.set("Metadata", "download-artwork", os.environ.get("METADATA_DOWNLOAD_ARTWORK")) + if os.environ.get("METADATA_PRESERVE_SOURCE_DISPOSITION"): + safeConfigParser.set("Metadata", "preserve-source-disposition", os.environ.get("METADATA_PRESERVE_SOURCE_DISPOSITION")) + + # Set Video Settings + if os.environ.get("VIDEO_CODEC"): + safeConfigParser.set("Video", "codec", os.environ.get("VIDEO_CODEC")) + if os.environ.get("VIDEO_BITRATE"): + safeConfigParser.set("Video", "bitrate", os.environ.get("VIDEO_BITRATE")) + if os.environ.get("VIDEO_CRF"): + safeConfigParser.set("Video", "crf", os.environ.get("VIDEO_CRF")) + if os.environ.get("VIDEO_CRF_PROFILES"): + safeConfigParser.set("Video", "crf-profiles", os.environ.get("VIDEO_CRF_PROFILES")) + if os.environ.get("VIDEO_MAX_WIDTH"): + safeConfigParser.set("Video", "max-width", os.environ.get("VIDEO_MAX_WIDTH")) + if os.environ.get("VIDEO_PROFILE"): + safeConfigParser.set("Video", "profile", os.environ.get("VIDEO_PROFILE")) + if os.environ.get("VIDEO_MAX_LEVEL"): + safeConfigParser.set("Video", "max-level", os.environ.get("VIDEO_MAX_LEVEL")) + if os.environ.get("VIDEO_PIX_FMT"): + safeConfigParser.set("Video", "pix-fmt", os.environ.get("VIDEO_PIX_FMT")) + + # Set Audio Settings + if os.environ.get("AUDIO_CODEC"): + safeConfigParser.set("Audio", "codec", os.environ.get("AUDIO_CODEC")) + if os.environ.get("AUDIO_LANGUAGES"): + safeConfigParser.set("Audio", "languages", os.environ.get("AUDIO_LANGUAGES")) + if os.environ.get("AUDIO_DEFAULT_LANGUAGE"): + safeConfigParser.set("Audio", "default-language", os.environ.get("AUDIO_DEFAULT_LANGUAGE")) + if os.environ.get("AUDIO_FIRST_STREAM_OF_LANGUAGE"): + safeConfigParser.set("Audio", "first-stream-of-language", os.environ.get("AUDIO_FIRST_STREAM_OF_LANGUAGE")) + if os.environ.get("AUDIO_CHANNEL_BITRATE"): + safeConfigParser.set("Audio", "channel-bitrate", os.environ.get("AUDIO_CHANNEL_BITRATE")) + if os.environ.get("AUDIO_MAX_BITRATE"): + safeConfigParser.set("Audio", "max-bitrate", os.environ.get("AUDIO_MAX_BITRATE")) + if os.environ.get("AUDIO_MAX_CHANNELS"): + safeConfigParser.set("Audio", "max-channels", os.environ.get("AUDIO_MAX_CHANNELS")) + if os.environ.get("AUDIO_PREFER_MORE_CHANNELS"): + safeConfigParser.set("Audio", "prefer-more-channels", os.environ.get("AUDIO_PREFER_MORE_CHANNELS")) + if os.environ.get("AUDIO_DEFAULT_MORE_CHANNELS"): + safeConfigParser.set("Audio", "default-more-channels", os.environ.get("AUDIO_DEFAULT_MORE_CHANNELS")) + if os.environ.get("AUDIO_FILTER"): + safeConfigParser.set("Audio", "filter", os.environ.get("AUDIO_FILTER")) + if os.environ.get("AUDIO_SAMPLE_RATES"): + safeConfigParser.set("Audio", "sample-rates", os.environ.get("AUDIO_SAMPLE_RATES")) + if os.environ.get("AUDIO_COPY_ORIGINAL"): + safeConfigParser.set("Audio", "copy-original", os.environ.get("AUDIO_COPY_ORIGINAL")) + if os.environ.get("AUDIO_AAC_ADTSTOASC"): + safeConfigParser.set("Audio", "aac-adtstoasc", os.environ.get("AUDIO_AAC_ADTSTOASC")) + if os.environ.get("AUDIO_IGNORE_TREHD"): + safeConfigParser.set("Audio", "ignore-truehd", os.environ.get("AUDIO_IGNORE_TREHD")) + + # Set Universal Audio Settings + if os.environ.get("UAUDIO_CODEC"): + safeConfigParser.set("Universal Audio", "codec", os.environ.get("UAUDIO_CODEC")) + if os.environ.get("UAUDIO_CHANNEL_BITRATE"): + safeConfigParser.set("Universal Audio", "channel-bitrate", os.environ.get("UAUDIO_CHANNEL_BITRATE")) + if os.environ.get("UAUDIO_FIRST_STREAM_ONLY"): + safeConfigParser.set("Universal Audio", "first-stream-only", os.environ.get("UAUDIO_FIRST_STREAM_ONLY")) + if os.environ.get("UAUDIO_MOVE_AFTER"): + safeConfigParser.set("Universal Audio", "move-after", os.environ.get("UAUDIO_MOVE_AFTER")) + if os.environ.get("UAUDIO_FILTER"): + safeConfigParser.set("Universal Audio", "filter", os.environ.get("UAUDIO_FILTER")) + + # Set Subtitle Settings + if os.environ.get("SUBTITLE_CODEC"): + safeConfigParser.set("Subtitle", "codec", os.environ.get("SUBTITLE_CODEC")) + if os.environ.get("SUBTITLE_CODEC_IMAGE_BASED"): + safeConfigParser.set("Subtitle", "codec-image-based", os.environ.get("SUBTITLE_CODEC_IMAGE_BASED")) + if os.environ.get("SUBTITLE_LANGUAGES"): + safeConfigParser.set("Subtitle", "languages", os.environ.get("SUBTITLE_LANGUAGES")) + if os.environ.get("SUBTITLE_DEFAULT_LANGUAGE"): + safeConfigParser.set("Subtitle", "default-language", os.environ.get("SUBTITLE_DEFAULT_LANGUAGE")) + if os.environ.get("SUBTITLE_FIRST_STREAM_OF_LANGUAGE"): + safeConfigParser.set("Subtitle", "first-stream-of-language", os.environ.get("SUBTITLE_FIRST_STREAM_OF_LANGUAGE")) + if os.environ.get("SUBTITLE_ENCODING"): + safeConfigParser.set("Subtitle", "encoding", os.environ.get("SUBTITLE_ENCODING")) + if os.environ.get("SUBTITLE_BURN_SUBTITLES"): + safeConfigParser.set("Subtitle", "burn-subtitles", os.environ.get("SUBTITLE_BURN_SUBTITLES")) + if os.environ.get("SUBTITLE_DOWNLOAD_SUBS"): + safeConfigParser.set("Subtitle", "download-subs", os.environ.get("SUBTITLE_DOWNLOAD_SUBS")) + if os.environ.get("SUBTITLE_DOWNLOAD_HEARING_IMPAIRED_SUBS"): + safeConfigParser.set("Subtitle", "download-hearing-impaired-subs", os.environ.get("SUBTITLE_DOWNLOAD_HEARING_IMPAIRED_SUBS")) + if os.environ.get("SUBTITLE_DOWNLOAD_PROVIDERS"): + safeConfigParser.set("Subtitle", "download-providers", os.environ.get("SUBTITLE_DOWNLOAD_PROVIDERS")) + if os.environ.get("SUBTITLE_EMBED_SUBS"): + safeConfigParser.set("Subtitle", "embed-subs", os.environ.get("SUBTITLE_EMBED_SUBS")) + if os.environ.get("SUBTITLE_EMBED_IMAGE_SUBS"): + safeConfigParser.set("Subtitle", "embed-image-subs", os.environ.get("SUBTITLE_EMBED_IMAGE_SUBS")) + if os.environ.get("SUBTITLE_EMBED_ONLY_INTERNAL_SUBS"): + safeConfigParser.set("Subtitle", "embed-only-internal-subs", os.environ.get("SUBTITLE_EMBED_ONLY_INTERNAL_SUBS")) + if os.environ.get("SUBTITLE_IGNORE_EMBEDDED_SUBS"): + safeConfigParser.set("Subtitle", "ignore-embedded-subs", os.environ.get("SUBTITLE_IGNORE_EMBEDDED_SUBS")) + if os.environ.get("SUBTITLE_ATTACHMENT_CODEC"): + safeConfigParser.set("Subtitle", "attachment-codec", os.environ.get("SUBTITLE_ATTACHMENT_CODEC")) + + # Set Plex Settings + if os.environ.get("PLEX_HOST"): + safeConfigParser.set("Plex", "host", os.environ.get("PLEX_HOST")) + if os.environ.get("PLEX_PORT"): + safeConfigParser.set("Plex", "port", os.environ.get("PLEX_PORT")) + if os.environ.get("PLEX_REFRESH"): + safeConfigParser.set("Plex", "refresh", os.environ.get("PLEX_REFRESH")) + if os.environ.get("PLEX_TOKEN"): + safeConfigParser.set("Plex", "token", os.environ.get("PLEX_TOKEN")) + + # Set values from config.xml + safeConfigParser.set(section, "apikey", apikey) + safeConfigParser.set(section, "ssl", str(ssl)) + safeConfigParser.set(section, "port", sslport if ssl else port) + safeConfigParser.set(section, "webroot", webroot) + + # Set IP from environment variable + ip = os.environ.get("HOST") + if ip: + safeConfigParser.set(section, "host", ip) + else: + safeConfigParser.set(section, "host", "127.0.0.1") + + fp = open(autoProcess, "w") + safeConfigParser.write(fp) + fp.close() + + +if __name__ == '__main__': + main() From c9185eebb4522a01a565ae0a9df271ca95e86794 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 19:47:18 -0400 Subject: [PATCH 02/11] Update update.py --- root/scripts/update.py | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/root/scripts/update.py b/root/scripts/update.py index 46bb3e8..a66c06a 100644 --- a/root/scripts/update.py +++ b/root/scripts/update.py @@ -6,36 +6,10 @@ import logging import configparser import xml.etree.ElementTree as ET -xml = "/config/config.xml" autoProcess = os.path.join(os.environ.get("SMA_PATH", "/usr/local/sma"), "config/autoProcess.ini") - def main(): - if not os.path.isfile(xml): - logging.error("No Sonarr/Radarr config file found") - sys.exit(1) - - if not os.path.isfile(autoProcess): - logging.error("autoProcess.ini does not exist") - sys.exit(1) - - tree = ET.parse(xml) - root = tree.getroot() - port = root.find("Port").text - try: - sslport = root.find("SslPort").text - except: - sslport = port - webroot = root.find("UrlBase").text - webroot = webroot if webroot else "" - ssl = root.find("EnableSsl").text - ssl = ssl.lower() in ["true", "yes", "t", "1", "y"] if ssl else False - apikey = root.find("ApiKey").text - section = os.environ.get("SMA_APP") - if not section: - logging.error("No Sonarr/Radarr specifying ENV variable") - sys.exit(1) - + safeConfigParser = configparser.ConfigParser() safeConfigParser.read(autoProcess) @@ -177,19 +151,6 @@ def main(): if os.environ.get("PLEX_TOKEN"): safeConfigParser.set("Plex", "token", os.environ.get("PLEX_TOKEN")) - # Set values from config.xml - safeConfigParser.set(section, "apikey", apikey) - safeConfigParser.set(section, "ssl", str(ssl)) - safeConfigParser.set(section, "port", sslport if ssl else port) - safeConfigParser.set(section, "webroot", webroot) - - # Set IP from environment variable - ip = os.environ.get("HOST") - if ip: - safeConfigParser.set(section, "host", ip) - else: - safeConfigParser.set(section, "host", "127.0.0.1") - fp = open(autoProcess, "w") safeConfigParser.write(fp) fp.close() From fac85736f737cadf63c12205c325f9a90888fa07 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 19:50:46 -0400 Subject: [PATCH 03/11] Update 32-sma-setup.bash --- root/etc/cont-init.d/32-sma-setup.bash | 56 +++++++++----------------- 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/root/etc/cont-init.d/32-sma-setup.bash b/root/etc/cont-init.d/32-sma-setup.bash index 458f414..146ce72 100644 --- a/root/etc/cont-init.d/32-sma-setup.bash +++ b/root/etc/cont-init.d/32-sma-setup.bash @@ -1,53 +1,37 @@ #!/usr/bin/with-contenv bash -# import new config, if does not exist -if [ ! -f "/config/scripts/configs/sonarr-pp.ini" ]; then - cp "/usr/local/sma/setup/autoProcess.ini.sample" "/config/scripts/configs/sonarr-pp.ini" && \ - # set permissions - chmod 0666 "/config/scripts/configs/sonarr-pp.ini" -fi - -# import new config, if does not exist -if [ ! -f "/config/scripts/configs/radarr-pp.ini" ]; then - cp "/usr/local/sma/setup/autoProcess.ini.sample" "/config/scripts/configs/radarr-pp.ini" && \ - # set permissions - chmod 0666 "/config/scripts/configs/radarr-pp.ini" -fi - -# Remove sonarr log -if [ -f "/config/scripts/logs/sonarr-pp.log" ]; then - rm "/config/scripts/logs/sonarr-pp.log" && \ +# Remove exisitng +if [ -d "/config/scripts/sma" ]; then + rm -rf "/config/scripts/sma" && \ sleep 0.1 fi -# Remove radarr log -if [ -f "/config/scripts/logs/radarr-pp.log" ]; then - rm "/config/scripts/logs/radarr-pp.log" && \ +if [ -d "/usr/local/sma/config" ]; then + rm -rf /usr/local/sma/config/* && \ sleep 0.1 fi -# create sonarr log -if [ ! -f "/config/scripts/logs/sonarr-pp.log" ]; then - touch "/config/scripts/logs/sonarr-pp.log" && \ - # set permissions - chmod 0666 "/config/scripts/logs/sonarr-pp.log" +# create config directory +if [ ! -d "/config/scripts/sma" ]; then + mkdir -p "/config/scripts/sma" && \ + chmod 0777 -R "/config/scripts/sma" fi -# create radarr log -if [ ! -f "/config/scripts/logs/radarr-pp.log" ]; then - touch "/config/scripts/logs/radarr-pp.log" && \ - # set permissions - chmod 0666 "/config/scripts/logs/radarr-pp.log" + +# import new config, if does not exist +if [ ! -f "/config/sma/autoProcess.ini" ]; then + cp "/usr/local/sma/setup/autoProcess.ini.sample" "/usr/local/sma/config/autoProcess.ini" fi -# Set ffmpeg/ffprobe location -sed -i "s/ffmpeg.exe/ffmpeg/g" "/config/scripts/configs/sonarr-pp.ini" -sed -i "s/ffprobe.exe/ffprobe/g" "/config/scripts/configs/sonarr-pp.ini" +# create sma log file +touch "/config/scripts/sma/sma.log" && \ -# Set ffmpeg/ffprobe location -sed -i "s/ffmpeg.exe/ffmpeg/g" "/config/scripts/configs/radarr-pp.ini" -sed -i "s/ffprobe.exe/ffprobe/g" "/config/scripts/configs/radarr-pp.ini" +# link sma log file +ln -s "/config/scripts/sma/sma.log" "/usr/local/sma/config/sma.log" && \ +# set permissions +chmod 0666 "/config/scripts/sma"/* chmod 0777 -R "/usr/local/sma" +chmod 0777 -R "/scripts" exit 0 From 029cddf945767c8bb382079bcc5dfb319b11c2de Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 19:51:35 -0400 Subject: [PATCH 04/11] Add files via upload --- root/etc/cont-init.d/35-sma-config-update.bash | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 root/etc/cont-init.d/35-sma-config-update.bash diff --git a/root/etc/cont-init.d/35-sma-config-update.bash b/root/etc/cont-init.d/35-sma-config-update.bash new file mode 100644 index 0000000..1a5519d --- /dev/null +++ b/root/etc/cont-init.d/35-sma-config-update.bash @@ -0,0 +1,17 @@ +#!/usr/bin/with-contenv bash + +# Check if config is already updated, if not start cron... +if [ ! -f "/config/config.xml" ]; then + # start cron + service cron start + exit 0 +fi + +if [ -f "/config/config.xml" ]; then + # update autoprocess + python3 /scripts/update.py + # stop cron + service cron status > /dev/null && service cron stop +fi + +exit $? From 862af513ce63c632ee65adb99708d9f286655853 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 19:52:28 -0400 Subject: [PATCH 05/11] Update 35-sma-config-update.bash --- root/etc/cont-init.d/35-sma-config-update.bash | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/root/etc/cont-init.d/35-sma-config-update.bash b/root/etc/cont-init.d/35-sma-config-update.bash index 1a5519d..992343f 100644 --- a/root/etc/cont-init.d/35-sma-config-update.bash +++ b/root/etc/cont-init.d/35-sma-config-update.bash @@ -1,17 +1,6 @@ #!/usr/bin/with-contenv bash -# Check if config is already updated, if not start cron... -if [ ! -f "/config/config.xml" ]; then - # start cron - service cron start - exit 0 -fi - -if [ -f "/config/config.xml" ]; then - # update autoprocess - python3 /scripts/update.py - # stop cron - service cron status > /dev/null && service cron stop -fi +# update autoprocess +python3 /scripts/update.py exit $? From 6505b684b1220a5bf8512f24dcfb602948da3154 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 20:14:05 -0400 Subject: [PATCH 06/11] Update 33-script-setup.bash --- root/etc/cont-init.d/33-script-setup.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/root/etc/cont-init.d/33-script-setup.bash b/root/etc/cont-init.d/33-script-setup.bash index afd5c71..ac1e226 100644 --- a/root/etc/cont-init.d/33-script-setup.bash +++ b/root/etc/cont-init.d/33-script-setup.bash @@ -14,6 +14,17 @@ if [ ! -f "/config/scripts/audio-pp.bash" ]; then chmod 0777 "/config/scripts/audio-pp.bash" fi +if [ -f "/config/scripts/video-pp.bash" ]; then + rm "/config/scripts/video-pp.bash" + sleep 0.1 +fi + +# cp config file for use +if [ ! -f "/config/scripts/video-pp.bash" ]; then + cp "/usr/local/sabnzbd-scripts/video-pp.bash" "/config/scripts/video-pp.bash" && \ + chmod 0777 "/config/scripts/video-pp.bash" +fi + if [ -f "/config/scripts/radarr-pp.bash" ]; then rm "/config/scripts/radarr-pp.bash" sleep 0.1 From f1d78a13c0715c21590eb5293d02f9e64e23b745 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 20:16:47 -0400 Subject: [PATCH 07/11] Update README.md --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/README.md b/README.md index 41242d8..3e3b214 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,62 @@ Container images are configured using parameters passed at runtime (such as thos | `-e AUDIO_REPLAYGAIN=FALSE` | TRUE = ENABLED, adds replaygain tags for compatible players (FLAC ONLY) | | `-e VIDEO_LANG=eng` | Default: eng :: Set to required language (ISO 639-2 language code), if not found, will mark as failed | | `-e VIDEO_SMA=FALSE` | TRUE = Enabled :: Uses SMA to process incoming video files, update your configuraiton at: /config/scripts/configs/(radarr/sonarr)-pp.ini | +| `-e CONVERTER_THREADS="0"` | FFMpeg threads, corresponds to threads parameter | +| `-e CONVERTER_OUTPUT_FORMAT="mkv"` | Wrapped format corresponding to -f in FFmpeg | +| `-e CONVERTER_OUTPUT_EXTENSION="mkv"` | File extension for created media | +| `-e CONVERTER_SORT_STREAMS="True"` | Sort streams by language preferences and channels | +| `-e CONVERTER_PROCESS_SAME_EXTENSIONS="False"` | Run files with the same input and output extensions through the conversion process. Tagging is not effected. If after options are generated all streams are copy conversion will be skipped. Use with caution alongside universal audio and audio copy-original as tracks will keep replicating | +| `-e CONVERTER_FORCE_CONVERT="False"` | Force conversion regardless of streams being in appropriate format | +| `-e CONVERTER_PREOPTS=""` | Additional comma separated FFmpeg options placed before main commands | +| `-e CONVERTER_POSTOPTS=""` | Additional comma separated FFmpeg options placed after main commands | +| `-e PERMISSIONS_CHMOD="0666"` | Base 8 chmod value | +| `-e METADATA_RELOCATE_MOV="FALSE"` | Relocate MOOV atom using QTFastStart. MP4 only | +| `-e METADATA_TAG="False"` | Tag files with metadata from TMDB. MP4 only | +| `-e METADATA_TAG_LANGUAGE="eng"` | Tag language | +| `-e METADATA_DOWNLOAD_ARTWORK="thumb"` | Download artwork and embed in media. poster, thumb, True, False are valid options | +| `-e METADATA_PRESERVE_SOURCE_DISPOSITION="False"` | Maintain disposition elements from source file, set False to have the script set defaults based on sorting and preferences | +| `-e VIDEO_CODEC="h264, x264"` | Approved video codecs. Codecs not on this list are converted to the first codec on the list | +| `-e VIDEO_BITRATE="0"` | Maximum bitrate for video in Kb. Values above this range will be down sampled. 0 for no limit | +| `-e VIDEO_CRF="-1"` | CRF value, -1 to disable | +| `-e VIDEO_CRF_PROFILES=""` | See script website: https://github.com/mdhiggins/sickbeard_mp4_automator/wiki/AutoProcess-Settings | +| `-e VIDEO_MAX_WIDTH="0"` | Maximum video width, videos larger will be down sized | +| `-e VIDEO_PROFILE=""` | Video profile | +| `-e VIDEO_MAX_LEVEL="4.1"` | Maximum video level, videos above will be down sampled. Format example is 4.1 | +| `-e VIDEO_PIX_FMT=""` | Supported pix-fmt list. Formats not on this list are be converted to the first format on the list | +| `-e AUDIO_CODEC="libfdk_aac, aac, mp3, opus"` | Approved audio codecs. Codecs not on this list are converted to the first codec on the list | +| `-e AUDIO_LANGUAGES="eng"` | Approved audio stream languages. Languages not on this list will not be used. Leave blank to approve all languages | +| `-e AUDIO_DEFAULT_LANGUAGE="eng"` | If audio stream language is undefined, assumed this language | +| `-e AUDIO_FIRST_STREAM_OF_LANGUAGE="False"` | Only include the first occurrence of an audio stream of language | +| `-e AUDIO_CHANNEL_BITRATE="64"` | Bitrate of audio stream per channel. Multiple by number of channels to get stream bitrate. Use 0 to attempt to guess based on source bitrate | +| `-e AUDIO_MAX_BITRATE="0"` | Maximum audio stream bitrate regardless of channels. 0 for no limit | +| `-e AUDIO_MAX_CHANNELS="0"` | Maximum number of audio channels per stream. Streams with more channels will be down sampled | +| `-e AUDIO_PREFER_MORE_CHANNELS="True"` | When sorting source audio streams, prefer higher channel counts | +| `-e AUDIO_DEFAULT_MORE_CHANNELS="True"` | When setting default audio stream, prefer higher channel counts | +| `-e AUDIO_FILTER=""` | FFmpeg audio filter. Setting this will not allow copying audio streams | +| `-e AUDIO_SAMPLE_RATES=""` | Approved audio sample rates, rates not on the approved list will be converted to the first rate on the list | +| `-e AUDIO_COPY_ORIGINAL="True"` | Always include a copy of the original audio stream | +| `-e AUDIO_AAC_ADTSTOASC="False"` | | +| `-e AUDIO_IGNORE_TREHD="mp4, m4v"` | Ignore trueHD audio streams for specific extensions (Not supported in MP4 containers). Leave blank to disable | +| `-e UAUDIO_CODEC=""libfdk_aac, aac, mp3"` | Approved audio codecs. Codecs not on this list are converted to the first codec on the list | +| `-e UAUDIO_CHANNEL_BITRATE="80"` | Bitrate of universal audio stream per channel. Multiple by number of channels to get stream bitrate. Use 0 to attempt to guess based on source bitrate | +| `-e UAUDIO_FIRST_STREAM_ONLY="True"` | Only create a universal audio stream for the first audio stream encountered | +| `-e UAUDIO_MOVE_AFTER="True"` | Move universal audio stream after the source stream | +| `-e UAUDIO_FILTER=""` | FFmpeg audio filter. Setting this will not allow copying audio streams | +| `-e SUBTITLE_CODEC="srt"` | Approved subtitle codecs. Codecs not on this list are converted to the first codec on the list | +| `-e SUBTITLE_CODEC_IMAGE_BASED=""` | Approved image-based subtitle codecs. Codecs not on this list are converted to the first codec on the list | +| `-e SUBTITLE_LANGUAGES="eng"` | Approved subtitle stream languages. Languages not on this list will not be used. Leave blank to approve all languages | +| `-e SUBTITLE_DEFAULT_LANGUAGE="eng"` | If subtitle stream language is undefined, assumed this language | +| `-e SUBTITLE_FIRST_STREAM_OF_LANGUAGE="False"` | Only include the first occurrence of a subtitle stream of language | +| `-e SUBTITLE_ENCODING=""` | Subtitle encoding format | +| `-e SUBTITLE_BURN_SUBTITLES="False"` | Burns subtitles onto video stream. Valid parameters are true / any, false, default, forced, default, forced. If a valid subtitle for burning is found this will force the video stream to be encoded (cannot copy). Internal subtitles are prioritized over external subtitles. This feature does not support image based subtitle formats | +| `-e SUBTITLE_DOWNLOAD_SUBS="False"` | Attempt to download subtitles of your specified languages automatically using subliminal | +| `-e SUBTITLE_DOWNLOAD_HEARING_IMPAIRED_SUBS="False"` | Download hearing impaired subtitles using subliminal | +| `-e SUBTITLE_DOWNLOAD_PROVIDERS=""` | Subliminal providers, leave blank to use default providers | +| `-e SUBTITLE_EMBED_SUBS="True"` | Embeds text based subtitles in the output video. External subtitles in the same directory will embedded. If false subtitles will be extracted | +| `-e SUBTITLE_EMBED_IMAGE_SUBS="False"` | Embed image based subtitles in the output video. Ensure you are using a container that supports image based subtitles | +| `-e SUBTITLE_EMBED_ONLY_INTERNAL_SUBS="False"` | Limit embedding subtitles to only subs embedded in the source file | +| `-e SUBTITLE_IGNORE_EMBEDDED_SUBS="True"` | Ignore sub streams included in source file, external sources will still be processed | +| `-e SUBTITLE_ATTACHMENT_CODEC=""` | Approved codecs for attachments. Useful for fonts included with source file | ## Application Setup From 535b0c2d8083ba4b9997564b0647500d8386e519 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 20:23:04 -0400 Subject: [PATCH 08/11] Update Dockerfile --- Dockerfile | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/Dockerfile b/Dockerfile index 478f493..fa623df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,69 @@ ENV AUDIO_BITRATE 320 ENV AUDIO_REPLAYGAIN FALSE ENV AUDIO_DSFA TRUE ENV AUDIO_DSFAS 150M +# converter settings +ENV CONVERTER_THREADS="0" +ENV CONVERTER_OUTPUT_FORMAT="mp4" +ENV CONVERTER_OUTPUT_EXTENSION="mp4" +ENV CONVERTER_SORT_STREAMS="True" +ENV CONVERTER_PROCESS_SAME_EXTENSIONS="False" +ENV CONVERTER_FORCE_CONVERT="False" +ENV CONVERTER_PREOPTS="" +ENV CONVERTER_POSTOPTS="" +# permissions +ENV PERMISSIONS_CHMOD="0666" +# metadata settings +ENV METADATA_RELOCATE_MOV="True" +ENV METADATA_TAG="True" +ENV METADATA_TAG_LANGUAGE="eng" +ENV METADATA_DOWNLOAD_ARTWORK="thumb" +ENV METADATA_PRESERVE_SOURCE_DISPOSITION="True" +# video settings +ENV VIDEO_CODEC="h264, x264" +ENV VIDEO_BITRATE="0" +ENV VIDEO_CRF="-1" +ENV VIDEO_CRF_PROFILES="" +ENV VIDEO_MAX_WIDTH="0" +ENV VIDEO_PROFILE="" +ENV VIDEO_MAX_LEVEL="0.0" +ENV VIDEO_PIX_FMT="" +# audio settings +ENV AUDIO_CODEC="ac3" +ENV AUDIO_LANGUAGES="" +ENV AUDIO_DEFAULT_LANGUAGE="" +ENV AUDIO_FIRST_STREAM_OF_LANGUAGE="False" +ENV AUDIO_CHANNEL_BITRATE="128" +ENV AUDIO_MAX_BITRATE="0" +ENV AUDIO_MAX_CHANNELS="0" +ENV AUDIO_PREFER_MORE_CHANNELS="True" +ENV AUDIO_DEFAULT_MORE_CHANNELS="True" +ENV AUDIO_FILTER="" +ENV AUDIO_SAMPLE_RATES="" +ENV AUDIO_COPY_ORIGINAL="False" +ENV AUDIO_AAC_ADTSTOASC="False" +ENV AUDIO_IGNORE_TREHD="mp4, m4v" +# universal audio settings +ENV UAUDIO_CODEC="aac" +ENV UAUDIO_CHANNEL_BITRATE="128" +ENV UAUDIO_FIRST_STREAM_ONLY="False" +ENV UAUDIO_MOVE_AFTER="False" +ENV UAUDIO_FILTER="" +# subtitle settings +ENV SUBTITLE_CODEC="mov_text" +ENV SUBTITLE_CODEC_IMAGE_BASED="" +ENV SUBTITLE_LANGUAGES="" +ENV SUBTITLE_DEFAULT_LANGUAGE="" +ENV SUBTITLE_FIRST_STREAM_OF_LANGUAGE="False" +ENV SUBTITLE_ENCODING="" +ENV SUBTITLE_BURN_SUBTITLES="" +ENV SUBTITLE_DOWNLOAD_SUBS="False" +ENV SUBTITLE_DOWNLOAD_HEARING_IMPAIRED_SUBS="False" +ENV SUBTITLE_DOWNLOAD_PROVIDERS="" +ENV SUBTITLE_EMBED_SUBS="True" +ENV SUBTITLE_EMBED_IMAGE_SUBS="False" +ENV SUBTITLE_EMBED_ONLY_INTERNAL_SUBS="False" +ENV SUBTITLE_IGNORE_EMBEDDED_SUBS="False" +ENV SUBTITLE_ATTACHMENT_CODEC="" # Add files from ffmpeg COPY --from=ffmpeg /usr/local/ /usr/local/ From 318a7e84de553b21f0bff1efcacb1116fd07cc0d Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 20:42:32 -0400 Subject: [PATCH 09/11] Update 33-script-setup.bash --- root/etc/cont-init.d/33-script-setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/cont-init.d/33-script-setup.bash b/root/etc/cont-init.d/33-script-setup.bash index ac1e226..3f3df93 100644 --- a/root/etc/cont-init.d/33-script-setup.bash +++ b/root/etc/cont-init.d/33-script-setup.bash @@ -21,7 +21,7 @@ fi # cp config file for use if [ ! -f "/config/scripts/video-pp.bash" ]; then - cp "/usr/local/sabnzbd-scripts/video-pp.bash" "/config/scripts/video-pp.bash" && \ + cp "/usr/local/sabnzbd-scripts/sabnzbd/video-pp.bash" "/config/scripts/video-pp.bash" && \ chmod 0777 "/config/scripts/video-pp.bash" fi From ec7a38cdb41ebc596967a7a3fa59f5d77a6e30c0 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 20:47:52 -0400 Subject: [PATCH 10/11] Update 33-script-setup.bash --- root/etc/cont-init.d/33-script-setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/cont-init.d/33-script-setup.bash b/root/etc/cont-init.d/33-script-setup.bash index 3f3df93..7d52853 100644 --- a/root/etc/cont-init.d/33-script-setup.bash +++ b/root/etc/cont-init.d/33-script-setup.bash @@ -101,7 +101,7 @@ if cat "/config/sabnzbd.ini" | grep "\[categories\]" | read; then sed -i '/\[\[movies\]\]/,+7d' "/config/sabnzbd.ini" && \ # Add categories - sed -i '/\[categories\]/a\\[\[radarr\]\]\npriority = -100\npp = ""\nname = radarr\nscript = radarr-pp.bash\nnewzbin = ""\norder = 1\n\dir = radarr\n\[\[sonarr\]\]\npriority = -100\npp = ""\nname = sonarr\nscript = sonarr-pp.bash\nnewzbin = ""\norder = 2\n\dir = sonarr\n\[\[lidarr\]\]\npriority = -100\npp = ""\nname = lidarr\nscript = audio-pp.bash\nnewzbin = ""\norder = 3\n\dir = lidarr' "/config/sabnzbd.ini" + sed -i '/\[categories\]/a\\[\[radarr\]\]\npriority = -100\npp = ""\nname = radarr\nscript = video-pp.bash\nnewzbin = ""\norder = 1\n\dir = radarr\n\[\[sonarr\]\]\npriority = -100\npp = ""\nname = sonarr\nscript = video-pp.bash\nnewzbin = ""\norder = 2\n\dir = sonarr\n\[\[lidarr\]\]\npriority = -100\npp = ""\nname = lidarr\nscript = audio-pp.bash\nnewzbin = ""\norder = 3\n\dir = lidarr' "/config/sabnzbd.ini" sleep 2 restartsab=$(pgrep s6-supervise | sort -r | head -n1) && \ From 38d8681719828c52ea3a9b3eebd3aa3511c33dd8 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 20:52:43 -0400 Subject: [PATCH 11/11] Update 32-sma-setup.bash --- root/etc/cont-init.d/32-sma-setup.bash | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/root/etc/cont-init.d/32-sma-setup.bash b/root/etc/cont-init.d/32-sma-setup.bash index 146ce72..f5b03a9 100644 --- a/root/etc/cont-init.d/32-sma-setup.bash +++ b/root/etc/cont-init.d/32-sma-setup.bash @@ -1,8 +1,8 @@ #!/usr/bin/with-contenv bash # Remove exisitng -if [ -d "/config/scripts/sma" ]; then - rm -rf "/config/scripts/sma" && \ +if [ -d "/config/scripts/logs" ]; then + rm -rf "/config/scripts/logs" && \ sleep 0.1 fi @@ -12,25 +12,24 @@ if [ -d "/usr/local/sma/config" ]; then fi # create config directory -if [ ! -d "/config/scripts/sma" ]; then - mkdir -p "/config/scripts/sma" && \ - chmod 0777 -R "/config/scripts/sma" +if [ ! -d "/config/scripts/logs" ]; then + mkdir -p "/config/scripts/logs" && \ + chmod 0777 -R "/config/scripts/logs" fi - # import new config, if does not exist if [ ! -f "/config/sma/autoProcess.ini" ]; then cp "/usr/local/sma/setup/autoProcess.ini.sample" "/usr/local/sma/config/autoProcess.ini" fi # create sma log file -touch "/config/scripts/sma/sma.log" && \ +touch "/config/scripts/logs/sma.log" && \ # link sma log file -ln -s "/config/scripts/sma/sma.log" "/usr/local/sma/config/sma.log" && \ +ln -s "/config/scripts/logs/sma.log" "/usr/local/sma/config/sma.log" && \ # set permissions -chmod 0666 "/config/scripts/sma"/* +chmod 0666 "/config/scripts/logs"/* chmod 0777 -R "/usr/local/sma" chmod 0777 -R "/scripts"