-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
98 lines (85 loc) · 2.03 KB
/
Copy pathtypes.go
File metadata and controls
98 lines (85 loc) · 2.03 KB
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
package main
import (
"time"
)
// Metadata represents the metadata of an image file, with EXIF and IPTC metadata as the value.
type Metadata struct {
EXIF [][]string
IPTC [][]string
}
// Folders represents a list of folders, with the folder names as the value.
type Folders struct {
Folders []string
}
type RSSItem struct {
Title string
Description string
Link string
PubDate string
GUID string
}
type RSSFeed struct {
Title string
Description string
Link string
Copyright string
AtomLink string
Language string
LastBuildDate string
Items []RSSItem
}
// Image represents an image file, with a description, a file name, a path, and metadata.
type Image struct {
Description string
File string
Path string
Metadata Metadata
Index int
}
// Directory represents a directory with a path and name.
// FIXME: Rename to "Path"?
type NavigationElement struct {
Path string
Name string
}
// Gallery represents a gallery, with metadata and content.
type Gallery struct {
Name string
Copyright string
Folders []string
Navigation []NavigationElement
Images []Image
Year int
GalleryPath string
}
// File represents a file on disk, with a name and a modification time.
type File struct {
Name string
ModTime time.Time
}
// SubDir represents a subdirectory on disk, with a name.
type SubDir struct {
Name string
}
// Dir represents the content of a directory on disk.
type Dir struct {
Name string
Path string
Files map[string]File
SubDirs map[string]SubDir
NeedsUpdate bool
}
// DirMap is a map of directories on disk, with the path as the key.
type DirMap map[string]Dir
// AddDir adds a new directory to the DirMap.
func (dm DirMap) AddDir(path string, name string, needsUpdate bool) {
if _, exists := dm[path]; !exists {
dm[path] = Dir{
Name: name,
Path: path,
Files: make(map[string]File),
SubDirs: make(map[string]SubDir),
NeedsUpdate: needsUpdate,
}
}
}