|
- import sqlite3, sys
- from database import *
-
- conn = sqlite3.connect('database.db')
- cursor = conn.cursor()
-
-
-
-
- def get_last_read(uid, mid):
- cursor.execute("SELECT chap FROM readings WHERE uid = '{}' AND mid = '{}';".format(uid, mid) )
- rows = cursor.fetchall()
- return rows[0][0]
-
-
- def chapter_read_manual(uid, mid, chap):
- username = get_dbusername(uid)
- title = get_dbtitle(mid)
- print("User : %s" % str(username))
- print("Manga : %s" % str(mid))
- print("Chapter : %s" % str(chap))
- rows = cursor.fetchall()
- print("Last Chap: %s " % get_last_read(uid, mid) )
-
- if str(get_last_read(uid, mid)) == str(chap) :
- print("Vous avez deja lu ce chapitre")
- else :
- print("Vous n'avez pas vu le chapitre {} du manga {}".format(chap, title))
- cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(chap, mid, uid) )
- conn.commit()
-
-
- def main():
- uid = input("UserID : ")
- mid = input("MangaID : ")
- chap = input("Chap : ")
- chapter_read_manual(uid, mid, chap)
-
-
-
-
- if __name__ == '__main__':
- main()
|