seed

package module
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: 27 Imported by: 0

README

SEED

シードはIPFSを利用して、ヴィデオをアップして、内容の索引を作ってツールです。

アテンション: 番号捜索のみ使用すれば、TelegramGroupを入れって、

/video 番号 

を使って、番号を捜索してください。

或いは、Telegramのローボード@yinhe_botを使いって、

/video 番号 

を使って、番号を捜索してください。

SEEDの使い方法:

SEED process //seed.jsonを読み出して、ipfsネートをアップします。

SEED pin 番号 //番号を探して、IPFSネートにPINをします。番号を入力しなければ、全ての番号PINをします。

SEED transfer //DBからjsonファイルへ転換する。

SEED update //jsonファイルを読み出して、ビデオの紹介を更新します。

JSONファイルのExample:

[
 [
   {
     "bangumi": "video",
     "alias": [
       "video1"
     ],
     "slice": true,
     "files": [
       "D:\\video\\Okita Souji.mp4",
     ],
     "Sharpness": "1080P",
     "poster_path": "D:\\video\\H\\p2526321708.webp",
     "role": [
       ""
     ],
     "publish": "2018-01-20"
   },
   ...
]

処理完了のJSONファイル:

[
    {
        "bangumi": "avvd01312",
        "type": "",
        "output": "",
        "vr": "",
        "thumb": "",
        "intro": "",
        "alias": [
            "Lady Ninja: Aoi kage",
            "极乐女忍者"
        ],
        "language": "",
        "caption": "",
        "poster": "QmZPAqK6Hc2pwrmU3mPJLdMUGpTadaBhN8vFwJ9ay2ULBe",
        "role": [
            "叶加濑麻衣",
            "赤井沙希",
            "鸟肌实",
            "坂口征夫",
            "阿部祐二"
        ],
        "director": "",
        "season": "",
        "Episode": "",
        "TotalEpisode": "",
        "sharpness": "",
        "group": "",
        "publish": "2018-01-20",
        "video_group_list": [],
        "source_info_list": [
            {
                "id": "QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                "public_key": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC/voc3C3ZpdTuudhWcZIje7M2gE/V3Av33bUXqhaThmd/MVQZ1CVkzWSJmuYiv7Lq+Uop+pGwF2lKuNQ0xm3YeQrDTOgBkR2Gv8rF69VFdk1olIsFB7XvXwhpREP/l0BZ0u8hYML/gaePzDGpSXRSQi/tzgAbCwirhr18Vd+bh5VuaNcsT/hyCWxJv+uvPCnrrfBrViT7T6w+Oo2fcu8BhbyngBbT01aIhHwFbxuDuMHHDUhi6WvH5k3QPbEp9VNcLXmSiS6Lxvy/5tpUeBOosS99HtiWfswlOOJcjj0jfyMMcPXNgJNLfcoFw+idxW8aUgGnpTS0fixEEa0lk0Kz3AgMBAAE=",
                "addresses": [
                    "/ip4/10.0.75.1/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip4/169.254.112.168/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip4/169.254.206.232/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip4/169.254.248.113/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip4/192.168.1.47/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip4/169.254.55.142/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip4/127.0.0.1/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip4/172.29.42.81/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba",
                    "/ip6/::1/tcp/4001/ipfs/QmQwp6XEcXauaiBjt3bUsSwcy7SomtE5ve74YRVfi2vCba"
                ],
                "agent_version": "go-ipfs/0.4.19-dev/",
                "protocol_version": "ipfs/0.1.0"
            }
        ]
    },
    ...
]

Documentation

Index

Constants

View Source
const TimeOutLimit = 5 * time.Second

Variables

This section is empty.

Functions

func APICallback

func APICallback(v interface{}, cb APICallbackFunc) (Stepper, APICaller)

APICallback ...

func AddDir

func AddDir(api *API, dir string) (path.Resolved, error)

AddDir ...

func AddFile

func AddFile(api *API, filename string) (path.Resolved, error)

AddFile ...

func DatabaseCallback

func DatabaseCallback(v interface{}, cb DatabaseCallbackFunc) (Stepper, DatabaseCaller)

DatabaseCallback ...

func DatabasePinCall

func DatabasePinCall(p chan<- *model.Pin, fn func(session *xorm.Session) *xorm.Session) (Stepper, DatabaseCaller)

DatabasePinCall ...

func DatabaseUnfinishedCall

func DatabaseUnfinishedCall(u chan<- *model.Unfinished, fn func(session *xorm.Session) *xorm.Session) (Stepper, DatabaseCaller)

DatabaseUnfinishedCall ...

func DatabaseVideoCall

func DatabaseVideoCall(v chan<- *model.Video, fn func(session *xorm.Session) *xorm.Session) (Stepper, DatabaseCaller)

DatabaseVideoCall ...

func GetFiles

func GetFiles(p string) (files []string)

GetFiles ...

func Hash

func Hash(v interface{}) string

Hash ...

func IndexNumber

func IndexNumber(index int) byte

IndexNumber ...

func IsPicture

func IsPicture(name string) bool

IsPicture ...

func IsVideo

func IsVideo(filename string) bool

IsVideo ...

func JSONRead

func JSONRead(path string, v interface{}) error

JSONRead ...

func JSONWrite

func JSONWrite(path string, v interface{}) error

JSONWrite ...

func LastSlice

func LastSlice(s, sep string) string

LastSlice ...

func MoveCall

func MoveCall(from, to string) (Stepper, MoveCaller)

MoveCall ...

func MustString

func MustString(val, src string) string

MustString must string

func NumberIndex

func NumberIndex(name string) int

NumberIndex ...

func OnlyName

func OnlyName(name string) string

OnlyName ...

func OnlyNo

func OnlyNo(name string) string

OnlyNo ...

func PathMD5

func PathMD5(s ...string) string

PathMD5 ...

func ReadJSON

func ReadJSON(path string, v interface{}) (e error)

ReadJSON ...

func SkipTypeVerify

func SkipTypeVerify(tp model.Type, v ...interface{}) bool

SkipTypeVerify ...

func SkipVerify

func SkipVerify(tp string, v ...interface{}) bool

SkipVerify ...

func SliceCall

func SliceCall(file string, u *model.Unfinished, cb SliceCallbackFunc) (Stepper, SliceCaller)

SliceCall ...

func WriteJSON

func WriteJSON(path string, v interface{}) (e error)

WriteJSON ...

Types

type API

type API struct {
	*Thread
	// contains filtered or unexported fields
}

API ...

func NewAPI

func NewAPI(path string) *API

NewAPI ...

func (*API) Failed

func (api *API) Failed() bool

Failed ...

func (*API) Option

func (api *API) Option(s Seeder)

Option ...

func (*API) Push

func (api *API) Push(v interface{}) error

Push ...

func (*API) Run

func (api *API) Run(ctx context.Context)

Run ...

func (*API) SetFailed

func (api *API) SetFailed(failed bool)

SetFailed ...

type APICallbackFunc

type APICallbackFunc func(api *API, ipapi *httpapi.HttpApi, v interface{}) (e error)

APICallbackFunc ...

type APICaller

type APICaller interface {
	Call(*API, *httpapi.HttpApi) error
}

APICaller ...

type AfterInitOptions

type AfterInitOptions func(Seeder)

AfterInitOptions ...

type BeforeUpdate

type BeforeUpdate func(session *xorm.Session, modeler model.Modeler) (id interface{}, e error)

BeforeUpdate ...

type Database

type Database struct {
	*Thread
	// contains filtered or unexported fields
}

Database ...

func NewDatabase

func NewDatabase(eng *xorm.Engine, args ...DatabaseArgs) *Database

NewDatabase ...

func (*Database) Option

func (db *Database) Option(seed Seeder)

Option ...

func (*Database) Push

func (db *Database) Push(v interface{}) error

Push ...

func (*Database) RegisterSync

func (db *Database) RegisterSync(v ...interface{})

RegisterSync ...

func (*Database) Run

func (db *Database) Run(ctx context.Context)

Run ...

func (*Database) Sync

func (db *Database) Sync() error

Sync ...

type DatabaseArgs

type DatabaseArgs func(*Database)

DatabaseArgs ...

func DatabaseShowExecTimeArg

func DatabaseShowExecTimeArg() DatabaseArgs

DatabaseShowExecTimeArg ...

func DatabaseShowSQLArg

func DatabaseShowSQLArg() DatabaseArgs

DatabaseShowSQLArg ...

type DatabaseCallbackFunc

type DatabaseCallbackFunc func(database *Database, eng *xorm.Engine, v interface{}) (e error)

DatabaseCallbackFunc ...

type DatabaseCaller

type DatabaseCaller interface {
	Call(database *Database, eng *xorm.Engine) (e error)
}

DatabaseCaller ...

type Extend

type Extend struct {
	Path    string `json:"path"`
	Message string `json:"message"`
}

Extend ...

type Initer

type Initer interface {
	Init()
}

Initer ...

type Move

type Move struct {
	*Thread

	ToPath string
	// contains filtered or unexported fields
}

Move ...

func NewMove

func NewMove() *Move

NewMove ...

func (*Move) Push

func (m *Move) Push(v interface{}) error

Push ...

func (*Move) Register

func (m *Move) Register(ops ...Optioner)

Register ...

func (*Move) Run

func (m *Move) Run(ctx context.Context)

Run ...

type MoveCallbackFunc

type MoveCallbackFunc func(move *Move) error

MoveCallbackFunc ...

type MoveCaller

type MoveCaller interface {
	Call(*Move) error
}

MoveCaller ...

type Optioner

type Optioner interface {
	Option(Seeder)
}

Optioner set option

type Options

type Options func(seeder Seeder)

Options ...

func MoveOption

func MoveOption(stepper Stepper, Move *Move) Options

MoveOption ...

type PeerID

type PeerID struct {
	Addresses       []string `json:"Addresses"`
	AgentVersion    string   `json:"AgentVersion"`
	ID              string   `json:"ID"`
	ProtocolVersion string   `json:"ProtocolVersion"`
	PublicKey       string   `json:"PublicKey"`
}

PeerID ...

func MyID

func MyID(api *API) (*PeerID, error)

type Process

type Process struct {
	*Thread
	// contains filtered or unexported fields
}

Process ...

func NewProcess

func NewProcess() *Process

NewProcess ...

func (*Process) Option

func (p *Process) Option(seeder Seeder)

Option ...

func (*Process) Push

func (p *Process) Push(v interface{}) error

Push ...

func (*Process) Run

func (p *Process) Run(ctx context.Context)

Run ...

type ProcessCallbackFunc

type ProcessCallbackFunc func(*Process, *model.Video) error

ProcessCallbackFunc ...

type ProcessCaller

type ProcessCaller interface {
	Call(process *Process) error
}

ProcessCaller ...

type PushFunc

type PushFunc func(interface{}) error

PushFunc ...

type Pusher

type Pusher interface {
	Push(interface{}) error
}

Pusher ...

type Runnable

type Runnable interface {
	Run(context.Context)
}

Runnable ...

type Scale

type Scale int64

Scale ...

const HighScale Scale = 1080

HighScale ...

const LowScale Scale = 480

LowScale ...

const MiddleScale Scale = 720

MiddleScale ...

type Seeder

type Seeder interface {
	Start()
	Wait()
	Stop()
	Context() context.Context
	PushTo(stepper Stepper, v interface{}) error
	GetThread(stepper Stepper) ThreadRun
	SetThread(stepper Stepper, threader ThreadRun)
	HasThread(stepper Stepper) bool
	SetBaseThread(stepper Stepper, threader Threader)
	IsBase(stepper Stepper) bool
	SetNormalThread(stepper Stepper, threader ThreadRun)
	IsNormal(stepper Stepper) bool
	Register(ops ...Optioner)
	RunTask(task *Task)
	AddTasker(tasker Tasker)
}

Seeder ...

func NewSeed

func NewSeed(ops ...Optioner) Seeder

NewSeed ...

type Slice

type Slice struct {
	*Thread
	Scale       Scale
	SliceOutput string
	SkipType    []interface{}
	SkipExist   bool
	SkipSlice   bool
	// contains filtered or unexported fields
}

Slice ...

func NewSlice

func NewSlice() *Slice

NewSlice ...

func (*Slice) Option

func (s *Slice) Option(seed Seeder)

Option ...

func (*Slice) Push

func (s *Slice) Push(v interface{}) error

Push ...

func (*Slice) Run

func (s *Slice) Run(ctx context.Context)

Run ...

type SliceCallbackFunc

type SliceCallbackFunc func(s *Slice, sa *cmd.SplitArgs, v interface{}) (e error)

SliceCallbackFunc ...

type SliceCaller

type SliceCaller interface {
	Call(*Slice) error
}

SliceCaller ...

type State

type State int

State ...

const (
	// StateWaiting ...
	StateWaiting State = iota
	// StateRunning ...
	StateRunning
	// StateStop ...
	StateStop
)

State ...

type Stepper

type Stepper int

Stepper ...

const (
	// StepperNone ...
	StepperNone Stepper = iota

	//StepperRDatabase ...
	//StepperRDatabase
	//StepperDatabase ...
	StepperDatabase

	//StepperAPI ...
	StepperAPI
	//StepperSlice ...
	StepperSlice
	// StepperProcess ...
	StepperProcess

	// StepperMoveInfo ...
	StepperMoveInfo

	// StepperMove ...
	StepperMove
	// StepperTransfer ...
	StepperTransfer
	// StepperPin ...
	StepperPin
	// StepperCheck ...
	StepperCheck
	// StepperUpdate ...
	StepperUpdate
	// StepperTask ...
	StepperTask

	// StepperMax ...
	StepperMax
)

StepperNone ...

type Task

type Task struct {
	// contains filtered or unexported fields
}

Task ...

func NewTask

func NewTask(task TaskAble) *Task

NewTask ...

func (*Task) Push

func (t *Task) Push(seeder Seeder) error

Push ...

type TaskAble

type TaskAble interface {
	//Step() Stepper
	CallTask(Seeder, *Task) error
}

TaskAble ...

type TaskStep

type TaskStep int

TaskStep ...

const (
	TaskNone TaskStep = iota
	TaskInformation
	TaskMax
)

TaskStep ...

type Tasker

type Tasker interface {
	Task() *Task
}

Tasker ...

type Thread

type Thread struct {
	Seeder
	// contains filtered or unexported fields
}

Thread ...

func NewThread

func NewThread() *Thread

NewThread ...

func (*Thread) AfterRun

func (t *Thread) AfterRun(seed Seeder)

AfterRun ...

func (*Thread) BeforeRun

func (t *Thread) BeforeRun(seed Seeder)

BeforeRun ...

func (*Thread) Done

func (t *Thread) Done() <-chan bool

Done ...

func (*Thread) Finished

func (t *Thread) Finished()

Finished ...

func (*Thread) Push

func (t *Thread) Push(v interface{}) error

Push ...

func (*Thread) Run

func (t *Thread) Run(context.Context)

Run ...

func (*Thread) SetState

func (t *Thread) SetState(state State)

SetState ...

func (*Thread) State

func (t *Thread) State() State

State ...

type ThreadBase

type ThreadBase interface {
	State() State
	SetState(state State)
	Done() <-chan bool
	Finished()
}

ThreadBase ...

type ThreadRun

type ThreadRun interface {
	Runnable
	Pusher
	BeforeRun(seed Seeder)
	AfterRun(seed Seeder)
}

ThreadRun ...

type Threader

type Threader interface {
	ThreadRun
	ThreadBase
}

Threader ...

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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