rembo10 / headphones

Automatic music downloader for SABnzbd
GNU General Public License v3.0
3.35k stars 604 forks source link

Error post processing #3292

Closed opbillbobaggins closed 2 years ago

opbillbobaggins commented 2 years ago

I get one of 2 errors Post processing music.

  | ERROR | Error getting recommendation: musicbrainz.extra_tags not found. Not writing metadata | ERROR | Error getting recommendation: import.languages not found. Not writing metadata -- | -- | --
rembo10 commented 2 years ago

Do you have a separate beets config by any chance?

opbillbobaggins commented 2 years ago

No.

opbillbobaggins commented 2 years ago

Got this error on latest attempt to post process. Error getting recommendation: [Errno 13] Permission denied: '/home/headphones'. Not writing metadata I Fed it a flac album I created and had tagged. It was able to re-encode it to mp3 and clean up files but I saw this error. It continued on and ultimately stopped at Error getting recommendation: musicbrainz.extra_tags not found. Not writing metadata. You mentioned beets earlier. Is there a way to test if it's loaded and working? https://github.com/beetbox/beets is this what you are referring to as beets? As a reminder I'm running python 3.9.5 could this be an issue?

rembo10 commented 2 years ago

Yeah so it looks like it's trying to access the users home directory (I'm assuming you run headphones as the headphones user).... I wonder why it doesn't fail for me.... also running as headphones user, with no /home/headphones....

Yeah that's the beets.... It might be something to do with the imports again...

opbillbobaggins commented 2 years ago

yes running as headphones as headphones with no home.

Is there a way to check if its importing beets?

I had to install cherrypy to get headphones to run without cherrypy error. should I install beets?

rembo10 commented 2 years ago

I think something is up with the imports on your system, but I can't figure out what. The cherrypy lib is added to the path, and should be picked up automatically. Installing beets might fix it, but i'd love to find the underlying cause.

opbillbobaggins commented 2 years ago

What can I do on my side to help narrow it down?

rembo10 commented 2 years ago

I'm not exactly sure yet. Literally like the first line when the program runs adds the lib/ directory to the path.... But I guess other things are imported ok, so... It's very confusing. Do these errors happen every time? Like you get all of those errors? Or is it random which one it throws? If I think of anything else I'll let you know. You could try adding print(sys.path) to the top-level Headphones.py file, on line 26 (after it adds the lib/ dir to the path). We could take a look there to see if there's anything wonky.

opbillbobaggins commented 2 years ago

Error is the same every time I test post process.

I added print(sys.path) as instructed.

Here is output after status after starting service. I don't see anything in GUI log. root@Headphones:/opt/headphones# systemctl status headphones.service

Feb 13 15:22:13 Headphones systemd[1]: Starting LSB: starts instance of Headphones... Feb 13 15:22:13 Headphones headphones[2629]: * Starting Headphones Feb 13 15:22:14 Headphones headphones[2637]: /opt/headphones/lib/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release Feb 13 15:22:14 Headphones headphones[2637]: warnings.warn( Feb 13 15:22:14 Headphones headphones[2637]: ['/opt/headphones/lib/', '/opt/headphones', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages'] Feb 13 15:22:14 Headphones headphones[2629]: ...done. Feb 13 15:22:14 Headphones systemd[1]: Started LSB: starts instance of Headphones.

rembo10 commented 2 years ago

Can you try running it without LSB?

The errors were different in your 1st and 3rd messages, that's why i asked

opbillbobaggins commented 2 years ago

I stooped headphones and manually ran it from cmd line as root. Here is output from start up.

['/opt/headphones/lib/', '/opt/headphones', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages'] /opt/headphones/lib/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release warnings.warn( 13-Feb-2022 23:30:47 - INFO :: MainThread : Checking to see if the database has all tables.... 13-Feb-2022 23:30:47 - INFO :: MainThread : Retrieving latest version information from GitHub 13-Feb-2022 23:30:47 - INFO :: MainThread : Headphones is up to date 13-Feb-2022 23:30:47 - INFO :: MainThread : Starting Headphones web server on http://0.0.0.0:8181/ 13-Feb-2022 23:30:47 - INFO :: MainThread : Scheduled background task: Search for Wanted 13-Feb-2022 23:30:47 - INFO :: MainThread : Scheduled background task: Download Scan 13-Feb-2022 23:30:47 - INFO :: MainThread : Scheduled background task: Library Scan 13-Feb-2022 23:30:47 - INFO :: MainThread : Scheduled background task: MusicBrainz Update 13-Feb-2022 23:30:47 - INFO :: MainThread : Scheduled background task: Check GitHub for updates

As you can see /opt/headphones/lib/ loaded and guess what?? LOL It worked as desired got a Post-processing complete and it did everything it was supposed to do. Thoughts? Should I try changing user that the startup uses to root instead of headphones or look into a different way to set it up as a service? I looked back through my notes on this issue and I would get the "Error getting recommendation: [Errno 13] Permission denied: '/home/headphones'. Not writing metadata" The first time I tried to post process something after start up. Subsequent attempts before restart of headphones gave the " | ERROR | Error getting recommendation: musicbrainz.extra_tags not found. Not writing metadata" Is it at all possible the issue arises from headphones user not having a home directory?

rembo10 commented 2 years ago

No, don't use root. Set it up as a service without LSB. You can take a look at this system.d script for an example. I'd probably use a specific headphones user, and you'll have to change the directories to use /opt/headphones. I would do something like:

[Unit]
Description=Headphones - Automatic music downloader for SABnzbd

[Service]
ExecStart=/opt/headphones/Headphones.py --config /etc/headphones/headphones.ini --datadir /var/lib/headphones --nolaunch
User=headphones
Group=headphones

[Install]
WantedBy=multi-user.target

Or something like that

(edited to remove --daemon and the forking business. let systemd take care of it)

opbillbobaggins commented 2 years ago

Thank you for all the help. Sorry to occupy your time with an issue caused on my side.

opbillbobaggins commented 2 years ago

FYSA. I removed the service start up and recreated following your advice.The service would not start error on group with the settings you suggested. I changed the group from headphones to nogroup because headphones was not part of a group. service stated but encountered the post processing error. I deleted the headphones user and recreated it with a group. changed service start up script group back to headphones and everything worked perfectly.