@@ -28,7 +28,7 @@ def getAlbumArt(albumid):
28
28
29
29
# CAA
30
30
logger .info ("Searching for artwork at CAA" )
31
- artwork_path = 'http ://coverartarchive.org/release-group/%s/front' % albumid
31
+ artwork_path = 'https ://coverartarchive.org/release-group/%s/front' % albumid
32
32
artwork = getartwork (artwork_path )
33
33
if artwork :
34
34
logger .info ("Artwork found at CAA" )
@@ -41,7 +41,7 @@ def getAlbumArt(albumid):
41
41
'SELECT ArtistName, AlbumTitle, ReleaseID, AlbumASIN FROM albums WHERE AlbumID=?' ,
42
42
[albumid ]).fetchone ()
43
43
if dbalbum ['AlbumASIN' ]:
44
- artwork_path = 'http ://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg' % dbalbum ['AlbumASIN' ]
44
+ artwork_path = 'https ://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg' % dbalbum ['AlbumASIN' ]
45
45
artwork = getartwork (artwork_path )
46
46
if artwork :
47
47
logger .info ("Artwork found at Amazon" )
@@ -156,12 +156,19 @@ def getartwork(artwork_path):
156
156
break
157
157
elif maxwidth and img_width > maxwidth :
158
158
# Downsize using proxy service to max width
159
- artwork_path = '{0}?{1}' .format ('http://images.weserv.nl/' , urlencode ({
160
- 'url' : artwork_path .replace ('http://' , '' ),
161
- 'w' : maxwidth ,
162
- }))
163
159
artwork = bytes ()
164
- r = request .request_response (artwork_path , timeout = 20 , stream = True , whitelist_status_code = 404 )
160
+ url = "https://images.weserv.nl"
161
+ params = {
162
+ "url" : artwork_path ,
163
+ "w" : maxwidth
164
+ }
165
+ r = request .request_response (
166
+ url ,
167
+ params = params ,
168
+ timeout = 20 ,
169
+ stream = True ,
170
+ whitelist_status_code = 404
171
+ )
165
172
if r :
166
173
for chunk in r .iter_content (chunk_size = 1024 ):
167
174
artwork += chunk
@@ -182,7 +189,7 @@ def getCachedArt(albumid):
182
189
if not artwork_path :
183
190
return
184
191
185
- if artwork_path .startswith (' http://' ):
192
+ if artwork_path .startswith (" http" ):
186
193
artwork = request .request_content (artwork_path , timeout = 20 )
187
194
188
195
if not artwork :
0 commit comments