Skip to content

Add M-Team torrent detail and search category names - #26

Merged
tonycoder-hub merged 1 commit into
mainfrom
feat/mteam-detail-categories
Oct 16, 2026
Merged

tonycoder-hub merged 1 commit into
mainfrom
feat/mteam-detail-categories

Conversation

@tonycoder-hub

Copy link
Copy Markdown
Owner

Summary

  • M-Team torrent detail. M-Team now declares torrent.detail. site detail --api-key-stdin mteam REMOTE_ID sends one bounded multipart POST /api/torrent/detail with only the id field. It never calls /api/torrent/viewHits, which the website calls to count a view, and it never retries or follows redirects. The answer must be code 0 and must echo the exact requested ID and carry a name. Size, seeders, leechers, and completed count are mapped; a malformed counter is left absent. DOWNLOAD REFERENCE is always false.
  • Not found. The API returns HTTP 200 with code 1 for a missing torrent, but code 1 is also used for other refusals (for example the per-torrent daily download limit). Only code 1 with null data and the exact 種子未找到 / 种子未找到 message maps to not_found; any other code 1 is unrecognized_response. Server text is never echoed.
  • Search category names. TorrentSummary gains category_name (omitempty). M-Team fills it from a static table of the site's categoryList (nameChs, 48 entries, snapshotted 2026-10-16), so search makes no extra request. Unknown IDs keep only their ID.
  • Route-keyed detail warning. The site detail warning is now chosen by route ID. TJUPT keeps its exact sentence; M-Team states its own no-counter choice; an unlisted route gets only the generic first clause.

Deliberate public changes

  • New JSON field category_name on search rows (omitted when unknown, so TJUPT JSON is byte-identical).
  • The search table appends a trailing CATEGORY column only when at least one row has a name. TJUPT rows never have one, so TJUPT table output is unchanged.
  • M-Team's descriptor now lists torrent.detail: site list shows 4 capabilities for mteam and site capabilities mteam gains a row.
  • site detail accepts --api-key-stdin (mutually exclusive with --cookie-stdin). The usage line is now ptctl site detail (--cookie-stdin | --api-key-stdin) .... Without a credential flag, the usage error names the flag the site needs (--api-key-stdin for mteam, --cookie-stdin for tjupt, unchanged); choosing the wrong one gives site "X" does not support METHOD authentication before stdin is read.
  • An unknown detail route gets the generic warning the single request is tracker-visible instead of the TJUPT-specific sentence.

Unchanged: TJUPT detail output, stop reasons and their order, exit codes, route IDs, origins. reconcile still requires cookie detail, so --site-ref mteam/ID is refused with the existing text.

Verification

  • gofmt -l ., go vet ./..., go test -race ./..., go build -trimpath ./cmd/ptctl pass locally.
  • New offline tests use synthetic CANARY fixtures only: exact request shape (including the multipart body), field mapping, ID echo and name requirements, refusal classification, one-request session budget and close semantics, and credential-method checks before stdin is read.
  • Live, read-only, spaced requests on 2026-10-16: search shows category names in table and JSON; detail of a public software torrent was observed with one request; a nonexistent ID stops as not_found with one request. viewHits was never called.

Docs: MTEAM_ADAPTER.md, guide/sites.md, FEATURES.md, ADDING_A_SITE.md (gap table), AUTOMATION.md, ARCHITECTURE.md, README.md, docs/README.md.

Metafile download for M-Team is not part of this PR.

🤖 Generated with Claude Code

M-Team now declares torrent.detail. `site detail --api-key-stdin mteam ID`
sends one bounded multipart POST to /api/torrent/detail carrying only the
ID, never the view-counting endpoint, and accepts only a code 0 answer that
echoes the exact ID and has a name. Not found is read only from code 1 with
the exact fixed message, because the API reuses code 1 for other refusals.

Search rows gain category_name from a static table of the site's category
list, so a search costs no extra request; the table view adds a trailing
CATEGORY column only when some row has a name. The site detail warning is
now chosen by route ID, so TJUPT output is unchanged and unknown routes get
only the generic sentence. Reconcile still reads live detail with a cookie
only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tonycoder-hub
tonycoder-hub merged commit 96c04a6 into main Oct 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant