コード例 #1
0
ファイル: annotations.py プロジェクト: BLimmie/manga_ordering
 def __init__(self):
     self.annotations = {}
     for book in get_books():
         with open(op.join(root, "manga109", "annotations_json",
                           book + ".json"),
                   encoding="utf-8") as f:
             self.annotations[book] = json.load(f)
コード例 #2
0
ファイル: seed.py プロジェクト: Sameea786/project-book
def store_books_in_database():
    a = get_books("cooking")
    id_record= []
   
    for b in a:
        id=b[0]
        title = b[1]
        crud.create_book(id ,title,"None")
コード例 #3
0
ファイル: pages.py プロジェクト: BLimmie/manga_ordering
def get_pages(with_text: bool = False, exclude: Optional[List[str]] = None, include: Optional[List[str]] = None) -> \
        List[Tuple[str, int]]:
    assert exclude is None or include is None
    if exclude is None:
        exclude = []
    result = []
    books = get_books() if include is None else include
    for book in books:
        if book in exclude:
            continue
        data = annotations(book)
        num_pages = len(data["book"]["pages"]["page"])
        for i in range(num_pages):
            if with_text:
                if "text" not in data["book"]["pages"]["page"][i]:
                    continue
                if (book, i) in degeneracies:
                    continue
            result.append((book, i))
    return result
コード例 #4
0
def search_book():
    """search book"""
    search_keyword = request.args.get("search")
    books = get_books(search_keyword)
    return render_template("index.html", books=books)
コード例 #5
0
import crud
from data.books import get_books, search_book_with_google_id_and_set_with_review, search_book_with_google_id

from jinja2 import StrictUndefined
import cloudinary.uploader
import os

CLOUDINARY_KEY = os.environ['CLOUDINARY_KEY']
CLOUDINARY_KEY_SECRET = os.environ['CLOUDINARY_SECRET']

app = Flask(__name__)
#app.secrete_key = "dev"
app.secret_key = 'this-should-be-something-unguessable'
app.jinja_env.undefined = StrictUndefined
ID = 1
BOOKs = get_books('fiction')


@app.route('/')
def homepage():
    """View homepage."""
    if 'id' in session:
        return render_template("index.html", books=BOOKs)
    else:
        return render_template("index.html", books=BOOKs)


@app.route('/login')
def login():
    """check if user is already log in send on home page otherwise send him on login page"""
    if session.get("id") is None: