backend

package
v0.0.0-...-eb961a3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIRST_UPDATE_RATE          int   = 360  // min.
	DEFAULT_UPDATE_RATE        int   = 1440 // min.
	DEFAULT_CRAWLER_SCHEDULE   int64 = 60   // sec
	DEFAULT_INDEXER_SCHEDULE   int64 = 60   // sec
	DEFAULT_UPDATE_BATCH       int   = 50   // how many podcasts to update per crawler run
	DEFAULT_INDEX_UPDATE_BATCH int   = 1000 // how many podcasts or episodes to send to elasicsearch each batch
	MAX_ERRORS                 int   = 4
	SEARCH_REVISION            int   = 1
)
View Source
const (
	BACKEND_VERSION string = "0.1.0"
)

Variables

This section is empty.

Functions

func BulkSubmitPodcastFeed

func BulkSubmitPodcastFeed(urls []string) (int, error)

func IndexAdd

func IndexAdd(uid string, url string) error

func IndexBackoff

func IndexBackoff(uid string) (bool, error)

func IndexUpdate

func IndexUpdate(uid string) error

func JsonApiArrayResponse

func JsonApiArrayResponse(w rest.ResponseWriter, models []interface{}) error

func JsonApiErrorResponse

func JsonApiErrorResponse(w rest.ResponseWriter, code string, message string, err error)

func JsonApiResponse

func JsonApiResponse(w rest.ResponseWriter, model interface{}) error

func LogSearchString

func LogSearchString(s string)

func Response

func Response(w rest.ResponseWriter, model interface{}) error

func StatusResponse

func StatusResponse(w rest.ResponseWriter, status int)

func SubmitPodcastFeed

func SubmitPodcastFeed(feed string) error

Types

type ApiStats

type ApiStats struct {
	Version  string `json:"version"`
	Podcasts int    `json:"podcasts"`
	Episodes int    `json:"episodes"`
}

func SimpleApiStats

func SimpleApiStats() (*ApiStats, error)

type Episode

type Episode struct {
	Uid         string `jsonapi:"primary,episode"`
	PodcastUid  string `jsonapi:"attr,puid"`
	Title       string `jsonapi:"attr,title"`
	Url         string `jsonapi:"attr,url"`
	Description string `jsonapi:"attr,description"`
	Published   int64  `jsonapi:"attr,published"`
	Duration    int64  `jsonapi:"attr,duration"`
	Author      string `jsonapi:"attr,author"`
	AssetUrl    string `jsonapi:"attr,asset_url"`
	AssetType   string `jsonapi:"attr,asset_type"`
	AssetSize   int    `jsonapi:"attr,asset_size"`
}

type EpisodeMetadata

type EpisodeMetadata struct {
	Uid         string `json:"uid"`
	Title       string `json:"title"`
	Url         string `json:"url"`
	Description string `json:"description"`
	Published   int64  `json:"published"`
	Duration    int64  `json:"duration"`
	Author      string `json:"author"`
	AssetUrl    string `json:"asset_url"`
	AssetType   string `json:"asset_type"`
	AssetSize   int    `json:"asset_size"`

	PodcastUid string `json:"puid"`
	Version    int    `json:"version"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

func EpisodeLookup

func EpisodeLookup(uid string) *EpisodeMetadata

func PodcastLookupAllEpisodes

func PodcastLookupAllEpisodes(uid string) []*EpisodeMetadata

func PodcastLookupLatestEpisode

func PodcastLookupLatestEpisode(uid string) *EpisodeMetadata

type Error

type Error struct {
	Id     string `json:"id"`
	Status string `json:"status"`
	Code   string `json:"code"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

type JsonApiError

type JsonApiError struct {
	Errors *[]Error `json:"errors"`
}

type Podcast

type Podcast struct {
	Uid         string `jsonapi:"primary,podcast"`
	Title       string `jsonapi:"attr,title"`
	Subtitle    string `jsonapi:"attr,subtitle"`
	Url         string `jsonapi:"attr,url"`
	Feed        string `jsonapi:"attr,feed"`
	Description string `jsonapi:"attr,description"`
	Published   int64  `jsonapi:"attr,published"`
	Language    string `jsonapi:"attr,language"`
	ImageUrl    string `jsonapi:"attr,image_url"`
	OwnerName   string `jsonapi:"attr,owner_name"`
	OwnerEmail  string `jsonapi:"attr,owner_email"`

	Episodes []*Episode `jsonapi:"relation,episodes"`
}

type PodcastIndex

type PodcastIndex struct {
	Uid        string `json:"uid"`
	Feed       string `json:"feed"`
	UpdateRate int    `json:"update_rate"` // update rate in minutes
	Next       int64  `json:"next"`        // next scheduled update (unix time)
	N          int64  `json:"n"`
	Errors     int    `json:errors`
	Created    int64  `json:"created"`
	Updated    int64  `json:"updated"`
}

func IndexLookup

func IndexLookup(uid string) *PodcastIndex

type PodcastMetadata

type PodcastMetadata struct {
	Uid         string `json:"uid"`
	Title       string `json:"title"`
	Subtitle    string `json:"subtitle"`
	Url         string `json:"url"`
	Feed        string `json:"feed"`
	Description string `json:"description"`
	Published   int64  `json:"published"`
	Language    string `json:"language"`
	ImageUrl    string `json:"image_url"`
	OwnerName   string `json:"owner_name"`
	OwnerEmail  string `json:"owner_email"`
	Tags        string `json:"tags"`

	Score1  int64 `json:"score1"` // scores, not defined yet
	Score2  int64 `json:"score2"`
	Score3  int64 `json:"score3"`
	Version int   `json:"version"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

func PodcastLookup

func PodcastLookup(uid string) *PodcastMetadata

type Resource

type Resource struct {
	Id         string                 `json:"id"`
	Type       string                 `json:"type"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

type SearchKeyword

type SearchKeyword struct {
	Word      string `json:"word"`
	Frequency int64  `json:"frequency"`
}

type SearchTerm

type SearchTerm struct {
	Term    string `json:"term"`
	Created int64  `json:"created"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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