Documentation ¶
Index ¶
- type Handle
- func (d *Handle) AddGroup(groupname string) (*types.Group, error)
- func (d *Handle) CreatePart(p *types.Part) error
- func (d *Handle) DisableGroup(groupname string) error
- func (d *Handle) FindBinaryByHash(hash string) (*types.Binary, error)
- func (d *Handle) FindBinaryByName(name string) (*types.Binary, error)
- func (d *Handle) FindGroupByName(name string) (*types.Group, error)
- func (d *Handle) FindPartByHash(hash string) (*types.Part, error)
- func (d *Handle) FindReleaseByHash(h string) (*types.Release, error)
- func (d *Handle) GetActiveGroups() ([]types.Group, error)
- func (d *Handle) GetAllGroups() ([]types.Group, error)
- func (d *Handle) GetCategories() ([]*types.DBCategory, error)
- func (d *Handle) MakeBinaries() error
- func (d *Handle) MakeReleases() error
- func (d *Handle) SavePartsAndMissedMessages(parts map[string]*types.Part, missed []types.MissedMessage) error
- func (d *Handle) SearchReleases(query string, offset, limit int, categories []types.Category) ([]types.Release, error)
- func (d *Handle) SearchReleasesByName(name string) ([]types.Release, error)
- type NameCleaner
- type RegexCleaner
- type ReleaseCleaner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
Handle Struct
func NewDBHandle ¶
NewDBHandle creates a new DBHandle
dbpath: the path to the database to use. verbose: when true database accesses are logged to stdout
func NewMemoryDBHandle ¶
NewMemoryDBHandle creates a new in memory database. Only used for testing. The name of the database is a random string so multiple tests can run in parallel with their own database. This will setup the database with the all the tables as well.
func (*Handle) DisableGroup ¶
DisableGroup sets the Active attribute to false.
func (*Handle) FindBinaryByHash ¶
FindBinaryByHash does what it says.
func (*Handle) FindBinaryByName ¶
FindBinaryByName does what it says.
func (*Handle) FindGroupByName ¶
FindGroupByName does what it says
func (*Handle) FindPartByHash ¶
FindPartByHash does what it says.
func (*Handle) FindReleaseByHash ¶
FindReleaseByHash returns
func (*Handle) GetActiveGroups ¶
GetActiveGroups returns all groups marked active in the db
func (*Handle) GetAllGroups ¶
GetAllGroups returns all groups
func (*Handle) GetCategories ¶
func (d *Handle) GetCategories() ([]*types.DBCategory, error)
GetCategories returns a sorted list of parent categories with their cubcategories populated.
func (*Handle) MakeBinaries ¶
MakeBinaries makes binaries using the nzedb approach
func (*Handle) MakeReleases ¶
MakeReleases searchs for complete binaries and create releases from them deleting the binaries in the process.
func (*Handle) SavePartsAndMissedMessages ¶
func (d *Handle) SavePartsAndMissedMessages(parts map[string]*types.Part, missed []types.MissedMessage) error
SavePartsAndMissedMessages saves a list of parts and missing message ids from an Overview call to the news server.
func (*Handle) SearchReleases ¶
func (d *Handle) SearchReleases(query string, offset, limit int, categories []types.Category) ([]types.Release, error)
SearchReleases does what it says. query is matched against the name of the Releases limit limits the number of returned releases to no more than that categories restricts the searched releases to be in those categories
type NameCleaner ¶
NameCleaner rewrites a given string based on it's regexes and a set of fallback rules.
func NewNameCleaner ¶
func NewNameCleaner(regexes []*types.Regex) *NameCleaner
NewNameCleaner returns a new NameCleaner. It will call Compile() on all given regexes.
func (*NameCleaner) Clean ¶
func (n *NameCleaner) Clean(name, groupname string) string
Clean will return a rewritten name.
type RegexCleaner ¶
RegexCleaner cleans strings based on it's regexes
func NewRegexCleaner ¶
func NewRegexCleaner(regexes []*types.Regex) (*RegexCleaner, error)
NewRegexCleaner returns a new RegexCleaner and compiles all the given Regexes
func (*RegexCleaner) Clean ¶
func (r *RegexCleaner) Clean(name, groupname string) string
Clean tries to rewrite the given name using it's regexes that match the given group.
type ReleaseCleaner ¶
type ReleaseCleaner struct {
RegexCleaner *RegexCleaner
}
ReleaseCleaner rewrites release names based on regexes and hard coded rules.
func NewReleaseCleaner ¶
func NewReleaseCleaner(regexes []*types.Regex) (*ReleaseCleaner, error)
NewReleaseCleaner returns a new ReleaseCleaner