@@ -19,8 +19,17 @@ def parse_library(root):
1919
2020 return output
2121
22- import logging
23- _LOGGER = logging .getLogger (__name__ )
22+ def extract_metadata_and_type (path ):
23+ pattern = re .compile (r"/library/metadata/(\d+)/(thumb|art)/(\d+)" )
24+ match = pattern .search (path )
25+
26+ if match :
27+ metadata_id = match .group (1 )
28+ art_type = match .group (2 )
29+ art_id = match .group (3 )
30+ return metadata_id , art_type , art_id
31+
32+ return None
2433
2534def parse_data (data , max , base_url , token , identifier , section_key , images_base_url , is_all = False ):
2635 if is_all :
@@ -71,24 +80,12 @@ def parse_data(data, max, base_url, token, identifier, section_key, images_base_
7180 data_output ["rating" ] = ('\N{BLACK STAR} ' + str (item .get ("rating" ))) if int (float (item .get ("rating" , 0 ))) > 0 else ''
7281 data_output ['summary' ] = item .get ('summary' , '' )
7382 data_output ['trailer' ] = item .get ('trailer' )
74- data_output ["poster" ] = (f'{ images_base_url } ?path={ thumb } ' ) if thumb else ""
75- data_output ["fanart" ] = (f'{ images_base_url } ?path={ art } ' ) if art else ""
83+ thumb_IDs = extract_metadata_and_type (thumb )
84+ data_output ["poster" ] = (f'{ images_base_url } ?metadata={ thumb_IDs [0 ]} &thumb={ thumb_IDs [2 ]} ' ) if thumb_IDs else ""
85+ art_IDs = extract_metadata_and_type (art )
86+ data_output ["fanart" ] = (f'{ images_base_url } ?metadata={ art_IDs [0 ]} &art={ art_IDs [2 ]} ' ) if art_IDs else ""
7687 data_output ["deep_link" ] = deep_link if identifier else None
7788
78- _LOGGER .warn ({
79- "fanart" : {
80- "self" : (f'{ images_base_url } ?path={ item .get ("art" , None )} ' ) if item .get ("art" , None ) else "" ,
81- "grandparent" : (f'{ images_base_url } ?path={ item .get ("grandparentArt" , None )} ' ) if item .get ("grandparentArt" , None ) else "" ,
82- "current" : (f'{ images_base_url } ?path={ art } ' ) if art else ""
83- },
84- "poster" : {
85- "self" : (f'{ images_base_url } ?path={ item .get ("thumb" , None )} ' ) if item .get ("thumb" , None ) else "" ,
86- "parent" : (f'{ images_base_url } ?path={ item .get ("parentThumb" , None )} ' ) if item .get ("parentThumb" , None ) else "" ,
87- "grandparent" : (f'{ images_base_url } ?path={ item .get ("grandparentThumb" , None )} ' ) if item .get ("grandparentThumb" , None ) else "" ,
88- "current" : (f'{ images_base_url } ?path={ thumb } ' ) if thumb else ""
89- }
90- })
91-
9289 output .append (data_output )
9390
9491 return output
0 commit comments