2020from __future__ import unicode_literals
2121from enum import Enum
2222
23- IMG_URL = "http ://images.osl.wimpmusic. com/im/im?w={ width}&h= {height}&{id_type}={id} "
23+ IMG_URL = "https ://resources.tidal. com/images/{uuid}/{ width}x {height}.jpg "
2424
2525
2626class Model (object ):
2727 id = None
2828 name = None
29+ img_uuid = None
2930
3031 def __init__ (self , ** kwargs ):
3132 self .__dict__ .update (kwargs )
@@ -40,7 +41,8 @@ class Album(Model):
4041
4142 @property
4243 def image (self , width = 1280 , height = 1280 ):
43- return IMG_URL .format (width = width , height = height , id = self .id , id_type = 'albumid' )
44+ uuid = self .img_uuid .replace ('-' , '/' )
45+ return IMG_URL .format (uuid = uuid , width = width , height = height )
4446
4547 def picture (self , width , height ):
4648 """
@@ -51,31 +53,34 @@ def picture(self, width, height):
5153 :param height: pixel height, maximum 2000
5254 :type height: int
5355
54- Original sizes: 80x80, 160x160, 320x320, 640x640 and 1280x1280
56+ Accepted sizes: 80x80, 160x160, 320x320, 640x640 and 1280x1280
5557 """
56- return IMG_URL .format (width = width , height = height , id = self .id , id_type = 'albumid' )
58+ uuid = self .img_uuid .replace ('-' , '/' )
59+ return IMG_URL .format (uuid = uuid , width = width , height = height )
5760
5861
5962class Artist (Model ):
6063 roles = []
6164 role = None
6265
6366 @property
64- def image (self , width = 1280 , height = 1280 ):
65- return IMG_URL .format (width = width , height = height , id = self .id , id_type = 'artistid' )
67+ def image (self , width = 750 , height = 750 ):
68+ uuid = self .img_uuid .replace ('-' , '/' )
69+ return IMG_URL .format (uuid = uuid , width = width , height = height )
6670
6771 def picture (self , width , height ):
6872 """
6973 A url to an artist picture
7074
71- :param width: pixel width, maximum 2000
75+ :param width: pixel width, maximum 750
7276 :type width: int
73- :param height: pixel height, maximum 2000
77+ :param height: pixel height, maximum 750
7478 :type height: int
7579
76- Original sizes: 80x80, 160x160, 320x320, 480x480, 640x640, 1280x1280
80+ Accepted sizes: 80x80, 160x160, 320x320, 480x480, 750x750
7781 """
78- return IMG_URL .format (width = width , height = height , id = self .id , id_type = 'artistid' )
82+ uuid = self .img_uuid .replace ('-' , '/' )
83+ return IMG_URL .format (uuid = uuid , width = width , height = height )
7984
8085
8186class Playlist (Model ):
@@ -90,21 +95,23 @@ class Playlist(Model):
9095
9196 @property
9297 def image (self , width = 1080 , height = 1080 ):
93- return IMG_URL .format (width = width , height = height , id = self .id , id_type = 'uuid' )
98+ uuid = self .img_uuid .replace ('-' , '/' )
99+ return IMG_URL .format (uuid = uuid , width = width , height = height )
94100
95101 def picture (self , width , height ):
96102 """
97103 A url to a playlist picture
98104
99- :param width: pixel width, maximum 2000
105+ :param width: pixel width, maximum 1080
100106 :type width: int
101- :param height: pixel height, maximum 2000
107+ :param height: pixel height, maximum 1080
102108 :type height: int
103109
104- Original sizes: 160x160, 320x320, 480x480, 640x640, 750x750, 1080x1080
110+ Accepted sizes: 160x160, 320x320, 480x480, 640x640, 750x750, 1080x1080
105111
106112 """
107- return IMG_URL .format (width = width , height = height , id = self .id , id_type = 'uuid' )
113+ uuid = self .img_uuid .replace ('-' , '/' )
114+ return IMG_URL .format (uuid = uuid , width = width , height = height )
108115
109116
110117class Media (Model ):
0 commit comments