Improve cover search
This commit is contained in:
parent
80375e5bd8
commit
86f5362fc1
1 changed files with 11 additions and 0 deletions
|
@ -56,6 +56,14 @@ func getCover(e *epub.Epub, path string) (string, string) {
|
||||||
if n != 0 {
|
if n != 0 {
|
||||||
return resize(folder, path, ".jpg")
|
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)
|
os.Remove(imgPath)
|
||||||
|
|
||||||
exp, _ := regexp.Compile("<img.*src=[\"']([^\"']*(\\.[^\\.\"']*))[\"']")
|
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], "/")
|
url = strings.Join(urlPart[:len(urlPart)-2], "/")
|
||||||
}
|
}
|
||||||
res[1] = strings.Replace(res[1], "%20", " ", -1)
|
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 == "" {
|
if url == "" {
|
||||||
url = res[1]
|
url = res[1]
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in a new issue