@@ -48,11 +48,11 @@ async def export_pictures(url, col, headers):
4848 current = json .load (open (f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json' , 'r' , encoding = 'utf-8' ))
4949 compared = compare_fingerprints (current ['data' ], data [0 ][1 ])
5050
51- if compared .__len__ () > 0 :
52- logger .info (f'<./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json> Already exists moving to .old file !' )
53- os .rename (f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json' , f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json.old' )
54- else :
55- logger .info (f'<./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json> All datas are the same !' )
51+ # if compared.__len__() > 0:
52+ # logger.info(f'<./cache/pictures/taiga_{col.get("params")["type"]}.json> Already exists moving to .old file !')
53+ # os.rename(f'./cache/pictures/taiga_{col.get("params")["type"]}.json', f'./cache/pictures/taiga_{col.get("params")["type"]}.json.old')
54+ # else:
55+ # logger.info(f'<./cache/pictures/taiga_{col.get("params")["type"]}.json> All datas are the same !')
5656
5757 with open (f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json' , 'w' , encoding = 'utf-8' ) as fichier :
5858 json .dump (
@@ -67,24 +67,24 @@ async def export_pictures(url, col, headers):
6767 )
6868 logger .info (f"{ col .get ('method' )} " )
6969
70- if os .path .exists (f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json.old' ):
71- compare_now = compare_fingerprints (
72- json .load (open (f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json.old' , 'r' , encoding = 'utf-8' ))['data' ],
73- json .load (open (f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json' , 'r' , encoding = 'utf-8' ))['data' ],
74- )
75-
76- if compare_now .__len__ () > 0 :
77- logger .info (f'<./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json> Datas are different, starting exportation...' )
78- for picture in compare_now :
79- await export_picture (url , col , headers , picture [0 ])
80- else :
81- logger .info (f'<./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json> Datas are the same, nothing to do !' )
82- else :
83- logger .info (f'<./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json> No old file found, starting exportation...' )
84- for picture in data [0 ][1 ]:
85- await export_picture (url , col , headers , picture .get ('ident' ))
70+ # if os.path.exists(f'./cache/pictures/taiga_{col.get("params")["type"]}.json.old'):
71+ # compare_now = compare_fingerprints(
72+ # json.load(open(f'./cache/pictures/taiga_{col.get("params")["type"]}.json.old', 'r', encoding='utf-8'))['data'],
73+ # json.load(open(f'./cache/pictures/taiga_{col.get("params")["type"]}.json', 'r', encoding='utf-8'))['data'],
74+ # )
75+ #
76+ # if compare_now.__len__() > 0:
77+ # logger.info(f'<./cache/pictures/taiga_{col.get("params")["type"]}.json> Datas are different, starting exportation...')
78+ # for picture in compare_now:
79+ # await export_picture(url, col, headers, picture[0])
80+ # else:
81+ # logger.info(f'<./cache/pictures/taiga_{col.get("params")["type"]}.json> Datas are the same, nothing to do !')
82+ # else:
83+ logger .info (f'<./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json> No old file found, starting exportation...' )
84+ for picture in data [0 ][1 ]:
85+ await export_picture (url , col , headers , picture .get ('ident' ))
8686
87- copy_file (f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json' , f'./cache/pictures/taiga_{ col .get ("params" )["type" ]} .json.old' )
87+ # copy_file(f'./cache/pictures/taiga_{col.get("params")["type"]}.json', f'./cache/pictures/taiga_{col.get("params")["type"]}.json.old')
8888 except requests .exceptions .HTTPError as e :
8989 logger .warning (f"Failed to insert { col .get ('method' )} : { e } \n { e .response .text } " )
9090
0 commit comments