Dirty hack to reload covers from new books
This commit is contained in:
parent
c01c465330
commit
4b536352de
9 changed files with 985 additions and 1 deletions
32
tools/coverNew/coverNew.go
Normal file
32
tools/coverNew/coverNew.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"labix.org/v2/mgo/bson"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
db = initDB()
|
||||
defer db.Close()
|
||||
books, _, _ := db.GetNewBooks()
|
||||
|
||||
for _, book := range books {
|
||||
fmt.Println(book.Title)
|
||||
fmt.Println(book.File)
|
||||
e, err := OpenBook(book.File)
|
||||
if err != nil {
|
||||
fmt.Println("================", err)
|
||||
}
|
||||
|
||||
cover, coverSmall := GetCover(e, book.Title)
|
||||
if cover != "" {
|
||||
db.UpdateBook(bson.ObjectIdHex(book.Id), bson.M{"cover": cover, "coversmall": coverSmall})
|
||||
}
|
||||
e.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func notFound(w http.ResponseWriter, r *http.Request) {
|
||||
// cover.go needs this function to compile
|
||||
}
|
Reference in a new issue