Commit 4444a251c9
Unsigned
Layout: unified · split
curd.py +19 −3
| @@ -520,7 +520,16 @@ def select_anime(anime_list): | ||
| 520 | 520 | write_to_tmp("anime", selected_anime) |
| 521 | 521 | |
| 522 | 522 | 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) | |
| 523 | 529 | |
| 530 | with open(os.path.join(history_file_path_, "curd_anime"), "w") as temp1_: | |
| 531 | temp1_.write(selected_anime) | |
| 532 | ||
| 524 | 533 | return True |
| 525 | 534 | |
| 526 | 535 | # Initialize curses |
| @@ -1167,12 +1176,20 @@ mark_episode_as_completed_at = get_userconfig_value(user_config, "percentage_to_ | ||
| 1167 | 1176 | anilist_user_data = download_anilist_data(access_token, user_id) |
| 1168 | 1177 | anime_dict = extract_anime_info(anilist_user_data)[0] |
| 1169 | 1178 | |
| 1179 | search_for_new_anime = False | |
| 1170 | 1180 | if not args.c and not args.new: |
| 1171 | 1181 | select_anime(anime_dict) |
| 1172 | 1182 | if read_tmp("anime") == 'Add new anime': |
| 1173 | 1183 | search_for_new_anime = True |
| 1174 | else: | |
| 1175 | search_for_new_anime = False | |
| 1184 | ||
| 1185 | if 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!") | |
| 1176 | 1193 | |
| 1177 | 1194 | if args.new or search_for_new_anime: |
| 1178 | 1195 | new_anime_name_ = input("Enter anime name: ") |
| @@ -1299,7 +1316,6 @@ is_paused = False | ||
| 1299 | 1316 | mpv_playback_speed = 1.0 |
| 1300 | 1317 | |
| 1301 | 1318 | while True: |
| 1302 | ||
| 1303 | 1319 | try: |
| 1304 | 1320 | salt = random.randint(0,1500) |
| 1305 | 1321 | # print("SALT IS:"+str(salt)) |