Skip to content

Commit

Permalink
Fix timeline view + upgrade build
Browse files Browse the repository at this point in the history
  • Loading branch information
SmilyOrg committed Apr 10, 2023
1 parent 299f5e9 commit 062ed26
Show file tree
Hide file tree
Showing 18 changed files with 152 additions and 83 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.19

- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Photofield is a photo viewer built to mainly push the limits of what is possible
in terms of the number of photos visible at the same time and at the speed at
which they are displayed. The goal is to be as fast or faster than Google Photos
on commodity hardware while displaying more photos at the same time. It is
non-invasive and at this point meant to be used to complement other photo
gallery software.
non-invasive and can be used either completely standalone or complementing other
photo gallery software.


### Features
Expand Down Expand Up @@ -86,13 +86,16 @@ layouts.
able to search for photo contents using words like "beach sunset", "a couple
kissing", or "cat eyes".
![semantic search for "cat eyes"](docs/assets/semantic-search.jpg)
* **Reuse of existing thumbnails**. Do you have hundreds of gigabytes of
existing thumbnails from an existing system? Me too! Let's just reuse those.
Here are the currently supported thumbnail sources:
* **Flexible media/thumbnail system**. Do you have hundreds of gigabytes of existing
thumbnails from an existing system? Me too! Let's reuse those. Don't have any?
No worries, they will be generated automatically to speed up display. Here are
the currently supported thumbnail sources:
* Bespoke SQLite thumbnail database - `photofield.thumbs.db`.
* Synology Moments / Photo Station auto-generated thumbnails in `@eaDir`.
* Embedded JPEG thumbnails (`ThumbnailImage` Exif tag).
* Limited support for extension via `thumbnails` section of
the [Configuration].
* Embedded JPEG thumbnails - `ThumbnailImage` Exif tag.
* Native Go [image](https://pkg.go.dev/image) package.
* FFmpeg on-the-fly conversion - thumbnails and full sized variants.
* Configurable via the `sources` section of the [Configuration].
* Please [open an issue] for other systems, bonus points for an idea on how to
integrate!
* **Single file binary**. Thanks to [Go] and [GoReleaser], all the dependencies
Expand All @@ -112,7 +115,6 @@ transcoding supported right now.

### Limitations

* **No thumbnail generation**. Only pre-generated thumbnails are supported.
* **No photo details (yet)**. There is no way to show metadata of a photo in the
UI at this point.
* **Not optimized for many clients**. As a lot of the normally client-side
Expand Down Expand Up @@ -172,7 +174,7 @@ default. For further configuration, create a `configuration.yaml` in the
services:

photofield:
image: ghcr.io/smilyorg/photofield
image: ghcr.io/smilyorg/photofield:latest
ports:
- 8080:8080
volumes:
Expand Down
10 changes: 10 additions & 0 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ paths:
schema:
$ref: "#/components/schemas/LayoutType"

- name: sort
in: query
schema:
$ref: "#/components/schemas/Sort"

- name: search
in: query
schema:
Expand Down Expand Up @@ -629,6 +634,8 @@ components:
$ref: "#/components/schemas/LayoutType"
search:
$ref: "#/components/schemas/Search"
sort:
$ref: "#/components/schemas/Sort"

TaskType:
type: string
Expand Down Expand Up @@ -707,6 +714,9 @@ components:
Search:
type: string

Sort:
type: string

LayoutType:
type: string
enum:
Expand Down
61 changes: 19 additions & 42 deletions docker/grafana/dashboards/photofield.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,32 +213,7 @@
},
"unit": "µs"
},
"overrides": [
{
"__systemRef": "hideSeriesFrom",
"matcher": {
"id": "byNames",
"options": {
"mode": "exclude",
"names": [
"sqlite"
],
"prefix": "All except:",
"readOnly": true
}
},
"properties": [
{
"id": "custom.hideFrom",
"value": {
"legend": false,
"tooltip": false,
"viz": true
}
}
]
}
]
"overrides": []
},
"gridPos": {
"h": 8,
Expand Down Expand Up @@ -692,7 +667,7 @@
"refId": "A"
}
],
"title": "Loading",
"title": "Index",
"type": "row"
},
{
Expand Down Expand Up @@ -754,14 +729,15 @@
"uid": "RmeUbDMnz"
},
"exemplar": true,
"expr": "label_replace({__name__=~\"pf_load_${loader}_pending\"}, \"name\", \"$1\", \"__name__\", \"pf_load_(.*)_pending\")",
"expr": "label_replace({__name__=~\"pf_index_${indexer}_pending\"}, \"name\", \"$1\", \"__name__\", \"pf_index_(.*)_pending\")",
"hide": false,
"interval": "",
"legendFormat": "{{name}}",
"range": true,
"refId": "B"
}
],
"title": "Pending Loads",
"title": "Pending",
"type": "stat"
},
{
Expand Down Expand Up @@ -818,15 +794,15 @@
"uid": "RmeUbDMnz"
},
"exemplar": true,
"expr": "rate(pf_load_meta_done[10s])",
"expr": "rate(pf_index_metadata_done[10s])",
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"title": "Meta Load Rate",
"title": "Metadata Indexing Rate",
"type": "stat"
},
{
Expand Down Expand Up @@ -883,15 +859,15 @@
"uid": "RmeUbDMnz"
},
"exemplar": true,
"expr": "rate(pf_load_color_done[10s])",
"expr": "rate(pf_index_contents_done[10s])",
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"title": "Color Load Rate",
"title": "Contents Indexing Rate",
"type": "stat"
},
{
Expand Down Expand Up @@ -1946,7 +1922,7 @@
"type": "row"
}
],
"refresh": "",
"refresh": "2s",
"revision": 1,
"schemaVersion": 38,
"style": "dark",
Expand Down Expand Up @@ -2001,7 +1977,7 @@
},
{
"current": {
"selected": false,
"selected": true,
"text": [
"All"
],
Expand All @@ -2011,8 +1987,9 @@
},
"hide": 0,
"includeAll": true,
"label": "",
"multi": true,
"name": "loader",
"name": "indexer",
"options": [
{
"selected": true,
Expand All @@ -2021,16 +1998,16 @@
},
{
"selected": false,
"text": "meta",
"value": "meta"
"text": "metadata",
"value": "metadata"
},
{
"selected": false,
"text": "color",
"value": "color"
"text": "contents",
"value": "contents"
}
],
"query": "meta,color",
"query": "metadata,contents",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
Expand Down Expand Up @@ -2097,7 +2074,7 @@
]
},
"time": {
"from": "now-3h",
"from": "now-15m",
"to": "now"
},
"timepicker": {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ require (
github.com/pixiv/go-libjpeg v0.0.0-20190822045933-3da21a74767d
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_model v0.2.0
github.com/pyroscope-io/client v0.7.0
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
github.com/sheerun/queue v1.0.1
github.com/tdewolff/canvas v0.0.0-20200504121106-e2600b35c365
Expand Down Expand Up @@ -64,7 +65,6 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/pyroscope-io/client v0.7.0 // indirect
github.com/pyroscope-io/godeltaprof v0.1.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/tdewolff/minify/v2 v2.7.1-0.20200112204046-70870d25a935 // indirect
Expand Down
2 changes: 1 addition & 1 deletion internal/layout/album.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func LayoutAlbum(layout Layout, collection collection.Collection, scene *render.
limit := collection.Limit

infos := collection.GetInfos(source, image.ListOptions{
OrderBy: image.DateAsc,
OrderBy: image.ListOrder(layout.Order),
Limit: limit,
})

Expand Down
22 changes: 21 additions & 1 deletion internal/layout/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,28 @@ const (
Strip Type = "STRIP"
)

type Order int

const (
None Order = iota
DateAsc Order = iota
DateDesc Order = iota
)

func OrderFromSort(s string) Order {
switch s {
case "+date":
return DateAsc
case "-date":
return DateDesc
default:
return None
}
}

type Layout struct {
Type Type `json:"type"`
Type Type `json:"type"`
Order Order `json:"order"`
ViewportWidth float64
ViewportHeight float64
ImageHeight float64
Expand Down
2 changes: 1 addition & 1 deletion internal/layout/strip.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func LayoutStrip(layout Layout, collection collection.Collection, scene *render.
)
} else {
infos = collection.GetInfos(source, image.ListOptions{
OrderBy: image.DateAsc,
OrderBy: image.ListOrder(layout.Order),
Limit: limit,
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/layout/timeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func LayoutTimeline(layout Layout, collection collection.Collection, scene *rend
limit := collection.Limit

infos := collection.GetInfos(source, image.ListOptions{
OrderBy: image.DateDesc,
OrderBy: image.ListOrder(layout.Order),
Limit: limit,
})

Expand Down
7 changes: 5 additions & 2 deletions internal/layout/wall.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func LayoutWall(layout Layout, collection collection.Collection, scene *render.Scene, source *image.Source) {

infos := collection.GetInfos(source, image.ListOptions{
OrderBy: image.DateAsc,
OrderBy: image.ListOrder(layout.Order),
Limit: collection.Limit,
})

Expand All @@ -34,6 +34,9 @@ func LayoutWall(layout Layout, collection collection.Collection, scene *render.S
photoCount := len(section.infos)

edgeCount := int(math.Sqrt(float64(photoCount)))
if edgeCount < 1 {
edgeCount = 1
}

scene.Bounds.W = layout.ViewportWidth
cols := edgeCount
Expand All @@ -51,7 +54,7 @@ func LayoutWall(layout Layout, collection collection.Collection, scene *render.S

rows := int(math.Ceil(float64(photoCount) / float64(cols)))

scene.Bounds.H = math.Ceil(float64(rows)) * (imageHeight + layoutConfig.LineSpacing)
scene.Bounds.H = float64(rows) * (imageHeight + layoutConfig.LineSpacing)

sceneMargin := 10.
layoutConfig.ImageHeight = imageHeight
Expand Down
Loading

0 comments on commit 062ed26

Please sign in to comment.