Samik081 / beets-beatport4

Beatport API v4 compatible beets plugin
MIT License
25 stars 2 forks source link

nonetype has no attribute name #10

Closed mybuntu-git2 closed 1 year ago

mybuntu-git2 commented 1 year ago

probably another version of #7 this one happened as I was reorganising an old library of around 5k files. the main issue again, is not that it fails, but the crash itself, I would suggest that if anything that we need is missing, rather than crashing the program should skip the file with a warning like "[name of file] not processed by beatport4 because object has no attribute [name of attribute] "

Traceback (most recent call last):
 File "/usr/local/bin/beet", line 8, in <module>
   sys.exit(main())
 File "/usr/local/lib/python3.10/dist-packages/beets/ui/__init__.py", line 1285, in main
   _raw_main(args)
 File "/usr/local/lib/python3.10/dist-packages/beets/ui/__init__.py", line 1272, in _raw_main
   subcommand.func(lib, suboptions, subargs)
 File "/usr/local/lib/python3.10/dist-packages/beets/ui/commands.py", line 973, in import_func
   import_files(lib, paths, query)
 File "/usr/local/lib/python3.10/dist-packages/beets/ui/commands.py", line 943, in import_files
   session.run()
 File "/usr/local/lib/python3.10/dist-packages/beets/importer.py", line 340, in run
   pl.run_parallel(QUEUE_SIZE)
 File "/usr/local/lib/python3.10/dist-packages/beets/util/pipeline.py", line 446, in run_parallel
   raise exc_info[1].with_traceback(exc_info[2])
 File "/usr/local/lib/python3.10/dist-packages/beets/util/pipeline.py", line 311, in run
   out = self.coro.send(msg)
 File "/usr/local/lib/python3.10/dist-packages/beets/util/pipeline.py", line 193, in coro
   func(*(args + (task,)))
 File "/usr/local/lib/python3.10/dist-packages/beets/importer.py", line 1376, in lookup_candidates
   task.lookup_candidates()
 File "/usr/local/lib/python3.10/dist-packages/beets/importer.py", line 660, in lookup_candidates
   autotag.tag_album(self.items, search_ids=self.search_ids)
 File "/usr/local/lib/python3.10/dist-packages/beets/autotag/match.py", line 461, in tag_album
   for matched_candidate in hooks.album_candidates(items,
 File "/usr/local/lib/python3.10/dist-packages/beets/plugins.py", line 573, in decorated
   for v in generator(*args, **kwargs):
 File "/usr/local/lib/python3.10/dist-packages/beets/autotag/hooks.py", line 629, in album_candidates
   yield from plugins.candidates(items, artist, album, va_likely,
 File "/usr/local/lib/python3.10/dist-packages/beets/plugins.py", line 384, in candidates
   yield from plugin.candidates(items, artist, album, va_likely,
 File "/usr/local/lib/python3.10/dist-packages/beetsplug/beatport4.py", line 643, in candidates
   return self._get_releases(query)
 File "/usr/local/lib/python3.10/dist-packages/beetsplug/beatport4.py", line 699, in _get_releases
   albums = [self._get_album_info(x)
 File "/usr/local/lib/python3.10/dist-packages/beetsplug/beatport4.py", line 699, in <listcomp>
   albums = [self._get_album_info(x)
 File "/usr/local/lib/python3.10/dist-packages/beetsplug/beatport4.py", line 712, in _get_album_info
   tracks = [self._get_track_info(x) for x in release.tracks]
 File "/usr/local/lib/python3.10/dist-packages/beetsplug/beatport4.py", line 712, in <listcomp>
   tracks = [self._get_track_info(x) for x in release.tracks]
 File "/usr/local/lib/python3.10/dist-packages/beetsplug/beatport4.py", line 728, in _get_track_info
   title = track.name
AttributeError: 'NoneType' object has no attribute 'name'
Samik081 commented 1 year ago

Hey, thank you for spotting another one! :) I will take a look at this next week. You are probably right, that the crashes should not happen in such cases. I will try to cover all possible cases of this issue with better error handling.

Samik081 commented 1 year ago

Hey @mybuntu-git2, took me while, and sorry for that. This issue should be already fixed in the v0.3.3 with https://github.com/Samik081/beets-beatport4/commit/09bc72a4cb99e6301aafdbf8832ed37afee50586 and https://github.com/Samik081/beets-beatport4/commit/e63c64304325ad1f821bcd0267b549097f7bb6d8