Commit 9515a86bc7

9515a86bc7b4489c46d839d521ab98f433cae951

parent: b4d27eaa5e

Unsigned

Wraient <wraient.911@gmail.com> · 2024-09-03 20:14 UTC

function to find anime added

Layout: unified · split

track_anime.py +11 −2
@@ -80,13 +80,22 @@ def update_anime(database_file, anilist_id, allanime_id, episode, time, name):
80 80
81 print("Updated the file") 81 print("Updated the file")
82 82
83def find_anime(anime_list, anilist_id=-1, allanime_id=-1):
84 for anime in anime_list:
85 if anime['anilist_id'] == anilist_id or anime['allanime_id'] == allanime_id:
86 return anime
87
88 return False
89
83# Example usage 90# Example usage
84# database_name = "/home/wraient/.local/share/curd/curd_history.txt" 91database_name = "/home/wraient/.local/share/curd/curd_history.txt"
85# add_anime(database_name, '54321', '09876', '3', '100', 'My Hero Academia') 92# add_anime(database_name, '54321', '09876', '3', '100', 'My Hero Academia')
86 93
94
95
87# # Print all anime entries 96# # Print all anime entries
88# update_anime(database_name, '21', 'ReooPAxPMsHM4KPMY', '1110', '10', 'ONE PIECE') 97# update_anime(database_name, '21', 'ReooPAxPMsHM4KPMY', '1110', '10', 'ONE PIECE')
89# print(get_all_anime(database_name)) 98# print(find_anime(get_all_anime(database_name), allanime_id="21"))
90# update_anime(database_name, '21', 'ReooPAxPMsHM4KPMY', '1110', '101', 'ONE PIECE') 99# update_anime(database_name, '21', 'ReooPAxPMsHM4KPMY', '1110', '101', 'ONE PIECE')
91 100
92# # Update an entry 101# # Update an entry