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 тижднів тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. return rows[0][0]
  9. def chapter_read_plus(uid, mid, number):
  10. username = get_dbusername(uid)
  11. title = get_dbtitle(mid)
  12. print("------ PLUS ------")
  13. print("User : %s" % str(username))
  14. print("Manga : %s" % str(mid))
  15. print("Last Read: %s " % get_last_read(uid, mid))
  16. get_last_release(mid)
  17. new_value = int(get_last_read(uid, mid)) + int(number)
  18. print("New Value : %s" % str(new_value))
  19. cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(new_value, mid, uid) )
  20. conn.commit()
  21. def chapter_read_minus(uid, mid, number):
  22. username = get_dbusername(uid)
  23. title = get_dbtitle(mid)
  24. print("------ MINUS ------")
  25. print("User : %s" % str(username))
  26. print("Manga : %s" % str(mid))
  27. print("Last Read: %s " % get_last_read(uid, mid) )
  28. get_last_release(mid)
  29. new_value = int(get_last_read(uid, mid)) - int(number)
  30. print("New Value : %s" % str(new_value))
  31. cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(new_value, mid, uid) )
  32. conn.commit()
  33. def chapter_read_manual(uid, mid, chap):
  34. username = get_dbusername(uid)
  35. title = get_dbtitle(mid)
  36. print("------ MANUAL ------")
  37. print("User : %s" % str(username))
  38. print("Manga : %s" % str(mid))
  39. print("Chapter : %s" % str(chap))
  40. print("Last Read: %s " % get_last_read(uid, mid) )
  41. if str(get_last_read(uid, mid)) == str(chap) :
  42. print("Vous avez deja lu ce chapitre")
  43. else :
  44. print("Vous n'avez pas vu le chapitre {} du manga {}".format(chap, title))
  45. cursor.execute("UPDATE readings SET chap = '{}' WHERE mid = '{}' AND uid = '{}';".format(chap, mid, uid) )
  46. conn.commit()
  47. def main():
  48. uid = input("UserID : ")
  49. mid = input("MangaID : ")
  50. number = input("Nombre : ")
  51. chapter_read_minus(uid, mid, number)
  52. if __name__ == '__main__':
  53. try :
  54. main()
  55. except KeyboardInterrupt :
  56. print("CTRL+C, Exiting...")
  57. except IndexError :
  58. print("Bad values")