Peach: Local-first video metadata scraper and media manager.
fix(taste): 保留显式资料根并补齐 115 多资料目录回归
longmeidao80714421c611
diff --git a/README.en.md b/README.en.mdindex fb2eb6410..cb4ccf13f 100644--- a/README.en.md+++ b/README.en.md@@ -97,7 +97,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/src/peach/taste_history.py b/src/peach/taste_history.pyindex 97abfb7c3..8ce77ad6c 100644--- a/src/peach/taste_history.py+++ b/src/peach/taste_history.py@@ -123,11 +123,14 @@ def discover_history_sources(from .taste_browsers import _pathsplatform_name = platform_name or {"win32": "windows", "darwin": "macos"}.get(sys.platform, "linux")+ use_environment = home is Nonehome = home or Path.home()candidates: list[tuple[str, Path]] = []if platform_name == "windows":- appdata = appdata or Path(os.environ.get("APPDATA", home / "AppData" / "Roaming"))- localappdata = localappdata or Path(os.environ.get("LOCALAPPDATA", home / "AppData" / "Local"))+ appdata = appdata or (Path(os.environ.get("APPDATA") or home / "AppData" / "Roaming")+ if use_environment else home / "AppData" / "Roaming")+ localappdata = localappdata or (Path(os.environ.get("LOCALAPPDATA") or home / "AppData" / "Local")+ if use_environment else home / "AppData" / "Local")candidates.extend([("firefox", appdata / "Mozilla" / "Firefox" / "Profiles"),@@ -168,7 +171,8 @@ def discover_history_sources(])elif platform_name == "linux":- config = Path(os.environ.get("XDG_CONFIG_HOME", home / ".config"))+ config = (Path(os.environ.get("XDG_CONFIG_HOME") or home / ".config")+ if use_environment else home / ".config")candidates.extend([("firefox", home / ".mozilla/firefox"),("firefox", home / ".var/app/org.mozilla.firefox/.mozilla/firefox"),diff --git a/tests/test_taste_history.py b/tests/test_taste_history.pyindex 9502a6508..e6c966c2f 100644--- a/tests/test_taste_history.py+++ b/tests/test_taste_history.py@@ -11,7 +11,7 @@ import pathlibfrom urllib.parse import quotefrom unittest import mock-from peach import taste_history+from peach import taste_browsers, taste_historyfrom peach.taste_history import (HistorySource,analyze_history,@@ -152,6 +152,29 @@ class TasteHistoryTests(unittest.TestCase):results = refresh_history(enabled_history_sources(store), store)self.assertEqual([row["added"] for row in results], [1] * len(layouts))+ 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_historyex_directory_and_file_use_verified_browsing_schema(self):from peach.taste_browsers import configure_browser, enabled_history_sourcespath = self.root / "115Chrome/User Data/Default/HistoryEx"@@ -227,8 +250,9 @@ class TasteHistoryTests(unittest.TestCase):local, roaming = self.root / "RedirectedLocal", self.root / "RedirectedRoaming"self._chrome_db(local / "Google/Chrome/User Data/Profile 2/History")self._firefox_db(roaming / "Mozilla/Firefox/Profiles/custom/places.sqlite")- with mock.patch.dict("os.environ", {"APPDATA": str(roaming), "LOCALAPPDATA": str(local)}):- sources = discover_history_sources(home=self.root, platform_name="windows")+ with mock.patch.dict("os.environ", {"APPDATA": str(roaming), "LOCALAPPDATA": str(local)}), \+ mock.patch("pathlib.Path.home", return_value=self.root):+ sources = discover_history_sources(platform_name="windows")self.assertEqual([source.browser for source in sources], ["chrome", "firefox"])def test_linux_uses_native_and_sandboxed_browser_profiles(self):@@ -238,8 +262,9 @@ class TasteHistoryTests(unittest.TestCase):self.root / "snap/firefox/common/.mozilla/firefox/snap/places.sqlite"]for path in paths:(self._firefox_db if path.name == "places.sqlite" else self._chrome_db)(path)- with mock.patch.dict("os.environ", {"XDG_CONFIG_HOME": str(config)}):- sources = discover_history_sources(home=self.root, platform_name="linux")+ with mock.patch.dict("os.environ", {"XDG_CONFIG_HOME": str(config)}), \+ mock.patch("pathlib.Path.home", return_value=self.root):+ sources = discover_history_sources(platform_name="linux")self.assertEqual({source.path for source in sources}, set(paths))def test_the_history_store_has_one_entry_point(self):