base

package
v0.0.0-...-8b0f4ac Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2016 License: GPL-3.0 Imports: 7 Imported by: 5

Documentation

Overview

* from github.com/natefinch/pie

Index

Constants

View Source
const (
	AppName    string = "IsrafilCore"
	AppVersion uint   = 1
	APILevel   uint   = 1
)

AppName Name of the App, just for future possible name change APILevel The version of the universal music API. Just in case. AppVersion The version of Israfil Core

View Source
const (
	SrcNetease = 1
	SrcQQMusic = 2
	SrcXiami   = 3
	SrcKuwo    = 4
)

Variables

This section is empty.

Functions

func NewConsumer

func NewConsumer() *rpc.Client

NewConsumer returns an rpc.Client that will consume an API from the host process over this application's Stdin and Stdout using gob encoding.

func NewConsumerCodec

func NewConsumerCodec(f func(io.ReadWriteCloser) rpc.ClientCodec) *rpc.Client

NewConsumerCodec returns an rpc.Client that will consume an API from the host process over this application's Stdin and Stdout using the ClientCodec returned by f.

func StartProvider

func StartProvider(output io.Writer, path string, args ...string) (*rpc.Client, error)

StartProvider start a provider-style plugin application at the given path and args, and returns an RPC client that communicates with the plugin using gob encoding over the plugin's Stdin and Stdout. The writer passed to output will receive output from the plugin's stderr. Closing the RPC client returned from this function will shut down the plugin application.

func StartProviderCodec

func StartProviderCodec(
	f func(io.ReadWriteCloser) rpc.ClientCodec,
	output io.Writer,
	path string,
	args ...string,
) (*rpc.Client, error)

StartProviderCodec starts a provider-style plugin application at the given path and args, and returns an RPC client that communicates with the plugin using the ClientCodec returned by f over the plugin's Stdin and Stdout. The writer passed to output will receive output from the plugin's stderr. Closing the RPC client returned from this function will shut down the plugin application.

Types

type Album

type Album struct {
	AName   string
	AID     string
	APicURL string
	AURL    string
}

Album defines universal album structure

type Lyrics

type Lyrics struct {
	LURL string
}

Lyrics defines universal lyrics URL (Deprecated)

type Musician

type Musician struct {
	MName     string
	MID       string
	MURL      string
	MSongnum  uint
	MAlbumnum uint
	MPicURL   string
}

Musician defines universal Author struct

type SearchRet

type SearchRet struct {
	NumOfRes uint
	Songs    []Song
}

SearchRet SR

type Server

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

Server is a type that represents an RPC server that serves an API over stdin/stdout.

func NewProvider

func NewProvider() Server

NewProvider returns a Server that will serve RPC over this application's Stdin and Stdout. This method is intended to be run by the plugin application.

func StartConsumer

func StartConsumer(output io.Writer, path string, args ...string) (Server, error)

StartConsumer starts a consumer-style plugin application with the given path and args, writing its stderr to output. The plugin consumes an API this application provides. The function returns the Server for this host application, which should be used to register APIs for the plugin to consume.

func (Server) Close

func (s Server) Close() error

Close closes the connection with the client. If the client is a plugin process, the process will be stopped. Further communication using this Server will fail.

func (Server) Register

func (s Server) Register(rcvr interface{}) error

Register publishes in the provider the set of methods of the receiver value that satisfy the following conditions:

  • exported method
  • two arguments, both of exported type
  • the second argument is a pointer
  • one return value, of type error

It returns an error if the receiver is not an exported type or has no suitable methods. It also logs the error using package log. The client accesses each method using a string of the form "Type.Method", where Type is the receiver's concrete type.

func (Server) RegisterName

func (s Server) RegisterName(name string, rcvr interface{}) error

RegisterName is like Register but uses the provided name for the type instead of the receiver's concrete type.

func (Server) Serve

func (s Server) Serve()

Serve starts the Server's RPC server, serving via gob encoding. This call will block until the client hangs up.

func (Server) ServeCodec

func (s Server) ServeCodec(f func(io.ReadWriteCloser) rpc.ServerCodec)

ServeCodec starts the Server's RPC server, serving via the encoding returned by f. This call will block until the client hangs up.

type Song

type Song struct {
	SName           string
	SID             string
	UID             string
	SSingers        []Musician
	SAlbum          Album
	SSource         uint
	SOnly           bool
	SMp3URLs        []string
	SLLURLs         []string
	SPicURLs        []string
	SLyricsURLs     []string
	SURL            string
	SDevString      string
	SSlot1          string
	SSlot2          string
	SIsMp3Filled    bool
	SIsLyricsFilled bool
	SIsPicFilled    bool
	SIsAlbumFilled  bool
}

Song defines the main structure of universal song apis

func NewSong

func NewSong() *Song

Jump to

Keyboard shortcuts

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