Formatted code (go fmt ./...)
This commit is contained in:
parent
3da127435c
commit
1716c5a38f
14 changed files with 43 additions and 39 deletions
3
Makefile
3
Makefile
|
@ -6,6 +6,7 @@ GORUN=$(GOCMD) run
|
|||
GOCLEAN=$(GOCMD) clean
|
||||
GOTEST=$(GOCMD) test
|
||||
GOGET=$(GOCMD) get
|
||||
GOFMT=$(GOCMD) fmt
|
||||
BINARY_NAME=photoprism
|
||||
|
||||
all: deps js build
|
||||
|
@ -28,6 +29,8 @@ clean:
|
|||
image:
|
||||
docker build . --tag photoprism/photoprism
|
||||
docker push photoprism/photoprism
|
||||
format:
|
||||
$(GOFMT) ./...
|
||||
deps:
|
||||
$(GOBUILD) -v ./...
|
||||
upgrade:
|
||||
|
|
|
@ -2,11 +2,11 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/araddon/dateparse"
|
||||
"github.com/photoprism/photoprism"
|
||||
"github.com/photoprism/photoprism/server"
|
||||
"github.com/urfave/cli"
|
||||
"os"
|
||||
"github.com/araddon/dateparse"
|
||||
"github.com/photoprism/photoprism/server"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -251,7 +251,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
exportPath := fmt.Sprintf("%s/%s", conf.ExportPath, name);
|
||||
exportPath := fmt.Sprintf("%s/%s", conf.ExportPath, name)
|
||||
size := context.Int("size")
|
||||
originals := photoprism.FindOriginalsByDate(conf.OriginalsPath, afterDate, beforeDate)
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -25,7 +25,7 @@ require (
|
|||
github.com/pkg/errors v0.8.0
|
||||
github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/rwcarlsen/goexif v0.0.0-20180518182100-8d986c03457a
|
||||
github.com/steakknife/hamming v0.0.0-20161012051909-5ac3f73b8842
|
||||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3
|
||||
github.com/stretchr/testify v1.2.2
|
||||
github.com/tensorflow/tensorflow v1.10.1
|
||||
github.com/ugorji/go v1.1.1
|
||||
|
|
2
go.sum
2
go.sum
|
@ -60,6 +60,8 @@ github.com/rwcarlsen/goexif v0.0.0-20180518182100-8d986c03457a h1:ZDZdsnbMuRSoVb
|
|||
github.com/rwcarlsen/goexif v0.0.0-20180518182100-8d986c03457a/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk=
|
||||
github.com/steakknife/hamming v0.0.0-20161012051909-5ac3f73b8842 h1:Xk8V2cXXyb8xE/JOy2d8+0byqbKS1pEhVaeENndbaME=
|
||||
github.com/steakknife/hamming v0.0.0-20161012051909-5ac3f73b8842/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
|
||||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM=
|
||||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/tensorflow/tensorflow v1.10.0 h1:TVlKz+s8FPTwEBI98rhB2MR+8S46bK1Rp4bcIFCd7VQ=
|
||||
|
|
|
@ -41,5 +41,5 @@ func TestImporter_GetDestinationFilename(t *testing.T) {
|
|||
|
||||
assert.Empty(t, err)
|
||||
|
||||
assert.Equal(t, conf.OriginalsPath + "/2018/02/20180204_170813_B0770443A5F7.cr2", filename)
|
||||
assert.Equal(t, conf.OriginalsPath+"/2018/02/20180204_170813_B0770443A5F7.cr2", filename)
|
||||
}
|
||||
|
|
10
indexer.go
10
indexer.go
|
@ -2,12 +2,12 @@ package photoprism
|
|||
|
||||
import (
|
||||
"github.com/jinzhu/gorm"
|
||||
"os"
|
||||
"strings"
|
||||
"path/filepath"
|
||||
"log"
|
||||
"io/ioutil"
|
||||
"github.com/photoprism/photoprism/recognize"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Indexer struct {
|
||||
|
|
10
location.go
10
location.go
|
@ -1,12 +1,12 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"github.com/jinzhu/gorm"
|
||||
"strconv"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/jinzhu/gorm"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type Location struct {
|
||||
|
@ -36,7 +36,7 @@ type OpenstreetmapAddress struct {
|
|||
}
|
||||
|
||||
type OpenstreetmapLocation struct {
|
||||
PlaceId string `json:"place_id"`
|
||||
PlaceId string `json:"place_id"`
|
||||
Lat string `json:"lat"`
|
||||
Lon string `json:"lon"`
|
||||
Category string `json:"category"`
|
||||
|
|
12
mediafile.go
12
mediafile.go
|
@ -4,20 +4,20 @@ import (
|
|||
"encoding/hex"
|
||||
"github.com/brett-lempereur/ish"
|
||||
"github.com/djherbis/times"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/steakknife/hamming"
|
||||
"image"
|
||||
_ "image/gif"
|
||||
_ "image/jpeg"
|
||||
_ "image/png"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
"github.com/pkg/errors"
|
||||
"image"
|
||||
_ "image/jpeg"
|
||||
_ "image/png"
|
||||
_ "image/gif"
|
||||
"math"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -86,6 +86,5 @@ func (m *MediaFile) GetExifData() (*ExifData, error) {
|
|||
m.exifData.Orientation = 1
|
||||
}
|
||||
|
||||
|
||||
return m.exifData, nil
|
||||
}
|
||||
|
|
10
query.go
10
query.go
|
@ -18,13 +18,13 @@ func NewQuery(originalsPath string, db *gorm.DB) *Search {
|
|||
return instance
|
||||
}
|
||||
|
||||
func (s *Search) FindPhotos (query string, count int, offset int) (photos []Photo) {
|
||||
func (s *Search) FindPhotos(query string, count int, offset int) (photos []Photo) {
|
||||
q := s.db.Preload("Tags").Preload("Files").Preload("Location").Preload("Albums")
|
||||
|
||||
if query != "" {
|
||||
q = q.Joins("JOIN photo_tags ON photo_tags.photo_id=photos.id")
|
||||
q = q.Joins("JOIN tags ON photo_tags.tag_id=tags.id")
|
||||
q = q.Where("tags.label LIKE ?", "%" + query + "%")
|
||||
q = q.Where("tags.label LIKE ?", "%"+query+"%")
|
||||
}
|
||||
|
||||
q = q.Where(&Photo{Deleted: false}).Order("taken_at").Limit(count).Offset(offset)
|
||||
|
@ -33,14 +33,14 @@ func (s *Search) FindPhotos (query string, count int, offset int) (photos []Phot
|
|||
return photos
|
||||
}
|
||||
|
||||
func (s *Search) FindFiles (count int, offset int) (files []File) {
|
||||
func (s *Search) FindFiles(count int, offset int) (files []File) {
|
||||
s.db.Where(&File{}).Limit(count).Offset(offset).Find(&files)
|
||||
|
||||
return files
|
||||
}
|
||||
|
||||
func (s *Search) FindFile (id string) (file File) {
|
||||
func (s *Search) FindFile(id string) (file File) {
|
||||
s.db.Where("id = ?", id).First(&file)
|
||||
|
||||
return file
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@ package recognize
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
tf "github.com/tensorflow/tensorflow/tensorflow/go"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
tf "github.com/tensorflow/tensorflow/tensorflow/go"
|
||||
"log"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type ClassifyResult struct {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package recognize
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"io/ioutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetImageTags(t *testing.T) {
|
||||
|
@ -22,4 +22,4 @@ func TestGetImageTags(t *testing.T) {
|
|||
|
||||
assert.Equal(t, float32(0.23251747), result[1].Probability)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"github.com/photoprism/photoprism"
|
||||
"strconv"
|
||||
"github.com/photoprism/photoprism/server/forms"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/photoprism/photoprism"
|
||||
"github.com/photoprism/photoprism/server/forms"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Start(address string, port int, conf *photoprism.Config) {
|
||||
|
|
|
@ -3,11 +3,11 @@ package photoprism
|
|||
import (
|
||||
"fmt"
|
||||
"github.com/disintegration/imaging"
|
||||
"image"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"image"
|
||||
)
|
||||
|
||||
func CreateThumbnailsFromOriginals(originalsPath string, thumbnailsPath string, size int, square bool) {
|
||||
|
|
Loading…
Reference in a new issue