forked from mangalorg/libmangal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format.go
46 lines (37 loc) · 948 Bytes
/
format.go
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
package libmangal
//go:generate enumer -type=Format -trimprefix=Format -json -yaml -text
// Format is the format for saving chapters
type Format uint8
const (
// FormatPDF saves chapter as a PDF document
FormatPDF Format = iota + 1
// FormatImages saves chapter as a directory of plain images
FormatImages
// FormatCBZ saves chapter as CBZ archive.
// CBZ stands for Comic Book Zip format.
// Common among comic readers
FormatCBZ
// FormatTAR saves chapter images as tar archive
FormatTAR
// FormatTARGZ saves chapter images tar.gz archive
FormatTARGZ
// FormatZIP save chapter images as zip archive
FormatZIP
)
// Extension returns extension of the format with the leading dot.
func (f Format) Extension() string {
switch f {
case FormatPDF:
return ".pdf"
case FormatCBZ:
return ".cbz"
case FormatTAR:
return ".tar"
case FormatTARGZ:
return ".tar.gz"
case FormatZIP:
return ".zip"
default:
return ""
}
}