MCPcopy Create free account
hub / github.com/NatsUIJM/autoContents / run_batch

Function run_batch

mainprogress/pdf_metadata_extractor.py:271–291  ·  view source on GitHub ↗

执行一个批次的滑动窗口扫描

(start_page, end_page_limit)

Source from the content-addressed store, hash-verified

269 break
270 windows.append((i, min(i + 3, total_pages)))
271
272 if not windows:
273 return
274
275 tasks = [process_window(s, e) for s, e in windows]
276 results = await asyncio.gather(*tasks)
277
278 for s, e, t_start, t_end, _ in results:
279 if t_start is None: continue
280 for p in range(s, e + 1):
281 if t_start <= p <= t_end:
282 page_votes[p]["is_toc"] += 1
283 else:
284 page_votes[p]["not_toc"] += 1
285
286 def has_toc_in_range(votes_dict, start_p, end_p):
287 """检查指定范围内是否有被投票为目录的页"""
288 for p in range(start_p, end_p + 1):
289 if votes_dict.get(p, {}).get("is_toc", 0) > 0:
290 return True
291 return False
292
293 # 动态扫描与拓展逻辑
294 current_limit = min(20, total_pages)

Callers 1

extract_toc_infoFunction · 0.85

Calls 1

process_windowFunction · 0.85

Tested by

no test coverage detected