Commit 840c48c78c
Unsigned
Layout: unified · split
curd.py +4 −3
| @@ -1094,6 +1094,7 @@ parser = argparse.ArgumentParser(description="Print a greeting message.") | |||
| 1094 | parser.add_argument("-new", action='store_true', help="Add new anime to watching (optional)") | 1094 | parser.add_argument("-new", action='store_true', help="Add new anime to watching (optional)") |
| 1095 | parser.add_argument("-sub", action='store_true', help="Anime audio type (optional)") | 1095 | parser.add_argument("-sub", action='store_true', help="Anime audio type (optional)") |
| 1096 | parser.add_argument("-dub", action='store_true', help="Anime audio type (optional)") | 1096 | parser.add_argument("-dub", action='store_true', help="Anime audio type (optional)") |
| 1097 | parser.add_argument("-c", action='store_true', help="Continue last watching anime (optional)") | ||
| 1097 | args = parser.parse_args() | 1098 | args = parser.parse_args() |
| 1098 | 1099 | ||
| 1099 | user_config = load_config() # python dictionary containing all the configs as key value pairs | 1100 | user_config = load_config() # python dictionary containing all the configs as key value pairs |
| @@ -1133,15 +1134,15 @@ if args.new: | |||
| 1133 | 1134 | ||
| 1134 | user_id, user_name = get_anilist_user_id(access_token) | 1135 | user_id, user_name = get_anilist_user_id(access_token) |
| 1135 | mark_episode_as_completed_at = get_userconfig_value(user_config, "percentage_to_mark_complete") | 1136 | mark_episode_as_completed_at = get_userconfig_value(user_config, "percentage_to_mark_complete") |
| 1136 | |||
| 1137 | anilist_user_data = download_anilist_data(access_token, user_id) | 1137 | anilist_user_data = download_anilist_data(access_token, user_id) |
| 1138 | anime_dict = extract_anime_info(anilist_user_data)[0] | 1138 | anime_dict = extract_anime_info(anilist_user_data)[0] |
| 1139 | select_anime(anime_dict) | 1139 | if not args.c: select_anime(anime_dict) |
| 1140 | anime_name = read_tmp("anime") | 1140 | anime_name = read_tmp("anime") |
| 1141 | write_to_tmp("query", anime_name) | 1141 | write_to_tmp("query", anime_name) |
| 1142 | run_script("anime_list") | 1142 | run_script("anime_list") |
| 1143 | anime_dict = load_anime_data(f"/tmp/curd/curd_anime_list") | 1143 | anime_dict = load_anime_data(f"/tmp/curd/curd_anime_list") |
| 1144 | cleaned_text = re.sub(r'\(.*$', '', anime_name).strip() # clean anime name | 1144 | cleaned_text = re.sub(r'\(.*$', '', anime_name).strip() # clean anime name |
| 1145 | |||
| 1145 | # print(cleaned_text) | 1146 | # print(cleaned_text) |
| 1146 | try: | 1147 | try: |
| 1147 | result = search_anime_by_title(anilist_user_data, cleaned_text)[0] | 1148 | result = search_anime_by_title(anilist_user_data, cleaned_text)[0] |
| @@ -1235,7 +1236,7 @@ else: | |||
| 1235 | exit(1) | 1236 | exit(1) |
| 1236 | 1237 | ||
| 1237 | links = load_links(f"/tmp/curd/curd_links") | 1238 | links = load_links(f"/tmp/curd/curd_links") |
| 1238 | 1239 | # print(links) | |
| 1239 | if get_userconfig_value(user_config, "discord_presence") == True: | 1240 | if get_userconfig_value(user_config, "discord_presence") == True: |
| 1240 | from pypresence import Presence | 1241 | from pypresence import Presence |
| 1241 | # print("imported pypresence") | 1242 | # print("imported pypresence") |