This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.example.yaml
265 lines (230 loc) · 11.1 KB
/
config.example.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# verbose is a boolean flag that governs whether detailed log information are
# to be displayed
# It can be set at runtime using the '--debug' flag
#verbose: false
#
# debug is a boolean flag that governs whether debug information are
# to be displayed
# It can be set at runtime using the '--debug' flag
#debug: false
# readonly is a boolean flag that governs whether gostore is allowed to
# alter the content of the collection. It is typically useful to dry-run
# some actions.
# It can be set at runtime using the '--pretend' flag
#readonly: false
# DeleteGhosts is a flag that instructs gostore.Check to delete any
# database entries that does not correspond to an existing file in th
# store's filesystem (so called ghost record)
# It can be set at runtime using '--delete-ghosts' flag
#deleteGhosts: false
# deleteOrphans is a flag that instructs gostore.Check to delete any
# file of the store's filesystem that is not recorded in the store's
# database.
# It can be set at runtime using '--delete-orphans' flag
#deleteOrphans: false
# importOrphans is a flag that instructs gostore.Check to re-import a
# file of the store's filesystem that is not recorded in the store's
# database.
# It can be set at runtime using '--import-orphans' flag
#importOrphans: false
# store contains any customization to manage the way the collection is stored
store:
# path is the path to the collection's root folder. The database, index and
# media files are stored inside this root folder.
# It can be set at runtime using the '--root=xxx' flag.
# If root is not set, it defaults to the current working directory.
path: /tmp/gostore-test/
# indexingAnalyzer identify the analyzer used to index the media metadata when
# searching your collection.
# To take benefit of a new analyzer you usually have to rebuild an existing index.
# Available analyzers can be listed using `gostore config`.
indexingAnalyzer: fr
# ui contains any customization to manage the way gostore interacts with the
# user
ui:
# auto is a boolean flag that governs whether user manual interaction (like
# metadata editing) is expected.
# It can be set at runtime using the '--auto' flag
#auto: false
# editorcmd contains the invocation stanza to fire-up a text editor
# allowing the user to modify metadata.
# editorcmd accepts one argument which is the name of file to be edited.
# editorcmd can rely on environment variable.
# If editorcmd is not set, metadata manual modification is skipped.
editorcmd: $EDITOR "%s"
# mergercmd contains the invocation stanza to fire-up a text editor
# allowing the user to mergel two set of metadata.
# mergecmd accepts two argument which is the name of files to be merged.
# mergecmd can rely on environment variable.
# If mergercmd is not set, metadata manual modification is skipped.
mergercmd: vim "%[2]s" -c "vert diffsplit %[1]s"
# outputformat points to the style to print-out metadata. It should be one
# of the defined formatters.
# If not set or set to a non-specified formatter, it defaults to listing
# media file name.
# It can be set at runtime using '--style=xxx' flag.
outputformat: full
# formatters is the set of available styles for printing media metadata. For
# each style, customized template can be proposed for a given media type.
# Default template can be defined using the "media" keyword.
#
# Templates follow golang text/template specification.
# Stored metadata can be retrieved using their field name. List of known
# fields can be obtained using `gostore fields`.
# Extensions to template idiom are available to simplify common operations:
# - tmpl: execute a sub-template by name
# - tmplExec: execute a template text
# - tmplFile: execute a template stored in a file
# - get/getAll: filter out specific fields from a set of medias and order them accordingly.
# Specific indications can be provided:
# . "*": any remaining fields
# . "?xxx"/"?*": only display the field if non empty
# . "!xxx": do not display the information
# - extend: create a new field that can be called afterwards to be displayed.
# - json/jsonForHuman: convert to json
#
# It is also possible to define intermediate sub-templates and re-use
# them.
formatters:
list:
media: '{{ getAll . "Name" "Title" "Authors" | bold | byrow }}'
book: '{{ getAll . "Name" "Title" "?SubTitle" "?Serie" "?SeriePosition" "Authors" | bold | byrow }}'
full:
media: |
{{ range $i, $r := . -}}
{{ if $i }}{{ printf "\n\n" }}{{ end -}}
{{ get $r "Name" "Title" "?*" "Type" "?QALevel" "?SourceHash" "CreatedAt" "UpdatedAt" | bold | bycol -}}
{{ end -}}
book: |
{{ range $i, $r := . -}}
{{ if .Serie }}{{ extend . "SerieName" (tmplExec "{{.Serie}} {{.SeriePosition}}" .)}}{{ end -}}
{{ if $i }}{{ printf "\n\n" }}{{ end -}}
{{ get $r "Name" "Title" "?SubTitle" "?SerieName" "!Serie" "!SeriePosition" "Authors" "Description" "?*" "Type" "?QALevel" "?SourceHash" "CreatedAt" "UpdatedAt" | bold | bycol -}}
{{ end -}}
json:
media: '{{ json . }}'
#html:
# media:
# {{ tmplFile "html.tmpl" . }}
# import lists the different modules to operate on metadata during the import step.
# Modules are run in the provided order.
# List of modules is available using `gostore config`.
import:
# hasher computes a checksum-based signature for the record's file and make
# sure it does not already exist in the store.
- name: hasher
config:
# HashMethod specifies the hash algorithm to use.
# Available methods are: md5, sha1, sha256. Default to md5
#HashMethod: md5
# mdatareader reads metadata from a media file and populates the
# corresponding record's values.
- name : mdatareader
# fetcher a module that retrieves metadata from online databases.
- name: fetcher
# scrubber is a module that removes any fields a media metadata.
- name: scrubber
config: &scrubber
# fields is the list of metadata fields to scrub
fields: [ Comment ]
# dehtmlizer is a modules that removes any html tags from a media metadata.
# It can optionally convert the html tagging into another idioms (like
# markdown)
- name: dehtmlizer
config: &dehtmlizer
# fields is the list of metadata fields to clean from html tags
fields: [ Description ]
# outputstyle is the idiom in which html tagging is converted to.
# Available formats are plain text (default) or markdown
outputstyle: markdown
# dupfinder is a module that checks whether a record is already in the
# collection before importing it.
- name: dupfinder
config:
# DupQueries is a collection of queries templates that identify records'
# duplicates.
# Extensions to template idiom are available to simplify common operations:
# - escape: escape special characters in query phrase or names.
#
# Queries, once expanded, should follow https://blevesearch.com/docs/Query-String-Query/
dupqueries:
- 'ISBN:{{ escape .ISBN }}'
- |
{{if .Title}}+Title:{{ escape .Title }}~1.2{{end -}}
{{range $i, $a := .Authors }} +Authors:{{ escape $a }}~1.2{{end -}}
{{if .Publisher}} +Publisher:{{ escape .Publisher }}~1.2{{end -}}
# checker is a module that verifies that a metadata set has a good quality
# level.
- name: checker
config: &checker
# fieldName is the name of the metadata's field to store the quality
# level assessment.
fieldName: QALevel
# minLevel is the minimum allowed level. Any level below this threshold
# will result in an error aborting operation. Default to 0 (all quality
# level is accepted)
minLevel: 30
# normalizer is a module that proposes normalized field values based
# on already similar existing records' values.
- name: normalizer
config:
# Fields is the list of fields where you expect normalization to happen.
# Normalisation is only working for fields featuring strings (or list of
# strings) like Authors, Publisher...
fields: [ Authors, Publisher, Subject ]
# SimilarityLevel is the measure of similarity that is accepted
# between two records. Default to 1.
# . 0: the input text is analyzed first. An attempt is made to use the same
# analyzer that was used when the field was indexed.
# . > 0: the input text is analysed first, the match is done with the given
# level of fuzziness.
# Default to 0.
# SimilarityLevel: 0
# organizer is a module that rationalizes the name of a media based on its
# metadata values
- name: organizer
config: &organizer
# namingschemes is a collection of templates to define a media name
# based on its metadata values.
#
# Different naming schemes can be adopted based on the media's type.
# Fall-back templates or generic template can be defined using the
# "media" keyword.
#
# Templates follow golang text/template specification.
# Stored metadata can be retrieved using their field name. List of known
# fields can be obtained using `gostore fields`.
# Extensions to template idiom are available to simplify common operations:
# - tmpl: execute a sub-template by name
# - tmplExec: execute a template text
# - tmplFile: execute a template stored in a file
# - ext: get file extension
# - sanitizePath: replace special chars that don't usually work well when
# use in path name
# - nospace: get rid of spaces
#
# It is also possible to define intermediate sub-templates and re-use
# them.
namingschemes:
author: "{{if .Authors}}{{index .Authors 0}}{{end}}"
serie: "{{if .Serie}}{{.Serie}} {{.SeriePosition}}{{end}}"
book: |
{{ $a := (tmpl "author" .) -}}
{{ $s := (tmpl "serie" .) -}}
{{ print (or $a "unknown") (and $s (printf " - [%s]" $s)) " - " .Title (ext .Name) | sanitizePath -}}
# update lists the different modules to operate on metadata during the update
# step. Modules are run in the provided order.
# List of modules is available using `gostore config`.
update:
- name: scrubber
config:
<<: *scrubber
- name: dehtmlizer
config:
<<: *dehtmlizer
- name: organizer
config:
<<: *organizer
- name: checker
config:
<<: *checker