mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.52k stars 202 forks source link

Post Radarr script failing #1486

Closed chrispalka closed 2 years ago

chrispalka commented 2 years ago

Hello mdhiggins, love what you've built especially with the ease of using docker.

I have an issue that I was hoping you can point me in the right direction to resolve, I'm a JS/React dev and not too familiar with linux (permissions mostly) or python. I think there is a permissions issue but not certain. I've been running manual.py in the interim to convert my HDR files using the command: /usr/local/sma/venv/bin/python3 /usr/local/sma/manual.py

My autoProcess.ini below, along with the couple errors I'm seeing in Radarr logs.

[Converter] ffmpeg = /usr/local/bin/ffmpeg ffprobe = /usr/local/bin/ffprobe threads = 0 hwaccels = hwaccel-decoders = h264_cuvid, mjpeg_cuvid, mpeg1_cuvid, mpeg2_cuvid, mpeg4_cuvid, vc1_cuvid, hevc_qsv, h264_qsv, hevc_vaapi, h264_vaapi hwdevices = vaapi:/dev/dri/renderD128 hwaccel-output-format = vaapi:vaapi output-directory = output-format = mp4 output-extension = mp4 temp-extension = minimum-size = 0 ignored-extensions = nfo, dsstore copy-to = move-to = delete-original = True sort-streams = True process-same-extensions = True bypass-if-copying-all = False force-convert = True post-process = False wait-post-process = False detailed-progress = False opts-separator = , preopts = postopts = regex-directory-replace = [^\w-. ]

[Permissions] chmod = 0644 uid = -1 gid = -1

[Metadata] relocate-moov = True full-path-guess = True tag = True tag-language = eng download-artwork = poster sanitize-disposition = strip-metadata = False keep-titles = False

[Video] codec = h264, x264 max-bitrate = 0 bitrate-ratio = crf = -1 crf-profiles = preset = codec-parameters = dynamic-parameters = False max-width = 0 profile = max-level = 0.0 pix-fmt = filter = force-filter = False

[HDR] codec = hevc pix-fmt = space = bt2020nc transfer = smpte2084 primaries = bt2020 preset = codec-parameters = filter = force-filter = False profile =

[Audio] codec = ac3 languages = default-language = first-stream-of-language = False allow-language-relax = True channel-bitrate = 128 max-bitrate = 0 max-channels = 0 prefer-more-channels = True default-more-channels = True filter = force-filter = False sample-rates = sample-format = copy-original = False copy-original-before = False aac-adtstoasc = False ignore-truehd = mp4, m4v ignored-dispositions = unique-dispositions = False stream-codec-combinations =

[Universal Audio] codec = aac channel-bitrate = 128 first-stream-only = False move-after = False filter = force-filter = False

[Audio.ChannelFilters] 6-2 = pan=stereo|FL=0.5FC+0.707FL+0.707BL+0.5LFE|FR=0.5FC+0.707FR+0.707BR+0.5LFE

[Subtitle] codec = mov_text codec-image-based = languages = default-language = first-stream-of-language = False encoding = burn-subtitles = False burn-dispositions = embed-subs = True embed-image-subs = False embed-only-internal-subs = False filename-dispositions = forced ignore-embedded-subs = False ignored-dispositions = unique-dispositions = False attachment-codec =

[Subtitle.Subliminal] download-subs = False download-hearing-impaired-subs = False providers =

[Subtitle.Subliminal.Auth] opensubtitles = tvsubtitles =

[Sonarr] host = localhost port = 8989 apikey = ssl = False webroot = force-rename = False rescan = True block-reprocess = False

[Radarr] host = 127.0.0.1 port = 7878 apikey = 3cef6c2e98d344fbb4b87b07efd10302 ssl = False webroot = force-rename = False rescan = True block-reprocess = False

[Sickbeard] host = localhost port = 8081 ssl = False apikey = webroot = username = password =

[Sickrage] host = localhost port = 8081 ssl = False apikey = webroot = username = password =

[SABNZBD] convert = True sickbeard-category = sickbeard sickrage-category = sickrage sonarr-category = sonarr radarr-category = radarr bypass-category = bypass output-directory = path-mapping =

[Deluge] sickbeard-label = sickbeard sickrage-label = sickrage sonarr-label = sonarr radarr-label = radarr bypass-label = bypass convert = True host = localhost port = 58846 username = password = output-directory = remove = False path-mapping =

[qBittorrent] sickbeard-label = sickbeard sickrage-label = sickrage sonarr-label = sonarr radarr-label = radarr bypass-label = bypass convert = True action-before = action-after = host = localhost port = 8080 ssl = False username = password = output-directory = path-mapping =

[uTorrent] sickbeard-label = sickbeard sickrage-label = sickrage sonarr-label = sonarr radarr-label = radarr bypass-label = bypass convert = True webui = False action-before = action-after = host = localhost ssl = False port = 8080 username = password = output-directory = path-mapping =

[Plex] host = 192.168.1.26 port = 32400 refresh = False token = 2kGHtad7ysqneUsxxTC

Errors I'm receiving in Radarr log:

  1. ) 2021-10-25 17:14:41.7|Error|postRadarr.py|Traceback (most recent call last): 2021-10-25 17:14:41.7|Error|postRadarr.py| File "/usr/local/sma/postRadarr.py", line 4, in 2021-10-25 17:14:41.7|Error|postRadarr.py| import requests 2021-10-25 17:14:41.7|Error|postRadarr.py|ModuleNotFoundError: No module named 'requests' 2021-10-25 17:14:41.8|Warn|RadarrErrorPipeline|Invalid request Validation failed: -- : Script exited with code: 1

2.) 2021-10-26 01:49:49.4|Info|MovieService|Assigning file [Mad.Max.Fury.Road.2015.4K.HDR.2160p.BDRip Ita Eng x265-NAHOM.mkv] to movie [[Mad Max: Fury Road (2015)][tt1392190, 76341]] 2021-10-26 01:49:52.5|Error|postRadarr.sh|Traceback (most recent call last): 2021-10-26 01:49:52.5|Error|postRadarr.sh| File "/usr/local/sma/postRadarr.py", line 163, in 2021-10-26 01:49:52.5|Error|postRadarr.sh| log = getLogger("RadarrPostProcess") 2021-10-26 01:49:52.5|Error|postRadarr.sh| File "/usr/local/sma/resources/log.py", line 128, in getLogger 2021-10-26 01:49:52.5|Error|postRadarr.sh| fileConfig(configfile, defaults={'logfilename': logfile}) 2021-10-26 01:49:52.5|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/config.py", line 79, in fileConfig 2021-10-26 01:49:52.5|Error|postRadarr.sh| handlers = _install_handlers(cp, formatters) 2021-10-26 01:49:52.5|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/config.py", line 145, in _install_handlers 2021-10-26 01:49:52.5|Error|postRadarr.sh| h = klass(*args, *kwargs) 2021-10-26 01:49:52.6|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/handlers.py", line 148, in init 2021-10-26 01:49:52.6|Error|postRadarr.sh| BaseRotatingHandler.init(self, filename, mode, encoding, delay) 2021-10-26 01:49:52.6|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/handlers.py", line 55, in init 2021-10-26 01:49:52.6|Error|postRadarr.sh| logging.FileHandler.init(self, filename, mode, encoding, delay) 2021-10-26 01:49:52.6|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/init.py", line 1147, in init 2021-10-26 01:49:52.6|Error|postRadarr.sh| StreamHandler.init(self, self._open()) 2021-10-26 01:49:52.6|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/init.py", line 1176, in _open 2021-10-26 01:49:52.6|Error|postRadarr.sh| return open(self.baseFilename, self.mode, encoding=self.encoding) 2021-10-26 01:49:52.6|Error|postRadarr.sh|PermissionError: [Errno 13] Permission denied: '/usr/local/sma/config/sma.log' 2021-10-26 02:25:16.8|Error|postRadarr.sh|Traceback (most recent call last): 2021-10-26 02:25:16.8|Error|postRadarr.sh| File "/usr/local/sma/postRadarr.py", line 163, in 2021-10-26 02:25:16.8|Error|postRadarr.sh| log = getLogger("RadarrPostProcess") 2021-10-26 02:25:16.9|Error|postRadarr.sh| File "/usr/local/sma/resources/log.py", line 128, in getLogger 2021-10-26 02:25:16.9|Error|postRadarr.sh| fileConfig(configfile, defaults={'logfilename': logfile}) 2021-10-26 02:25:16.9|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/config.py", line 79, in fileConfig 2021-10-26 02:25:16.9|Error|postRadarr.sh| handlers = _install_handlers(cp, formatters) 2021-10-26 02:25:16.9|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/config.py", line 145, in _install_handlers 2021-10-26 02:25:16.9|Error|postRadarr.sh| h = klass(args, **kwargs) 2021-10-26 02:25:16.9|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/handlers.py", line 148, in init 2021-10-26 02:25:16.9|Error|postRadarr.sh| BaseRotatingHandler.init(self, filename, mode, encoding, delay) 2021-10-26 02:25:16.9|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/handlers.py", line 55, in init 2021-10-26 02:25:16.9|Error|postRadarr.sh| logging.FileHandler.init(self, filename, mode, encoding, delay) 2021-10-26 02:25:16.9|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/init.py", line 1147, in init 2021-10-26 02:25:16.9|Error|postRadarr.sh| StreamHandler.init(self, self._open()) 2021-10-26 02:25:16.9|Error|postRadarr.sh| File "/usr/lib/python3.8/logging/init.py", line 1176, in _open 2021-10-26 02:25:16.9|Error|postRadarr.sh| return open(self.baseFilename, self.mode, encoding=self.encoding) 2021-10-26 02:25:16.9|Error|postRadarr.sh|PermissionError: [Errno 13] Permission denied: '/usr/local/sma/config/sma.log' 2021-10-26 02:25:17.0|Warn|RadarrErrorPipeline|Invalid request Validation failed: -- : Script exited with code: 1

mdhiggins commented 2 years ago

Looks like you just need to fix permissions on your config folder / sma.log

-rwxrwxr-x 1 dockeruser dockeruser   4655 Oct 21 04:22 autoProcess.ini
-rw-r--r-- 1 dockeruser dockeruser      0 Aug 22 01:03 __init__.py
-rw-r--r-- 1 dockeruser dockeruser   1202 Mar  7  2021 logging.ini
drwxr-xr-x 2 dockeruser dockeruser   4096 Aug 24 10:50 __pycache__
-rw-r--r-- 1 dockeruser dockeruser 769659 Oct 29 01:02 sma.log
-rw-r--r-- 1 dockeruser dockeruser 999842 Oct 15 17:08 sma.log.1
-rw-r--r-- 1 dockeruser dockeruser 999933 Oct 15 16:47 sma.log.2
-rw-r--r-- 1 dockeruser dockeruser 999862 Oct 15 16:23 sma.log.3

That's what mine looks like, with dockeruser's GID and UID being set to the PGID and PUID environment variables for the container

Volumes look like this

    volumes:
      - /opt/appdata/sonarr:/config
      - /opt/appdata/sma:/usr/local/sma/config

Edit: The directory you're mounting for your config folder should also have the same permissions as the files above (in my case, /opt/appdata/sma)

chrispalka commented 2 years ago

Ok my permission game is weak, but this is what I have now (matched the permissions for sma.log to the same as the other files in the directory)

-rwxrwxr-x 1 pi pi 4207 Oct 30 18:01 autoProcess.ini -rwxrwxr-x 1 pi pi 1209 Oct 25 13:28 logging.ini -rw-r--r-- 1 pi pi 68085 Oct 30 21:14 sma.log -rwxrwxr-x 1 pi pi 97980 Oct 29 01:27 sma.log.1

And these are the permissions on the folder

drwxr-xr-x 7 pi pi 4096 Oct 25 13:17 radarr drwxrwxr-x 2 pi pi 4096 Oct 30 18:01 sma

mdhiggins commented 2 years ago

Now you need to make sure that your UID and GID for that pi user and pi group match what you're passing as your PUID and PGID environment variables to the container

id ps should show you

Mine shows

id dockeruser
uid=1001(dockeruser) gid=1001(dockeruser) groups=1001(dockeruser)

And so I set both values to 1001

mdhiggins commented 2 years ago

You'll also need to rebuild / up the container after you make those environment changes

chrispalka commented 2 years ago

Thank you! Is there a difference between 1000 and 1001?

My pi user:

uid=1000(pi) gid=1000(pi) groups=1000(pi)

My env variables for the container are both 1000 and match the above pi user as well

radarr: image: mdhiggins/radarr-sma container_name: radarr environment:

mdhiggins commented 2 years ago

Hm nah no difference between 1001 and 1000, just an identifier that needs to match the docker config which looks like yours does

Your SMA.log file does seem to have less permissions compared to your 2nd sma.log.1 file though given its owned by pi so it should be ok, but you could try relaxing the permissions a little since it's presumably still not working and maybe the group needs write permission which it currently does not have

-rw-r--r-- 1 pi pi 68085 Oct 30 21:14 sma.log
-rwxrwxr-x 1 pi pi 97980 Oct 29 01:27 sma.log.1

chmod -R 0664 /opt/appdata/sma should recursively set everything in the directory and make them all the same and add write permission to the group

chrispalka commented 2 years ago

hmm doing so doesn't allow me to navigate into the folder anymore, sorry I suck with permissions. Thanks again for your help.

pi@raspberrypi:/opt/appdata $ cd sma/ -bash: cd: sma/: Permission denied

mdhiggins commented 2 years ago

What's the ls -l of your /opt/appdata directory look like

chrispalka commented 2 years ago

This is in /opt:

drwxrwxrwx 4 root root 4096 Oct 25 12:59 appdata drwx--x--x 4 root root 4096 Oct 25 12:58 containerd

this is in /opt/appdata:

drwxr-xr-x 7 pi pi 4096 Oct 25 13:17 radarr drw-rw-r-- 2 pi pi 4096 Oct 30 18:01 sma

mdhiggins commented 2 years ago

Sorry I meant the contents of the appdata directory

chrispalka commented 2 years ago

sorry just edited it

mdhiggins commented 2 years ago

And you can't open that directory now? Looks like it has read permissions across the board

mdhiggins commented 2 years ago

Can try 0774 instead or 0775

chrispalka commented 2 years ago

0775 worked! Ok you think I'd be good to give the postRadarr script a shot?

mdhiggins commented 2 years ago

Yeah give it a try and let me know

chrispalka commented 2 years ago

Any easy way to test other than downloading something and seeing if it converts?

mdhiggins commented 2 years ago

You can do a "manual import" of a file you already have downloaded and that will move/rename/run script

mdhiggins commented 2 years ago

image

chrispalka commented 2 years ago

I think it worked! Thank you very much

mdhiggins commented 2 years ago

Cool gonna close this out then

chrispalka commented 2 years ago

One more thing since you were super helpful, when I run the manual.py script, for a 40gb file it takes about 10-15 minutes. Having postRadarr script run it's been converting overnight on a file that's just 6GB. You ever notice or come across that?