Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertEd2kHash32(srcHash []byte) [16]byte
- func CreateFile(fileName string) error
- func CreatePath(path string) error
- func GetConfigPath() string
- func GetEd2kLink(name string, size uint64, hash []byte) string
- func GetPrimaryKeywords(s string) ([]string, map[string]bool)
- func GetPrimaryKeywordsByKeyword(keyword string) []string
- func GetPrimaryKeywordsByPrimaryKeyword(keyword string) []string
- func IsChinese(c rune) bool
- func IsEnglishOrChinese(c rune) bool
- func IsYellow(name string) bool
- func Split2Keywords(s string) []string
- func Split2PrimaryKeywords(s string) []string
- func StripString(s string) string
- type Ed2kFileLink
- type FileInfo
- type Item
- type KeywordListNode
- type KeywordManager
- type MyKeyword
- type MyKeywordStruct
Constants ¶
const ( // Movie type Movie byte = 0 // SeasonTV is TV has season SeasonTV byte = 1 // NoSeasonTV is TV has no season NoSeasonTV byte = 2 // UnknownType x UnknownType byte = 255 )
Variables ¶
var HhjLog = logging.MustGetLogger("hhj")
HhjLog is HHJ system log
Functions ¶
func GetEd2kLink ¶
GetEd2kLink is getting ED2K link by file name, size and hash from eMule KAD network.
func GetPrimaryKeywords ¶
GetPrimaryKeywords is getting primary keyword slice and map via name Used for KAD search
func GetPrimaryKeywordsByKeyword ¶
GetPrimaryKeywordsByKeyword is get primary keywords by native keyword.
func GetPrimaryKeywordsByPrimaryKeyword ¶
GetPrimaryKeywordsByPrimaryKeyword is getting primary keywords via one primary keyword. Like 捉妖记2, we think primary keywords are 捉妖记 and 捉妖记2. Primary keyword is keyword in syntax.
func IsEnglishOrChinese ¶
IsEnglishOrChinese is char is English or Chinese.
func Split2Keywords ¶
Split2Keywords is split to slice of keyword by seperators.
func Split2PrimaryKeywords ¶
Split2PrimaryKeywords is split to slice of primary keyword by seperators. And keyword containing specific char not thinking as primary keyword.
func StripString ¶
StripString is for string cannot be legal file name or directory name at Windows. Not sure if it's same rule at Linux.
Types ¶
type Ed2kFileLink ¶
type Ed2kFileLink struct { FileInfo // attributes from ED2K Name string Size uint64 Avail uint32 Hash []byte }
Ed2kFileLink x
type FileInfo ¶
FileInfo x
func ToFileInfo ¶
ToFileInfo is converting file name from KAD or DHT via item from Internet(DouBan) @items: already sorted
type Item ¶
Item is getting from internet, e.g. DouBan
func FilterItems ¶
FilterItems is checking items from internet/database if satisfying user search keyword. We use NameKeywords, not PrimaryKeywords for accurate matching.
type KeywordListNode ¶
type KeywordListNode struct {
// contains filtered or unexported fields
}
KeywordListNode is list node of items mappting to keywords.
type KeywordManager ¶
type KeywordManager struct {
// contains filtered or unexported fields
}
KeywordManager is a manager for user search primary keywords mapping to items from DouBan. ///////////////////////////////////////////////////////////////////////////////////////////
func (*KeywordManager) Get ¶
func (m *KeywordManager) Get(keywords []string) []*Item
Get is getting items via @keywords
func (*KeywordManager) GetKeyStrs ¶
func (m *KeywordManager) GetKeyStrs() []string
GetKeyStrs is getting all key strings from least recently to most recently.
func (*KeywordManager) Set ¶
func (m *KeywordManager) Set(keywords []string, items []*Item)
Set supports appending.
type MyKeyword ¶
type MyKeyword struct { OrgKeywords []string // from user input SearchKeywords []string // search keywords of name, for DouBan search NameKeywords []string // keywords of name based on user input Season int // 0: all seasons for TV and movies }
MyKeyword is keyword in my system, low cases except @OrgKeywords
func NewMyKeyword ¶
NewMyKeyword is converting keywords from user to my format
type MyKeywordStruct ¶
type MyKeywordStruct struct { TargetKeywords []string // For KAD search MyKeyword *MyKeyword // from user Items []*Item // from Internet or database }
MyKeywordStruct is used for KAD search with multiple target keywords.
func NewMyKeywordStruct ¶
func NewMyKeywordStruct(myKeyword *MyKeyword, items []*Item) *MyKeywordStruct
NewMyKeywordStruct is created for KAD search.