Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoneType object has no attribute artists #7

Closed
mybuntu-git2 opened this issue Dec 28, 2022 · 5 comments
Closed

NoneType object has no attribute artists #7

mybuntu-git2 opened this issue Dec 28, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@mybuntu-git2
Copy link

mybuntu-git2 commented Dec 28, 2022

hi, I got a similar error to #4

(...)
  File "/usr/local/lib/python3.10/dist-packages/beetsplug/beatport4.py", line 600, in _get_album_info
    va = len(release.artists) > 3
AttributeError: 'NoneType' object has no attribute 'artists'

my beets setup is set to tag from scratch, and I move the 'artists' tag to 'artist' if that is not present, then I wipe 'artists' because the subsonic api reads artists first then artist if it is empty, which is kinda annoying as sometimes 'artists' is kind of unrelated to 'artist' which is usually the right one.
my preference would be, if some critical info is missing for beatport api to run, do not run it without crashing, but also have the artists-> artist fallback.

@Samik081
Copy link
Owner

Samik081 commented Jan 4, 2023

Hey @mybuntu-git2, thank you for spotting this one!

Could you please provide me some of these, so I can reproduce the issue and make sure I'll have it fixed?

  • the deeper stack trace of an error
  • the beet import command you are using
  • related debug log starting with beatport4: (in such case, please remember to erase your credentials from the logs if present, before posting it)
    • debug level logs can be seen by adding -vv to the command beet -vv import ...

@Samik081 Samik081 added the bug Something isn't working label Jan 10, 2023
@JOJ0
Copy link
Contributor

JOJ0 commented Jan 12, 2023

Hi @Samik081, sorry for crashing in. I can confirm this bug, I came across it a few times during the last days.
Here's a longer output including import command. Don't mind the debug print statements on the very top. They are there because I'm investigating something else, they might even help here or at least don't hurt, so I left them there:

beet import "/remote/data/music-library/DrumnbassJungleDrumfunk/0-Single-Tracks/Calibre - 0 - Inflicted _ Always - Always.mp3"

This is criteria
{'artist': 'calibre',
 'label': 'creative source',
 'release': 'inflicted / always',
 'tracks': '1'}

We were called from:
album_candidates
extra_tags is
{'label': 'Creative Source', 'catalognum': ''}
Traceback (most recent call last):
  File "/home/jojo/.pyenv/versions/beets/bin/beet", line 33, in <module>
    sys.exit(load_entry_point('beets', 'console_scripts', 'beet')())
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1304, in main
    _raw_main(args)
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1291, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/jojo/git/beets/beets/ui/commands.py", line 1034, in import_func
    import_files(lib, paths, query)
  File "/home/jojo/git/beets/beets/ui/commands.py", line 974, in import_files
    session.run()
  File "/home/jojo/git/beets/beets/importer.py", line 340, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/jojo/git/beets/beets/util/pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/home/jojo/git/beets/beets/util/pipeline.py", line 311, in run
    out = self.coro.send(msg)
  File "/home/jojo/git/beets/beets/util/pipeline.py", line 193, in coro
    func(*(args + (task,)))
  File "/home/jojo/git/beets/beets/importer.py", line 1408, in lookup_candidates
    task.lookup_candidates()
  File "/home/jojo/git/beets/beets/importer.py", line 661, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "/home/jojo/git/beets/beets/autotag/match.py", line 461, in tag_album
    for matched_candidate in hooks.album_candidates(items,
  File "/home/jojo/git/beets/beets/plugins.py", line 573, in decorated
    for v in generator(*args, **kwargs):
  File "/home/jojo/git/beets/beets/autotag/hooks.py", line 632, in album_candidates
    yield from plugins.candidates(items, artist, album, va_likely, extra_tags)
  File "/home/jojo/git/beets/beets/plugins.py", line 384, in candidates
    yield from plugin.candidates(items, artist, album, va_likely,
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 537, in candidates
    return self._get_releases(query)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 593, in _get_releases
    albums = [self._get_album_info(x)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 593, in <listcomp>
    albums = [self._get_album_info(x)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 600, in _get_album_info
    va = len(release.artists) > 3
AttributeError: 'NoneType' object has no attribute 'artists'

Does that help already? I can try tagging the same file and adding -vv if you want. HTH

@Samik081
Copy link
Owner

@JOJ0 thank you for the stack trace, it was all I needed. :) Seems like Beatport API returns 403 for some releases, even though they present them in the /catalog/search result. This issue should be fixed by 76458c9, already in v0.2.10

@JOJ0
Copy link
Contributor

JOJ0 commented Jan 12, 2023

Awesome! That was quick! Thanks!

@mybuntu-git2
Copy link
Author

Thanks! really sorry for not providing the information myself, I lost track of this issue. I confirm that after updating best port with pip, the same files get correctly processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants