Improve cover search

This commit is contained in:
Las Zenow 2012-08-16 13:28:16 +02:00
parent 80375e5bd8
commit 86f5362fc1

View file

@ -56,6 +56,14 @@ func getCover(e *epub.Epub, path string) (string, string) {
if n != 0 {
return resize(folder, path, ".jpg")
}
n, _ = file.Write(e.Data("cover1.jpg"))
if n != 0 {
return resize(folder, path, ".jpg")
}
n, _ = file.Write(e.Data("cover1.jpeg"))
if n != 0 {
return resize(folder, path, ".jpg")
}
os.Remove(imgPath)
exp, _ := regexp.Compile("<img.*src=[\"']([^\"']*(\\.[^\\.\"']*))[\"']")
@ -74,6 +82,9 @@ func getCover(e *epub.Epub, path string) (string, string) {
url = strings.Join(urlPart[:len(urlPart)-2], "/")
}
res[1] = strings.Replace(res[1], "%20", " ", -1)
res[1] = strings.Replace(res[1], "%27", "'", -1)
res[1] = strings.Replace(res[1], "%28", "(", -1)
res[1] = strings.Replace(res[1], "%29", ")", -1)
if url == "" {
url = res[1]
} else {