diff --git a/config.py b/config.py
index ac50630..5861965 100644
--- a/config.py
+++ b/config.py
@@ -4,6 +4,8 @@ from werkzeug.security import generate_password_hash
#CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/library") #docker
#CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/home/drudoo/ComicsTest/Comics") #linux
CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/Comics/ComicRack") #windows
+WIN_DRIVE_LETTER = 'B'
+DEFAULT_SEARCH_NUMBER = 10
TEENYOPDS_ADMIN_PASSWORD = os.getenv("TEENYOPDS_ADMIN_PASSWORD", None)
diff --git a/main.py b/main.py
index c8d9a54..ded0d24 100644
--- a/main.py
+++ b/main.py
@@ -31,6 +31,7 @@ def verify_password(username, password):
@app.route("/")
def startpage():
+ #result = "Hello, World!"
conn = sqlite3.connect('app.db')
cursor = conn.cursor()
cursor.execute("select * from comics;")
@@ -50,7 +51,7 @@ def import2sql():
importcount = 0
skippedcount = 0
errorcount = 0
-
+ comics_with_errors = []
start_time = timeit.default_timer()
for root, dirs, files in os.walk(os.path.abspath(config.CONTENT_BASE_DIR)):
for file in files:
@@ -83,8 +84,14 @@ def import2sql():
#sql="INSERT OR REPLACE INTO COMICS (CVDB,ISSUE,SERIES,VOLUME, PUBLISHER, TITLE, FILE,PATH,UPDATED) VALUES ("+CVDB[0]+",'"+ISSUE+"','"+SERIES+"','"+VOLUME+"','"+PUBLISHER+"','"+TITLE+"','"+file+"','" + f + "','" + UPDATED + "')"
#print(sql,file=sys.stdout)
#conn.execute(sql);
- query = "SELECT UPDATED FROM COMICS WHERE CVDB = '" + str(CVDB[0]) + "';"
- savedmodtime = conn.execute(query).fetchone()[0]
+
+ # CREATE TABLE IF MISSING
+ # create table COMICS (CVDB, ISSUE, SERIES,VOLUME,PUBLISHER,TITLE,FILE,PATH,UPDATED,PRIMARY KEY(CVDB))
+ try:
+ query = "SELECT UPDATED FROM COMICS WHERE CVDB = '" + str(CVDB[0]) + "';"
+ savedmodtime = conn.execute(query).fetchone()[0]
+ except:
+ savedmodtime = 0
#print(savedmodtime)
#print(float(savedmodtime))
#print(type(savedmodtime))
@@ -92,24 +99,25 @@ def import2sql():
if savedmodtime < filemodtime:
#print(str(savedmodtime) + " is less than " + str(filemodtime))
- print(str(CVDB[0]) + " - s: " + str(savedmodtime))
- print(str(CVDB[0]) + " - f: " + str(filemodtime))
+ #print(str(CVDB[0]) + " - s: " + str(savedmodtime))
+ #print(str(CVDB[0]) + " - f: " + str(filemodtime))
conn.execute("INSERT OR REPLACE INTO COMICS (CVDB,ISSUE,SERIES,VOLUME, PUBLISHER, TITLE, FILE,PATH,UPDATED) VALUES (?,?,?,?,?,?,?,?,?)", (CVDB[0], ISSUE, SERIES, VOLUME, PUBLISHER, TITLE, file, f, UPDATED))
conn.commit()
- print("Adding: " + str(CVDB[0]))
+ #print("Adding: " + str(CVDB[0]))
importcount = importcount + 1
else:
# print("Skipping: " + str(CVDB[0]))
skippedcount = skippedcount + 1
except:
errorcount = errorcount + 1
- print(f,file=sys.stdout)
+ comics_with_errors.append(f)
+ #print(f,file=sys.stdout)
conn.close()
elapsed = timeit.default_timer() - start_time
elapsed_time = "IMPORTED IN: " + str(round(elapsed,2)) + "s"
- print(elapsed_time)
- return elapsed_time + "
Comics: " + str(comiccount) + "
Imported: " + str(importcount) + "
Skipped: " + str(skippedcount) + "
Errors: " + str(errorcount)
+ import_stats = elapsed_time + "
Comics: " + str(comiccount) + "
Imported: " + str(importcount) + "
Skipped: " + str(skippedcount) + "
Errors: " + str(errorcount)
+ return import_stats #+ "
" + ['