browser

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefLimit = 30
View Source
const (
	HOST = "all.api.radio-browser.info"
)

Variables

View Source
var ServerErrMsg = errors.New("Server response not available")

Functions

This section is empty.

Types

type Api

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

func NewApi

func NewApi(ctx context.Context, cfg *config.Value) (*Api, error)

func (*Api) GetCountries added in v0.2.0

func (a *Api) GetCountries(ctx context.Context) ([]Country, error)

func (*Api) GetLanguages added in v0.2.0

func (a *Api) GetLanguages(ctx context.Context) ([]Language, error)

func (*Api) GetStations

func (a *Api) GetStations(ctx context.Context, uuids []string) ([]Station, error)

func (*Api) Search added in v0.1.2

func (a *Api) Search(ctx context.Context, s SearchParams) ([]Station, error)

func (*Api) StationCounter added in v0.2.4

func (a *Api) StationCounter(ctx context.Context, uuid string) error

func (*Api) StationVote added in v0.3.0

func (a *Api) StationVote(ctx context.Context, uuid string) error

func (*Api) TopStations

func (a *Api) TopStations(ctx context.Context) ([]Station, error)

type ClickCounterResponse

type ClickCounterResponse struct {
	Ok          string `json:"ok"`
	Message     string `json:"message"`
	Stationuuid string `json:"stationuuid"`
	Name        string `json:"name"`
	URL         string `json:"url"`
}

type Country

type Country struct {
	Name         string `json:"name"`
	ISO3166_1    string `json:"iso_3166_1"`
	Stationcount int    `json:"stationcount"`
}

type Language

type Language struct {
	Name         string `json:"name"`
	ISO639       string `json:"iso_639"`
	Stationcount int    `json:"stationcount"`
}

type OrderBy added in v0.2.1

type OrderBy string
const (
	Votes         OrderBy = "votes"      // Number of votes for this station. This number is by server and only ever increases. It will never be reset to 0.
	Clickcount    OrderBy = "clickcount" // Clicks within the last 24 hours
	Clicktrend    OrderBy = "clicktrend" // The difference of the clickcounts within the last 2 days. Posivite values mean an increase, negative a decrease of clicks.
	Bitrate       OrderBy = "bitrate"
	Name          OrderBy = "name"
	Tags          OrderBy = "tags"
	CountryOrder  OrderBy = "country"
	LanguageOrder OrderBy = "language"
	Codec         OrderBy = "codec"
	Random        OrderBy = "random"
)

type SearchParams

type SearchParams struct {
	Name     string
	TagList  string
	Country  string
	State    string
	Language string
	Limit    int
	Order    OrderBy
	Reverse  bool

	Offset int
}

func DefaultSearchParams added in v0.1.2

func DefaultSearchParams() SearchParams

type ServerMirror

type ServerMirror struct {
	IP   string `json:"ip"`
	Name string `json:"name"`
}

type Station

type Station struct {
	// A globally unique identifier for the change of the station information
	Changeuuid string `json:"changeuuid"`

	// A globally unique identifier for the station
	Stationuuid string `json:"stationuuid"`

	Serveruuid interface{} `json:"serveruuid"`

	// 	The name of the station
	Name string `json:"name"`

	// The stream URL provided by the user
	URL string `json:"url"`

	// An automatically "resolved" stream URL. Things resolved are playlists (M3U/PLS/ASX...), HTTP redirects (Code 301/302).
	// This link is especially usefull if you use this API from a platform that is not able to do a resolve on its own (e.g. JavaScript in browser)
	// or you just don't want to invest the time in decoding playlists yourself.
	URLResolved string `json:"url_resolved"`

	// URL to the homepage of the stream, so you can direct the user to a page with more information about the stream.
	Homepage string `json:"homepage"`

	Favicon string `json:"favicon"`

	// Tags of the stream with more information about it
	Tags string `json:"tags"`

	//  	DEPRECATED: use countrycode instead, full name of the country. Currently it is autogenerated from the countrycode.
	Country string `json:"country"`

	// Official countrycodes as in ISO 3166-1 alpha-2
	Countrycode string `json:"countrycode"`

	//"US-NY"
	ISO3166_2 interface{} `json:"iso_3166_2"`

	State string `json:"state"`

	// string, multivalue, split by comma 	Languages that are spoken in this stream.
	Language string `json:"language"`

	// Languages that are spoken in this stream by code ISO 639-2/B
	Languagecodes string `json:"languagecodes"`

	// Number of votes for this station. This number is by server and only ever increases. It will never be reset to 0.
	Votes int64 `json:"votes"`

	Lastchangetime string `json:"lastchangetime"`

	LastchangetimeIso8601 string `json:"lastchangetime_iso8601"`

	Codec string `json:"codec"`

	Bitrate int64 `json:"bitrate"`

	HLS int64 `json:"hls"`

	Lastcheckok int64 `json:"lastcheckok"`

	Lastchecktime string `json:"lastchecktime"`

	LastchecktimeIso8601 string `json:"lastchecktime_iso8601"`

	Lastcheckoktime string `json:"lastcheckoktime"`

	LastcheckoktimeIso8601 string `json:"lastcheckoktime_iso8601"`

	Lastlocalchecktime string `json:"lastlocalchecktime"`

	LastlocalchecktimeIso8601 string `json:"lastlocalchecktime_iso8601"`

	Clicktimestamp string `json:"clicktimestamp"`

	ClicktimestampIso8601 string `json:"clicktimestamp_iso8601"`

	Clickcount int64 `json:"clickcount"`

	Clicktrend int64 `json:"clicktrend"`

	SSLError int64 `json:"ssl_error"`

	GeoLat interface{} `json:"geo_lat"`

	GeoLong interface{} `json:"geo_long"`

	HasExtendedInfo bool `json:"has_extended_info"`
}

func (Station) Description

func (s Station) Description() string

func (Station) FilterValue

func (s Station) FilterValue() string

func (Station) Title

func (s Station) Title() string

type StationTag

type StationTag struct {
	Name         string `json:"name"`
	Stationcount string `json:"stationcount"`
}

Jump to

Keyboard shortcuts

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