Closed jprenaudet closed 5 years ago
Hello,
Does it happen for all artists, or only one in particular? You could try to to go on the artist page, then Action > Update Artist Info.
It seems that the Spotify image was not fetched correctly, so refreshing the info might solve the problem.
I'll publish a fix soon to avoid crashing but log the error.
Yes it happen on all artists I tried (4/5 different : Daft Punk, Corinne, Brigitte...).
Don't know if it's relevant, but on the website, I don't have artist images display (the bio from lastfm is ok). No error from log when I'm on the website. Can't remember if it was like this with V2.1.0.
I try to update artist info, but nothing change.
I'll publish a fix soon to avoid crashing but log the error.
Ok great, thank you :)
On the website the error is catched, but not from the Subsonic API. So you don't see any error in the interface, but you should see an error in the log.
What is surprising is that refreshing the info doesn't solve the issue. I'll also have a look to log the request done to Spotify so I can reproduce the problem on my side, not only hide it 😊
By the way, can you check if there is some error reported in the log when you update the artist info? I realized there are already a couple of things logged in case of error, so it might be helpful.
Thanks
Here as the log when I update artist info:
No log/error are display
Aug 19 11:24:10 audio odoo-bin[31932]: 2019-08-19 09:24:10,799 31932 INFO koozicDB werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:10] "POST /web/action/load HTTP/1.0" 200 - 13 0.014 0.018
Aug 19 11:24:10 audio odoo-bin[31932]: 2019-08-19 09:24:10,881 31932 DEBUG koozicDB odoo.modules.registry: Multiprocess signaling check: [Registry - 1 -> 1] [Cache - 8 -> 8]
Aug 19 11:24:13 audio odoo-bin[31932]: 2019-08-19 09:24:13,952 31932 INFO ? werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:13] "GET /web/static/src/img/spin.png HTTP/1.0" 200 - - - -
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,040 31932 INFO koozicDB odoo.addons.oomusic.models.oomusic_spotify: Error while fetching URL 'b'https://api.spotify.com/v1/search?type=artist&limit=1&q=Daft+Punk''
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/addons/oomusic/models/oomusic_spotify.py", line 49, in get_query
Aug 19 11:24:14 audio odoo-bin[31932]: self.env["oomusic.spotify.token"]._get_token()
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/addons/oomusic/models/oomusic_spotify.py", line 141, in _get_token
Aug 19 11:24:14 audio odoo-bin[31932]: content = json.loads(res.content)
Aug 19 11:24:14 audio odoo-bin[31932]: File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
Aug 19 11:24:14 audio odoo-bin[31932]: s.__class__.__name__))
Aug 19 11:24:14 audio odoo-bin[31932]: TypeError: the JSON object must be str, not 'bytes'
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,041 31932 DEBUG koozicDB odoo.addons.oomusic.models.oomusic_artist: Retrieving image for artist Daft Punk...
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,041 31932 INFO koozicDB odoo.addons.oomusic.models.oomusic_artist: No image found for artist 'Daft Punk' (id: 145)
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/addons/oomusic/models/oomusic_artist.py", line 154, in _compute_sp_image
Aug 19 11:24:14 audio odoo-bin[31932]: item = req_json["artists"]["items"][0] if req_json["artists"]["items"] else {}
Aug 19 11:24:14 audio odoo-bin[31932]: KeyError: 'artists'
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,043 31932 INFO koozicDB werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:14] "POST /web/action/run HTTP/1.0" 200 - 17 0.029 3.135
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,128 31932 DEBUG koozicDB odoo.modules.registry: Multiprocess signaling check: [Registry - 1 -> 1] [Cache - 8 -> 8]
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,132 31932 DEBUG koozicDB odoo.api: call oomusic.artist(145,).read(['sp_image', '__last_update', 'bit_follow', 'name', 'star', 'fm_getinfo_bio', 'rating', 'tag_ids', 'album_ids', 'fm_gettoptracks_track_ids', 'track_ids', 'fm_getsimilar_artist_ids', 'bit_event_ids', 'download_ids', 'display_name'])
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,220 31932 INFO koozicDB odoo.addons.oomusic.models.oomusic_spotify: Error while fetching URL 'b'https://api.spotify.com/v1/search?type=artist&limit=1&q=Daft+Punk''
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/odoo/api.py", line 1039, in get
Aug 19 11:24:14 audio odoo-bin[31932]: value = self._data[key][field][record._ids[0]]
Aug 19 11:24:14 audio odoo-bin[31932]: KeyError: 145
Aug 19 11:24:14 audio odoo-bin[31932]: During handling of the above exception, another exception occurred:
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/odoo/fields.py", line 981, in __get__
Aug 19 11:24:14 audio odoo-bin[31932]: value = record.env.cache.get(record, self)
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/odoo/api.py", line 1041, in get
Aug 19 11:24:14 audio odoo-bin[31932]: raise CacheMiss(record, field)
Aug 19 11:24:14 audio odoo-bin[31932]: odoo.exceptions.CacheMiss: ('oomusic.artist(145,).sp_image', None)
Aug 19 11:24:14 audio odoo-bin[31932]: During handling of the above exception, another exception occurred:
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/addons/oomusic/models/oomusic_spotify.py", line 49, in get_query
Aug 19 11:24:14 audio odoo-bin[31932]: self.env["oomusic.spotify.token"]._get_token()
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/addons/oomusic/models/oomusic_spotify.py", line 141, in _get_token
Aug 19 11:24:14 audio odoo-bin[31932]: content = json.loads(res.content)
Aug 19 11:24:14 audio odoo-bin[31932]: File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
Aug 19 11:24:14 audio odoo-bin[31932]: s.__class__.__name__))
Aug 19 11:24:14 audio odoo-bin[31932]: TypeError: the JSON object must be str, not 'bytes'
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,224 31932 DEBUG koozicDB odoo.addons.oomusic.models.oomusic_artist: Retrieving image for artist Daft Punk...
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,224 31932 INFO koozicDB odoo.addons.oomusic.models.oomusic_artist: No image found for artist 'Daft Punk' (id: 145)
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/odoo/api.py", line 1039, in get
Aug 19 11:24:14 audio odoo-bin[31932]: value = self._data[key][field][record._ids[0]]
Aug 19 11:24:14 audio odoo-bin[31932]: KeyError: 145
Aug 19 11:24:14 audio odoo-bin[31932]: During handling of the above exception, another exception occurred:
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/odoo/fields.py", line 981, in __get__
Aug 19 11:24:14 audio odoo-bin[31932]: value = record.env.cache.get(record, self)
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/odoo/api.py", line 1041, in get
Aug 19 11:24:14 audio odoo-bin[31932]: raise CacheMiss(record, field)
Aug 19 11:24:14 audio odoo-bin[31932]: odoo.exceptions.CacheMiss: ('oomusic.artist(145,).sp_image', None)
Aug 19 11:24:14 audio odoo-bin[31932]: During handling of the above exception, another exception occurred:
Aug 19 11:24:14 audio odoo-bin[31932]: Traceback (most recent call last):
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/addons/oomusic/models/oomusic_artist.py", line 154, in _compute_sp_image
Aug 19 11:24:14 audio odoo-bin[31932]: item = req_json["artists"]["items"][0] if req_json["artists"]["items"] else {}
Aug 19 11:24:14 audio odoo-bin[31932]: KeyError: 'artists'
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,321 31932 INFO koozicDB werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:14] "POST /web/dataset/call_kw/oomusic.artist/read HTTP/1.0" 200 - 42 0.066 0.130
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,408 31932 DEBUG koozicDB odoo.modules.registry: Multiprocess signaling check: [Registry - 1 -> 1] [Cache - 8 -> 8]
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,411 31932 DEBUG koozicDB odoo.api: call oomusic.album(381, 376, 383, 378, 375, 382, 379, 380).read(['in_playlist', 'name', 'year', 'genre_id'])
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,422 31932 DEBUG koozicDB odoo.modules.registry: Multiprocess signaling check: [Registry - 1 -> 1] [Cache - 8 -> 8]
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,424 31932 INFO koozicDB werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:14] "POST /web/dataset/call_kw/oomusic.album/read HTTP/1.0" 200 - 5 0.007 0.011
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,427 31932 DEBUG koozicDB odoo.api: call oomusic.track(5200, 5199, 5171, 5188, 5195, 5201, 5131, 5163, 5193, 5192).read(['in_playlist', 'name', 'album_id', 'track_number'])
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,437 31932 INFO koozicDB werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:14] "POST /web/dataset/call_kw/oomusic.track/read HTTP/1.0" 200 - 5 0.005 0.013
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,524 31932 DEBUG koozicDB odoo.modules.registry: Multiprocess signaling check: [Registry - 1 -> 1] [Cache - 8 -> 8]
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,527 31932 DEBUG koozicDB odoo.api: call oomusic.track(5204, 5202, 5203, 5213, 5211, 5207, 5214, 5206, 5210, 5209, 5208, 5212, 5205, 5215, 5143, 5155, 5136, 5146, 5139, 5135, 5148, 5154, 5153, 5142, 5145, 5140, 5134, 5147, 5141, 5144, 5138, 5149, 5151, 5152, 5150, 5137, 5238, 5239, 5233, 5242, 5241, 5232, 5235, 5231, 5230, 5240, 5237, 5236, 5234, 5177, 5181, 5183, 5176, 5184, 5173, 5178, 5180, 5185, 5186, 5174, 5175, 5182, 5172, 5179, 5126, 5129, 5128, 5132, 5124, 5133, 5130, 5125, 5131, 5127, 5225, 5219, 5226, 5223, 5229, 5228, 5218, 5217, 5216, 5222, 5220, 5224, 5221, 5227, 5187, 5199, 5188, 5195, 5200, 5193, 5192, 5197, 5189, 5201, 5196, 5198, 5194, 5191, 5190, 5160, 5161, 5165, 5163, 5164, 5162, 5171, 5159, 5157, 5170, 5156, 5167, 5158, 5166, 5168, 5169).read(['in_playlist', 'name', 'album_id', 'track_number'])
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,549 31932 INFO koozicDB werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:14] "POST /web/dataset/call_kw/oomusic.track/read HTTP/1.0" 200 - 5 0.007 0.021
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,551 31932 DEBUG koozicDB odoo.modules.registry: Multiprocess signaling check: [Registry - 1 -> 1] [Cache - 8 -> 8]
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,555 31932 DEBUG koozicDB odoo.api: call oomusic.artist(129, 423, 427, 125, 140).read(['name'])
Aug 19 11:24:14 audio odoo-bin[31932]: 2019-08-19 09:24:14,559 31932 INFO koozicDB werkzeug: 192.168.121.101 - - [19/Aug/2019 09:24:14] "POST /web/dataset/call_kw/oomusic.artist/read HTTP/1.0" 200 - 2 0.003 0.012
I also try to wget the spotify uri, here is the log :
xxx@xxx:~$ wget https://api.spotify.com/v1/search?type=artist&limit=1&q=Daft+Punk
[1] 32359
[2] 32360
xxx@xxx:~$ --2019-08-19 11:25:22-- https://api.spotify.com/v1/search?type=artist
Resolving api.spotify.com (api.spotify.com)... 35.186.224.53
Connecting to api.spotify.com (api.spotify.com)|35.186.224.53|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Username/Password Authentication Failed.
[1]- Exit 6 wget https://api.spotify.com/v1/search?type=artist
[2]+ Done limit=1
Maybe MusicBrainz
or discogs
could be use to retreive images without the need of authentification.
Thanks, that was helpful.
This is the faulty part:
Aug 19 11:24:14 audio odoo-bin[31932]: File "/opt/koozic/addons/oomusic/models/oomusic_spotify.py", line 141, in _get_token
Aug 19 11:24:14 audio odoo-bin[31932]: content = json.loads(res.content)
Aug 19 11:24:14 audio odoo-bin[31932]: File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
Aug 19 11:24:14 audio odoo-bin[31932]: s.__class__.__name__))
Aug 19 11:24:14 audio odoo-bin[31932]: TypeError: the JSON object must be str, not 'bytes'
This is due to a difference between Python 3.5 and 3.6.
In 3.5:
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.loads('{}')
{}
>>> json.loads(b'{}')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
In 3.6:
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.loads('{}')
{}
>>> json.loads(b'{}')
{}
For reference: https://github.com/python/cpython/commit/b161562f72a28e83e62ec0a0a5de601e7724629f
I always test in 3.6 (Ubuntu 18.04), but not in 3.5...
The fix is quite easy to apply: https://github.com/DocMarty84/oomusic/pull/7
I'll publish a new version ASAP.
v2.2.1 released: https://github.com/DocMarty84/koozic/releases/tag/v2.2.1
Great !! That was quick, thank you :smiley:
I'll test it this afternoon.
Thank you again.
Hello,
As always, very good work with the V2.2.0 release.
Environment:
Bug: When browsing library in DSub, on artist page, there is an Artist Bio display at top of screen. With the new V2.2.0 (V2.1.0 is OK), nothing is shown and a error popup :
Server log: