diff --git a/.gitignore b/.gitignore index bf6d7e2..64a7365 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /.idea -/__pycache__ +__pycache__ diff --git a/comics/__pycache__/comics.cpython-37.pyc b/comics/__pycache__/comics.cpython-37.pyc deleted file mode 100644 index e205606..0000000 Binary files a/comics/__pycache__/comics.cpython-37.pyc and /dev/null differ diff --git a/comics/comics.py b/comics/comics.py index c6e8ad6..f1651c7 100644 --- a/comics/comics.py +++ b/comics/comics.py @@ -17,16 +17,30 @@ MOBILE_DEVICES = ["android", "blackberry", "ipad", "iphone"] @login_required def index(): try: - return render_template("comics/index.html", title="Comics", publishers=database.get_publishers()) + page = request.args.get("page", 1, type=int) + max_items = request.args.get("max_items", 30, type=int) + publishers = database.get_publishers() + start = (max_items*(page-1)) + end = len(publishers) if len(publishers) < max_items*page else max_items*page + return render_template("comics/index.html", title="Comics", publishers=publishers, page=page, max_items=max_items, start=start, end=end, item_count=len(publishers)) except Exception as e: - print(e) - return str(e) + print(type(e), e) + return str(type(e)) + " " + str(e) @Comics.route("/comics/search") @login_required def search(): try: + page = request.args.get("page", 1, type=int) + max_items = request.args.get("max_items", 30, type=int) + publisher_end = 0 + series_end = 0 + comics_end = 0 + publisher_start = 0 + series_start = 0 + comics_start = 0 + item_count = 0 query = request.args.get("q") results = { "publisher": [], @@ -35,8 +49,23 @@ def search(): } if query: results = database.db_search_comics(query) - return render_template("comics/search.html", title="Comics: Search", - publishers=results["publisher"], publisher_series=results["series"], comics=results["comics"]) + item_count = len(results["publisher"]) + len(results["series"]) + len(results["comics"]) + for temp_page in range(1, page+1): + publisher_start = publisher_end + series_start = series_end + comics_start = comics_end + items = 0 + publisher_end = len(results["publisher"]) if len(results["publisher"]) < max_items*temp_page else max_items*temp_page + items += publisher_end - publisher_start + if items < max_items: + series_end = len(results["series"]) if len(results["series"]) < (max_items*temp_page)-items else (max_items*temp_page)-items + items += series_end-series_start + if items < max_items: + comics_end = len(results["comics"]) if len(results["comics"]) < (max_items*temp_page)-series_end-publisher_end else (max_items*temp_page)-series_end-publisher_end + return render_template("comics/search.html", title="Comics: Search", publishers=results["publisher"], publisher_series=results["series"], + comics=results["comics"], page=page, max_items=max_items, item_count=item_count, + publisher_start=publisher_start, series_start=series_start, comics_start=comics_start, + publisher_end=publisher_end, series_end=series_end, comics_end=comics_end) except Exception as e: print(type(e), e) return str(type(e))+" "+str(e) @@ -45,20 +74,32 @@ def search(): @Comics.route("/comics/") @login_required def comics_publisher(publisher): - publisher = parse.unquote(publisher) - series = request.args.get("series") - series_year = request.args.get("seriesYear") - issue = request.args.get("issue") - page_number = request.args.get("pageNumber") - if series: - if issue: - if page_number: - return comic_viewer(publisher, series, series_year, issue) - return comic_gallery(publisher, series, series_year, issue) - return render_template("comics/seriesView.html", title="Comics", - comics=database.db_get_comics_in_series(series, publisher, series_year)) - return render_template("comics/publisherSeriesView.html", title="Comics", - publisher_series=database.db_get_series_by_publisher(publisher)) + try: + publisher = parse.unquote(publisher) + series = request.args.get("series") + series_year = request.args.get("seriesYear") + issue = request.args.get("issue") + page_number = request.args.get("pageNumber") + page = request.args.get("page", 1, type=int) + max_items = request.args.get("max_items", 30, type=int) + publisher_series = database.db_get_series_by_publisher(publisher) + start = (max_items*(page-1)) + end = len(publisher_series) if len(publisher_series) < max_items*page else max_items*page + if series: + comics = database.db_get_comics_in_series(series, publisher, series_year) + start = (max_items * (page - 1)) + end = len(comics) if len(comics) < max_items * page else max_items * page + if issue: + if page_number: + return comic_viewer(publisher, series, series_year, issue) + return comic_gallery(publisher, series, series_year, issue) + return render_template("comics/seriesView.html", title="Comics", comics=comics, + start=start, end=end, page=page, max_items=max_items, item_count=len(comics)) + return render_template("comics/publisherSeriesView.html", title="Comics", publisher_series=publisher_series, + start=start, end=end, page=page, max_items=max_items, item_count=len(publisher_series)) + except Exception as e: + print(type(e), e) + return str(type(e)) + " " + str(e) def comic_viewer(publisher, series, series_year, issue): @@ -83,17 +124,21 @@ def comic_viewer(publisher, series, series_year, issue): title = "Comics: "+meta["series"]+": #"+meta["issueText"]+" "+(meta["title"] or "") return render_template("comics/comicView.html", title=title, on_mobile=on_mobile, prev_url=prev_url, next_url=next_url, comic=meta, page_number=page_number) except Exception as e: - print(e) - return str(e) + print(type(e), e) + return str(type(e)) + " " + str(e) def comic_gallery(publisher, series, series_year, issue): try: + page = request.args.get("page", 1, type=int) + max_items = request.args.get("max_items", 30, type=int) meta = database.db_get_comic(publisher, series, series_year, issue) - return render_template("comics/comicGallery.html", title="Comics", comic=meta) + start = (max_items*(page-1)) + end = meta["pageCount"] if meta["pageCount"] < max_items*page else max_items*page + return render_template("comics/comicGallery.html", title="Comics", comic=meta, start=start, end=end, page=page, max_items=max_items, item_count=meta["pageCount"]) except Exception as e: - print(e) - return str(e) + print(type(e), e) + return str(type(e)) + " " + str(e) @Comics.route("/comics/get_comic//") diff --git a/comics/templates/comics/PublisherSeriesList.html b/comics/templates/comics/PublisherSeriesList.html index 6dcc683..f2361e9 100644 --- a/comics/templates/comics/PublisherSeriesList.html +++ b/comics/templates/comics/PublisherSeriesList.html @@ -1,10 +1,10 @@ -{% for comic in publisher_series %} +{% for i in range(start, end) %}
- +
- +
- {{ comic["series"] }} {{ comic["seriesYear"] }} + {{ publisher_series[i]["series"] }} {{ publisher_series[i]["seriesYear"] }}
diff --git a/comics/templates/comics/comicGallery.html b/comics/templates/comics/comicGallery.html index 881dbef..05a6e6d 100644 --- a/comics/templates/comics/comicGallery.html +++ b/comics/templates/comics/comicGallery.html @@ -1,9 +1,12 @@ {% extends "base.html" %} {% block content %} +
+ {% include "pagination.html" %} +
- {% for page_number in range(comic["pageCount"]|int) %} + {% for page_number in range(start, end) %}
+
+ {% include "pagination.html" %} +
{% endblock %} diff --git a/comics/templates/comics/comicView.html b/comics/templates/comics/comicView.html index fec50d8..1046851 100644 --- a/comics/templates/comics/comicView.html +++ b/comics/templates/comics/comicView.html @@ -36,3 +36,5 @@ {% endblock %} + +{% block footer %}{% endblock %} diff --git a/comics/templates/comics/index.html b/comics/templates/comics/index.html index d78aa53..dffdc8c 100644 --- a/comics/templates/comics/index.html +++ b/comics/templates/comics/index.html @@ -5,9 +5,15 @@ {% endblock %} {% block content %} +
+ {% include "pagination.html" %} +
{% include "comics/publisherList.html" %}
+
+ {% include "pagination.html" %} +
{% endblock %} diff --git a/comics/templates/comics/publisherList.html b/comics/templates/comics/publisherList.html index f29891f..10c8b3e 100644 --- a/comics/templates/comics/publisherList.html +++ b/comics/templates/comics/publisherList.html @@ -1,10 +1,10 @@ -{% for publisher in publishers %} +{% for i in range(start, end) %}
- +
- +
- {{ publisher }} + {{ publishers[i] }}
diff --git a/comics/templates/comics/publisherSeriesView.html b/comics/templates/comics/publisherSeriesView.html index 36f7bf3..2627160 100644 --- a/comics/templates/comics/publisherSeriesView.html +++ b/comics/templates/comics/publisherSeriesView.html @@ -1,9 +1,15 @@ {% extends "base.html" %} {% block content %} +
+ {% include "pagination.html" %} +
{% include "comics/PublisherSeriesList.html" %}
+
+ {% include "pagination.html" %} +
{% endblock %} diff --git a/comics/templates/comics/search.html b/comics/templates/comics/search.html index bcd0e0e..14a1587 100644 --- a/comics/templates/comics/search.html +++ b/comics/templates/comics/search.html @@ -13,24 +13,42 @@ {% endblock %} {% block content %} -
- {% if publishers != [] %} +
+ {% include "pagination.html" %} +
+
+ {% with %} + {% set end=publisher_end %} + {% set start=publisher_start %} + {% if publishers != [] and start != end %}

Publishers

-
- {% include "comics/publisherList.html" %} -
- {% endif %} - {% if publisher_series != [] %} +
+ {% include "comics/publisherList.html" %} +
+ {% endif %} + {% endwith %} + {% with %} + {% set end=series_end %} + {% set start=series_start %} + {% if publisher_series != [] and start != end %}

Series

-
- {% include "comics/PublisherSeriesList.html" %} -
- {% endif %} - {% if comics != [] %} +
+ {% include "comics/PublisherSeriesList.html" %} +
+ {% endif %} + {% endwith %} + {% with %} + {% set end=comics_end %} + {% set start=comics_start %} + {% if comics != [] and start != end %}

Comics

-
- {% include "comics/seriesList.html" %} -
- {% endif %} +
+ {% include "comics/seriesList.html" %} +
+ {% endif %} + {% endwith %} +
+
+ {% include "pagination.html" %}
{% endblock %} diff --git a/comics/templates/comics/seriesList.html b/comics/templates/comics/seriesList.html index a5699ab..a0778b2 100644 --- a/comics/templates/comics/seriesList.html +++ b/comics/templates/comics/seriesList.html @@ -1,10 +1,10 @@ -{% for comic in comics %} +{% for i in range(start, end) %}
- +
- +
- {{ comic["series"] }} {% if comic["issue"] > 0 %}{{ "#{0:g}".format(comic["issue"]) }}{% endif %} {% if comic["title"] != None %}{{ comic["title"] }} {% endif %} + {{ comics[i]["series"] }} {% if comics[i]["issue"] > 0 %}{{ "#{0:g}".format(comics[i]["issue"]) }}{% endif %} {% if comics[i]["title"] != None %}{{ comics[i]["title"] }} {% endif %}
diff --git a/comics/templates/comics/seriesView.html b/comics/templates/comics/seriesView.html index 4afd431..c321ee7 100644 --- a/comics/templates/comics/seriesView.html +++ b/comics/templates/comics/seriesView.html @@ -1,9 +1,15 @@ {% extends "base.html" %} {% block content %} +
+ {% include "pagination.html" %} +
{% include "comics/seriesList.html" %}
+
+ {% include "pagination.html" %} +
{% endblock %} diff --git a/movies/__pycache__/movies.cpython-37.pyc b/movies/__pycache__/movies.cpython-37.pyc deleted file mode 100644 index e01ede9..0000000 Binary files a/movies/__pycache__/movies.cpython-37.pyc and /dev/null differ diff --git a/movies/movies.py b/movies/movies.py index 7f70e18..a0c814d 100644 --- a/movies/movies.py +++ b/movies/movies.py @@ -14,7 +14,36 @@ Movies = Blueprint("movies", __name__, template_folder="templates") @Movies.route("/movies") @login_required def index(): - return render_template("movies/index.html", title="Movies", movies=database.db_get_all_movies()) + try: + page = request.args.get("page", 1, type=int) + max_items = request.args.get("max_items", 30, type=int) + movies = database.db_get_all_movies() + start = (max_items*(page-1)) + end = len(movies) if len(movies) < max_items*page else max_items*page + return render_template("movies/index.html", title="Movies", movies=movies, page=page, max_items=max_items, start=start, end=end, item_count=len(movies)) + except Exception as e: + print(type(e), e) + return str(type(e)) + " " + str(e) + + +@Movies.route("/movies/search") +@login_required +def search(): + try: + page = request.args.get("page", 1, type=int) + max_items = request.args.get("max_items", 30, type=int) + start = 0 + end = 0 + query = request.args.get("q") + results = [] + if query: + results = database.db_search_movies(query) + start = (max_items*(page-1)) + end = len(results) if len(results) < max_items*page else max_items*page + return render_template("movies/search.html", title="Movies", movies=results, page=page, max_items=max_items, start=start, end=end, item_count=len(results)) + except Exception as e: + print(type(e), e) + return str(type(e)) + " " + str(e) @Movies.route("/movies/") @@ -24,8 +53,8 @@ def movie_view(imdb_id): movie_data = database.db_get_movie_by_imdb_id(imdb_id) return render_template("movies/movieViewer.html", title="Movies: " + movie_data["title"], movie=movie_data) except Exception as e: - print(e) - return str(e) + print(type(e), e) + return str(type(e)) + " " + str(e) @Movies.route("/movies//extended") @@ -35,8 +64,8 @@ def movie_view_extended(imdb_id): movie_data = database.db_get_movie_by_imdb_id(imdb_id, extended=1) return render_template("movies/movieViewer.html", title="Movies: " + movie_data["title"], movie=movie_data) except Exception as e: - print(e) - return str(e) + print(type(e), e) + return str(type(e)) + " " + str(e) @Movies.route("/movies//directors_cut") @@ -46,8 +75,8 @@ def movie_view_directors_cut(imdb_id): movie_data = database.db_get_movie_by_imdb_id(imdb_id, directors_cut=1) return render_template("movies/movieViewer.html", title="Movies: " + movie_data["title"], movie=movie_data) except Exception as e: - print(e) - return str(e) + print(type(e), e) + return str(type(e)) + " " + str(e) @Movies.route("/movies/get_movie/") diff --git a/movies/templates/movies/index.html b/movies/templates/movies/index.html index 491f315..0b64ce5 100644 --- a/movies/templates/movies/index.html +++ b/movies/templates/movies/index.html @@ -1,16 +1,26 @@ {% extends "base.html" %} +{% block nav %} + Search +{% endblock %} + {% block content %} +
+ {% include "pagination.html" %} +
{% include "movies/moviesList.html" %}
+
+ {% include "pagination.html" %} +
{% endblock %} -{% block footer %} +{% block footer_content %}

This product uses the TMDb API but is not endorsed or certified by TMDb.

-{% endblock %} +{% endblock footer_content %} diff --git a/movies/templates/movies/movieViewer.html b/movies/templates/movies/movieViewer.html index b2979db..92ec233 100644 --- a/movies/templates/movies/movieViewer.html +++ b/movies/templates/movies/movieViewer.html @@ -14,3 +14,10 @@

{{ movie["description"] }}

{% endblock %} + +{% block footer_content %} +
+ +

This product uses the TMDb API but is not endorsed or certified by TMDb.

+
+{% endblock footer_content %} diff --git a/movies/templates/movies/moviesList.html b/movies/templates/movies/moviesList.html index 2b8a27d..9d12efb 100644 --- a/movies/templates/movies/moviesList.html +++ b/movies/templates/movies/moviesList.html @@ -1,10 +1,10 @@ -{% for movie in movies %} +{% for i in range(start, end) %}
- +
- +
- {{ movie["title"] }} + {{ movies[i]["title"] }} ({{ movies[i]["year"] }})
diff --git a/movies/templates/movies/search.html b/movies/templates/movies/search.html new file mode 100644 index 0000000..9fab78b --- /dev/null +++ b/movies/templates/movies/search.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block nav %} + +{% endblock %} + +{% block content %} +
+ {% include "pagination.html" %} +
+
+ {% if movies != [] %} +
+ {% include "movies/moviesList.html" %} +
+ {% else %} +

No results.

+ {% endif %} +
+
+ {% include "pagination.html" %} +
+{% endblock %} + +{% block footer_content %} +
+ +

This product uses the TMDb API but is not endorsed or certified by TMDb.

+
+{% endblock footer_content %} diff --git a/scripts/__pycache__/database.cpython-36.pyc b/scripts/__pycache__/database.cpython-36.pyc deleted file mode 100644 index 4ab2bdf..0000000 Binary files a/scripts/__pycache__/database.cpython-36.pyc and /dev/null differ diff --git a/scripts/__pycache__/database.cpython-37.pyc b/scripts/__pycache__/database.cpython-37.pyc deleted file mode 100644 index b6496fe..0000000 Binary files a/scripts/__pycache__/database.cpython-37.pyc and /dev/null differ diff --git a/scripts/__pycache__/func.cpython-36.pyc b/scripts/__pycache__/func.cpython-36.pyc deleted file mode 100644 index 646d91c..0000000 Binary files a/scripts/__pycache__/func.cpython-36.pyc and /dev/null differ diff --git a/scripts/__pycache__/func.cpython-37.pyc b/scripts/__pycache__/func.cpython-37.pyc deleted file mode 100644 index 5166705..0000000 Binary files a/scripts/__pycache__/func.cpython-37.pyc and /dev/null differ diff --git a/scripts/__pycache__/imdb_import.cpython-37.pyc b/scripts/__pycache__/imdb_import.cpython-37.pyc deleted file mode 100644 index a7d714c..0000000 Binary files a/scripts/__pycache__/imdb_import.cpython-37.pyc and /dev/null differ diff --git a/scripts/__pycache__/tmdb.cpython-37.pyc b/scripts/__pycache__/tmdb.cpython-37.pyc deleted file mode 100644 index 5ba3321..0000000 Binary files a/scripts/__pycache__/tmdb.cpython-37.pyc and /dev/null differ diff --git a/scripts/database.py b/scripts/database.py index 56481d4..dbdd7b1 100644 --- a/scripts/database.py +++ b/scripts/database.py @@ -1,7 +1,10 @@ from flask import Flask from flask import g from flask_login import UserMixin + from werkzeug.security import generate_password_hash, check_password_hash +from io import BytesIO +from wand.image import Image import sqlite3 import os, time @@ -338,6 +341,52 @@ def db_search_comics(query): return {"publisher": publishers, "series": series, "comics": comics} +def db_search_movies(query): + results = db_search_table_columns_by_query(query, "movies", ["title", "year", "description"], order="title") + movies = [] + for movie in results["title"]: + if movie not in movies: + movies.append(movie) + for movie in results["description"]: + if movie not in movies: + movies.append(movie) + for movie in results["year"]: + if movie not in movies: + movies.append(movie) + return movies + + +def resize_image(image, new_width=256, new_height=256): + new_image = image + orig_height = new_image.height + orig_width = new_image.width + if orig_height >= orig_width: + width = int((orig_width / orig_height) * new_height) + height = new_height + else: + height = int((orig_height / orig_width) * new_width) + width = new_width + new_image.thumbnail(width, height) + return new_image + + +def fix_thumbnails(): + new_height = 256 + new_width = 256 + print("Start fix thumbnail size") + rows = get_db().execute("SELECT * FROM comic_thumbnails") + print("got list of all thumbnails\n") + + for row in rows: + image = Image(file=BytesIO(row["image"])) + if image.width > new_width or image.height > new_height: + print("id:", row["id"], "pageNumber:", row["pageNumber"]) + get_db().execute("UPDATE comic_thumbnails SET image=? WHERE id=? AND pageNumber=?", + [resize_image(image, new_width, new_height).make_blob(), row["id"], row["pageNumber"]]) + get_db().commit() + print("Finished fix thumbnail size") + + def get_user(username): user_data = get_db().execute("SELECT * FROM users WHERE username=?", [username]).fetchone() if user_data: diff --git a/scripts/fix_thumbnail_size.py b/scripts/fix_thumbnail_size.py new file mode 100644 index 0000000..8947674 --- /dev/null +++ b/scripts/fix_thumbnail_size.py @@ -0,0 +1,46 @@ +from io import BytesIO +from wand.image import Image +import sqlite3, os + + +RPI_DATABASE = "/var/lib/rpiWebApp/database.db" + +MC_DATABASE = "***REMOVED***" + +DATABASE = RPI_DATABASE if os.path.exists(RPI_DATABASE) else MC_DATABASE + + +db = sqlite3.connect(DATABASE) +db.row_factory = sqlite3.Row + + +def resize_image(image, new_width=256, new_height=256): + new_image = image + orig_height = new_image.height + orig_width = new_image.width + if orig_height >= orig_width: + width = int((orig_width/orig_height) * new_height) + height = new_height + else: + height = int((orig_height/orig_width) * new_width) + width = new_width + new_image.thumbnail(width, height) + return new_image + + +def fix_thumbnails(): + new_height = 256 + new_width = 256 + print("Start fix thumbnail size") + rows = db.execute("SELECT * FROM comic_thumbnails") + print("got list of all thumbnails\n") + + for row in rows: + image = Image(file=BytesIO(row["image"])) + if image.width > new_width or image.height > new_height: + print("id:", row["id"], "pageNumber:", row["pageNumber"]) + db.execute("UPDATE comic_thumbnails SET image=? WHERE id=? AND pageNumber=?", [resize_image(image, new_width, new_height).make_blob(), row["id"], row["pageNumber"]]) + db.commit() + + +fix_thumbnails() diff --git a/scripts/func.py b/scripts/func.py index adfafaf..b6c46bc 100644 --- a/scripts/func.py +++ b/scripts/func.py @@ -39,6 +39,8 @@ def get_comics(): i = 0 for root, dirs, files in os.walk(COMICS_DIRECTORY): for f in files: + if "temp" in root: + continue if f.endswith(".cbr"): total_comics += 1 path = os.path.join(root, f) @@ -98,7 +100,7 @@ def get_comic_thumbnails(comic): image = Image(file=image_bytes) orig_height = image.height orig_width = image.width - if (orig_width/orig_height)*new_height <= new_width: + if orig_height >= orig_width: width = int((orig_width/orig_height) * new_height) height = new_height else: @@ -116,7 +118,7 @@ def open_comic(path): def get_movies(): print("start load movies") - pattern = r"(.+)( \(....\))(\(extended\))?(\(Director's Cut\))?(\.mkv)" + pattern = r"(.+)( \(....\))(\(extended\))?( Director's Cut)?(\.mkv)" movies = [] total_movies = 0 movies_in_db = 0 @@ -124,11 +126,13 @@ def get_movies(): for root, dirs, files in os.walk(MOVIES_DIRECTORY): for f in files: if f.endswith(".mkv"): + total_movies += 1 path = os.path.join(root, f) if not database.movie_path_in_db(path): try: match = re.fullmatch(pattern, f) if not match: + print(f, "did not match regex.") continue print("movie path:", path) title = f[:-4].replace(match.group(2), "") @@ -158,6 +162,7 @@ def get_movies(): description = tmdb_data[1] poster_path = tmdb_data[2] backdrop_path = tmdb_data[3] + movies_added += 1 movies.append((path, imdb_id, tmdb_id, title, year, length, description, extended, directors_cut, poster_path, backdrop_path)) if len(movies) >= 20: @@ -165,6 +170,7 @@ def get_movies(): movies.clear() except Exception as e: print(e) + movies_in_db += 1 movie_loaded.send("anonymous", movies=movies) print("finish load movies") print("total movies:", total_movies) diff --git a/static/images/St. Johns Publishing Co..png b/static/images/St. Johns Publishing Co..png new file mode 100644 index 0000000..550324c Binary files /dev/null and b/static/images/St. Johns Publishing Co..png differ diff --git a/static/images/Vital Publications, Inc..png b/static/images/Vital Publications, Inc..png new file mode 100644 index 0000000..21fab7f Binary files /dev/null and b/static/images/Vital Publications, Inc..png differ diff --git a/templates/base.html b/templates/base.html index c2584b1..297271e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -57,9 +57,11 @@ {% endblock %}
-
{% block footer %} -{% endblock %} -
+
+ {% block footer_content %} + {% endblock footer_content %} +
+{% endblock footer %} diff --git a/templates/pagination.html b/templates/pagination.html new file mode 100644 index 0000000..2fb6c4e --- /dev/null +++ b/templates/pagination.html @@ -0,0 +1,18 @@ +{% with page_count=(item_count/max_items)|round(method="ceil")|int %} +{% if page_count > 1 %} + +{% endif %} +{% endwith %} diff --git a/test.py b/test.py index b67c36d..8658150 100644 --- a/test.py +++ b/test.py @@ -10,10 +10,9 @@ from PIL import Image import datetime, pytz from werkzeug.security import generate_password_hash -os.environ["UNRAR_LIB_PATH"] = "C:\\Program Files (x86)\\UnrarDLL\\UnRAR.dll" +from scripts import database -DATABASE = "***REMOVED***" -db = sqlite3.connect(DATABASE) +db = sqlite3.connect(database.DATABASE) db.row_factory = sqlite3.Row @@ -74,7 +73,7 @@ def db_search_comics(query): return {"publishers": publishers, "series": series, "comics": comics} -results = db_search_comics("ar") +results = db_search_comics("lord") for key in results.keys():