| @@ -13,14 +13,47 @@ def get_last_read(uid, mid): | |||
| return rows[0][0] | |||
| def chapter_read_plus(uid, mid, number): | |||
| username = get_dbusername(uid) | |||
| title = get_dbtitle(mid) | |||
| print("------ PLUS ------") | |||
| print("User : %s" % str(username)) | |||
| print("Manga : %s" % str(mid)) | |||
| print("Last Read: %s " % get_last_read(uid, mid)) | |||
| get_last_release(mid) | |||
| new_value = int(get_last_read(uid, mid)) + int(number) | |||
| print("New Value : %s" % str(new_value)) | |||
| cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(new_value, mid, uid) ) | |||
| conn.commit() | |||
| def chapter_read_minus(uid, mid, number): | |||
| username = get_dbusername(uid) | |||
| title = get_dbtitle(mid) | |||
| print("------ MINUS ------") | |||
| print("User : %s" % str(username)) | |||
| print("Manga : %s" % str(mid)) | |||
| print("Last Read: %s " % get_last_read(uid, mid) ) | |||
| get_last_release(mid) | |||
| new_value = int(get_last_read(uid, mid)) - int(number) | |||
| print("New Value : %s" % str(new_value)) | |||
| cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(new_value, mid, uid) ) | |||
| conn.commit() | |||
| def chapter_read_manual(uid, mid, chap): | |||
| username = get_dbusername(uid) | |||
| title = get_dbtitle(mid) | |||
| print("------ MANUAL ------") | |||
| 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) ) | |||
| print("Last Read: %s " % get_last_read(uid, mid) ) | |||
| if str(get_last_read(uid, mid)) == str(chap) : | |||
| print("Vous avez deja lu ce chapitre") | |||
| @@ -33,11 +66,16 @@ def chapter_read_manual(uid, mid, chap): | |||
| def main(): | |||
| uid = input("UserID : ") | |||
| mid = input("MangaID : ") | |||
| chap = input("Chap : ") | |||
| chapter_read_manual(uid, mid, chap) | |||
| number = input("Nombre : ") | |||
| chapter_read_minus(uid, mid, number) | |||
| if __name__ == '__main__': | |||
| main() | |||
| try : | |||
| main() | |||
| except KeyboardInterrupt : | |||
| print("CTRL+C, Exiting...") | |||
| except IndexError : | |||
| print("Bad values") | |||