@@ -91,7 +91,7 @@ def followed_game_to_listitem(self, game):
9191
9292 def channel_to_listitem (self , channel ):
9393 image = channel .get (Keys .PROFILE_IMAGE_URL ) if channel .get (Keys .PROFILE_IMAGE_URL ) else Images .ICON
94- video_banner = channel . get ( Keys . OFFLINE_IMAGE_URL ) if channel .get (Keys .OFFLINE_IMAGE_URL ) else Images .FANART
94+ fanart = self . get_fanart ( channel .get (Keys .OFFLINE_IMAGE_URL ), Images .FANART )
9595 context_menu = list ()
9696 context_menu .extend (menu_items .refresh ())
9797 name = channel .get (Keys .DISPLAY_NAME ) if channel .get (Keys .DISPLAY_NAME ) else channel .get (Keys .LOGIN )
@@ -100,7 +100,7 @@ def channel_to_listitem(self, channel):
100100 return {'label' : name ,
101101 'path' : kodi .get_plugin_url ({'mode' : MODES .CHANNELVIDEOS , 'channel_id' : channel [Keys .ID ],
102102 'channel_name' : channel [Keys .LOGIN ], 'display_name' : name }),
103- 'art' : the_art ({'fanart' : video_banner , 'poster' : image , 'thumb' : image }),
103+ 'art' : the_art ({'fanart' : fanart , 'poster' : image , 'thumb' : image }),
104104 'context_menu' : context_menu ,
105105 'info' : self .get_plot_for_channel (channel )}
106106
@@ -139,6 +139,7 @@ def video_list_to_listitem(self, video):
139139 date = video .get (Keys .CREATED_AT )[:10 ] if video .get (Keys .CREATED_AT ) else ''
140140 year = video .get (Keys .CREATED_AT )[:4 ] if video .get (Keys .CREATED_AT ) else ''
141141 image = self .get_thumbnail (video .get (Keys .THUMBNAIL_URL ), Images .VIDEOTHUMB )
142+ fanart = self .get_fanart (video .get (Keys .OFFLINE_IMAGE_URL ), Images .FANART )
142143 context_menu = list ()
143144 context_menu .extend (menu_items .refresh ())
144145 display_name = to_string (video .get (Keys .USER_NAME ) if video .get (Keys .USER_NAME ) else video .get (Keys .USER_LOGIN ))
@@ -160,10 +161,10 @@ def video_list_to_listitem(self, video):
160161 'is_playable' : True ,
161162 'info' : info ,
162163 'content_type' : 'video' ,
163- 'art' : the_art ({'poster' : image , 'thumb' : image , 'icon' : image })}
164+ 'art' : the_art ({'fanart' : fanart , ' poster' : image , 'thumb' : image , 'icon' : image })}
164165
165166 def search_stream_to_listitem (self , search ):
166- video_banner = Images .FANART
167+ fanart = self . get_fanart ( search . get ( Keys . OFFLINE_IMAGE_URL ), Images .FANART )
167168 image = self .get_thumbnail (search .get (Keys .THUMBNAIL_URL ), Images .VIDEOTHUMB )
168169 if get_refresh_stamp ():
169170 image = '?timestamp=' .join ([image , quote (get_refresh_stamp ())])
@@ -193,10 +194,10 @@ def search_stream_to_listitem(self, search):
193194 'is_playable' : True ,
194195 'info' : info ,
195196 'content_type' : 'video' ,
196- 'art' : the_art ({'fanart' : video_banner , 'poster' : image , 'thumb' : image , 'icon' : image })}
197+ 'art' : the_art ({'fanart' : fanart , 'poster' : image , 'thumb' : image , 'icon' : image })}
197198
198199 def search_channel_to_listitem (self , search ):
199- video_banner = Images .FANART
200+ fanart = self . get_fanart ( search . get ( Keys . OFFLINE_IMAGE_URL ), Images .FANART )
200201 image = self .get_thumbnail (search .get (Keys .THUMBNAIL_URL ), Images .VIDEOTHUMB )
201202 if get_refresh_stamp ():
202203 image = '?timestamp=' .join ([image , quote (get_refresh_stamp ())])
@@ -218,10 +219,10 @@ def search_channel_to_listitem(self, search):
218219 'context_menu' : context_menu ,
219220 'info' : info ,
220221 'content_type' : 'video' ,
221- 'art' : the_art ({'fanart' : video_banner , 'poster' : image , 'thumb' : image , 'icon' : image })}
222+ 'art' : the_art ({'fanart' : fanart , 'poster' : image , 'thumb' : image , 'icon' : image })}
222223
223224 def stream_to_listitem (self , stream ):
224- video_banner = Images .FANART
225+ fanart = self . get_fanart ( stream . get ( Keys . OFFLINE_IMAGE_URL ), Images .FANART )
225226 preview = self .get_thumbnail (stream .get (Keys .THUMBNAIL_URL ), Images .VIDEOTHUMB )
226227 logo = Images .VIDEOTHUMB
227228 if preview and get_refresh_stamp ():
@@ -253,7 +254,7 @@ def stream_to_listitem(self, stream):
253254 'is_playable' : True ,
254255 'info' : info ,
255256 'content_type' : 'video' ,
256- 'art' : the_art ({'fanart' : video_banner , 'poster' : image , 'thumb' : image , 'icon' : image })}
257+ 'art' : the_art ({'fanart' : fanart , 'poster' : image , 'thumb' : image , 'icon' : image })}
257258
258259 def clip_to_playitem (self , clip ):
259260 # path is returned '' and must be set after
@@ -643,7 +644,18 @@ def get_boxart(boxart, default=Images.BOXART):
643644 boxart = boxart .replace ('52x72' , '{width}x{height}' ).replace ('285x380' , '{width}x{height}' )
644645
645646 if '{width}' in boxart and '{height}' in boxart :
646- thumbnail = boxart .replace ('%{width}' , '{width}' ).replace ('%{height}' , '{height}' )
647- return thumbnail .format (width = width , height = height )
647+ boxart = boxart .replace ('%{width}' , '{width}' ).replace ('%{height}' , '{height}' )
648+ return boxart .format (width = width , height = height )
648649
649650 return boxart or default
651+
652+ @staticmethod
653+ def get_fanart (fanart , default = Images .FANART ):
654+ if not fanart :
655+ return default
656+
657+ if '{width}' in fanart and '{height}' in fanart :
658+ fanart = fanart .replace ('%{width}' , '{width}' ).replace ('%{height}' , '{height}' )
659+ return fanart .format (width = '0' , height = '0' )
660+
661+ return fanart or default
0 commit comments