-
Notifications
You must be signed in to change notification settings - Fork 1
/
process.go
43 lines (32 loc) · 925 Bytes
/
process.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
package main
func needsProc(j *job) bool {
var imgChanged bool
var settingsChanged bool
if j.report.Empty() || j.settings.force {
settingsChanged = true
imgChanged = true
}
// if !j.report.Empty() && j.report.Version != j.settings.version {
// settingsChanged = true
// }
if j.settings.forceQuality && !j.report.Empty() && j.report.Quality != j.settings.quality {
settingsChanged = true
}
modTime := timeModified(j.settings.source + j.fileName)
if !j.report.Empty() && !modTime.Equal(j.report.ModTime) {
imgChanged = true
}
sha := sha1ForFile(j.settings.source + j.fileName)
if !j.report.Empty() && sha != j.report.Sha1 {
imgChanged = true
}
if !imgChanged && !settingsChanged {
return false
}
j.report.Quality = j.settings.quality
j.report.ModTime = modTime
j.report.Path = j.settings.source + j.fileName
j.report.Sha1 = sha
j.report.Version = j.settings.version
return true
}