com

package
v0.0.0-...-2d6549b Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var HhjLog = logging.MustGetLogger("hhj")

HhjLog is HHJ system log

Functions

func ConvertEd2kHash32

func ConvertEd2kHash32(srcHash []byte) [16]byte

ConvertEd2kHash32 x

func CreateFile

func CreateFile(fileName string) error

CreateFile x

func CreatePath

func CreatePath(path string) error

CreatePath x

func GetConfigPath

func GetConfigPath() string

GetConfigPath x

func GetEd2kLink(name string, size uint64, hash []byte) string

GetEd2kLink is getting ED2K link by file name, size and hash from eMule KAD network.

func GetPrimaryKeywords

func GetPrimaryKeywords(s string) ([]string, map[string]bool)

GetPrimaryKeywords is getting primary keyword slice and map via name Used for KAD search

func GetPrimaryKeywordsByKeyword

func GetPrimaryKeywordsByKeyword(keyword string) []string

GetPrimaryKeywordsByKeyword is get primary keywords by native keyword.

func GetPrimaryKeywordsByPrimaryKeyword

func GetPrimaryKeywordsByPrimaryKeyword(keyword string) []string

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 IsChinese

func IsChinese(c rune) bool

IsChinese x

func IsEnglishOrChinese

func IsEnglishOrChinese(c rune) bool

IsEnglishOrChinese is char is English or Chinese.

func IsYellow

func IsYellow(name string) bool

IsYellow is to check if name has sex info or not.

func Split2Keywords

func Split2Keywords(s string) []string

Split2Keywords is split to slice of keyword by seperators.

func Split2PrimaryKeywords

func Split2PrimaryKeywords(s string) []string

Split2PrimaryKeywords is split to slice of primary keyword by seperators. And keyword containing specific char not thinking as primary keyword.

func StripString

func StripString(s string) string

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 struct {
	FileInfo

	// attributes from ED2K
	Name  string
	Size  uint64
	Avail uint32
	Hash  []byte
}

Ed2kFileLink x

func (f *Ed2kFileLink) GetEd2kLink() string

GetEd2kLink x

func (*Ed2kFileLink) GetHash

func (f *Ed2kFileLink) GetHash() [16]byte

GetHash x

func (*Ed2kFileLink) GetPrintStr

func (f *Ed2kFileLink) GetPrintStr() string

GetPrintStr x

func (*Ed2kFileLink) ToJSON

func (f *Ed2kFileLink) ToJSON() []byte

ToJSON x

type FileInfo

type FileInfo struct {
	Type    byte
	OrgName string
	ChName  string
	Season  int
	Episode int
}

FileInfo x

func ToFileInfo

func ToFileInfo(name string, items []*Item) *FileInfo

ToFileInfo is converting file name from KAD or DHT via item from Internet(DouBan) @items: already sorted

type Item

type Item struct {
	Type        byte
	OrgName     string
	ChName      string
	OtherChName string
}

Item is getting from internet, e.g. DouBan

func FilterItems

func FilterItems(m []*Item, myKeyword *MyKeyword) []*Item

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 NewKeywordManager

func NewKeywordManager() *KeywordManager

NewKeywordManager x

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

func NewMyKeyword(keywords []string) *MyKeyword

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.

Jump to

Keyboard shortcuts

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