Commit 7c6a5a6e04
Unsigned
Layout: unified · split
curd.py +19
| @@ -904,6 +904,20 @@ def load_config() -> dict: | ||
| 904 | 904 | |
| 905 | 905 | return config_dict |
| 906 | 906 | |
| 907 | def update_script(): | |
| 908 | script_dir = os.path.dirname(os.path.realpath(__file__)) | |
| 909 | script_file = os.path.join(script_dir, "curd.py") | |
| 910 | ||
| 911 | response = requests.get("https://raw.githubusercontent.com/Wraient/curd/refs/heads/main/curd.py") | |
| 912 | if response.status_code == 200: | |
| 913 | # Write the content to a file | |
| 914 | with open(script_file, 'wb') as file: | |
| 915 | file.write(response.content) | |
| 916 | print(f"Script update successfully at {script_file}") | |
| 917 | else: | |
| 918 | print(f"Failed to download the script. Status code: {response.status_code}") | |
| 919 | exit(1) | |
| 920 | ||
| 907 | 921 | # ----------------------------------------------- Create Bash Script ---------------------------------------- |
| 908 | 922 | |
| 909 | 923 | def create_anime_list(): |
| @@ -1104,8 +1118,13 @@ parser.add_argument("-new", action='store_true', help="Add new anime to watching | ||
| 1104 | 1118 | parser.add_argument("-sub", action='store_true', help="Anime audio type (optional)") |
| 1105 | 1119 | parser.add_argument("-dub", action='store_true', help="Anime audio type (optional)") |
| 1106 | 1120 | parser.add_argument("-c", action='store_true', help="Continue last watching anime (optional)") |
| 1121 | parser.add_argument("-u", action='store_true', help="Update script (optional)") | |
| 1107 | 1122 | args = parser.parse_args() |
| 1108 | 1123 | |
| 1124 | if args.u: | |
| 1125 | update_script() | |
| 1126 | exit(0) | |
| 1127 | ||
| 1109 | 1128 | user_config = load_config() # python dictionary containing all the configs as key value pairs |
| 1110 | 1129 | history_file_path_ = os.path.expandvars(get_userconfig_value(user_config, "history_file")) |
| 1111 | 1130 | history_file_path_ = os.path.dirname(history_file_path_) |