update libs
This commit is contained in:
parent
8d2d44597c
commit
24c5907e54
|
@ -147,7 +147,7 @@ func (api *API) downloadSubredditImage(ctx context.Context, post reddit.Post, de
|
|||
return nil
|
||||
}
|
||||
if !errors.Is(errStat, os.ErrNotExist) {
|
||||
return errs.Wrapw(err, "failed to check thumbail existence", "path", thumbnailPath)
|
||||
return errs.Wrapw(err, "failed to check thumbnail existence", "path", thumbnailPath)
|
||||
}
|
||||
|
||||
thumbnailSource, err := imaging.Open(tmpImageFile.filename)
|
||||
|
|
|
@ -235,6 +235,19 @@ func (post *Post) GetThumbnailTargetPath(cfg *config.Config) string {
|
|||
return path.Join(baseDownloadDir, "_thumbnails", post.GetSubreddit(), post.GetImageFilename())
|
||||
}
|
||||
|
||||
func (post *Post) GetThumbnailRelativePath() string {
|
||||
return path.Join("_thumbnails", post.GetSubreddit(), post.GetImageFilename())
|
||||
}
|
||||
|
||||
func (post *Post) GetImageRelativePath(device queries.Device) string {
|
||||
return path.Join(device.Name, post.GetSubreddit(), post.GetImageFilename())
|
||||
}
|
||||
|
||||
func (post *Post) GetWindowsWallpaperImageRelativePath(device queries.Device) string {
|
||||
filename := fmt.Sprintf("%s_%s", post.GetSubreddit(), post.GetImageFilename())
|
||||
return path.Join(device.Name, filename)
|
||||
}
|
||||
|
||||
func (post *Post) GetImageFilename() string {
|
||||
if !post.IsImagePost() {
|
||||
return ""
|
||||
|
|
7
db/queries/devices.sql
Normal file
7
db/queries/devices.sql
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- name: GetDevices :many
|
||||
SELECT * FROM devices;
|
||||
|
||||
-- name: CreateDevice :one
|
||||
INSERT INTO devices (name, resolution_x, resolution_y, aspect_ratio_tolerance, min_x, min_y, max_x, max_y, nsfw, windows_wallpaper_mode)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
RETURNING *;
|
Loading…
Reference in a new issue