Peach: Local-first video metadata scraper and media manager.
fix(performers): avwikidb 已绑编号重取女优页失败时保留上一次的资料
longmeidaoe8d7401fef9e
diff --git a/src/peach/performer_profile_followup.py b/src/peach/performer_profile_followup.pyindex edba033e4..73d5fbf2b 100644--- a/src/peach/performer_profile_followup.py+++ b/src/peach/performer_profile_followup.py@@ -392,10 +392,9 @@ def _visit_avwikidb(contract, pages, entity_id: int, names, state: dict, batch:url = avwikidb.ACTOR_PAGE.format(id=actor_ref)try:actor = avwikidb.actor_profile(pages.get(url)[1]) or {}- except alias.Unavailable:- actor = {}- except alias.Blocked as error:+ except (alias.Blocked, alias.Unavailable) as error:if refs:+ # 已绑的编号只为重取资料而来:没取到就留着上一次的资料,不拿一份空的顶掉。reports[AVWIKIDB] = f"{UNFETCHED}:{error}"return 0actor = {}diff --git a/tests/test_performer_profile_followup.py b/tests/test_performer_profile_followup.pyindex 65a41f676..c81860c7a 100644--- a/tests/test_performer_profile_followup.py+++ b/tests/test_performer_profile_followup.py@@ -423,6 +423,20 @@ class AvwikidbTests(Case):self.assertTrue(summary["sites"][followup.AVWIKIDB].startswith(followup.UNFETCHED))self.assertEqual(self.refs(self.hikaru), {})+ def test_a_failed_refresh_keeps_the_metadata_of_a_bound_number(self):+ self.run_followup(self.hikaru, run_id=5)+ with self.database.write_transaction(notify=False) as connection:+ connection.execute("UPDATE entity_external_ref SET last_synced_at='2026-01-01T00:00:00Z'"+ " WHERE provider=?", (followup.AVWIKIDB,))+ stale = time.time() - followup.REFRESH - 60+ for cached in (self.generated / "provider-cache" / "avwikidb").glob("*.json"):+ os.utime(cached, (stale, stale))+ del self.avwikidb.pages[ACTOR_URL]+ summary = self.run_followup(self.hikaru, run_id=6)+ _number, metadata = self.refs(self.hikaru)[followup.AVWIKIDB]+ self.assertEqual((metadata["height"], metadata["batch"]), (148, f"{followup.SOURCE}@5"))+ self.assertTrue(summary["sites"][followup.AVWIKIDB].startswith(followup.UNFETCHED))+def test_fc2_codes_are_not_used_as_an_entry(self):fc2 = self.entity("FC2の人")self.work(5, fc2, code="FC2-PPV-1234567")