66import crcmod , base64
77import hashlib
88import knesset_data
9+ import sys
910
1011
1112BASE_HASH_OBJ = hashlib .md5 ()
@@ -55,7 +56,7 @@ def process_row(row, row_index, resource_descriptor, resource_index, parameters,
5556 and (row ["FilePath" ].lower ().endswith ('.doc' ) or row ["FilePath" ].lower ().endswith ('.docx' ))):
5657 document_id = "{}-{}-{}" .format (row ["GroupTypeID" ], row ["DocumentCommitteeSessionID" ], row ["ApplicationDesc" ])
5758 original_filename , ext , output_filename , full_output_filename , download_filename , full_output_hash_filename = get_filenames (row , parameters )
58- if os .path .exists (download_filename ) and row .get ('download_crc32c' ):
59+ if os .path .exists (download_filename ) and row .get ('download_crc32c' ) and os . path . getsize ( download_filename ) > 0 :
5960 m = BASE_HASH_OBJ .copy ()
6061 m .update (row ['download_crc32c' ].encode ())
6162 new_cache_hash = m .hexdigest ()
@@ -74,6 +75,7 @@ def process_row(row, row_index, resource_descriptor, resource_index, parameters,
7475 row [t + "_error" ] = 'reached files-limit, skipping'
7576 stats [t + ": skipped files" ] += 1
7677 else :
78+ print (f'parse_meeting_protocols({ t } ): { row_index } old_cache_hash={ old_cache_hash } new_cache_hash={ new_cache_hash } { row } ' , file = sys .stderr )
7779 error_string = None
7880 try :
7981 with open (download_filename , "rb" ) as f :
@@ -106,6 +108,7 @@ def process_row(row, row_index, resource_descriptor, resource_index, parameters,
106108 stats [t + ": parsed files" ] += 1
107109 with open (full_output_hash_filename , 'w' ) as f :
108110 f .write (new_cache_hash )
111+ print (f'parse_meeting_protocols({ t } ): done { row_index } { row } ' , file = sys .stderr )
109112 else :
110113 row [t + "_error" ] = 'missing download file'
111114 stats [t + ': missing download files' ] += 1
0 commit comments