Use the new API of epubgo

This commit is contained in:
Las Zenow 2013-06-04 21:30:37 +02:00
parent a1c029345b
commit d51b7f935c
2 changed files with 6 additions and 6 deletions

View file

@ -86,7 +86,7 @@ func GetCover(e *epubgo.Epub, title string) (bson.ObjectId, bson.ObjectId) {
res := exp.FindSubmatch(txt) res := exp.FindSubmatch(txt)
if res != nil { if res != nil {
href := string(res[1]) href := string(res[1])
urlPart := strings.Split(it.Url(), "/") urlPart := strings.Split(it.URL(), "/")
url := strings.Join(urlPart[:len(urlPart)-1], "/") url := strings.Join(urlPart[:len(urlPart)-1], "/")
if href[:3] == "../" { if href[:3] == "../" {
href = href[3:] href = href[3:]

View file

@ -65,10 +65,10 @@ func getNextPrev(e *epubgo.Epub, file string, id string, base string) (string, s
prev := "" prev := ""
next := "" next := ""
for err == nil { for err == nil {
if cleanLink(spine.Url()) == file { if cleanLink(spine.URL()) == file {
break break
} }
prev = spine.Url() prev = spine.URL()
err = spine.Next() err = spine.Next()
} }
if err != nil { if err != nil {
@ -79,7 +79,7 @@ func getNextPrev(e *epubgo.Epub, file string, id string, base string) (string, s
prev = genLink(id, base, prev) prev = genLink(id, base, prev)
} }
if spine.Next() == nil { if spine.Next() == nil {
next = genLink(id, base, spine.Url()) next = genLink(id, base, spine.URL())
} }
return next, prev return next, prev
} }
@ -106,7 +106,7 @@ func listChapters(nav *epubgo.NavigationIterator, depth int) []chapter {
for err == nil { for err == nil {
var c chapter var c chapter
c.Label = nav.Title() c.Label = nav.Title()
c.Link = nav.Url() c.Link = nav.URL()
c.Depth = depth c.Depth = depth
for c.Depth < depth { for c.Depth < depth {
c.Out = append(c.Out, true) c.Out = append(c.Out, true)
@ -143,7 +143,7 @@ func readStartHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
notFound(w, r) notFound(w, r)
return return
} }
http.Redirect(w, r, "/read/"+id+"/"+it.Url(), http.StatusTemporaryRedirect) http.Redirect(w, r, "/read/"+id+"/"+it.URL(), http.StatusTemporaryRedirect)
} }
func readHandler(w http.ResponseWriter, r *http.Request, sess *Session) { func readHandler(w http.ResponseWriter, r *http.Request, sess *Session) {