Skip to content

Commit

Permalink
added api/gps/scan.
Browse files Browse the repository at this point in the history
  • Loading branch information
schwarzlichtbezirk committed Jan 3, 2023
1 parent a2cec99 commit 7935bb4
Show file tree
Hide file tree
Showing 6 changed files with 330 additions and 27 deletions.
4 changes: 4 additions & 0 deletions aec.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ const (
AECgpsrangeshpbad
AECgpsrangenoacc
AECgpsrangelist

// gps/scan
AECgpsscannodata
AECgpsscannoacc
)

// HTTP error messages
Expand Down
10 changes: 5 additions & 5 deletions caches.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ type PathStore struct {

// Store is struct of sqlite3 item for cache with puid/T values.
type Store[T any] struct {
Puid Puid_t `xorm:"pk"`
Prop T `xorm:"extends"`
Puid Puid_t `xorm:"pk" json:"puid" yaml:"puid" xml:"puid,attr"`
Prop T `xorm:"extends" json:"prop" yaml:"prop" xml:"prop"`
}

type (
Expand Down Expand Up @@ -206,7 +206,7 @@ func ExifStoreGet(session *Session, puid Puid_t) (ep ExifProp, ok bool) {
ok = false
return
}
if !ep.IsZero() {
if ok = !ep.IsZero(); ok {
ExifStoreSet(session, &ExifStore{ // update database
Puid: puid,
Prop: ep,
Expand All @@ -218,7 +218,7 @@ func ExifStoreGet(session *Session, puid Puid_t) (ep ExifProp, ok bool) {
// ExifStoreSet puts value to EXIF cache.
func ExifStoreSet(session *Session, est *ExifStore) (err error) {
// set to GPS cache
if est.Prop.Latitude != 0 {
if est.Prop.Latitude != 0 || est.Prop.Longitude != 0 {
var gi GpsInfo
gi.FromProp(&est.Prop)
gpscache.Store(est.Puid, gi)
Expand Down Expand Up @@ -254,7 +254,7 @@ func TagStoreGet(session *Session, puid Puid_t) (tp TagProp, ok bool) {
ok = false
return
}
if !tp.IsZero() {
if ok = !tp.IsZero(); ok {
TagStoreSet(session, &TagStore{ // update database
Puid: puid,
Prop: tp,
Expand Down
Loading

0 comments on commit 7935bb4

Please sign in to comment.