@@ -55,11 +55,11 @@ def load_image_b64(url):
5555
5656
5757@functools .lru_cache (maxsize = 128 )
58- def make_svg (artist_name , song_name , img , is_now_playing ):
58+ def make_svg (artist_name , song_name , img , is_now_playing , cover_image ):
5959
6060 print ("make_svg" )
6161
62- height = 445
62+ height = 445 if cover_image else 145
6363 num_bar = 75
6464
6565 if is_now_playing :
@@ -79,8 +79,8 @@ def make_svg(artist_name, song_name, img, is_now_playing):
7979 "title_text" : title_text ,
8080 "artist_name" : artist_name ,
8181 "song_name" : song_name ,
82- "content_bar" : content_bar ,
8382 "img" : img ,
83+ "cover_image" : cover_image ,
8484 }
8585
8686 return render_template ("spotify.html.j2" , ** rendered_data )
@@ -100,6 +100,7 @@ def catch_all(path):
100100 global CACHE_TOKEN_INFO
101101
102102 uid = request .args .get ("uid" )
103+ cover_image = request .args .get ("cover_image" , default = 'true' ) == 'true'
103104
104105 # Load token from cache memory
105106 token_info = get_cache_token_info (uid )
@@ -165,7 +166,7 @@ def catch_all(path):
165166 artist_name = item ["artists" ][0 ]["name" ]
166167 song_name = item ["name" ]
167168
168- svg = make_svg (artist_name , song_name , img , is_now_playing )
169+ svg = make_svg (artist_name , song_name , img , is_now_playing , cover_image )
169170
170171 resp = Response (svg , mimetype = "image/svg+xml" )
171172 resp .headers ["Cache-Control" ] = "s-maxage=1"
0 commit comments