Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(taste): 识别 115 浏览器的 HistoryEx 历史文件

Codex66e2358bb824
diff --git a/README.en.md b/README.en.md
index 6893d52a1..1ce40a9e9 100644
--- a/README.en.md
+++ b/README.en.md
@@ -96,7 +96,7 @@ The original screenshots are lossless 3840×2160 PNGs; click to view them. You c
- **Cloud download**: open Find resources from JAV or a quality goal, search a video code or paste a magnet link, then submit the selected resource to 115 or PikPak. Once it lands, Peach selects the main video, isolates promotional attachments that meet the automatic threshold, collects metadata and applies that source's organization template. Progress and failed-step retries show up in Activity.
- **Find a release**: direct cloud downloads search `manko.fun → JavDB → Sukebei` first and stop when manko.fun has a 1080p or 2160p match; without one, they continue through your configured Prowlarr or Jackett indexers. Wanted titles collect candidates from multiple sources so you can compare versions. Available covers and title details appear with the resource candidates.
- **Statistics**: which drive holds what, how much you have watched and which tags dominate, on one page.
-- **Taste**: combines viewing, feedback, accumulated library titles, browsing history and followed accounts. Read local Aside, Chrome, Edge or Firefox profiles, or add another browser's profile directory. Stopping sync and deleting imported records are separate controls. Social visits are associated with registered accounts and known identities.
+- **Taste**: combines viewing, feedback, accumulated library titles, browsing history and followed accounts. Read local 115, Aside, Chrome, Edge or Firefox profiles, or add another browser's profile directory. Stopping sync and deleting imported records are separate controls. Social visits are associated with registered accounts and known identities.
- **Settings**: the dialog groups appearance and navigation, browsing and playback, JAV and new releases, search and recommendations, and content display. Peach configuration groups media intake, sources and subscriptions, download channels, network access, and application maintenance.
- **Any screen**: works in the browser on desktop, tablet and phone.
diff --git a/README.md b/README.md
index d71396812..bf8ec8743 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ https://github.com/user-attachments/assets/a5610874-e611-41bb-be22-7d99f0d64b62
- **云下载**:在 JAV 或高清版目标打开「查找资源」,搜索番号或粘贴磁力,选择资源后提交到 115 或 PikPak。落地后自动选择正片、隔离达到自动线的推广附件、采集资料并按该来源模板整理;进度和失败重试都在活动页看。
- **按番号找资源**:云下载直接添加先按 `manko.fun → JavDB → Sukebei` 查磁力,`manko.fun` 命中 1080p 或 2160p 就停止;没有高清命中时再接配置的 Prowlarr 或 Jackett 索引器。「想要」的待找清单继续汇集多个来源,方便比较版本。取得的封面和作品资料与候选资源一起展示。
- **统计**:片子存在哪块盘、看过多少、标签分布,一页看完。
-- **口味**:综合观看、反馈、馆藏积累、浏览记录及关注关系。可读取 Aside、Chrome、Edge、Firefox 等本机浏览器,也可添加其他浏览器的资料目录;停止同步与删除已导入记录分别管理。社媒访问按已登记账号和人物身份判断。
+- **口味**:综合观看、反馈、馆藏积累、浏览记录及关注关系。可读取 115、Aside、Chrome、Edge、Firefox 等本机浏览器,也可添加其他浏览器的资料目录;停止同步与删除已导入记录分别管理。社媒访问按已登记账号和人物身份判断。
- **设置**:弹窗按外观与导航、浏览与播放、JAV 与新作、搜索与推荐、内容显示分类;「Peach 配置」集中管理媒体入库、来源订阅、下载渠道、网络访问与应用维护。
- **多端**:电脑、平板、手机的浏览器都能用。
diff --git a/src/peach/taste_browsers.py b/src/peach/taste_browsers.py
index d9463eb9e..ef9524196 100644
--- a/src/peach/taste_browsers.py
+++ b/src/peach/taste_browsers.py
@@ -17,7 +17,7 @@ def _paths(path: Path) -> list[Path]:
return [path]
if not path.is_dir():
return []
- return sorted({item for name in ("History", "places.sqlite", "History.db")
+ return sorted({item for name in ("History", "HistoryEx", "places.sqlite", "History.db")
for pattern in (name, f"*/{name}") for item in path.glob(pattern)
if item.is_file()})[:200]
@@ -107,7 +107,8 @@ def enabled_history_sources(store_path: Path):
for browser in browser_sources(store_path):
if browser["enabled"]:
for path in _paths(Path(browser["path"])):
- engine = {"History": "chrome", "places.sqlite": "firefox", "History.db": "safari"}.get(path.name, browser["engine"])
+ engine = {"History": "chrome", "HistoryEx": "chrome", "places.sqlite": "firefox",
+ "History.db": "safari"}.get(path.name, browser["engine"])
unique.setdefault(str(path.resolve()).casefold(), HistorySource(
browser["name"].casefold(), path.parent.name, path, engine=engine))
return list(unique.values())
diff --git a/src/peach/taste_history.py b/src/peach/taste_history.py
index 3aee4d80e..4484a7a6b 100644
--- a/src/peach/taste_history.py
+++ b/src/peach/taste_history.py
@@ -127,6 +127,7 @@ def discover_history_sources(
("firefox", appdata / "Mozilla" / "Firefox" / "Profiles"),
("zen", appdata / "zen" / "Profiles"),
("chrome", localappdata / "Google" / "Chrome" / "User Data"),
+ ("115", localappdata / "115Chrome" / "User Data"),
("aside", localappdata / "Aside" / "User Data"),
("edge", localappdata / "Microsoft" / "Edge" / "User Data"),
("brave", localappdata / "BraveSoftware" / "Brave-Browser" / "User Data"),
@@ -151,7 +152,8 @@ def discover_history_sources(
for browser, root in candidates:
if not root.is_dir():
continue
- filename = "places.sqlite" if browser in {"firefox", "zen"} else "History"
+ filename = ("places.sqlite" if browser in {"firefox", "zen"}
+ else "HistoryEx" if browser == "115" else "History")
for path in [root / filename, *root.glob(f"*/{filename}")]:
if path.is_file():
found.append(HistorySource(browser, path.parent.name, path, root,
diff --git a/tests/test_taste_history.py b/tests/test_taste_history.py
index 98efaa943..f6db69862 100644
--- a/tests/test_taste_history.py
+++ b/tests/test_taste_history.py
@@ -11,7 +11,7 @@ import pathlib
from urllib.parse import quote
from unittest import mock
-from peach import taste_history
+from peach import taste_browsers, taste_history
from peach.taste_history import (
HistorySource,
analyze_history,
@@ -124,6 +124,45 @@ class TasteHistoryTests(unittest.TestCase):
sources = discover_history_sources(home=self.root, platform_name="macos")
self.assertEqual([source.browser for source in sources], ["chrome", "firefox", "safari", "zen"])
+ def test_discovers_windows_115_historyex_profiles(self):
+ home = self.root.resolve()
+ user_data = home / "AppData" / "Local" / "115Chrome" / "User Data"
+ for profile in ("Default", "Profile 1"):
+ self._chrome_db(user_data / profile / "HistoryEx")
+ sources = discover_history_sources(home=home, platform_name="windows")
+ self.assertEqual(
+ sources,
+ [HistorySource("115", profile, user_data / profile / "HistoryEx", user_data, "chrome")
+ for profile in ("Default", "Profile 1")],
+ )
+ store = home / "115-history.sqlite"
+ with mock.patch.object(taste_history, "discover_history_sources", return_value=sources):
+ browsers = taste_browsers.browser_sources(store)
+ self.assertEqual(len(browsers), 1)
+ self.assertTrue(browsers[0]["automatic"])
+ self.assertTrue(browsers[0]["available"])
+ self.assertEqual(browsers[0]["path"], str(user_data))
+ self.assertEqual(browsers[0]["profiles"], 2)
+ enabled = taste_browsers.enabled_history_sources(store)
+ self.assertTrue(all(source.engine == "chrome" for source in enabled))
+ self.assertIn(user_data / "Default" / "HistoryEx", [source.path for source in enabled])
+
+ def test_registers_115_historyex_from_user_data_profile_or_file(self):
+ user_data = self.root.resolve() / "115Chrome" / "User Data"
+ history = user_data / "Default" / "HistoryEx"
+ self._chrome_db(history)
+ for index, path in enumerate((user_data, history.parent, history)):
+ with self.subTest(path=path), mock.patch.object(taste_history, "discover_history_sources", return_value=[]):
+ store = self.root.resolve() / f"115-history-{index}.sqlite"
+ taste_browsers.configure_browser(store, "add", {"name": "115", "path": str(path)})
+ browser = taste_browsers.browser_sources(store)[0]
+ self.assertTrue(browser["available"])
+ self.assertEqual(browser["profiles"], 1)
+ sources = taste_browsers.enabled_history_sources(store)
+ self.assertEqual(sources, [HistorySource("115", "Default", history, engine="chrome")])
+ self.assertEqual(refresh_history(sources, store, host="test")[0]["added"], 1)
+ self.assertEqual(refresh_history(sources, store, host="test")[0]["added"], 0)
+
def test_the_history_store_has_one_entry_point(self):
"""打开私有历史库的前导只许有一份。