funread 1.2.6__tar.gz → 1.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. {funread-1.2.6 → funread-1.2.8}/PKG-INFO +1 -1
  2. {funread-1.2.6 → funread-1.2.8}/pyproject.toml +1 -1
  3. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/reader/registry.py +5 -2
  4. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/reader/service.py +6 -2
  5. {funread-1.2.6 → funread-1.2.8}/tests/reader/test_reader_service.py +9 -0
  6. {funread-1.2.6 → funread-1.2.8}/tests/reader/test_registry.py +11 -0
  7. {funread-1.2.6 → funread-1.2.8}/tests/test_download_base.py +12 -8
  8. {funread-1.2.6 → funread-1.2.8}/.github/FUNDING.yml +0 -0
  9. {funread-1.2.6 → funread-1.2.8}/.github/workflows/ci.yml +0 -0
  10. {funread-1.2.6 → funread-1.2.8}/.gitignore +0 -0
  11. {funread-1.2.6 → funread-1.2.8}/CHANGELOG.md +0 -0
  12. {funread-1.2.6 → funread-1.2.8}/LICENSE +0 -0
  13. {funread-1.2.6 → funread-1.2.8}/README.md +0 -0
  14. {funread-1.2.6 → funread-1.2.8}/example/run.py +0 -0
  15. {funread-1.2.6 → funread-1.2.8}/example/run1.py +0 -0
  16. {funread-1.2.6 → funread-1.2.8}/example/run3.py +0 -0
  17. {funread-1.2.6 → funread-1.2.8}/scripts/setup.sh +0 -0
  18. {funread-1.2.6 → funread-1.2.8}/src/funread/__init__.py +0 -0
  19. {funread-1.2.6 → funread-1.2.8}/src/funread/base/__init__.py +0 -0
  20. {funread-1.2.6 → funread-1.2.8}/src/funread/base/config.py +0 -0
  21. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/__init__.py +0 -0
  22. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/__init__.py +0 -0
  23. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/backends/__init__.py +0 -0
  24. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/backends/html.py +0 -0
  25. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/backends/jsonx.py +0 -0
  26. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/backends/regexrow.py +0 -0
  27. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/book.py +0 -0
  28. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/errors.py +0 -0
  29. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/evaluator.py +0 -0
  30. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/expr.py +0 -0
  31. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/feed.py +0 -0
  32. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/fetch.py +0 -0
  33. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/js/__init__.py +0 -0
  34. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/js/base.py +0 -0
  35. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/js/host.py +0 -0
  36. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/js/null.py +0 -0
  37. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/js/quickjs_runtime.py +0 -0
  38. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/lexer.py +0 -0
  39. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/models.py +0 -0
  40. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/nodes.py +0 -0
  41. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/opml.py +0 -0
  42. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/rss.py +0 -0
  43. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/runtime.py +0 -0
  44. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/source.py +0 -0
  45. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/values.py +0 -0
  46. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/engine/variables.py +0 -0
  47. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/__init__.py +0 -0
  48. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/__init__.py +0 -0
  49. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/context.py +0 -0
  50. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/core/__init__.py +0 -0
  51. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/core/constants.py +0 -0
  52. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/core/db_backup.py +0 -0
  53. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/core/processor.py +0 -0
  54. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/core/store.py +0 -0
  55. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/reporting/__init__.py +0 -0
  56. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/reporting/builder.py +0 -0
  57. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/reporting/remote.py +0 -0
  58. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/sources/__init__.py +0 -0
  59. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/sources/book.py +0 -0
  60. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/sources/factory.py +0 -0
  61. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/sources/rss.py +0 -0
  62. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/download/task.py +0 -0
  63. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/publish/__init__.py +0 -0
  64. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/publish/entrance.py +0 -0
  65. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/publish/rss.py +0 -0
  66. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/__init__.py +0 -0
  67. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/check/__init__.py +0 -0
  68. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/check/task.py +0 -0
  69. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/merge/__init__.py +0 -0
  70. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/merge/task.py +0 -0
  71. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/storage.py +0 -0
  72. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/sync/__init__.py +0 -0
  73. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/source/sync/task.py +0 -0
  74. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/utils/__init__.py +0 -0
  75. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/utils/core.py +0 -0
  76. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/manage/utils/worker.py +0 -0
  77. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/net/__init__.py +0 -0
  78. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/net/charset.py +0 -0
  79. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/net/fetcher.py +0 -0
  80. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/net/probe.py +0 -0
  81. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/net/survey.py +0 -0
  82. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/reader/__init__.py +0 -0
  83. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/reader/matching.py +0 -0
  84. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/reader/rss_service.py +0 -0
  85. {funread-1.2.6 → funread-1.2.8}/src/funread/legado/reader/storage.py +0 -0
  86. {funread-1.2.6 → funread-1.2.8}/src/funread/py.typed +0 -0
  87. {funread-1.2.6 → funread-1.2.8}/src/funread/scripts/__init__.py +0 -0
  88. {funread-1.2.6 → funread-1.2.8}/src/funread/scripts/command.py +0 -0
  89. {funread-1.2.6 → funread-1.2.8}/tests/conftest.py +0 -0
  90. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_book_flow.py +0 -0
  91. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_combinators_and_regex.py +0 -0
  92. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_default_dialect.py +0 -0
  93. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_dialects.py +0 -0
  94. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_feed_parser.py +0 -0
  95. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_js_boundary.py +0 -0
  96. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_js_quickjs.py +0 -0
  97. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_no_heavy_imports.py +0 -0
  98. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_opml.py +0 -0
  99. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_rss_engine.py +0 -0
  100. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_source_spec.py +0 -0
  101. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_source_spec_rss.py +0 -0
  102. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_url_options.py +0 -0
  103. {funread-1.2.6 → funread-1.2.8}/tests/engine/test_variables_and_interpolation.py +0 -0
  104. {funread-1.2.6 → funread-1.2.8}/tests/net/test_charset.py +0 -0
  105. {funread-1.2.6 → funread-1.2.8}/tests/net/test_requests_fetcher.py +0 -0
  106. {funread-1.2.6 → funread-1.2.8}/tests/net/test_survey.py +0 -0
  107. {funread-1.2.6 → funread-1.2.8}/tests/reader/test_chapter_matching.py +0 -0
  108. {funread-1.2.6 → funread-1.2.8}/tests/reader/test_reader_storage.py +0 -0
  109. {funread-1.2.6 → funread-1.2.8}/tests/reader/test_rss_service.py +0 -0
  110. {funread-1.2.6 → funread-1.2.8}/tests/reader/test_rss_storage.py +0 -0
  111. {funread-1.2.6 → funread-1.2.8}/tests/reader/test_user_scoping.py +0 -0
  112. {funread-1.2.6 → funread-1.2.8}/tests/test_config.py +0 -0
  113. {funread-1.2.6 → funread-1.2.8}/tests/test_db_backup.py +0 -0
  114. {funread-1.2.6 → funread-1.2.8}/tests/test_publish_and_parse.py +0 -0
  115. {funread-1.2.6 → funread-1.2.8}/tests/test_publish_optional_fundrive.py +0 -0
  116. {funread-1.2.6 → funread-1.2.8}/tests/test_report_builder.py +0 -0
  117. {funread-1.2.6 → funread-1.2.8}/tests/test_source_download_storage.py +0 -0
  118. {funread-1.2.6 → funread-1.2.8}/tests/test_task_database_resolution.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: funread
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: 一个用于管理和处理阅读源(Legado 阅读 APP 的书源和 RSS 源)的 Python 工具库
5
5
  Project-URL: Organization, https://github.com/farfarfun
6
6
  Project-URL: Repository, https://github.com/farfarfun/funread
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "funread"
3
- version = "1.2.6"
3
+ version = "1.2.8"
4
4
  description = "一个用于管理和处理阅读源(Legado 阅读 APP 的书源和 RSS 源)的 Python 工具库"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -140,7 +140,7 @@ class SourceRegistry:
140
140
  needs_js = spec.needs_js()
141
141
  web_view = spec.is_web_view
142
142
  has_explore = bool(
143
- spec.explore_url.strip()
143
+ any(kind.url for kind in spec.explore_kinds())
144
144
  and (
145
145
  spec.has_rule("ruleExplore", "bookList") or spec.has_rule("ruleSearch", "bookList")
146
146
  )
@@ -218,7 +218,10 @@ class SourceRegistry:
218
218
  spec.is_complete,
219
219
  not spec.is_web_view,
220
220
  not spec.needs_js(),
221
- bool(spec.explore_url and spec.has_rule("ruleExplore", "bookList")),
221
+ bool(
222
+ any(kind.url for kind in spec.explore_kinds())
223
+ and spec.has_rule("ruleExplore", "bookList")
224
+ ),
222
225
  len(spec.raw),
223
226
  )
224
227
  if identity not in unique or quality > unique[identity][0]:
@@ -398,7 +398,7 @@ class ReaderService:
398
398
  spec = self.registry.load_spec(int(pref.url_id))
399
399
  if spec is None:
400
400
  continue
401
- kinds = [kind.name for kind in spec.explore_kinds() if kind.name and kind.url]
401
+ kinds = [kind.name or spec.name for kind in spec.explore_kinds() if kind.url]
402
402
  if not kinds:
403
403
  continue
404
404
  items.append(
@@ -419,7 +419,11 @@ class ReaderService:
419
419
  顺序反过来就可能把选项拼坏。
420
420
  """
421
421
  spec = self._spec(url_id)
422
- kinds = [{"name": kind.name, "url": kind.url} for kind in spec.explore_kinds() if kind.url]
422
+ kinds = [
423
+ {"name": kind.name or spec.name, "url": kind.url}
424
+ for kind in spec.explore_kinds()
425
+ if kind.url
426
+ ]
423
427
  if not kinds:
424
428
  raise LookupError("这个源没有可浏览的分类")
425
429
  return kinds
@@ -594,6 +594,15 @@ def test_explore_sources_includes_the_category_names(make_service):
594
594
  assert service.explore_sources()["items"][0]["kinds"] == ["玄幻", "都市"]
595
595
 
596
596
 
597
+ def test_explore_sources_names_an_unnamed_category(make_service):
598
+ service = make_service(
599
+ pages={}, sources={1: _explore_source("a.example.com", "甲源", kinds="/browse")}
600
+ )
601
+
602
+ assert service.explore_sources()["items"][0]["kinds"] == ["甲源"]
603
+ assert service.explore_kinds(1) == [{"name": "甲源", "url": "/browse"}]
604
+
605
+
597
606
  def test_explore_sources_filters_and_paginates(make_service):
598
607
  service = make_service(
599
608
  pages={},
@@ -363,6 +363,17 @@ def test_ingest_prefers_browsable_duplicate(registry):
363
363
  assert registry.load_spec(pref.url_id).explore_url == "/browse"
364
364
 
365
365
 
366
+ def test_ingest_excludes_sources_without_parseable_explore_kinds(registry):
367
+ source = {
368
+ **GOOD,
369
+ "exploreUrl": '[{"title":"空分类","url":""}]',
370
+ "ruleExplore": {"bookList": "class.item"},
371
+ }
372
+
373
+ assert registry.ingest([[source]]) == 1
374
+ assert registry.prefs(explore_only=True) == []
375
+
376
+
366
377
  def test_candidates_respects_the_limit(registry, tmp_path):
367
378
  hubs = tmp_path / "hubs"
368
379
  for index in range(1, 6):
@@ -228,10 +228,12 @@ def test_export_sources_only_includes_pending_and_available_statuses(tmp_path: P
228
228
 
229
229
  exported = next(source.export_sources(size=10))
230
230
 
231
- assert [item["sourceUrl"].split("#")[0] for item in exported] == [
232
- "https://rss.example.com/pending",
233
- "https://rss.example.com/available",
234
- ]
231
+ assert sorted(item["sourceUrl"].split("#")[0] for item in exported) == sorted(
232
+ [
233
+ "https://rss.example.com/pending",
234
+ "https://rss.example.com/available",
235
+ ]
236
+ )
235
237
 
236
238
 
237
239
  class _FakeDrive:
@@ -361,10 +363,12 @@ def test_upload_only_includes_pending_and_available_sources(tmp_path: Path) -> N
361
363
  UploadSourceBatchesTask(store=source, remote_manager=_RemoteManager()).run()
362
364
 
363
365
  assert len(uploaded_batches) == 1
364
- assert [item["sourceUrl"].split("#")[0] for item in uploaded_batches[0]] == [
365
- "https://rss.example.com/pending",
366
- "https://rss.example.com/available",
367
- ]
366
+ assert sorted(item["sourceUrl"].split("#")[0] for item in uploaded_batches[0]) == sorted(
367
+ [
368
+ "https://rss.example.com/pending",
369
+ "https://rss.example.com/available",
370
+ ]
371
+ )
368
372
 
369
373
 
370
374
  def test_source_step_tasks_delegate_to_generator() -> None:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes