Documentation
¶
Index ¶
- Constants
- Variables
- func IsPluginTypeValid(plugType string) bool
- func ListPlugins() map[string][]string
- func PluginRecover(plugName, funcName string)
- func RegisterPlugin(name string, plugin Plugin)
- func StartFolder(input Input)
- func StartScrapper(input Input)
- func StartTerm(input Input)
- type Controller
- type Input
- type Manager
- type Output
- type Plugin
- type Project
- type ProjectStore
- func (ps ProjectStore) AddScanToProject(name string, scan bson.ObjectID) error
- func (ps ProjectStore) DeleteProject(name string) error
- func (ps ProjectStore) GetProject(name string) (Project, error)
- func (ps ProjectStore) GetProjectList() ([]Project, error)
- func (ps ProjectStore) GetScan(id bson.ObjectID) (Scan, error)
- func (ps ProjectStore) NewProject(name string) (Project, error)
- func (ps ProjectStore) PrintProject(name string) error
- func (ps ProjectStore) SaveScan(project string, output *Output) error
- type Scan
- type SetupFunc
Constants ¶
const UserAgent = "The_Goca_v0.1"
UserAgent defines the UserAgent used by goca
Variables ¶
var ( // AppName is the Application name AppName string // AppVersion is the Application version AppVersion string )
var ( PS ProjectStore CurrentProject Project )
var ( // Topics is a list available event topics Topics = map[string]string{ "NewTarget": "topic:new:url", "NewOutput": "topic:new:output", } )
Functions ¶
func IsPluginTypeValid ¶
IsPluginTypeValid validates plugin against registered plugins
func PluginRecover ¶
func PluginRecover(plugName, funcName string)
func RegisterPlugin ¶
RegisterPlugin is a function that allows plugins to get registered in Goca
func StartFolder ¶
func StartFolder(input Input)
StartFolder is the Goca library entrypoint for folders
func StartScrapper ¶ added in v0.2.0
func StartScrapper(input Input)
StartScrapper is the Goca library entrypoint for the web scrapper TODO: v0.3.0 (core rewrite) This should been placed on other file/location
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller satisfy the Manager interface
func NewController ¶
func NewController(input Input) *Controller
func NewControllerTest ¶
func NewControllerTest() *Controller
func (*Controller) Publish ¶
func (c *Controller) Publish(topic string, args ...interface{})
func (*Controller) Subscribe ¶
func (c *Controller) Subscribe(topic string, fn interface{}) error
func (*Controller) SubscribeOnce ¶
func (c *Controller) SubscribeOnce(topic string, fn interface{}) error
func (*Controller) Unsubscribe ¶
func (c *Controller) Unsubscribe(topic string, fn interface{}) error
type Input ¶
type Input struct {
Term string
Domain string
URL string
ListURL bool
Folder string
FileType []string
PagesDork int
TimeOut int
UA string
Scrapper string
}
Input represents the command line arguments
type Manager ¶
type Manager interface {
Publish(string, ...interface{})
Subscribe(string, interface{}) error
SubscribeOnce(string, interface{}) error
Unsubscribe(string, interface{}) error
}
Manager represents what interface should satisfies a Goca controller
type Output ¶
type Output struct {
// MainType will set which kind of file represents the Output
MainType string `json:"main_type,omitempty"`
Target string `json:"target,omitempty"`
CreateDate string `json:"create_date,omitempty"`
ModifyDate string `json:"modify_date,omitempty"`
MetadataDate string `json:"metadata_date,omitempty"`
CreatorTool string `json:"creator_tool,omitempty"`
DocumentID string `json:"document_id,omitempty"`
InstanceID string `json:"instance_id,omitempty"`
ContentType string `json:"content_type,omitempty"`
Title string `json:"title,omitempty"`
Lang string `json:"lang,omitempty"`
Producer string `json:"producer,omitempty"`
Genre string `json:"genre,omitempty"`
Artist string `json:"artist,omitempty"`
AlbumArtist string `json:"album_artist,omitempty"`
Album string `json:"album,omitempty"`
Year string `json:"year,omitempty"`
Month string `json:"month,omitempty"`
Day string `json:"day,omitempty"`
Comment string `json:"comment,omitempty"`
Composer string `json:"composer,omitempty"`
Lyrics string `json:"lyrics,omitempty"`
Keywords string `json:"keywords,omitempty"`
Description string `json:"description,omitempty"`
ModifiedBy string `json:"modified_by,omitempty"`
Category string `json:"category,omitempty"`
DiscU int `json:"disc_u,omitempty"`
DiscD int `json:"disc_d,omitempty"`
DiscC int `json:"disc_c,omitempty"`
TrackU int `json:"track_u,omitempty"`
TrackD int `json:"track_d,omitempty"`
TrackC int `json:"track_c,omitempty"`
Duration string `json:"duration,omitempty"`
Version uint8 `json:"version,omitempty"`
FrameCount uint16 `json:"frame_count,omitempty"`
FrameRate float32 `json:"frame_rate,omitempty"`
ImageWidth float32 `json:"image_width,omitempty"`
ImageHeight float32 `json:"image_height,omitempty"`
Email string `json:"email,omitempty"`
}
Output is a flat structure which represents all possible values that Goca can extract. Each plugin will generate one Output per object processed
type ProjectStore ¶ added in v0.2.0
func OpenProjectStore ¶ added in v0.2.0
func OpenProjectStore() (ProjectStore, error)
Opens a Project Store
func (ProjectStore) AddScanToProject ¶ added in v0.2.0
func (ps ProjectStore) AddScanToProject(name string, scan bson.ObjectID) error
Adds an scan to an existing project
func (ProjectStore) DeleteProject ¶ added in v0.2.0
func (ps ProjectStore) DeleteProject(name string) error
Deletes an existing project
func (ProjectStore) GetProject ¶ added in v0.2.0
func (ps ProjectStore) GetProject(name string) (Project, error)
Obtain a project
func (ProjectStore) GetProjectList ¶ added in v0.2.0
func (ps ProjectStore) GetProjectList() ([]Project, error)
Obtain all projects
func (ProjectStore) GetScan ¶ added in v0.2.0
func (ps ProjectStore) GetScan(id bson.ObjectID) (Scan, error)
Gets an scan
func (ProjectStore) NewProject ¶ added in v0.2.0
func (ps ProjectStore) NewProject(name string) (Project, error)
Creates a new project
func (ProjectStore) PrintProject ¶ added in v0.2.0
func (ps ProjectStore) PrintProject(name string) error
Prints a project
