Repository: beetbox/beets

Issue:
discogs: TypeError whenever artist and title are empty
<!--
Describe your problem, feature request, or discussion topic here.

Please fill out this and the "Setup" section below and remember to include
enough detail so that other people can reproduce the problem.
-->

### Problem

Running this command in verbose (`-vv`) mode:

```sh
$ eet -v import -s /mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/musikregal/new-downloads
```

Led to this problem:

```
beet -v import -s /mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/musikregal/new-downloads                                1
user configuration: /home/fhchl/.config/beets/config.yaml
data directory: /home/fhchl/.config/beets
plugin paths: /home/fhchl/.local/lib/python3.8/site-packages/beetsplug
fetchart: google: Disabling art source due to missing key
fetchart: lastfm: Disabling art source due to missing key
Sending event: pluginload
library database: /mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/beets.db
library directory: /mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/musikregal/beets
Sending event: library_opened
Sending event: import_begin
Import of the directory:
/mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/musikregal/new-downloads
was interrupted. Resume (Y/n)? n
Sending event: import_task_created
...
Sending event: import_task_created
Looking up: /mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/musikregal/new-downloads/Barato Total - Gal Costa-mzTeBoCJ6JM.mp3
Item search terms:  - 
bandcamp: Searching ts for  using {'query': '', 'artist': '', 'label': '', 'search_type': 't'}
discogs: Skipping Discogs query. File missing artist and title tags.
Traceback (most recent call last):
  File "/home/fhchl/.local/bin/beet", line 8, in <module>
    sys.exit(main())
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/ui/__init__.py", line 1862, in main
    _raw_main(args)
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/ui/__init__.py", line 1849, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/ui/commands.py", line 1384, in import_func
    import_files(lib, paths, query)
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/ui/commands.py", line 1315, in import_files
    session.run()
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/importer.py", line 360, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/util/pipeline.py", line 447, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/util/pipeline.py", line 195, in coro
    func(*(args + (task,)))
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/importer.py", line 1497, in lookup_candidates
    task.lookup_candidates()
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/importer.py", line 1008, in lookup_candidates
    prop = autotag.tag_item(self.item, search_ids=self.search_ids)
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/autotag/match.py", line 611, in tag_item
    for track_info in hooks.item_candidates(item, search_artist, search_title):
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/plugins.py", line 579, in decorated
    for v in generator(*args, **kwargs):
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/autotag/hooks.py", line 771, in item_candidates
    yield from plugins.item_candidates(item, artist, title)
  File "/home/fhchl/.local/lib/python3.8/site-packages/beets/plugins.py", line 398, in item_candidates
    yield from plugin.item_candidates(item, artist, title)
TypeError: 'NoneType' object is not iterable

```
Whenever both title and artist strings are empty, [this method](https://github.com/beetbox/beets/blob/9055abdba27e3c7f5d75b011984d13f2bf6331aa/beetsplug/discogs.py#L236) returns None, instead of an empty list, triggering the error.

### Setup

* OS: Ubuntu 20.04
* Python version: 3.8
* beets version: master branch
* Turning off plugins made problem go away (yes/no):  yes, discogs plugin

<!--
You can turn off plugins temporarily by passing --plugins= on the command line:

$ beet --plugins= version
-->

My configuration (output of `beet config`) is:

```yaml
directory: /mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/musikregal/beets
library: /mnt/16b3f200-a888-42d0-bac1-4f9176ab62ae/music/beets.db

import:
  move: yes

pluginpath: 
  - ~/.local/lib/python3.8/site-packages/beetsplug
    
plugins: discogs chroma spotify fetchart embedart lastgenre # bandcamp

group_albums: yes
asciify_paths: yes

# Plugin options
lastgenre:
    fallback: ''

fetchart:
    auto: yes

chroma:
    auto: yes

embedart:
    ifemtpy: yes
    auto: yes

acoustid:
    apikey: bbhn6v8T3A

musicbrainz:
    searchlimit: 5

discogs:
    source_weight: 0.0%     
```



Discussion:

Resolving patch:
diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py
--- a/beetsplug/discogs.py
+++ b/beetsplug/discogs.py
@@ -246,13 +246,13 @@ def item_candidates(self, item, artist, title):
         :rtype: list[beets.autotag.hooks.TrackInfo]
         """
         if not self.discogs_client:
-            return
+            return []
 
         if not artist and not title:
             self._log.debug(
                 "Skipping Discogs query. File missing artist and " "title tags."
             )
-            return
+            return []
 
         query = f"{artist} {title}"
         try:


Test patch: