mopidy / mopidy-beets

Mopidy extension for playing music from a Beets collection
https://mopidy.com/ext/beets/
MIT License
49 stars 14 forks source link

No album results in browse or search #30

Open jimydirektsaft opened 4 years ago

jimydirektsaft commented 4 years ago

I'm unsure if this is a beets or a mopidy-beets issue so I start here to report this. I tested with mopidy-mobile, iris and python = 3.7.3 for mopidy python = 3.8.2 for beets mopidy = 3.0.2 beets = 1.4.9 Mopidy-Beets installed with pip

For testing I have one album in the beets library which I can successfully search for in beets cli and in beets web.

The issue: If I browse the beets library with mopidy-mobile or iris by "Albums by Artist" I get the album artist but no album. I get no errors or warnings in mopidy. beets logs:

beets          | 172.16.253.1 - - [26/Aug/2020 13:24:30] "GET /album/query/albumartist:Zola%20Jesus/albumartist::%5EZola%5C%20Jesus%24/original_year%2B/year%2B/album%2B HTTP/1.1" 308 -
beets          | 172.16.253.1 - - [26/Aug/2020 13:24:30] "GET /album/query/albumartist:Zola%20Jesus%2Calbumartist::%5EZola%5C%20Jesus%24%2Coriginal_year+%2Cyear+%2Calbum+ HTTP/1.1" 200 -

If I browse "Albums by Genre" in mopidy-mobile I get the genre but no album. The logs:

mopidy         | INFO     2020-08-26 11:34:15,605 [1:BeetsBackend-16] mopidy_beets.client                                                                      
mopidy         |   Beets - invalid sorting field ignore: albumartist
beets          | 172.16.253.1 - - [26/Aug/2020 13:34:15] "GET /album/query/genre:J-Pop/genre::%5EJ%5C-Pop%24/original_year%2B/year%2B/album%2B HTTP/1.1" 308 - 
beets          | 172.16.253.1 - - [26/Aug/2020 13:34:15] "GET /album/query/genre:J-Pop%2Cgenre::%5EJ%5C-Pop%24%2Coriginal_year+%2Cyear+%2Calbum+ HTTP/1.1" 200 -

Browsing beets "Albums by Year" mopidy logs:

mopidy         |   BeetsBackend backend caused an exception.                                                                                                    
mopidy         | Traceback (most recent call last):                                                                                                             
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/core/library.py", line 17, in _backend_error_handling                                    
mopidy         |     yield                                                                                                                                      
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/core/library.py", line 114, in _browse                                                   
mopidy         |     result = backend.library.browse(uri).get()                                                                                                 
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/pykka/_threading.py", line 45, in get                                                           
mopidy         |     _compat.reraise(*self._data['exc_info'])                                                                                                   
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/pykka/_compat/__init__.py", line 29, in reraise                                                 
mopidy         |     raise value                                                                                                                                
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/pykka/_actor.py", line 193, in _actor_loop                                                      
mopidy         |     response = self._handle_receive(envelope.message)                                                                                          
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/pykka/_actor.py", line 299, in _handle_receive                                                  
mopidy         |     return callee(*message.args, **message.kwargs)                                                                                             
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy_beets/library.py", line 81, in browse                                                    
mopidy         |     return browser.get_toplevel()                                                                                                              
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy_beets/browsers/albums.py", line 19, in get_toplevel                                      
mopidy         |     for key in keys                                                                                                                            
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy_beets/browsers/albums.py", line 19, in <listcomp>                                        
mopidy         |     for key in keys                                                                                                                            
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/models/__init__.py", line 78, in directory                                               
mopidy         |     return cls(**kwargs)                                                                                                                       
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/models/immutable.py", line 159, in __call__                                              
mopidy         |     instance = super().__call__(*args, **kwargs)                                                                                               
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/models/immutable.py", line 35, in __init__                                               
mopidy         |     self._set_field(key, value)                                                                                                                
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/models/immutable.py", line 188, in _set_field                                            
mopidy         |     object.__setattr__(self, name, value)                                                                                                      
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/models/fields.py", line 50, in __set__                                                   
mopidy         |     value = self.validate(value)                                                                                                               
mopidy         |   File "/usr/local/lib/python3.7/dist-packages/mopidy/models/fields.py", line 35, in validate                                                  
mopidy         |     f"Expected {self._name} to be a {self._type}, not {value!r}"                                                                               
mopidy         | TypeError: Expected name to be a <class 'str'>, not 2014

If I do a beets search for the artist in mopidy-mobile or iris I get:

beets          | 172.16.253.1 - - [26/Aug/2020 13:45:16] "GET /item/query/zola HTTP/1.1" 200 -                                                                                                                                                 
beets          | [2020-08-26 13:45:16,426] ERROR in app: Exception on /album/1 [GET]                                                                                                                                                           
beets          | Traceback (most recent call last):                                                                                                                                                                                            
beets          |   File "/usr/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app                                                                                                                                                
beets          |     ctx.push()                                                                                                                                                                                                                
beets          |   File "/usr/lib/python3.8/site-packages/flask/ctx.py", line 396, in push                                                                                                                                                     
beets          |     self.match_request()
beets          |   File "/usr/lib/python3.8/site-packages/flask/ctx.py", line 350, in match_request
beets          |     result = self.url_adapter.match(return_rule=True)
beets          |   File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 1873, in match
beets          |     rv = rule.match(path, method)
beets          |   File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 902, in match
beets          |     new_path = "|".join(self.build(result, False))
beets          |   File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 1040, in build
beets          |     return self._build(**values)
beets          |   File "<werkzeug routing>", line 1, in <builder:'/album/<idlist:ids>'>
beets          |   File "/usr/lib/python3.8/site-packages/beetsplug/web/__init__.py", line 172, in to_url
beets          |     return ','.join(value)
beets          | TypeError: sequence item 0: expected str instance, int found
beets          | 172.16.253.1 - - [26/Aug/2020 13:45:16] "GET /album/1 HTTP/1.1" 500 -
mopidy         | ERROR    2020-08-26 11:45:16,433 [1:BeetsBackend-16] mopidy_beets.client
mopidy         |   Beets - Request http://172.16.253.1:8337/album/1, failed with status code 500
mopidy         | WARNING  2020-08-26 11:45:16,435 [1:Core-20] mopidy.core.library
mopidy         |   BeetsBackend does not implement library.search() with "exact" support. Please upgrade it.
beets          | 172.16.253.1 - - [26/Aug/2020 13:45:16] "GET /item/query/album:zola HTTP/1.1" 200 -
beets          | 172.16.253.1 - - [26/Aug/2020 13:45:16] "GET /item/query/artist:zola HTTP/1.1" 200 -
beets          | [2020-08-26 13:45:16,592] ERROR in app: Exception on /album/1 [GET]
beets          | Traceback (most recent call last):
beets          |   File "/usr/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
beets          |     ctx.push()
beets          |   File "/usr/lib/python3.8/site-packages/flask/ctx.py", line 396, in push
beets          |     self.match_request()
beets          |   File "/usr/lib/python3.8/site-packages/flask/ctx.py", line 350, in match_request
beets          |     result = self.url_adapter.match(return_rule=True)
beets          |   File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 1873, in match
beets          |     rv = rule.match(path, method)
beets          |   File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 902, in match
beets          |     new_path = "|".join(self.build(result, False))
beets          |   File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 1040, in build
beets          |     return self._build(**values)
beets          |   File "<werkzeug routing>", line 1, in <builder:'/album/<idlist:ids>'>
beets          |   File "/usr/lib/python3.8/site-packages/beetsplug/web/__init__.py", line 172, in to_url
beets          |     return ','.join(value)
beets          | TypeError: sequence item 0: expected str instance, int found
beets          | 172.16.253.1 - - [26/Aug/2020 13:45:16] "GET /album/1 HTTP/1.1" 500 -
mopidy         | ERROR    2020-08-26 11:45:16,600 [1:BeetsBackend-16] mopidy_beets.client
mopidy         |   Beets - Request http://172.16.253.1:8337/album/1, failed with status code 500
mopidy         | WARNING  2020-08-26 11:45:16,601 [1:Core-20] mopidy.core.library
mopidy         |   BeetsBackend does not implement library.search() with "exact" support. Please upgrade it.
Cr1515b commented 4 years ago

Having the same issue. I tried running Nginx in front of beets as recommended and still no dice.

guikubivan commented 3 years ago

I had faced a similar issue before and just encountered it again when upgrading beets to 1.4.9. I had to go back to a previous version. I used docker image linuxserver/beets:d43d54e2-ls47, which maps to this commit on beets project which I think it's related: https://github.com/beetbox/beets/commit/d43d54e2

Latest beets version seems to have that change, but not sure why it doesn't work now. Going back to that commit works for the most part.

uroborov commented 2 years ago

similar problem here, no way to solve with the new version?

sumpfralle commented 2 years ago

I think, the problem of the original bug report was fixed in the mentioned beets commit (beetbox/beets@d43d54e2).

Another related problem (resulting in empty query results) is about to be merged soon (see beetbox/beets#4182), I guess.

Maybe someone wants to try whether the simple change in beets/beetsplug/web/__init__.py (change the comma to a slash in line 264) fixes the problem?