Episode and Torrent timestamps reflect publish date of provider#79
Episode and Torrent timestamps reflect publish date of provider#79Zzackllack wants to merge 11 commits intomainfrom
Conversation
Add release timestamp parsing and normalization for AniWorld/S.to markup. Propagate parsed release_at through probe info into availability cache extras. Use cached/probed release_at as Torznab pubDate with safe fallback to now. Keep fast season-search behavior intact while improving timestamp fidelity.
Allow overriding ClientTask added_on during upsert. Read availability extra.release_at when adding torrents and persist it. Normalize timestamp serialization to UTC for torrents and sync endpoints.
…sage Add parser tests for German/English publish strings and invalid dates. Cover S.to release parsing, Torznab pubDate sourcing, and qB added_on reuse. Update model tests for added_on override behavior. Document release-aware timestamp feature in README.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughExtracts and normalizes provider release timestamps (release_at) from HTML/text, persists them in availability/client-task metadata, and propagates UTC release_at as Torznab RSS pubDate and qBittorrent added_on/completion_on across probe, Torznab, and qBittorrent flows. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Provider as Provider (AniWorld / S.to)
participant Probe as ProbeQuality
participant Cache as AvailabilityCache
participant Torznab as TorznabAPI
participant QB as qBittorrentSync
participant DB as Database
Provider->>Probe: Episode HTML (cached on Episode)
Probe->>Probe: parse_release_at_from_html(html) -> release_at (UTC)
Probe->>Cache: upsert_availability(extra={"release_at": ISO8601})
Torznab->>Cache: fetch availability(extra)
Torznab->>Torznab: resolve pubDate = release_at or now
Torznab->>Client: emit RSS item with pubDate
Client->>Torznab: request add (magnet)
Torznab->>Cache: fetch availability(extra)
Torznab->>DB: upsert_client_task(..., added_on=release_at)
DB->>QB: task payload with added_on/completion_on (UTC)
QB->>QB: store task timestamps
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @Zzackllack. The following files were modified: * `app/api/qbittorrent/sync.py` * `app/api/qbittorrent/torrents.py` * `app/api/torznab/api.py` * `app/db/models.py` * `app/providers/sto/v2.py` * `app/utils/probe_quality.py` * `app/utils/release_dates.py` * `tests/test_qbittorrent_torrents.py` These files were kept as they were: * `tests/test_models.py` * `tests/test_release_dates.py` * `tests/test_sto_v2.py` * `tests/test_torznab.py` These file types are not supported: * `.github/README.md`
Extract duplicated qBittorrent UTC timestamp conversion into a shared helper and update sync/torrents endpoints to reuse it without behavior changes. Tighten Torznab helper typing and expose the shared release metadata key for test fixtures. Add and refine PEP 257 docstrings and explicit return/type annotations across release-date and STO parsing paths, and align tests with shared constants and current UTC normalization semantics.
fix(api): update _try_mapped_special_probe to return ProbeResult chore(v2): remove redundant setattr for _anibridge_sto_v2_html
docs(api): enhance ProbeResult docstring with field descriptions refactor(v2): remove unused parse_release_at_from_sto_html function refactor(v2): streamline release timestamp extraction in enrich_episode_from_v2_html test: update test to use new release timestamp parsing function
…nterface - Introduced `AvailabilityRecordProtocol` and `TNModuleProtocol` to define the structure and required methods for availability records and tn-module operations. - Updated function signatures to use the new protocols for better type safety and clarity.
Description
This pull request introduces release-aware timestamps throughout the system, ensuring that episode and torrent timestamps (such as
pubDateandadded_on) reflect the actual provider publish time when available, rather than the time of the request. This improves the accuracy and reliability of metadata for both users and downstream consumers (like Sonarr/Prowlarr). The changes also refactor and centralize logic for handling release dates, and propagate this information through the API and database layers. Closes #7.Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Release-aware timestamp handling:
AniWorld,s.to, and related endpoints, and is now reflected in the README documentation. [1] [2] [3]_to_utc_timestamp,release_at_from_extra, etc.) to standardize conversion and retrieval of UTC timestamps across the codebase. [1] [2] [3] [4]API and data model updates:
/qbittorrent/syncand/qbittorrent/torrentsendpoints to store and return release-aware timestamps foradded_onandcompletion_onfields, ensuring clients receive accurate publish dates. [1] [2] [3] [4] [5]pubDatevalues in RSS feeds, using release-aware timestamps when available, and to store this information in the availability cache. [1] [2] [3] [4] [5] [6] [7] [8]Internal logic and utilities:
Overall, these changes make the system's handling of release times more robust and accurate, benefiting both API consumers and end users.
Summary by CodeRabbit
New Features
Tests