Pārlūkot izejas kodu

chapter_read_manuel/get_last_read pour mettre des chapitres en "lu"

master
TheBidouilleur pirms 2 nedēļām
vecāks
revīzija
8489cb31e9
1 mainītis faili ar 43 papildinājumiem un 0 dzēšanām
  1. +43
    -0
      reading.py

+ 43
- 0
reading.py Parādīt failu

@@ -0,0 +1,43 @@
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" % username)
print("Manga : %s" % mid)
print("Chapter : %s" % str(chap))
rows = cursor.fetchall()
print("Last Chap: %s " % get_last_dread(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, username))
cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(chap, mid, uid) )
conn.commit()
# cursor.execute("SELECT password FROM users WHERE username = '%s' ;")
#cursor.execute("INSERT INTO manga(id, title, author, url, chap, img) VALUES(:id, :title, :author, :url, :chap, :img)")


def main():
input("")
chapter_read_manual(1, 31477, 2)




if __name__ == '__main__':
main()

Notiek ielāde…
Atcelt
Saglabāt