osdb

package
v0.0.0-...-e0fbffd Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OsdbApiKeyFlag       = "osdb-api-key"
	OsdbApiUserAgentFlag = "osdb-api-user-agent"
	OsdbApiURLFlag       = "osdb-api-url"
	OsdbUser             = "osdb-user"
	OsdbPass             = "osdb-pass"
)

Variables

This section is empty.

Functions

func RegisterOSDBClientFlags

func RegisterOSDBClientFlags(c *cli.App)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c *cli.Context, cl *http.Client) *Client

func (*Client) DownloadSubtitle

func (s *Client) DownloadSubtitle(ctx context.Context, id int, format string) (d []byte, err error)

func (*Client) SearchSubtitles

func (s *Client) SearchSubtitles(ctx context.Context, u string) (subs []Subtitle, err error)

func (*Client) SearchSubtitlesByHash

func (s *Client) SearchSubtitlesByHash(ctx context.Context, hash string) (subs []Subtitle, err error)

func (*Client) SearchSubtitlesByIMDB

func (s *Client) SearchSubtitlesByIMDB(ctx context.Context, id string) (subs []Subtitle, err error)

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	User struct {
		AllowedDownloads    int    `json:"allowed_downloads"`
		AllowedTranslations int    `json:"allowed_translations"`
		Level               string `json:"level"`
		UserId              int    `json:"user_id"`
		ExtInstalled        bool   `json:"ext_installed"`
		Vip                 bool   `json:"vip"`
	} `json:"user"`
	BaseUrl string `json:"base_url"`
	Token   string `json:"token"`
	Status  int    `json:"status"`
}

type Subtitle

type Subtitle struct {
	Id         string `json:"id"`
	Type       string `json:"type"`
	Attributes struct {
		SubtitleId        string    `json:"subtitle_id"`
		Language          string    `json:"language"`
		DownloadCount     int       `json:"download_count"`
		NewDownloadCount  int       `json:"new_download_count"`
		HearingImpaired   bool      `json:"hearing_impaired"`
		Hd                bool      `json:"hd"`
		Fps               float64   `json:"fps"`
		Votes             int       `json:"votes"`
		Points            int       `json:"points"`
		Ratings           float64   `json:"ratings"`
		FromTrusted       bool      `json:"from_trusted"`
		ForeignPartsOnly  bool      `json:"foreign_parts_only"`
		AiTranslated      bool      `json:"ai_translated"`
		MachineTranslated bool      `json:"machine_translated"`
		UploadDate        time.Time `json:"upload_date"`
		Release           string    `json:"release"`
		Comments          string    `json:"comments"`
		LegacySubtitleId  int       `json:"legacy_subtitle_id"`
		Uploader          struct {
			UploaderId int    `json:"uploader_id"`
			Name       string `json:"name"`
			Rank       string `json:"rank"`
		} `json:"uploader"`
		FeatureDetails struct {
			FeatureId   int    `json:"feature_id"`
			FeatureType string `json:"feature_type"`
			Year        int    `json:"year"`
			Title       string `json:"title"`
			MovieName   string `json:"movie_name"`
			ImdbId      int    `json:"imdb_id"`
			TmdbId      int    `json:"tmdb_id"`
		} `json:"feature_details"`
		Url          string `json:"url"`
		RelatedLinks []struct {
			Label  string `json:"label"`
			Url    string `json:"url"`
			ImgUrl string `json:"img_url"`
		} `json:"related_links"`
		Files []struct {
			FileId   int    `json:"file_id"`
			CdNumber int    `json:"cd_number"`
			FileName string `json:"file_name"`
		} `json:"files"`
	} `json:"attributes"`
}

type SubtitleDownloadRequest

type SubtitleDownloadRequest struct {
	FileID    int    `json:"file_id"`
	SubFormat string `json:"sub_format,omitempty"`
}

type SubtitleDownloadResponse

type SubtitleDownloadResponse struct {
	Link         string    `json:"link"`
	FileName     string    `json:"file_name"`
	Requests     int       `json:"requests"`
	Remaining    int       `json:"remaining"`
	Message      string    `json:"message"`
	ResetTime    string    `json:"reset_time"`
	ResetTimeUtc time.Time `json:"reset_time_utc"`
}

type SubtitleSearchResponse

type SubtitleSearchResponse struct {
	TotalPages int        `json:"total_pages"`
	TotalCount int        `json:"total_count"`
	Page       int        `json:"page"`
	Data       []Subtitle `json:"data"`
}

Jump to

Keyboard shortcuts

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