rhimport

package
v0.0.0-...-a1d808b Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: GPL-3.0, GPL-3.0-or-later Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CART_MAX = 999999
	CUT_MAX  = 999
	// not sure if rdxport.cgi can handle filesizes > MAX(INT32)
	FILESIZE_MAX = (2 * 1024 * 1024 * 1024) - 1

	// TODO: make this configurable
	ARCHIV_HOST      = "bigmama.helsinki.at"
	ARCHIV_USER      = "rhimport"
	ARCHIV_BASE_PATH = "/srv/_nfs4_root_/archiv/ogg-flac"
)

Variables

This section is empty.

Functions

func Init

func Init(stdlog, dbglog *log.Logger)

func NewSessionStore

func NewSessionStore(conf *Config, db *rddb.DB, stdlog, dbglog *log.Logger) (store *sessionStore, err error)

func RemoveCart

func RemoveCart(cart uint, rdxportEndpoint, username, password string) (err error)

Types

type AttachmentChunk

type AttachmentChunk struct {
	Data  []byte
	Error error
}

type Config

type Config struct {
	ConfigFile      string
	RDXportEndpoint string
	TempDir         string
	LocalFetchDir   string
	SampleRate      uint
	ImportParamDefaults
}

func NewConfig

func NewConfig(configfile, rdxportEndpoint, tempDir, localFetchDir string) (conf *Config, err error)

type Context

type Context struct {
	UserName             string
	Password             string
	Trusted              bool
	ShowId               uint
	ClearShowCarts       bool
	ShowCarts            []uint
	GroupName            string
	Cart                 uint
	ClearCart            bool
	Cut                  uint
	Channels             uint
	NormalizationLevel   int
	AutotrimLevel        int
	UseMetaData          bool
	SourceUri            string
	AttachmentChan       chan AttachmentChunk
	FetchConverter       string
	ExtraMetaData        map[string]string
	OrigFilename         string
	Title                string
	WorkDir              string
	SourceFile           string
	SourceFilePolicy     FilePolicy
	LoudnessCorr         float64
	ProgressCallBack     ProgressCB
	ProgressCallBackData interface{}
	Cancel               <-chan bool
	// contains filtered or unexported fields
}

func NewContext

func NewContext(conf *Config, db *rddb.DB, stdlog, dbglog *log.Logger) *Context

func (*Context) CheckPassword

func (ctx *Context) CheckPassword() (bool, error)

func (*Context) CreateTempWorkDir

func (ctx *Context) CreateTempWorkDir() (err error)

func (*Context) RemoveTempWorkDir

func (ctx *Context) RemoveTempWorkDir()

func (*Context) SanityCheck

func (ctx *Context) SanityCheck() error

func (*Context) SwitchTempWorkDir

func (ctx *Context) SwitchTempWorkDir(newDir string)

type DoneCB

type DoneCB func(result Result, userdata interface{}) bool

type FilePolicy

type FilePolicy int
const (
	Delete FilePolicy = iota
	Keep
)

func (*FilePolicy) FromString

func (p *FilePolicy) FromString(str string) error

func (*FilePolicy) String

func (p *FilePolicy) String() string

type ImportParamDefaults

type ImportParamDefaults struct {
	Channels           uint
	NormalizationLevel int
	AutotrimLevel      int
	UseMetaData        bool
}

type ProgressCB

type ProgressCB func(step int, stepName string, current, total float64, title string, cart, cut uint, userdata interface{}) bool

type ProgressData

type ProgressData struct {
	Step     int
	StepName string
	Current  float64
	Total    float64
	Title    string
	Cart     uint
	Cut      uint
}

type Result

type Result struct {
	ResponseCode int
	ErrorString  string
	Cart         uint
	Cut          uint
	SourceFile   string
}

func FetchFile

func FetchFile(ctx *Context) (res *Result, err error)

func ImportFile

func ImportFile(ctx *Context) (res *Result, err error)

func NormalizeFile

func NormalizeFile(ctx *Context) (res *Result, err error)

type Session

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

func (*Session) AddDoneHandler

func (s *Session) AddDoneHandler(userdata interface{}, cb DoneCB) error

func (*Session) AddProgressHandler

func (s *Session) AddProgressHandler(userdata interface{}, cb ProgressCB) error

func (*Session) AttachUploader

func (s *Session) AttachUploader() (<-chan bool, chan<- AttachmentChunk)

func (*Session) Cancel

func (s *Session) Cancel()

func (*Session) Run

func (s *Session) Run(timeout time.Duration)

type SessionStore

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

func (*SessionStore) Get

func (store *SessionStore) Get(user, id string) (*Session, string, int, string)

func (*SessionStore) List

func (store *SessionStore) List(user, password string, trusted bool, userdata interface{}, cb SessionsUpdateCB) (map[string]string, int, string)

func (*SessionStore) New

func (store *SessionStore) New(ctx *Context, refId string) (string, *Session, int, string)

func (*SessionStore) Remove

func (store *SessionStore) Remove(user, id string) (int, string)

type SessionsListCB

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

type SessionsUpdateCB

type SessionsUpdateCB func(added, removed map[string]string, userdata interface{}) bool

Jump to

Keyboard shortcuts

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