Implement Read Only mode
This commit is contained in:
parent
6464d92dd4
commit
e1bd235785
19 changed files with 544 additions and 335 deletions
|
@ -68,7 +68,7 @@ func coverHandler(h handler) {
|
|||
}
|
||||
}
|
||||
|
||||
func GetCover(e *epubgo.Epub, id string, store *storage.Store) bool {
|
||||
func GetCover(e *epubgo.Epub, id string, store storage.Store) bool {
|
||||
if coverFromMetadata(e, id, store) {
|
||||
return true
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ func GetCover(e *epubgo.Epub, id string, store *storage.Store) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func coverFromMetadata(e *epubgo.Epub, id string, store *storage.Store) bool {
|
||||
func coverFromMetadata(e *epubgo.Epub, id string, store storage.Store) bool {
|
||||
metaList, _ := e.MetadataAttr("meta")
|
||||
for _, meta := range metaList {
|
||||
if meta["name"] == "cover" {
|
||||
|
@ -135,7 +135,7 @@ func coverFromMetadata(e *epubgo.Epub, id string, store *storage.Store) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func searchCommonCoverNames(e *epubgo.Epub, id string, store *storage.Store) bool {
|
||||
func searchCommonCoverNames(e *epubgo.Epub, id string, store storage.Store) bool {
|
||||
for _, p := range []string{"cover.jpg", "Images/cover.jpg", "images/cover.jpg", "cover.jpeg", "cover1.jpg", "cover1.jpeg"} {
|
||||
img, err := e.OpenFile(p)
|
||||
if err == nil {
|
||||
|
@ -146,7 +146,7 @@ func searchCommonCoverNames(e *epubgo.Epub, id string, store *storage.Store) boo
|
|||
return false
|
||||
}
|
||||
|
||||
func storeImg(img io.Reader, id string, store *storage.Store) bool {
|
||||
func storeImg(img io.Reader, id string, store storage.Store) bool {
|
||||
/* open the files */
|
||||
fBig, err := store.Create(id, coverFile)
|
||||
if err != nil {
|
||||
|
|
Reference in a new issue