Go library and CLI for interacting with srrdb.com — a database for scene release reconstruction (SRR) files.
go
sudo2k16 30bcb4d68b
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
ci/woodpecker/release/woodpecker Pipeline was successful
Fix: details --no-archive now hides RAR parts instead of archived content (#3)
Reviewed-on: #3
2026-03-25 20:24:22 +01:00
cmd/srrdb refactor: move CLI to internal/cli, add details --no-archive, nfo --view and -s shorthand (#1) 2026-03-25 14:12:26 +01:00
internal/cli Fix: details --no-archive now hides RAR parts instead of archived content (#3) 2026-03-25 20:24:22 +01:00
srrdb Initial release: Go library and CLI for srrdb.com 2026-03-22 13:27:29 +01:00
.gitignore Initial release: Go library and CLI for srrdb.com 2026-03-22 13:27:29 +01:00
.woodpecker.yaml Chore: add automatic changelog generation and CONTRIBUTING.md (#2) 2026-03-25 18:56:28 +01:00
CONTRIBUTING.md Chore: add automatic changelog generation and CONTRIBUTING.md (#2) 2026-03-25 18:56:28 +01:00
go.mod Initial release: Go library and CLI for srrdb.com 2026-03-22 13:27:29 +01:00
go.sum Initial release: Go library and CLI for srrdb.com 2026-03-22 13:27:29 +01:00
LICENSE Initial release: Go library and CLI for srrdb.com 2026-03-22 13:27:29 +01:00
README.md Initial release: Go library and CLI for srrdb.com 2026-03-22 13:27:29 +01:00

go-srrdb

Go library and CLI for interacting with srrdb.com — a database for scene release reconstruction (SRR) files.

Library

Install

go get codeberg.org/upPollo/go-srrdb

Usage

package main

import (
    "context"
    "fmt"

    "codeberg.org/upPollo/go-srrdb/srrdb"
)

func main() {
    client := srrdb.New()
    ctx := context.Background()

    // Search for releases
    results, _ := client.Search(ctx, "Interstellar 2014 1080p")
    for _, r := range results.Results {
        fmt.Println(r.Release, r.Date)
    }

    // Get release details (file listings with CRC32)
    details, _ := client.Details(ctx, "Interstellar.2014.1080p.BluRay.x264-SPARKS")
    for _, f := range details.ArchivedFiles {
        fmt.Printf("%s  %s\n", f.CRC, f.Name)
    }

    // Get IMDB info
    imdb, _ := client.IMDb(ctx, "Interstellar.2014.1080p.BluRay.x264-SPARKS")
    if len(imdb.Releases) > 0 {
        fmt.Printf("tt%s - %s\n", imdb.Releases[0].IMDbID, imdb.Releases[0].Title)
    }

    // Get NFO metadata
    nfo, _ := client.NFO(ctx, "Interstellar.2014.1080p.BluRay.x264-SPARKS")
    for _, name := range nfo.NFO {
        fmt.Println(name)
    }

    // Download a stored file (NFO, SFV)
    data, _ := client.DownloadFile(ctx, "Interstellar.2014.1080p.BluRay.x264-SPARKS", "sparks.nfo")
    fmt.Println(string(data))

    // Download and parse an SRR file
    srrData, _ := client.DownloadSRR(ctx, "Interstellar.2014.1080p.BluRay.x264-SPARKS")
    info, _ := srrdb.ParseSRR(srrData)
    for _, sf := range info.StoredFiles {
        fmt.Printf("%s (%d bytes)\n", sf.Name, len(sf.Data))
    }
}

Client Options

// Custom HTTP client (useful for proxies, timeouts, testing)
client := srrdb.New(srrdb.WithHTTPClient(myHTTPClient))

// Custom User-Agent
client := srrdb.New(srrdb.WithUserAgent("myapp/1.0"))

// Override base URLs (useful for testing with httptest)
client := srrdb.New(
    srrdb.WithBaseAPIURL("http://localhost:8080"),
    srrdb.WithBaseWebURL("http://localhost:8080"),
)

API Methods

Method Description
Search(ctx, query) Search for releases
Details(ctx, release) File listings with CRC32 checksums
NFO(ctx, release) NFO filenames and download links
IMDb(ctx, release) IMDB ID, title, rating, votes
DownloadSRR(ctx, release) Download raw SRR binary
DownloadFile(ctx, release, file) Download a stored file (NFO, SFV)

SRR Parser

Parse SRR files to extract embedded stored files (NFO, SFV, etc.):

info, err := srrdb.ParseSRR(data)
// or from an io.Reader:
info, err := srrdb.ParseSRRReader(reader)

fmt.Println(info.AppName)
for _, f := range info.StoredFiles {
    fmt.Printf("%s (%d bytes)\n", f.Name, len(f.Data))
}

Error Handling

details, err := client.Details(ctx, "Some.Release")
if errors.Is(err, srrdb.ErrReleaseNotFound) {
    // release doesn't exist on srrdb
}
if errors.Is(err, srrdb.ErrRateLimited) {
    // got an HTML response instead of JSON (rate limited)
}
var apiErr *srrdb.APIError
if errors.As(err, &apiErr) {
    fmt.Printf("HTTP %d from %s\n", apiErr.StatusCode, apiErr.Endpoint)
}

CLI

Install

go install codeberg.org/upPollo/go-srrdb/cmd/srrdb@latest

Commands

Search for releases:

$ srrdb search Interstellar 2014 1080p

Found 39 results

  RELEASE                                       DATE         SIZE
  -------                                       ----         ----
  Interstellar.2014.1080p.BluRay.x264-DAA       2015-03-15   14.31 GB
  Interstellar.2014.1080p.BluRay.x264-SPARKS    2015-01-26   10.00 GB
  ...

Show file details:

$ srrdb details Interstellar.2014.1080p.BluRay.x264-DAA

Release: Interstellar.2014.1080p.BluRay.x264-DAA

Stored Files (5):
  NAME                                              SIZE         CRC32
  ----                                              ----         -----
  daa-2014.a.space.odyssey-1080p.nfo                1.39 KB      5EA27675
  daa-2014.a.space.odyssey-1080p.sfv                2.72 KB      922C8B08
  ...

Archived Files (1):
  NAME                                              SIZE         CRC32
  ----                                              ----         -----
  Interstellar.2014.1080p.BluRay.x264-DAA.mkv       14.21 GB     15D5232D

Get IMDB info:

$ srrdb imdb Interstellar.2014.1080p.BluRay.x264-DAA

IMDB:     https://www.imdb.com/title/tt0816692/
Title:    Interstellar
Rating:   8.439
Votes:    34928

Show NFO metadata:

$ srrdb nfo Interstellar.2014.1080p.BluRay.x264-DAA

Release: Interstellar.2014.1080p.BluRay.x264-DAA

  daa-2014.a.space.odyssey-1080p.nfo
  -> https://www.srrdb.com/download/file/Interstellar.2014.1080p.BluRay.x264-DAA/daa-2014.a.space.odyssey-1080p.nfo

Download NFO to disk:

$ srrdb nfo --save Interstellar.2014.1080p.BluRay.x264-DAA
Saved: daa-2014.a.space.odyssey-1080p.nfo

Download SRR file:

$ srrdb fetch Interstellar.2014.1080p.BluRay.x264-DAA
Saved: Interstellar.2014.1080p.BluRay.x264-DAA.srr

Download and extract stored files from SRR:

$ srrdb fetch --extract Interstellar.2014.1080p.BluRay.x264-DAA
Extracted: daa-2014.a.space.odyssey-1080p.nfo (1.39 KB)
Extracted: daa-2014.a.space.odyssey-1080p.sfv (2.72 KB)

Download a specific file type:

$ srrdb fetch --file nfo Interstellar.2014.1080p.BluRay.x264-DAA
Saved: daa-2014.a.space.odyssey-1080p.nfo

Parse a local SRR file:

$ srrdb parse release.srr

Created by: ReScene .NET 0.5
Stored files: 3

  NAME                      SIZE
  ----                      ----
  release.nfo               1.39 KB
  release.sfv               2.72 KB
  Sample/release-sample.mkv 100.20 MB

Global Flags

Flag Description
--json Output as JSON
--timeout HTTP request timeout (default 30s)
-q, --quiet Suppress non-essential output

License

MIT