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

qBittorrent Passing labels to Python Script #1569

Closed mcaps1 closed 2 years ago

mcaps1 commented 2 years ago

Describe the bug qBittorrentPostProcess script is not recognizing the category/label of "radarr" set by Radarr.exe. However, category is being properly passed to qBittorrent.

Command or context you are trying to run Python.exe "C:\Media Server\sickbeard_mp4_automator-master\qBittorrentPostProcess.py" "%L" "%T" "%R" "%F" "%N" "%I"

autoProcess.ini settings [Converter] ffmpeg = ffmpeg.exe ffprobe = ffprobe.exe threads = 0 hwaccels = hwaccel-decoders = hwdevices = hwaccel-output-format = output-directory = output-format = mp4 output-extension = mp4 temp-extension = temp-output = False minimum-size = 0 ignored-extensions = nfo, dsstore copy-to = move-to = delete-original = True process-same-extensions = False bypass-if-copying-all = False force-convert = False 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 = prioritize-source-pix-fmt = True filter = force-filter = False

[HDR] codec = 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 variable-bitrate = 0 max-bitrate = 0 max-channels = 0 filter = profile = force-filter = False sample-rates = sample-format = copy-original = False copy-original-before = False aac-adtstoasc = False ignored-dispositions = unique-dispositions = False stream-codec-combinations =

[Audio.Sorting] sorting = language, channels.d, map, d.comment default-sorting = channels.d, map, d.comment codecs =

[Universal Audio] codec = aac channel-bitrate = 128 variable-bitrate = 0 first-stream-only = False move-after = False filter = profile = 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.Sorting] sorting = language, d.comment, d.default.d, d.forced.d codecs =

[Subtitle.CleanIt] enabled = False config-path = tags =

[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 = localhost port = 7878 apikey = *** 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 = localhost port = 32400 refresh = False token = ***

Log files 2022-04-22 17:12:10 - qBittorrentPostProcess - INFO - qBittorrent post processing started. 2022-04-22 17:12:10 - resources.readsettings - INFO - C:\Python310\python.exe 2022-04-22 17:12:10 - resources.readsettings - INFO - Loading config file C:\Media Server\sickbeard_mp4_automator-master\config\autoProcess.ini. 2022-04-22 17:12:10 - qBittorrentPostProcess - ERROR - No valid label detected. 2022-04-22 17:12:10 - qBittorrentPostProcess - ERROR - Unexpected exception. Traceback (most recent call last): File "C:\Media Server\sickbeard_mp4_automator-master\qBittorrentPostProcess.py", line 50, in sys.exit(1) SystemExit: 1

FFMpeg headers ffmpeg version N-106643-g70db14376c-20220422 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.0 (crosstool-NG 1.24.0.533_681aaef) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220422 libavutil 57. 24.101 / 57. 24.101 libavcodec 59. 26.100 / 59. 26.100 libavformat 59. 22.100 / 59. 22.100 libavdevice 59. 6.100 / 59. 6.100 libavfilter 8. 33.100 / 8. 33.100 libswscale 6. 6.100 / 6. 6.100 libswresample 4. 6.100 / 4. 6.100 libpostproc 56. 5.100 / 56. 5.100 Hyper fast Audio and Video encoder

System Information

Expected behavior Expect script to recognize label and pass on properly to Radarr Screen Shot 2022-04-22 at 5 37 44 PM Screen Shot 2022-04-22 at 5 38 39 PM

mdhiggins commented 2 years ago

Can you rerun this with debug level logging so I can see what label is being reported?

See the wiki for how to turn this on if you're unfamiliar

mcaps1 commented 2 years ago

2022-04-22 20:54:05 - qBittorrentPostProcess - INFO - qBittorrent post processing started. 2022-04-22 20:54:05 - resources.readsettings - INFO - C:\Python310\python.exe 2022-04-22 20:54:05 - resources.readsettings - DEBUG - Loading default config file. 2022-04-22 20:54:05 - resources.readsettings - INFO - Loading config file C:\Media Server\sickbeard_mp4_automator-master\config\autoProcess.ini. 2022-04-22 20:54:05 - qBittorrentPostProcess - DEBUG - Root Path: %R. 2022-04-22 20:54:05 - qBittorrentPostProcess - DEBUG - Content Path: %F. 2022-04-22 20:54:05 - qBittorrentPostProcess - DEBUG - Label: %l. 2022-04-22 20:54:05 - qBittorrentPostProcess - DEBUG - Categories: ['sickbeard', 'sonarr', 'radarr', 'sickrage', 'bypass']. 2022-04-22 20:54:05 - qBittorrentPostProcess - DEBUG - Torrent hash: %I. 2022-04-22 20:54:05 - qBittorrentPostProcess - DEBUG - Torrent name: %N. 2022-04-22 20:54:05 - qBittorrentPostProcess - ERROR - No valid label detected. 2022-04-22 20:54:05 - qBittorrentPostProcess - ERROR - Unexpected exception. Traceback (most recent call last): File "C:\Media Server\sickbeard_mp4_automator-master\qBittorrentPostProcess.py", line 50, in sys.exit(1) SystemExit: 1

mdhiggins commented 2 years ago

Hm so something is wrong with QBT. It's not substituting the variables like it should and is just passing the raw text of the variables so the script has no data to act on. You can try removing the quotes around it and see if that helps. I wonder if they changed that recommendation but previously they recommended quotation

mdhiggins commented 2 years ago

And just to confirm these logs are from an execution being called by QBT and not just manually from the command line, correct? Cause just in case you're copying that command and running it manually for some reason, those % parameters are variables that QBT will populate, they don't magically work if not run by QBT and the logs would suggest the variables aren't being population its just passing the raw text

image

mcaps1 commented 2 years ago

The log provided was from the command being ran manually using, CMD.

When QBT is running the command, nothing is populating in the logs even though I have it in the settings and a console does appear on my screen for a mere second. I have tried with the command in the QBT settings, or creating a .bat file to call the commands. Oddly enough the QBT on my computer does show that the parameters should still be encapsulated by the %

This is the log being generated by QBT when running the program WITH the command encapsulated as shown below: 4/23/2022 7:10 AM - Torrent: Uncharted.2022.1080p.WEBRip.DD5.1.x264-NOGRP, running external program, command: Python.exe "C:\Media Server\sickbeard_mp4_automator-master\qBittorrentPostProcess.py" "radarr" "" "E:\Torrents\Movies\radarr\Uncharted.2022.1080p.WEBRip.DD5.1.x264-NOGRP" "E:\Torrents\Movies\radarr\Uncharted.2022.1080p.WEBRip.DD5.1.x264-NOGRP" "Uncharted.2022.1080p.WEBRip.DD5.1.x264-NOGRP" "bdf583d90f46b5d0fff4dc708f65c7699df0c4e7"

This is the log being generated by QBT when running the command WITHOUT the encapsulated parameters: 4/23/2022 11:50 AM - Torrent: X.2022.720p.AMZN.WEBRip.DDP5.1.Atmos.x264-FLUX, running external program, command: Python.exe "C:\Media Server\sickbeard_mp4_automator-master\qBittorrentPostProcess.py" radarr E:\Torrents\Movies\radarr\X.2022.720p.AMZN.WEBRip.DDP5.1.Atmos.x264-FLUX E:\Torrents\Movies\radarr\X.2022.720p.AMZN.WEBRip.DDP5.1.Atmos.x264-FLUX X.2022.720p.AMZN.WEBRip.DDP5.1.Atmos.x264-FLUX acc2a6bda89df74ccc45630395fa53f000cbfd29

Screen Shot 2022-04-23 at 11 20 58 AM Screen Shot 2022-04-23 at 11 32 41 AM

mdhiggins commented 2 years ago

Alright so my assumption about the quotes potentially being a problem wasn't the issue, the issue with the logs provided before was the script will never work running from the command in if you don't substitute those variables for actual data

So it seems the real issue is that QBT is failing to run the program, the assumption that the label was the problem was incorrect since no label data was being provided to the script in your tests creating that error

If you run the command that QBT is outputting in the logs, does it work?

Python.exe "C:\Media Server\sickbeard_mp4_automator-master\qBittorrentPostProcess.py" "radarr" "" "E:\Torrents\Movies\radarr\Uncharted.2022.1080p.WEBRip.DD5.1.x264-NOGRP" "E:\Torrents\Movies\radarr\Uncharted.2022.1080p.WEBRip.DD5.1.x264-NOGRP" "Uncharted.2022.1080p.WEBRip.DD5.1.x264-NOGRP" "bdf583d90f46b5d0fff4dc708f65c7699df0c4e7"

Sometimes these things can be a permission problem, make sure whatever command prompt window you're testing that command with is running at the same permission level as QBT to help sort that out but if you're getting nothing in the logs that means the script isn't able to start (permission problem perhaps) or there's some high level import error which given the fact that you can get some log output running it manually makes that unlikely

Finally, when you say you tried a batch file, can you show the code of the batch file you used? And did you get any log output with the batch file or just a brief command window and empty logs

mcaps1 commented 2 years ago

So running the command that QBT had on the log worked flawless. I then tried again with the batch file running the same command as was in QBT, that did not work.

So I then proceeded to change the permissions of QBT to allow for further control of the system without needing to run as administrator, and it worked. The console opened, transcribed the parameters to Python, and I was able to see all the logs generated by the session.