clinton-hall / nzbToMedia

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

Upgraded from a very old March 2017 commit to nzbToMedia v12.1.10 - PP fails with error: terminated with unknown status #1962

Closed neil-bh closed 4 months ago

neil-bh commented 1 year ago

Describe the bug Recently I upgraded nzbToMedia to the latest v12.1.10 release (after recently realizing I was running a very old version: commit cabaa99 - Mar 12, 2017, that wasn't auto updating). I "started from fresh" and installed/setup the post processing and script according to the wiki. When post-processing starts running, it fails with "terminated with unknown status". The log shows a few things of concern that I'd like to raise below to request some assistance from the community and script authors.

Technical Specs

  1. Running on: Linux (Ubuntu 16.04.7 LTS)
  2. Python version: 3.7 (default is 2.7 but I have added an alias for 'python=python3')
  3. Download Client: NZBget
  4. Intended Media Management: Radarr and Sonarr

Expected behavior As per the previous (old) version of nzbToMedia, I expect that the the post processing activities will perform their functions as per design, then allow Radarr or Sonarr to finalize the handling of the downloaded file (such as renaming it). The log below show what looks like several errors. I'd be grateful for any advice, suggestions or next steps. Thanks.

Log

INFO    Tue Jan 31 2023 12:25:39    Collection Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN added to history
ERROR   Tue Jan 31 2023 12:25:39    Post-process-script nzbToMedia.py for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN failed (terminated with unknown status)
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Exception AttributeError: "'NoneType' object has no attribute 'path'" in <bound method PosixProcess.__del__ of <core.utils.processes.PosixProcess object at 0x7f51871d3390>> ignored
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: First error at line 86.
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: configobj.ConfigObjError: Parsing failed with several errors.
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: raise error
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/libs/common/configobj.py", line 1318, in _load
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: self._load(infile, configspec)
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/libs/common/configobj.py", line 1229, in __init__
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: super(configobj.ConfigObj, self).__init__(*args, **kw)
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/core/configuration.py", line 102, in __init__
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: cfg_new = config()
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/core/configuration.py", line 289, in addnzbget
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: CFG = config.addnzbget()
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/core/__init__.py", line 349, in configure_migration
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: configure_migration()
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/core/__init__.py", line 1027, in initialize
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: core.initialize(section)
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/nzbToMedia.py", line 743, in main
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: exit(main(sys.argv))
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: File "/diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/nzbToMedia.py", line 795, in <module>
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Traceback (most recent call last):
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: -- Cleanup finished --
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Returning to directory: /
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: No folders to clean
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: -- Cleaning folders: [u'libs', u'core'] --
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Removing eol.pyc
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Removing cleanup.pyc
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Removing eol.pyc
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Removing cleanup.pyc
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: -- Cleaning bytecode --
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: Changing to directory: /diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: [12:25:39] [ERROR]::MAIN: Unable to migrate config file /diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/autoProcessMedia.cfg, exiting ...
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: First error at line 86. when copying to .cfg
INFO    Tue Jan 31 2023 12:25:39    nzbToMedia: [12:25:39] [ERROR]::MAIN: Error Parsing failed with several errors.
INFO    Tue Jan 31 2023 12:25:37    nzbToMedia: warnings.warn("beets.mediafile is deprecated; use mediafile instead")
INFO    Tue Jan 31 2023 12:25:37    nzbToMedia: /diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/libs/common/beets/mediafile.py:19: UserWarning: beets.mediafile is deprecated; use mediafile instead
INFO    Tue Jan 31 2023 12:25:36    nzbToMedia: warnings.warn(msg, LifetimeWarning)
INFO    Tue Jan 31 2023 12:25:36    nzbToMedia: /diskpool1-raidz1/NAS/LinuxStore/nzbget/scripts/nzbToMedia/eol.py:150: LifetimeWarning: Python 2.7 is no longer supported.
INFO    Tue Jan 31 2023 12:25:36    Executing post-process-script nzbToMedia.py for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN
INFO    Tue Jan 31 2023 12:25:35    Move for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN successful
INFO    Tue Jan 31 2023 12:25:35    Moving completed files for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN
INFO    Tue Jan 31 2023 12:25:35    Cleanup for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN successful
INFO    Tue Jan 31 2023 12:25:35    Deleting file f09d8f3d3484daaa49caee59ce02e5d2.par2
INFO    Tue Jan 31 2023 12:25:35    Cleaning up Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN
INFO    Tue Jan 31 2023 12:25:35    No renamed files found for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN
INFO    Tue Jan 31 2023 12:25:35    Checking renamed files for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN
INFO    Tue Jan 31 2023 12:25:08    Unpack for Squid.Game.S01E09.One.Lucky.Day.1080p.NF.WEB-DL.DDP5.1.Atmos.x264-SKiN successful
clinton-hall commented 1 year ago

it is failing to load the .cfg file. something in this file is invalid. if you email to fock_wulf@hotmail.com I can try to load it here and see what is failing.... but I suspect there is a category or sub-category that should have a path parameter that is missing.

neil-bh commented 1 year ago

I found that my .cfg file had blank category sections, such as:

[[""]]
    apikiey = ""
    host = ""
    port = ""
    ssl = 0
    web_root = ""
    enabled = 1

I think the reason for this was because in the UI, I deleted the text that was in the category name field for all of the services that I do not use, not knowing the negative effect it'll have. I decided to directly change the blank values back to some other text (in the .cfg file) and for good measure I set these sections so that 'enabled = 0' is set too, now everything was working fine. FYI, I just named the service categories respectively, e.g Sickbeard section became 'sickbeard' (instead of blank or it's original title 'tv' and Watcher3 was labeled 'watcher3' etc.

Out of curiosity I took a look in the configuration in the UI or NZBget and it doesn't appear to reflect the manual changes I made in the .cfg file... Does directly editing the values in the .cfg override the ability to see the settings in the UI (NZBGet)?

When I returned to look at the .cfg file, I noticed my sections have reverted 'enabled' to '1'. That has just confused me. But since it's working I don't need to tinker. Although, I'm unsure which is taking precedence, the actual .cfg file, or whatever datasource is populating the UI.

Whilst i'm here, the last 2 errors (Warnings) in the logs I get is: LifetimeWarning: Python 2.7 is no longer supported. - but I have Python 3.7 installed too. Any ideas what I can/should do about this? and, UserWarning: beets.mediafile is deprecated; use mediafile instead - but I have no idea how to remediate this? Thanks.

clinton-hall commented 1 year ago

glad it is working.

With NZBGet, the NZBGet gui config takes precedence (i.e. the config in NZBGet is written into the .cfg file on run). Any category defined in the NZBGet gui will be set as active.

When using NZBget, all config shuld be done through the gui and then only edit the .cfg if there are additional/advanced features you want to use that are not in the gui config.

For Python versions. There are 2 ways to switch to 3.7...

  1. Change the default version for your system. i.e. change /usr/bin/python symlink to point to python3.7 and not python2.7 (Note that this will impact other apps as well.... but honestly, python 2.7 is pretty old now)

  2. Use NZBGet Shell override so that all .py scripts are launched by python3.7 (in EXTENSION SCRIPTS,, SHELL OVERRIDE, I think you set this as .py=/usr/bin/python3.7 or similar, using the path to your python3.7 binary.

neil-bh commented 1 year ago

Thanks @clinton-hall , I appreciate you taking the time to look at my issue.

I began to write a follow up reply, but I realised it deserves it's own issue post rather than hijacking this thread, so here is a link to my new issue for what it's worth: Issue #1964

I noticed that I cannot start fresh with nzbToMedia because somewhere my settings are being stored other than in the autoProcessMedia.cfg file. For example, if I completely delete the nzbToMedia folder and restart NZBGet, I can confirm the various .py scripts are not available in NZBGet (as you'd expect). I then proceed to clone the git for nzbToMedia, and can confirm that everything is new, even the autoProcessMedia file has the default ".cfg.spec" file extension. But when I go into NZBGet, I can see all the new .py scripts that allow you to configure, but all the settings are already pre-populated from what I had previous to me deleting it - so it's saved/cached the settings somewhere and ideally I wanted to start from fresh. Any ideas how to get a clean start? Are these settings being stored in a NZBGet db somewhere perhaps?

By the way, I used your suggestion with the SHELL OVERRIDE in order to set the .py extension to be handled by my Python v3.10 and it works, so now I have one less error. Thank you. The remaining error however is this userWarning: UserWarning: beets.mediafile is deprecated; use mediafile instead