aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design-notes.md222
1 files changed, 222 insertions, 0 deletions
diff --git a/design-notes.md b/design-notes.md
new file mode 100644
index 0000000..c39f98c
--- /dev/null
+++ b/design-notes.md
@@ -0,0 +1,222 @@
1# ldgallery design notes
2
3_ldgallery_ consists of two main components that are packaged and distributed together, but are otherwise functionally independent:
4
5* a __compiler__ which turns a collection of pictures and sidecar metadata files into their compressed/normalised and aggregated versions respectively, and
6* a web __viewer__ in the form of a single-page application, rendering the output of the compiler as a searchable picture gallery.
7
8
9## Gallery compiler
10
11### Input
12
13#### Directory structure
14
15The compiler takes a source directory as input which shall contain item resource files and associated metadata sidecar files. Those items may be recursively grouped into multiple levels of sub-directories.
16
17Example source directory structure:
18
19```
20example-gallery-source
21├── _DSC8808-1.jpg -- a picture
22├── _DSC8808-1.jpg.yaml -- its associated sidecar metadata file
23└── Glacier 3000 -- a directory grouping gallery items
24 ├── _DSC5475.jpg
25 ├── _DSC5475.jpg.yaml
26 ├── _DSC5542.jpg
27 └── _DSC5542.jpg.yaml
28```
29
30
31#### Metadata sidecar file
32
33Metadata associated to items are stored in YAML sidecar files of the same name, with the `.yaml` extension appended. The use of plain text sidecar files allow for easier editing without any special tool in a unified manner for multiple types of files (pictures, videos, ebooks, ...). The metadata contained within item files are simply ignored.
34
35Tags are given with a group hierarchy separated by `.`, which allows generic searches as well as implicit disambiguation.
36
37Example metadata sidecar file:
38
39```yaml
40title: Some title
41
42date: 2019-12-20T16:51:52+00:00
43
44description: >
45 Some multiline description
46 that may contain some markdown later.
47
48tags:
49 - photographer.someone
50 - location.france.paris
51 - monochromatic
52```
53
54Possible evolutions:
55
56* Fallback values may later be defined for each field, making them optional.
57* The description field could be allowed to contain markdown-formatted content, which would be rendered by the __viewer__ app.
58* Other keys could be added to allow the definition of specific transform/compilation/displaying parameters on a particular file.
59* Metadata sidecar files could be added for directories as well in some `index.yaml` file.
60
61
62#### Gallery configuration file
63
64The gallery YAML configuration file contains the __compiler__'s and the __viewer__'s settings in two different sections.
65
66Proposed configuration file, named `gallery.yaml` at the root of the source directory:
67
68```yaml
69compiler:
70 # TODO: configuration options to be defined
71 # format normalisation?
72 # image maximum size?
73 # item compression?
74 # thumbnail size?
75 # thumbnail generation algorithm?
76
77viewer:
78 # TODO: configuration options to be defined
79 # separately shown tags and their colours
80 # use hash in URL (useful for use without webserver url rewrite)?
81```
82
83
84### Output
85
86#### Directory structure
87
88```
89data
90├── items -- original/normalised item directory
91│ ├── _DSC8808-1.jpg
92│ └── Glacier 3000
93│ ├── _DSC5475.jpg
94│ └── _DSC5542.jpg
95├── thumbnails -- item thumbnails directory
96│ ├── _DSC8808-1.jpg
97│ └── Glacier 3000
98│ ├── _DSC5475.jpg
99│ └── _DSC5542.jpg
100├── index.json -- content index file
101└── viewer.json -- viewer configuration file
102```
103
104
105#### Viewer configuration file
106
107The content of the `viewer` section of the gallery configuration file is used, without any transformation by the __compiler__, to generate the `viewer.json` file located at the root of the output directory.
108
109
110#### Gallery items index
111
112The __compiler__ generates a global index file `index.json` aggregating the metadata of all the source sidecar files as a tree of items as described below. Its root node is a directory item. The type of each property node is marked by its `type` field.
113
114Directory items aggregate their tags from the items below it in order to be displayed in search results.
115
116Resource paths are rooted with respect to the data output directory which serves as the base path.
117
118Serialised item structure:
119
120```json
121{
122 /* common fields */
123
124 "title": "Some title",
125 "date": "2019-12-20T16:51:52+00:00",
126 "description": "Some multiline description\nthat may contain some markdown later.",
127
128 "tags": [
129 "photographer.someone",
130 "location.france.paris",
131 "monochromatic"
132 ],
133
134 "path": "[resource path]",
135 "thumbnail": { "path": "[resource path]" },
136
137
138 /* type-dependent */
139
140 "properties": {
141 "type": "image",
142 "filesize": 12345,
143 "resolution": { "width": 123, "height": 456 }
144 },
145
146 "properties": {
147 "type": "video",
148 "filesize": 12345
149 }
150
151 "properties": {
152 "type": "directory",
153 "items": [ /* item objects */ ]
154 }
155}
156```
157
158
159#### Normalised items and thumbnails
160
161Gallery items are normalised and made available in the `items` sub-directory of the data output directory. Normalisation consists of optional transcoding and other transforms as configured by the user in the compiler part of the `gallery.yaml` configuration file.
162
163Thumbnails are also generated for those items and are placed in the `thumbnails` sub-directory. Thumbnails of pictures in particular are resized using Lanczos resampling. Directory thumbnails may later be generated by picking or assembling one or multiple of its items, or defined explicitely by the user.
164
165The structure of the input directory is kept in both those output sub-directories. Input item files and directories also keep their original names.
166
167
168## Gallery viewer
169
170The __viewer__ is a single-page web application which displays the gallery's content.
171
172It runs fully on the client's side and remains usable without any back-end. It renders the compiled resources from the `data` directory, placed at its root, generated by the __compiler__.
173
174
175### URL anchor
176
177The page anchor is updated and used by the application to reflect the state of its current state in such a way that any view can be shared and loaded back by copying the URL and its anchor. It should in particular contain the current directory or item, as well as the filtering query.
178
179
180### Directory/collection/grid view
181
182The application starts by showing a grid view of the root directory of the gallery.
183
184This combined view offers the possiblity to the user to navigate to other items and to search recursively through the current directory.
185
186
187#### Directory breadcrumbs
188
189The directory view displays the current directory path, with links allowing the user to navigate into parent ones.
190
191```
192Gallery / Some directory / Sub-directory
193```
194
195
196#### Filering query
197
198A query field allows the user to search through and filter the items of the current directory and its sibling items recursively. This search field allows restriction on tags in a hierarchical manner. It should feature some sort of autocompletion, as well as an adjacent list of tags that are available for filtering. Positive as well as negative filtering should be possible, allowing the user to exclude some tags from the search results.
199
200For instance, the query `france -chessy` should match an item tagged with `location.france.paris`, but not `location.france.chessy`.
201
202The search is performed on the client side, either by scanning the item tree or with the use on some client-side indexer such as [Elasticlunr].
203
204In addition to tag-based filtering, full-text search on the `title` and `description` could later be added by leveraging such indexer.
205
206[Elasticlunr]: http://elasticlunr.com/
207
208
209#### Thumbnail grid
210
211The content of a directory are displayed as a grid of thumbnails which allows to navigate through sub-directories and to view items.
212
213By default, the content is rendered in the same ordered as listed in `index.json`. The user could later be presented with a menu allowing to sort those items by name, date for example.
214
215
216### Item view
217
218Items other than directories are displayed by this view, making use of most of the screen space to render the element.
219
220This view should as well display the title, description, date, tags and other information associated to the item. Tags in particular are displayed in a grouped manner as determined in `viewer.json`.
221
222It should be possible to navigate between items of the same directory as the current one through a thumbnail reel and previous/next links.