Commit 4444a251c9

4444a251c946b6ede40f4b3bd707adb5a5b0cf2d

parent: be29ceb81c

Unsigned

Wraient <wraient.911@gmail.com> · 2024-10-08 09:27 UTC

better -c implementation

Layout: unified · split

curd.py +19 −3
@@ -520,7 +520,16 @@ def select_anime(anime_list):
520520 write_to_tmp("anime", selected_anime)
521521
522522 write_to_tmp("id", str(selected_id))
523
524 history_file_path_ = os.path.expandvars(get_userconfig_value(user_config, "history_file"))
525 history_file_path_ = os.path.dirname(history_file_path_)
526
527 with open(os.path.join(history_file_path_, "curd_id"), "w") as temp1_:
528 temp1_.write(selected_id)
523529
530 with open(os.path.join(history_file_path_, "curd_anime"), "w") as temp1_:
531 temp1_.write(selected_anime)
532
524533 return True
525534
526535 # Initialize curses
@@ -1167,12 +1176,20 @@ mark_episode_as_completed_at = get_userconfig_value(user_config, "percentage_to_
11671176anilist_user_data = download_anilist_data(access_token, user_id)
11681177anime_dict = extract_anime_info(anilist_user_data)[0]
11691178
1179search_for_new_anime = False
11701180if not args.c and not args.new:
11711181 select_anime(anime_dict)
11721182 if read_tmp("anime") == 'Add new anime':
11731183 search_for_new_anime = True
1174 else:
1175 search_for_new_anime = False
1184
1185if args.c:
1186 try:
1187 with open(os.path.join(history_file_path_, "curd_id"), "r") as temp1_:
1188 write_to_tmp("id", temp1_.read())
1189 with open(os.path.join(history_file_path_, "curd_anime"), "r") as temp1_:
1190 write_to_tmp("anime", temp1_.read())
1191 except:
1192 print("No previous history!")
11761193
11771194if args.new or search_for_new_anime:
11781195 new_anime_name_ = input("Enter anime name: ")
@@ -1299,7 +1316,6 @@ is_paused = False
12991316mpv_playback_speed = 1.0
13001317
13011318while True:
1302
13031319 try:
13041320 salt = random.randint(0,1500)
13051321 # print("SALT IS:"+str(salt))