Beispiel #1
0
func main() {
	util.SetDebug(util.DebugInfo)

	worker := nandu.NewWorker()

	worker.Run()
	//worker.Model(kDatabaseName, &AwUser{})
}
Beispiel #2
0
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()
}
Beispiel #3
0
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)
		}
	}
}
Beispiel #4
0
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))
}
Beispiel #5
0
func main() {
	util.SetDebug(util.DebugError)
	server.Forever()
}