srrdb

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2022 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Overview

Package srrdb allows to download & upload SRR files from srrdb.com and to access their search API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(dirname string) ([]byte, error)

Download will return a SRR file by dirname.

func NewLoginCookieJar

func NewLoginCookieJar(u, p string) (*cookiejar.Jar, error)

NewLoginCookieJar tries to login with the provided username and password and returns a cookie jar on success. You can store this jar, just take a look at the expiration date.

func UploadStoredFile

func UploadStoredFile(fp, dirname, folder string, jar *cookiejar.Jar) (string, error)

UploadStoredFile will upload a stored file into a folder of a provided release to the srrdb. You must provide a valid login with a cookie jar, see NewLoginCookieJar().

Types

type SRRUploadResponse

type SRRUploadResponse struct {
	Files []SRRUploadedFile `json:"files"`
}

UploadResponse holds the results of a file upload.

func UploadSRRs

func UploadSRRs(fps []string, jar *cookiejar.Jar) (SRRUploadResponse, error)

UploadSRRs will upload one or more SRR files to the srrdb. You can provide a login with a cookie jar, see NewLoginCookieJar().

type SRRUploadedFile

type SRRUploadedFile struct {
	Dirname string `json:"name"`
	Color   int    `json:"color"`
	Message string `json:"message"`
}

UploadedFile is the result of a file upload.

type SearchResponse

type SearchResponse struct {
	Results     []SearchResult `json:"results"`
	ResultCount int            `json:"resultsCount"`
	Warnings    []string       `json:"warnings"`
	Query       []string       `json:"query"`
}

SearchResponse holds the results of a search.

func Search(query string) (SearchResponse, error)

Search will request the srrdb search API with the provided query and return their response. For a list of available keywords see http://www.srrdb.com/help#keywords

type SearchResult

type SearchResult struct {
	Dirname        string `json:"release"`
	DateResponse   string `json:"date"` // f.e. 2014-06-16 17:35:26
	HasNFOResponse string `json:"hasNFO"`
	HasSRSResponse string `json:"hasSRS"`
}

SearchResult is the result of a search.

func (*SearchResult) HasNFO

func (r *SearchResult) HasNFO() bool

HasNFO will return if the search-result has a NFO file.

func (*SearchResult) HasSRS

func (r *SearchResult) HasSRS() bool

HasSRS will return if the search-result has a SRS file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL