rpiwebapp-public/test.py
Matthew Welch 2f855db067 Comics can be read
Comics can be opened and read. Thumbnails for each comics are now stored in the database. Some files have been renamed for clarification.
2019-07-11 17:35:30 -07:00

32 lines
778 B
Python

import threading
import time
import os
import sqlite3
from comicapi import comicarchive
from comicapi.issuestring import IssueString
from urllib import parse
from io import BytesIO
from PIL import Image
os.environ["UNRAR_LIB_PATH"] = 'C:\\Program Files (x86)\\UnrarDLL\\UnRAR.dll'
DATABASE = "C:\\Users\\Matthew\\Documents\\MyPrograms\\Websites\\rpi web interface\\database.db"
db = sqlite3.connect(DATABASE)
def get_db():
return db
row_id = 1
comic_id = 0
for row in get_db().execute("SELECT pageNumber, ROWID FROM comic_thumbnails ORDER BY ROWID").fetchall():
print("ROWID:", row[1])
if row[0] == 0:
comic_id += 1
print("comic id:", comic_id)
get_db().execute("UPDATE comic_thumbnails SET id=? WHERE ROWID=?", (comic_id, row[1]))
row_id += 1
get_db().commit()