mirror of
https://github.com/FutaGuard/LowTechFilter.git
synced 2025-06-21 05:21:02 +08:00
Prevent storing duplicate records
This commit is contained in:
parent
a552b790c9
commit
506fbbf0b1
@ -160,15 +160,14 @@ async def write_files(datalist: List[Dict[str, List[bytes]]]):
|
||||
continue
|
||||
combined_data[key].update(value)
|
||||
|
||||
accumulate = b""
|
||||
dataset = set()
|
||||
# combined_data is ordered by insertion (sorted date)
|
||||
for i, data in enumerate(combined_data.values()):
|
||||
if not accumulate:
|
||||
accumulate = b"\n".join(data)
|
||||
else:
|
||||
accumulate += b"\n" + b"\n".join(data)
|
||||
dataset.update(data)
|
||||
# accumulate = "\n".join(sorted(set(accumulate.split("\n"))))
|
||||
base_path.joinpath(f"past-{(i + 1):02d}day.txt").write_bytes(accumulate)
|
||||
base_path.joinpath(f"past-{(i + 1):02d}day.txt").write_bytes(
|
||||
b"\n".join(dataset)
|
||||
)
|
||||
|
||||
|
||||
async def main():
|
||||
|
Loading…
x
Reference in New Issue
Block a user