Un serveur permettant de récupérer à quelle manga on s'est arrêté d'une licence. Un script se chargera de récupérer automatiquement les derniers mangas à jour à l'aide du site MangaDex
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2 недель назад
2 недель назад
2 недель назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import sqlite3, sys
  2. from database import *
  3. conn = sqlite3.connect('database.db')
  4. cursor = conn.cursor()
  5. def get_last_read(uid, mid):
  6. cursor.execute("SELECT chap FROM readings WHERE uid = '{}' AND mid = '{}';".format(uid, mid) )
  7. rows = cursor.fetchall()
  8. if len(rows) == 0 :
  9. return 0
  10. return rows[0][0]
  11. def chapter_read_plus(uid, mid, number):
  12. username = get_dbusername(uid)
  13. title = get_dbtitle(mid)
  14. print("------ PLUS ------")
  15. print("User : %s" % str(username))
  16. print("Manga : %s" % str(mid))
  17. print("Last Read: %s " % get_last_read(uid, mid))
  18. get_last_release(mid)
  19. new_value = int(get_last_read(uid, mid)) + int(number)
  20. print("New Value : %s" % str(new_value))
  21. cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(new_value, mid, uid) )
  22. conn.commit()
  23. def chapter_read_minus(uid, mid, number):
  24. username = get_dbusername(uid)
  25. title = get_dbtitle(mid)
  26. print("------ MINUS ------")
  27. print("User : %s" % str(username))
  28. print("Manga : %s" % str(mid))
  29. print("Last Read: %s " % get_last_read(uid, mid) )
  30. get_last_release(mid)
  31. new_value = int(get_last_read(uid, mid)) - int(number)
  32. print("New Value : %s" % str(new_value))
  33. cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(new_value, mid, uid) )
  34. conn.commit()
  35. def chapter_read_manual(uid, mid, chap):
  36. username = get_dbusername(uid)
  37. title = get_dbtitle(mid)
  38. print("------ MANUAL ------")
  39. print("User : %s" % str(username))
  40. print("Manga : %s" % str(mid))
  41. print("Chapter : %s" % str(chap))
  42. print("Last Read: %s " % get_last_read(uid, mid) )
  43. if str(get_last_read(uid, mid)) == str(chap) :
  44. print("Vous avez deja lu ce chapitre")
  45. else :
  46. print("Vous n'avez pas vu le chapitre {} du manga {}".format(chap, title))
  47. cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(chap, mid, uid) )
  48. conn.commit()
  49. def main():
  50. uid = input("UserID : ")
  51. mid = input("MangaID : ")
  52. """number = input("Nombre : ")
  53. chapter_read_minus(uid, mid, number)"""
  54. print(get_last_read(uid, mid))
  55. if __name__ == '__main__':
  56. try :
  57. main()
  58. except KeyboardInterrupt :
  59. print("CTRL+C, Exiting...")
  60. except IndexError :
  61. print("Bad values")