app

package
v0.0.0-...-b21714d Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IVOOX_AUDIO_ML    = "http://www.ivoox.com/listen_mn_id_1.m4a?internal=HTML5"
	IVOOX_AUDIO_ID_RE = `(?m)var\s+idaudio\s+=\s+(\d+)`
)
View Source
const (
	IVOOX_HOST          = "www.ivoox.com"
	IVOOX_ORIGINALS_URL = "ivoox.com/originals"
	IVOOX_RE_GENERATOR  = `(?m)<generator>iVoox<\/generator>`
	IVOOX_RE_ENCLOSURE  = `(?m)<enclosure\s+url="\S+"\s+type="audio/mpeg"\s+length="(\d+)"/>`
	ENCLOSURE_TPL       = "<enclosure url=\"%s\" type=\"audio/mpeg\" length=\"%s\"/>"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	BaseURL  string
	User     string
	Password string
	// contains filtered or unexported fields
}

App ivoox proxy entry point.

func NewApp

func NewApp(baseURL string, user string, password string) *App

NewApp Creates a new instance of ivoox proxy

func (*App) Err

func (a *App) Err(format string, vars ...interface{})

func (*App) HandleError

func (a *App) HandleError(w http.ResponseWriter, status int, msg string)

HandleError Generates an error reponse based on the status code and a custom message.

func (*App) Log

func (a *App) Log(format string, vars ...interface{})

func (*App) ServeHTTP

func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP Starts the server.

func (*App) Warn

func (a *App) Warn(format string, vars ...interface{})

type Feed

type Feed struct {
	IsIvooxOriginals bool
	UserInfo         *url.Userinfo
	BaseURL          string
	// contains filtered or unexported fields
}

Feed Contains the feed url, the parsed RSS feed and the modified output.

func NewFeed

func NewFeed(content string, r *http.Request) (*Feed, error)

NewFeed Creates a new feed based on a string.

func (*Feed) Patch

func (f *Feed) Patch() string

String This is a bit trickier than expected. gofeed does not allow to export to XML, only to JSON. This is a problem as we want to keep the XML output but we don't want to reimplement the whole RSS parser.

The hack consists on using the parsed version to generate the URL and later replace them in the right order in the original RSS. It is ugly, but it works and it is better than reimplmenting the library.

Jump to

Keyboard shortcuts

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