diff --git a/README.md b/README.md index fa544a450..c491309d8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ PhotoPrism [issues]: https://github.com/photoprism/photoprism/issues [ci]: https://travis-ci.org/photoprism/photoprism -PhotoPrism is a server-based application for automatically tagging, searching and organizing large amounts of JPEG and RAW files. +PhotoPrism is a server-based application for automatically tagging, searching and organizing digital photo collections. It is functionally similar to popular cloud services such as [Flickr](https://www.flickr.com/) or [Google Photos](https://photos.google.com/). Originals are stored in the file system in a structured way for easy backup and reliable long-term accessibility. diff --git a/internal/photoprism/album.go b/internal/models/album.go similarity index 88% rename from internal/photoprism/album.go rename to internal/models/album.go index 5f78d2397..dbc229094 100644 --- a/internal/photoprism/album.go +++ b/internal/models/album.go @@ -1,4 +1,4 @@ -package photoprism +package models import ( "github.com/jinzhu/gorm" diff --git a/internal/photoprism/camera.go b/internal/models/camera.go similarity index 96% rename from internal/photoprism/camera.go rename to internal/models/camera.go index 30cedc6b4..78f2af951 100644 --- a/internal/photoprism/camera.go +++ b/internal/models/camera.go @@ -1,4 +1,4 @@ -package photoprism +package models import ( "github.com/gosimple/slug" diff --git a/internal/photoprism/file.go b/internal/models/file.go similarity index 95% rename from internal/photoprism/file.go rename to internal/models/file.go index fdcaa48e6..0580ee7b1 100644 --- a/internal/photoprism/file.go +++ b/internal/models/file.go @@ -1,4 +1,4 @@ -package photoprism +package models import ( "github.com/jinzhu/gorm" diff --git a/internal/models/location.go b/internal/models/location.go new file mode 100644 index 000000000..289ba5e02 --- /dev/null +++ b/internal/models/location.go @@ -0,0 +1,22 @@ +package models + +import ( + "github.com/jinzhu/gorm" +) + +type Location struct { + gorm.Model + LocDisplayName string + LocLat float64 + LocLong float64 + LocCategory string + LocType string + LocName string + LocCity string + LocPostcode string + LocCounty string + LocState string + LocCountry string + LocCountryCode string + LocFavorite bool +} \ No newline at end of file diff --git a/internal/photoprism/photo.go b/internal/models/photo.go similarity index 97% rename from internal/photoprism/photo.go rename to internal/models/photo.go index 4beae2456..485a580a1 100644 --- a/internal/photoprism/photo.go +++ b/internal/models/photo.go @@ -1,4 +1,4 @@ -package photoprism +package models import ( "github.com/jinzhu/gorm" diff --git a/internal/photoprism/tag.go b/internal/models/tag.go similarity index 96% rename from internal/photoprism/tag.go rename to internal/models/tag.go index e4229e994..f79488ed4 100644 --- a/internal/photoprism/tag.go +++ b/internal/models/tag.go @@ -1,4 +1,4 @@ -package photoprism +package models import ( "github.com/gosimple/slug" diff --git a/internal/photoprism/config.go b/internal/photoprism/config.go index e66ab39aa..bbb7ed5bf 100644 --- a/internal/photoprism/config.go +++ b/internal/photoprism/config.go @@ -7,6 +7,7 @@ import ( _ "github.com/jinzhu/gorm/dialects/postgres" _ "github.com/jinzhu/gorm/dialects/sqlite" "github.com/kylelemons/go-gypsy/yaml" + . "github.com/photoprism/photoprism/internal/models" "github.com/urfave/cli" "log" "os" diff --git a/internal/photoprism/mediafile_exif.go b/internal/photoprism/exif.go similarity index 100% rename from internal/photoprism/mediafile_exif.go rename to internal/photoprism/exif.go diff --git a/internal/photoprism/mediafile_exif_test.go b/internal/photoprism/exif_test.go similarity index 100% rename from internal/photoprism/mediafile_exif_test.go rename to internal/photoprism/exif_test.go diff --git a/internal/photoprism/indexer.go b/internal/photoprism/indexer.go index 876f24720..23a66fc2d 100644 --- a/internal/photoprism/indexer.go +++ b/internal/photoprism/indexer.go @@ -3,6 +3,7 @@ package photoprism import ( "fmt" "github.com/jinzhu/gorm" + . "github.com/photoprism/photoprism/internal/models" "log" "os" "path/filepath" diff --git a/internal/photoprism/mediafile.go b/internal/photoprism/mediafile.go index 1ec3feda3..aa4d40dd4 100644 --- a/internal/photoprism/mediafile.go +++ b/internal/photoprism/mediafile.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/brett-lempereur/ish" "github.com/djherbis/times" + . "github.com/photoprism/photoprism/internal/models" "github.com/pkg/errors" "github.com/steakknife/hamming" "image" diff --git a/internal/photoprism/location.go b/internal/photoprism/openstreetmap.go similarity index 87% rename from internal/photoprism/location.go rename to internal/photoprism/openstreetmap.go index 23b7c5579..5d288bad3 100644 --- a/internal/photoprism/location.go +++ b/internal/photoprism/openstreetmap.go @@ -2,30 +2,13 @@ package photoprism import ( "encoding/json" - "errors" "fmt" - "github.com/jinzhu/gorm" + . "github.com/photoprism/photoprism/internal/models" + "github.com/pkg/errors" "net/http" "strconv" ) -type Location struct { - gorm.Model - LocDisplayName string - LocLat float64 - LocLong float64 - LocCategory string - LocType string - LocName string - LocCity string - LocPostcode string - LocCounty string - LocState string - LocCountry string - LocCountryCode string - LocFavorite bool -} - type OpenstreetmapAddress struct { Town string `json:"town"` City string `json:"city"` diff --git a/internal/photoprism/search.go b/internal/photoprism/search.go index 5cca43bbc..1e06d5835 100644 --- a/internal/photoprism/search.go +++ b/internal/photoprism/search.go @@ -2,7 +2,8 @@ package photoprism import ( "github.com/jinzhu/gorm" - "github.com/photoprism/photoprism/internal/forms" + . "github.com/photoprism/photoprism/internal/forms" + . "github.com/photoprism/photoprism/internal/models" "strings" "time" ) @@ -76,7 +77,7 @@ func NewSearch(originalsPath string, db *gorm.DB) *Search { return instance } -func (s *Search) Photos(form forms.PhotoSearchForm) ([]PhotoSearchResult, int, error) { +func (s *Search) Photos(form PhotoSearchForm) ([]PhotoSearchResult, int, error) { q := s.db.NewScope(nil).DB() q = q.Table("photos"). Select(`SQL_CALC_FOUND_ROWS photos.*,