Documentation
¶
Overview ¶
Package srrdb provides a Go client for the srrdb.com API and an SRR binary parser.
srrdb.com is a database for scene release reconstruction (SRR) files. This package supports searching releases, fetching file details with CRC32 checksums, retrieving NFO metadata, looking up IMDB information, downloading SRR/stored files, and parsing the SRR binary format to extract embedded files.
Create a client with New and call methods like Search, Details, NFO, IMDb, DownloadSRR, and DownloadFile. Use ParseSRR or ParseSRRReader to extract stored files from SRR binary data.
Index ¶
- Variables
- type APIError
- type Client
- func (c *Client) Details(ctx context.Context, releaseName string) (*DetailsResponse, error)
- func (c *Client) DownloadFile(ctx context.Context, releaseName, fileName string) ([]byte, error)
- func (c *Client) DownloadSRR(ctx context.Context, releaseName string) ([]byte, error)
- func (c *Client) IMDb(ctx context.Context, releaseName string) (*IMDbResponse, error)
- func (c *Client) NFO(ctx context.Context, releaseName string) (*NFOResponse, error)
- func (c *Client) Search(ctx context.Context, query string) (*SearchResponse, error)
- type DetailsResponse
- type FileInfo
- type IMDbEntry
- type IMDbResponse
- type NFOResponse
- type Option
- type SRRInfo
- type SearchResponse
- type SearchResult
- type StoredFile
Constants ¶
This section is empty.
Variables ¶
var ( // ErrReleaseNotFound is returned when a release does not exist on srrdb. ErrReleaseNotFound = errors.New("srrdb: release not found") // ErrRateLimited is returned when srrdb returns an HTML rate-limit page. ErrRateLimited = errors.New("srrdb: rate limited") // ErrInvalidSRR is returned when SRR data cannot be parsed. ErrInvalidSRR = errors.New("srrdb: invalid SRR data") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with the srrdb.com API.
func (*Client) Details ¶
Details fetches file listings for a release. Returns ErrReleaseNotFound if the release does not exist.
func (*Client) DownloadFile ¶
DownloadFile downloads a stored file (NFO, SFV, etc.) from a release. Returns the raw file bytes.
func (*Client) DownloadSRR ¶
DownloadSRR downloads the SRR binary for a release. Returns the raw SRR file bytes.
type DetailsResponse ¶
type DetailsResponse struct {
Name string `json:"name"`
Files []FileInfo `json:"files"`
ArchivedFiles []FileInfo `json:"archived-files"`
Adds []FileInfo `json:"adds"`
}
DetailsResponse holds file listings for a release.
type IMDbEntry ¶
type IMDbEntry struct {
IMDbID string `json:"imdb"`
Title string `json:"title"`
Rating string `json:"rating"`
Votes string `json:"votes"`
}
IMDbEntry holds IMDB data linked to a release.
type IMDbResponse ¶
IMDbResponse is the top-level response from the IMDB endpoint.
type NFOResponse ¶
type NFOResponse struct {
Release string `json:"release"`
NFO []string `json:"nfo"`
NFOLinks []string `json:"nfolink"`
}
NFOResponse holds NFO metadata for a release.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithBaseAPIURL ¶
WithBaseAPIURL overrides the API base URL (for testing).
func WithBaseWebURL ¶
WithBaseWebURL overrides the web base URL (for testing).
func WithHTTPClient ¶
WithHTTPClient sets a custom *http.Client.
func WithUserAgent ¶
WithUserAgent sets a custom User-Agent header.
type SRRInfo ¶
type SRRInfo struct {
AppName string
StoredFiles []StoredFile
}
SRRInfo holds parsed metadata from an SRR file.
type SearchResponse ¶
type SearchResponse struct {
Results []SearchResult `json:"results"`
ResultsCount int `json:"resultsCount"`
Warnings []string `json:"warnings"`
Query []string `json:"query"`
}
SearchResponse is the top-level response from the search endpoint.
type SearchResult ¶
type SearchResult struct {
Release string `json:"release"`
Date string `json:"date"`
HasNFO string `json:"hasNFO"`
HasSRS string `json:"hasSRS"`
IsForeign string `json:"isForeign"`
IMDbID string `json:"imdbId,omitempty"`
Size int64 `json:"size"`
}
SearchResult represents a single release from a search query.
type StoredFile ¶
StoredFile represents a file embedded inside an SRR archive.