示例#1
0
文件: main.go 项目: Jiajun-Fan/nandu
func main() {
	util.SetDebug(util.DebugInfo)

	worker := nandu.NewWorker()

	worker.Run()
	//worker.Model(kDatabaseName, &AwUser{})
}
示例#2
0
文件: main.go 项目: Jiajun-Fan/nandu
func main() {
	util.SetDebug(util.DebugInfo)

	worker := nandu.NewWorker()

	worker.TaskSet(kTumblrTaskSetName).Parser(TumblrParser).Client(kTumblrOauthName).Database(kDatabaseName)
	worker.TaskSet(kDownloadTaskSetName).Parser(DownloadParser).Database(kDatabaseName)

	worker.Model(kDatabaseName, &TumblrBlog{}).
		Model(kDatabaseName, &TumblrPhoto{}).
		Model(kDatabaseName, &TumblrPost{}).
		Model(kDatabaseName, &FileData{})

	worker.Run()
}
示例#3
0
文件: main.go 项目: Jiajun-Fan/nandu
func main() {
	util.SetDebug(util.DebugInfo)

	worker := nandu.NewWorker()

	info, err := NewTaskPushInfo(kTaskPushInfoFile)
	if err != nil {
		util.Fatal("%s\n", err.Error())
	}

	for i := range info.Blogs {
		task := &info.Blogs[i]
		d := TaskTumblrData{}
		task.GetData(&d)

		d.Min = getStop(d.Name, worker.GetDB(kDatabaseName))
		task.SetData(d)
		util.Info("%s", task.PushLog())
		worker.Push(task)
	}

	photos := getPhotos(info.FileDataRange.Start, info.FileDataRange.Stop, worker.GetDB(kDatabaseName))
	if photos != nil {
		for i := range photos {
			task := common.Task{}
			if photos[i].FileDataID != 0 {
				continue
			}
			task.Url = photos[i].Url
			task.TaskSet = kDownloadTaskSetName
			task.SetData(DownloadData{photos[i].ID})
			util.Info("push %s\n", task.Url)
			worker.Push(&task)
		}
	}
}
示例#4
0
文件: main.go 项目: Jiajun-Fan/nandu
func main() {
	util.SetDebug(util.DebugInfo)

	worker := nandu.NewWorker()

	worker.Model(kDatabaseName, &AwUser{})

	t := time.Now().AddDate(0, 1, 0)

	/*user := AwUser{
		User: common.User{
			Email: "*****@*****.**",
			Name:  "Jiajun-Fan",
		},
		Group:  kAwGroupAdvan,
		Expire: t,
		Token:  "J3rWxdFvpbur26UljYASM6ou1R4XYhpkmGQ0RZqYw3HHhY0v4P",
		Secret: "afBwgNzPI6LWRtacBmWQ7kvX2vEtFPQQGROvGlZV4TtSshG0sH",
	}

	worker.GetDB(kDatabaseName).Create(&user)*/

	AddUserTasks(worker.GetDB(kDatabaseName))
}
示例#5
0
文件: main.go 项目: Jiajun-Fan/nandu
func main() {
	util.SetDebug(util.DebugError)
	server.Forever()
}