model

package
v0.0.0-...-ca5c8a7 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: GPL-3.0 Imports: 18 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdatePin

func AddOrUpdatePin(session *xorm.Session, p *Pin) (e error)

AddOrUpdatePin ...

func AddOrUpdateUnfinished

func AddOrUpdateUnfinished(session *xorm.Session, unfin *Unfinished) (e error)

AddOrUpdateUnfinished ...

func AddOrUpdateVideo

func AddOrUpdateVideo(session *xorm.Session, video *Video, checkFn ...func(session *xorm.Session) *xorm.Session) (e error)

AddOrUpdateVideo ...

func AllPin

func AllPin(session *xorm.Session, limit int, start ...int) (pins *[]*Pin, e error)

AllPin find pins

func AllUnfinished

func AllUnfinished(session *xorm.Session, limit int, start ...int) (unfins *[]*Unfinished, e error)

AllUnfinished ...

func AllVideos

func AllVideos(session *xorm.Session, limit int, start ...int) (videos *[]*Video, e error)

AllVideos ...

func Checksum

func Checksum(filepath string) string

Checksum ...

func DeepFind

func DeepFind(session *xorm.Session, s string, videos *[]*Video) (e error)

DeepFind ...

func InitDB

func InitDB(db *DatabaseConfig) (eng *xorm.Engine, e error)

InitDB ...

func InitSQLite3

func InitSQLite3(name string) (eng *xorm.Engine, e error)

InitSQLite3 ...

func IsExist

func IsExist(session *xorm.Session, table interface{}) bool

IsExist ...

func MustDatabase

func MustDatabase(engine *xorm.Engine, err error) *xorm.Engine

MustDatabase ...

func MustSession

func MustSession(session *xorm.Session) *xorm.Session

MustSession ...

func PinHash

func PinHash(path path.Resolved) string

PinHash ...

func Register

func Register(name string, table interface{})

Register ...

func RegisterTable

func RegisterTable(v interface{})

RegisterTable ...

func SQLite3DB

func SQLite3DB(name string) string

SQLite3DB ...

func Sync

func Sync(db *xorm.Engine) (e error)

Sync ...

func Tables

func Tables() []interface{}

Tables ...

func Top

func Top(session *xorm.Session, limit int, start ...int) (videos *[]*Video, e error)

Top ...

func UpdatePinVideoID

func UpdatePinVideoID(session *xorm.Session, p *Pin) (e error)

UpdatePinVideoID ...

func Visited

func Visited(session *xorm.Session, video *Video) (err error)

Visited ...

Types

type DatabaseConfig

type DatabaseConfig struct {
	ShowSQL      bool   `toml:"show_sql"`
	ShowExecTime bool   `toml:"show_exec_time"`
	UseCache     bool   `json:"use_cache"`
	Type         string `toml:"type"`
	Addr         string `toml:"addr"`
	Port         string `toml:"port"`
	Username     string `toml:"username"`
	Password     string `toml:"password"`
	Schema       string `toml:"schema"`
	Charset      string `toml:"charset"`
	Prefix       string `toml:"prefix"`
	Loc          string `toml:"loc"`
	// contains filtered or unexported fields
}

DatabaseConfig ...

func DefaultDB

func DefaultDB() *DatabaseConfig

DefaultDB ...

func LoadDatabaseConfig

func LoadDatabaseConfig(path string) (db *DatabaseConfig)

LoadDatabaseConfig ...

func (*DatabaseConfig) Location

func (d *DatabaseConfig) Location() string

Location ...

func (*DatabaseConfig) SetLocation

func (d *DatabaseConfig) SetLocation(loc string)

SetLocation ...

func (*DatabaseConfig) Source

func (d *DatabaseConfig) Source() string

Source ...

type Model

type Model struct {
	ID        string     `xorm:"id pk"`
	CreatedAt time.Time  `xorm:"created_at created"`
	UpdatedAt time.Time  `xorm:"updated_at updated"`
	DeletedAt *time.Time `xorm:"deleted_at deleted"`
	Version   int        `xorm:"version"`
}

Model ...

func (*Model) BeforeInsert

func (m *Model) BeforeInsert()

BeforeInsert ...

type Modeler

type Modeler interface {
	GetID() string
	SetID(string)
	GetVersion() int
	SetVersion(int)
}

Modeler ...

type Pin

type Pin struct {
	Model    `xorm:"extends" json:"-"`
	PinHash  string `xorm:"pin_hash"`
	PeerID   string `xorm:"peer_id"`
	VideoID  string `xorm:"video_id"`
	IsPinned string `xorm:"is_pinned"` //TODO:status is now not used
}

Pin ...

func FindPin

func FindPin(session *xorm.Session, ph string) (pin *Pin, e error)

FindPin find one pin

type SourceInfo

type SourceInfo struct {
	Model            `xorm:"extends"`
	SourceInfoDetail `xorm:"extends"`
}

SourceInfo ...

type SourceInfoDetail

type SourceInfoDetail struct {
	ID              string   `xorm:"source_id" json:"id"`
	PublicKey       string   `json:"public_key"`
	Addresses       []string `xorm:"json" json:"addresses"` //一组节点源列表
	AgentVersion    string   `json:"agent_version"`
	ProtocolVersion string   `json:"protocol_version"`
}

SourceInfoDetail ...

type SourcePeer

type SourcePeer struct {
	Model            `xorm:"extends"`
	Index            int
	SourcePeerDetail `xorm:"extends"`
}

SourcePeer ...

type SourcePeerDetail

type SourcePeerDetail struct {
	Addr string `json:"addr"`
	Peer string `json:"peer"`
}

SourcePeerDetail ...

type Type

type Type string

Type ...

const TypeCaption Type = "caption"

TypeCaption caption file

const TypeOther Type = "other"

TypeOther ...

const TypePoster Type = "poster"

TypePoster ...

const TypeSlice Type = "slice"

TypeSlice ...

const TypeThumb Type = "thumb"

TypeThumb ...

const TypeVideo Type = "video"

TypeVideo ...

type Unfinished

type Unfinished struct {
	Model       `xorm:"extends"`
	Checksum    string       `xorm:"default() checksum"`            //sum值
	Type        Type         `xorm:"default() type"`                //类型
	Relate      string       `xorm:"default()" json:"relate"`       //关联信息
	Name        string       `xorm:"default() name"`                //名称
	Hash        string       `xorm:"default() hash"`                //哈希地址
	Sharpness   string       `xorm:"default()" json:"sharpness"`    //清晰度
	Caption     string       `xorm:"default()" json:"caption"`      //字幕
	Encrypt     bool         `json:"encrypt"`                       //加密
	Key         string       `xorm:"default()" json:"key"`          //秘钥
	M3U8        string       `xorm:"m3u8 default()" json:"m3u8"`    //M3U8名
	SegmentFile string       `xorm:"default()" json:"segment_file"` //ts切片名
	Sync        bool         `xorm:"notnull default(0)"`            //是否已同步
	Object      *VideoObject `xorm:"json" json:"object,omitempty"`  //视频信息
}

Unfinished 未分类

func FindUnfinished

func FindUnfinished(session *xorm.Session, checksum string) (unfin *Unfinished, e error)

FindUnfinished ...

func (*Unfinished) Clone

func (unfin *Unfinished) Clone() (n *Unfinished)

Clone ...

func (*Unfinished) GetID

func (unfin *Unfinished) GetID() string

GetID ...

func (*Unfinished) GetVersion

func (unfin *Unfinished) GetVersion() int

GetVersion ...

func (*Unfinished) SetID

func (unfin *Unfinished) SetID(s string)

SetID ...

func (*Unfinished) SetVersion

func (unfin *Unfinished) SetVersion(i int)

SetVersion ...

type Video

type Video struct {
	Model        `xorm:"extends" json:"-"`
	FindNo       string   `json:"-"`                              //查找号
	Bangumi      string   `xorm:"bangumi" json:"bangumi"`         //番組
	Intro        string   `xorm:"varchar(2048)" json:"intro"`     //简介
	Alias        []string `xorm:"json" json:"alias"`              //别名,片名
	ThumbHash    string   `xorm:"thumb_hash" json:"thumb_hash"`   //缩略图
	PosterHash   string   `xorm:"poster_hash" json:"poster_hash"` //海报地址
	SourceHash   string   `xorm:"source_hash" json:"source_hash"` //原片地址
	M3U8Hash     string   `xorm:"m3u8_hash" json:"m3u8_hash"`     //切片地址
	Key          string   `json:"-"`                              //秘钥
	M3U8         string   `xorm:"m3u8" json:"-"`                  //M3U8名
	Role         []string `xorm:"json" json:"role"`               //主演
	Director     string   `json:"-"`                              //导演
	Systematics  string   `json:"-"`                              //分级
	Season       string   `json:"-"`                              //季
	TotalEpisode string   `json:"-"`                              //总集数
	Episode      string   `json:"-"`                              //集数
	Producer     string   `json:"-"`                              //生产商
	Publisher    string   `json:"-"`                              //发行商
	Type         string   `json:"-"`                              //类型:film,FanDrama
	Format       string   `json:"format"`                         //输出格式:3D,2D,VR(VR格式:Half-SBS:左右半宽,Half-OU:上下半高,SBS:左右全宽)
	Language     string   `json:"-"`                              //语言
	Caption      string   `json:"-"`                              //字幕
	Group        string   `json:"-"`                              //分组
	Index        string   `json:"-"`                              //索引
	Date         string   `json:"-"`                              //发行日期
	Sharpness    string   `json:"sharpness"`                      //清晰度
	Visit        uint64   `json:"-" xorm:"notnull default(0)"`    //访问数
	Series       string   `json:"series"`                         //系列
	Tags         []string `xorm:"json" json:"tags"`               //标签
	Length       string   `json:"length"`                         //时长
	MagnetLinks  []string `json:"-"`                              //磁链
	Uncensored   bool     `json:"uncensored"`                     //有码,无码
}

Video ...

func FindVideo

func FindVideo(session *xorm.Session, ban string) (video *Video, e error)

FindVideo ...

func (*Video) Clone

func (v *Video) Clone() (n *Video)

Clone ...

func (*Video) GetID

func (v *Video) GetID() string

GetID ...

func (*Video) GetVersion

func (v *Video) GetVersion() int

GetVersion ...

func (*Video) SetID

func (v *Video) SetID(s string)

SetID ...

func (*Video) SetVersion

func (v *Video) SetVersion(i int)

SetVersion ...

type VideoGroup

type VideoGroup struct {
	Model       `xorm:"extends"`
	Index       string         `json:"index"`                        //索引
	Checksum    string         `json:"checksum"`                     //文件Hash
	Sliced      bool           `json:"sliced"`                       //切片
	Encrypt     bool           `json:"encrypt"`                      //加密
	Key         string         `json:"key"`                          //秘钥
	M3U8        string         `json:"m3u8"`                         //M3U8名
	SegmentFile string         `json:"segment_file"`                 //ts切片名
	Object      []*VideoObject `xorm:"json" json:"object,omitempty"` //视频信息
}

VideoGroup ...

type VideoLink struct {
	Hash string `json:"hash"`
	Name string `json:"name"`
	Size uint64 `json:"size"`
	Type int    `json:"type"`
}

VideoLink ...

func ObjectToVideoLink(obj *shell.Object) *VideoLink

ObjectToVideoLink ...

type VideoObject

type VideoObject struct {
	Links []*VideoLink `json:"links,omitempty"`
	Link  *VideoLink   `xorm:"extends"  json:",inline,omitempty"`
}

VideoObject ...

func (obj *VideoObject) ParseLinks(links []*shell.Object) *VideoLink

ParseLinks ...

Jump to

Keyboard shortcuts

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