did things
This commit is contained in:
parent
96aee306b5
commit
375a5ad681
|
@ -5,7 +5,6 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -78,10 +77,7 @@ func work(wn int, posts []e621.Post, directory string, completed *int, successes
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSavePath(post *e621.Post, directory *string) string {
|
func getSavePath(post *e621.Post, directory *string) string {
|
||||||
pathSliced := strings.Split(post.FileURL, ".")
|
savePath := path.Join(*directory, strconv.Itoa(post.ID)+"."+post.FileExt)
|
||||||
extension := pathSliced[len(pathSliced)-1]
|
|
||||||
|
|
||||||
savePath := path.Join(*directory, strconv.Itoa(post.ID)+"."+extension)
|
|
||||||
|
|
||||||
return savePath
|
return savePath
|
||||||
}
|
}
|
||||||
|
|
58
e621/e621.go
58
e621/e621.go
|
@ -9,35 +9,35 @@ import (
|
||||||
|
|
||||||
// Post represents an e621 post object returned by the e621 API.
|
// Post represents an e621 post object returned by the e621 API.
|
||||||
type Post struct {
|
type Post struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"` // The ID of the post
|
||||||
Tags string `json:"tags"`
|
Tags string `json:"tags"` // Space-separated list of tags attached to this post
|
||||||
LockedTags bool `json:"locked_tags"`
|
LockedTags bool `json:"locked_tags"` // (undocumented)
|
||||||
Description string `json:"description"`
|
Description string `json:"description"` // The post's description
|
||||||
CreatedAt SerializedDate `json:"created_at"`
|
CreatedAt SerializedDate `json:"created_at"` // When the post was uploaded
|
||||||
CreatorID int `json:"creator_id"`
|
CreatorID int `json:"creator_id"` // User ID of the user who uploaded the post
|
||||||
Author string `json:"author"`
|
Author string `json:"author"` // Username of the user who uploaded the post
|
||||||
Change int `json:"change"`
|
Change int `json:"change"` // (undocumented)
|
||||||
Source string `json:"source"`
|
Source string `json:"source"` // URL that the source for this post can be found at
|
||||||
Score int `json:"score"`
|
Score int `json:"score"` // The post's score (upvotes - downvotes)
|
||||||
FavoritesCount int `json:"fav_count"`
|
FavoritesCount int `json:"fav_count"` // Amount of users that favorited this post
|
||||||
MD5Hash string `json:"md5"`
|
MD5Hash string `json:"md5"` // MD5-sum of the post's file's content
|
||||||
FileSize int `json:"file_size"`
|
FileSize int `json:"file_size"` // Size of the post's file
|
||||||
FileURL string `json:"file_url"`
|
FileURL string `json:"file_url"` // URL to the full-sized file
|
||||||
FileExt string `json:"file_ext"`
|
FileExt string `json:"file_ext"` // File extension
|
||||||
PreviewURL string `json:"preview_url"`
|
PreviewURL string `json:"preview_url"` // URL to preview-sized version of the file
|
||||||
PreviewHeight int `json:"preview_height"`
|
PreviewHeight int `json:"preview_height"` // Height of the preview
|
||||||
PreviewWidth int `json:"preview_width"`
|
PreviewWidth int `json:"preview_width"` // Width of the preview
|
||||||
Rating string `json:"rating"`
|
Rating string `json:"rating"` // Rating of the file ("safe", "questionable", "explicit")
|
||||||
Status string `json:"status"`
|
Status string `json:"status"` // Moderation status ("active" or "pending")
|
||||||
Width int `json:"width"`
|
Width int `json:"width"` // Width of the original file
|
||||||
Height int `json:"height"`
|
Height int `json:"height"` // Height of the original file
|
||||||
HasComments bool `json:"has_comments"`
|
HasComments bool `json:"has_comments"` // True if post has comments
|
||||||
HasNotes bool `json:"has_notes"`
|
HasNotes bool `json:"has_notes"` // True if post has notes
|
||||||
HasChildren bool `json:"has_children"`
|
HasChildren bool `json:"has_children"` // True if post has children
|
||||||
Children string `json:"children"`
|
Children string `json:"children"` // Comma-separated list of children post IDs
|
||||||
ParentID int `json:"parent_id"`
|
ParentID int `json:"parent_id"` // ID of the parent post
|
||||||
Artist []string `json:"artist"`
|
Artist []string `json:"artist"` // Slice of artist names
|
||||||
Sources []string `json:"sources"`
|
Sources []string `json:"sources"` // Slice of source URLs
|
||||||
}
|
}
|
||||||
|
|
||||||
// SerializedDate represents a serialized date passed via JSON
|
// SerializedDate represents a serialized date passed via JSON
|
||||||
|
|
Loading…
Reference in New Issue