Commit 7c6a5a6e04

7c6a5a6e0452f327988de30ec0245750e5a2fb9b

parent: 13f5cbef1e

Unsigned

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

update script automatically

Layout: unified · split

curd.py +19
@@ -904,6 +904,20 @@ def load_config() -> dict:
904904
905905 return config_dict
906906
907def 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
907921# ----------------------------------------------- Create Bash Script ----------------------------------------
908922
909923def create_anime_list():
@@ -1104,8 +1118,13 @@ parser.add_argument("-new", action='store_true', help="Add new anime to watching
11041118parser.add_argument("-sub", action='store_true', help="Anime audio type (optional)")
11051119parser.add_argument("-dub", action='store_true', help="Anime audio type (optional)")
11061120parser.add_argument("-c", action='store_true', help="Continue last watching anime (optional)")
1121parser.add_argument("-u", action='store_true', help="Update script (optional)")
11071122args = parser.parse_args()
11081123
1124if args.u:
1125 update_script()
1126 exit(0)
1127
11091128user_config = load_config() # python dictionary containing all the configs as key value pairs
11101129history_file_path_ = os.path.expandvars(get_userconfig_value(user_config, "history_file"))
11111130history_file_path_ = os.path.dirname(history_file_path_)