Improved avatar generator
This commit is contained in:
@ -54,6 +54,9 @@ func main() {
|
||||
&MyAnimeList{
|
||||
RequestLimiter: time.NewTicker(250 * time.Millisecond),
|
||||
},
|
||||
&FileSystem{
|
||||
Directory: "images/avatars/large/",
|
||||
},
|
||||
}
|
||||
|
||||
// Define the avatar outputs
|
||||
@ -118,7 +121,6 @@ func StartWorkers(queue chan *arn.User, work func(*arn.User)) {
|
||||
|
||||
// Work handles a single user.
|
||||
func Work(user *arn.User) {
|
||||
fmt.Println(user.ID, "|", user.Nick)
|
||||
user.AvatarExtension = ""
|
||||
|
||||
for _, source := range avatarSources {
|
||||
@ -129,6 +131,13 @@ func Work(user *arn.User) {
|
||||
continue
|
||||
}
|
||||
|
||||
sourceType := reflect.TypeOf(source).Elem().Name()
|
||||
|
||||
// Avoid quality loss (if it's on the file system, we don't need to write it again)
|
||||
if sourceType == "FileSystem" {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, writer := range avatarOutputs {
|
||||
err := writer.SaveAvatar(avatar)
|
||||
|
||||
@ -137,7 +146,7 @@ func Work(user *arn.User) {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(color.GreenString("✔"), reflect.TypeOf(source).Elem().Name(), "|", user.Nick, "|", avatar)
|
||||
fmt.Println(color.GreenString("✔"), sourceType, "|", user.Nick, "|", avatar)
|
||||
break
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user