clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
672 stars 176 forks source link

Script exit code is 1 when transcoder is enabled #1826

Closed ictinc closed 6 months ago

ictinc commented 3 years ago

Describe the bug A clear and concise description of what the bug is. More likely user error then a bug but couldn't find a solution elsewhere. Once transcoder is enabled the postprocess in sabnzbd exits with the error "Script exit code is 1".

Technical Specs

  1. TrueNAS FreeBSD 12.1 jail
  2. Python 3.7.10
  3. Download Client SabNZBD on FreeBSD so old version (3.0.2 [51cc765])
  4. Intended Media Management, SickChill

Expected behavior Expected is to have the file transcoded to mkv, renamed and put into the correct directory as is the case when the transcoder is disabled. In autoProcessMedia.cfg for SickBeard I have set chmodDirectory = 777. However I noticed in the log below it says "0o777" which may or may not be an issue related to the permissions errors resulting in this exit code 1.

Log `fatal: not a git repository (or any of the parent directories): .git [00:39:39] [INFO]::MAIN: Loading config from [/usr/local/sabnzbd/scripts/autoProcessMedia.cfg] [00:39:39] [INFO]::MAIN: Python v3.7 will reach end of life in 806 days. [00:39:39] [INFO]::MAIN: Checking database structure... [00:39:39] [INFO]::MAIN: Checking if source needs an update [00:39:40] [INFO]::MAIN: No update needed [00:39:40] [INFO]::MAIN: nzbToMedia Version:9d64c2f47869584ebf3ca269632e1f03a461f99e Branch:master (FreeBSD 12.2-RELEASE-p3) [00:39:40] [INFO]::MAIN: ######################################################### [00:39:40] [INFO]::MAIN: ## ..::[nzbToMedia.py]::.. ## [00:39:40] [INFO]::MAIN: ######################################################### [00:39:40] [INFO]::MAIN: Script triggered from SABnzbd Version 3.0.2. [00:39:40] [INFO]::MAIN: Auto-detected SECTION:SickBeard [00:39:40] [INFO]::MAIN: Calling SickBeard:tvshows to post-process:SERIES.NAME.SEASON.EPISODE.1080p.BRAV.WEBRip.AAC2.0.x264 [00:39:40] [INFO]::MAIN: Attempting to auto-detect tvshows fork [00:39:40] [INFO]::MAIN: SickBeard:tvshows fork auto-detection found custom params {'path': None, 'force_next': None, 'return_data': None, 'force_replace': None, 'is_priority': None, 'process_method': None, 'type': None, 'delete': None, 'failed': None, 'cmd': 'postprocess', 'proc_dir': None, 'force': None} [00:39:40] [INFO]::MAIN: SickBeard:tvshows fork set to custom [00:39:40] [INFO]::MAIN: FLATTEN: Flattening directory: /mnt/media/downloads/sabnzbd/complete/tvshows/SERIES.NAME.SEASON.EPISODE.1080p.BRAV.WEBRip.AAC2.0.x264 [00:39:40] [INFO]::TRANSCODER: Checking [SERIES.NAME.SEASON.EPISODE.1080p.BRAV.WEBRip.AAC2.0.x264.mkv] for corruption, please stand by ... [00:39:40] [INFO]::TRANSCODER: SUCCESS: [SERIES.NAME.SEASON.EPISODE.1080p.BRAV.WEBRip.AAC2.0.x264.mkv] has no corruption. [00:39:40] [INFO]::MAIN: Checking for files to be transcoded [00:39:40] [INFO]::SICKBEARD: Attempting to set the octal permission of '0o777' on directory '/mnt/media/downloads/sabnzbd/complete/tvshows/SERIES.NAME.SEASON.EPISODE.1080p.BRAV.WEBRip.AAC2.0.x264' [00:39:40] [INFO]::MAIN: Changing file mode of /mnt/media/downloads/sabnzbd/complete/tvshows/SERIES.NAME.SEASON.EPISODE.1080p.BRAV.WEBRip.AAC2.0.x264 to 0o777 Changing to directory: /usr/local/sabnzbd/scripts

-- Cleaning bytecode -- WARNING: Automatic cleanup could not be executed. If errors occur, manual cleanup may be required. REASON : Error Code: 128

Directory is not a git repository

Force cleaning folder: libs Skipping required subfolders ['common', 'custom', 'py2', 'win']

Force cleaning folder: core Skipping required subfolders ['auto_process', 'extractor', 'plugins', 'utils'] Returning to directory: /usr/local/share/sabnzbdplus

-- Cleanup finished --

Traceback (most recent call last): File "/usr/local/sabnzbd/scripts/nzbToSickBeard.py", line 273, in result = nzbToMedia.main(sys.argv, section) File "/usr/local/sabnzbd/scripts/nzbToMedia.py", line 968, in main failure_link=os.environ['SAB_FAILURE_URL']) File "/usr/local/sabnzbd/scripts/nzbToMedia.py", line 853, in process result = tv.process(section_name, input_directory, input_name, status, client_agent, download_id, input_category, failure_link) File "/usr/local/sabnzbd/scripts/core/auto_process/tv.py", line 175, in process core.rchmod(dir_name, chmod_directory) File "/usr/local/sabnzbd/scripts/core/utils/paths.py", line 162, in rchmod os.chmod(path, mod) PermissionError: [Errno 1] Operation not permitted: '/mnt/media/downloads/sabnzbd/complete/tvshows/SERIES.NAME.SEASON.EPISODE.1080p.BRAV.WEBRip.AAC2.0.x264' Exception ignored in: <function PosixProcess.del at 0x8033915f0> Traceback (most recent call last): File "/usr/local/sabnzbd/scripts/core/utils/processes.py", line 95, in del AttributeError: 'NoneType' object has no attribute 'isfile'`

clinton-hall commented 3 years ago

Interestingly the only time CHMOD is applied is after successfully transcoding. So it may be easiest to set

[SickBeard]
  [[tvshows]]
    chmodDirectory = 0

i.e. disable the chmod to see if the rest of the renaming works as required.

The 0o777 should be ok, as this is converted to octal... but I would need to do some tests to confirm that is displaying correctly.