@@ -41,7 +41,38 @@ def parse_data(data, max, base_url, token, identifier, section_key, images_base_
4141
4242 if not item .get ("addedAt" , None ):
4343 continue
44+ data_output = {}
4445
46+ data_output ["airdate" ] = datetime .utcfromtimestamp (int (item .get ("addedAt" , 0 ))).strftime ('%Y-%m-%dT%H:%M:%SZ' )
47+ data_output ["title" ] = item .get ("grandparentTitle" , item .get ("parentTitle" , item .get ("title" , "" )))
48+ data_output ["release" ] = '$day, $date $time'
49+ if item .get ("title" , None ):
50+ data_output ["episode" ] = item ["title" ]
51+ else :
52+ data_output ["episode" ] = ''
53+ if item .get ("parentIndex" , None ) and item .get ("index" , None ):
54+ data_output ["number" ] = f'S{ "{:0>2}" .format (item .get ("parentIndex" , "1" ))} E{ "{:0>2}" .format (item .get ("index" , "1" ))} '
55+ else :
56+ data_output ["number" ] = ''
57+ if item .get ("parentIndex" , None ):
58+ data_output ["season_num" ] = item ["parentIndex" ]
59+ if item .get ("index" , None ):
60+ data_output ["episode_num" ] = item ["index" ]
61+ data_output ["genres" ] = ", " .join ([genre ['tag' ] for genre in item .get ('Genre' , [])][:3 ])
62+ data_output ["rating" ] = ('\N{BLACK STAR} ' + str (item .get ("rating" ))) if int (float (item .get ("rating" , 0 ))) > 0 else ''
63+ data_output ["studio" ] = item .get ("studio" , "" )
64+ data_output ["aired" ] = date
65+ if int (item .get ('duration' , 0 )) > 0 :
66+ data_output ["runtime" ] = math .floor (int (item ["duration" ]) / 60000 )
67+ data_output ["poster" ] = (f'{ images_base_url } ?path={ thumb } ' ) if thumb else ""
68+ data_output ["fanart" ] = (f'{ images_base_url } ?path={ art } ' ) if art else ""
69+ data_output ["flag" ] = "viewCount" not in item
70+ data_output ["deep_link" ] = deep_link if identifier else None
71+
72+
73+
74+
75+ """
4576 output.append(
4677 {
4778 "airdate": datetime.utcfromtimestamp(int(item.get("addedAt", 0))).strftime('%Y-%m-%dT%H:%M:%SZ'),
@@ -63,6 +94,9 @@ def parse_data(data, max, base_url, token, identifier, section_key, images_base_
6394 "deep_link": deep_link if identifier else None
6495 }
6596 )
97+ """
98+
99+ output .append (data_output )
66100
67101 return output
68102
0 commit comments