mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Added seperate download function for sftp/ftp
This commit is contained in:
parent
3219e32351
commit
fb52973cf6
@ -241,5 +241,5 @@ def search_specific_plugin(plugin_name) -> None:
|
|||||||
rich_print_error("Error: Number was out of range! Please try again!")
|
rich_print_error("Error: Number was out of range! Please try again!")
|
||||||
return None
|
return None
|
||||||
selected_plugin_name = handle_regex_plugin_name(plugin_search_results[plugin_selected]["name"])
|
selected_plugin_name = handle_regex_plugin_name(plugin_search_results[plugin_selected]["name"])
|
||||||
rich_console.print(f"\n [bright_white]● [bright_magenta]{selected_plugin_name} [bright_green]latest")
|
rich_console.print(f"\n [not bold][bright_white]● [bright_magenta]{selected_plugin_name} [bright_green]latest")
|
||||||
get_specific_plugin(plugin_selected_id)
|
get_specific_plugin(plugin_selected_id)
|
||||||
|
@ -278,6 +278,7 @@ def check_installed_plugins(input_selected_object : str="all", input_parameter :
|
|||||||
|
|
||||||
rich_console = Console()
|
rich_console = Console()
|
||||||
rich_console.print(rich_table)
|
rich_console.print(rich_table)
|
||||||
|
rich_console.print()
|
||||||
if plugins_with_udpates != 0:
|
if plugins_with_udpates != 0:
|
||||||
rich_console.print(
|
rich_console.print(
|
||||||
"[not bold][bright_yellow]Plugins with available updates: [bright_green]" +
|
"[not bold][bright_yellow]Plugins with available updates: [bright_green]" +
|
||||||
@ -325,6 +326,7 @@ def update_installed_plugins(input_selected_object : str="all", no_confirmation
|
|||||||
|
|
||||||
:returns: None
|
:returns: None
|
||||||
"""
|
"""
|
||||||
|
rich_console = Console()
|
||||||
config_values = config_value()
|
config_values = config_value()
|
||||||
match config_values.connection:
|
match config_values.connection:
|
||||||
case "sftp":
|
case "sftp":
|
||||||
@ -348,19 +350,26 @@ def update_installed_plugins(input_selected_object : str="all", no_confirmation
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# used later for output as stats
|
# used later for output as stats
|
||||||
plugins_updated = 0
|
plugins_updated = plugins_skipped = 0
|
||||||
|
|
||||||
#for plugin in track(INSTALLEDPLUGINLIST, description="[cyan]Updating...", transient=True, style="bright_yellow"):
|
#for plugin in track(INSTALLEDPLUGINLIST, description="[cyan]Updating...", transient=True, style="bright_yellow"):
|
||||||
for plugin in INSTALLEDPLUGINLIST:
|
for plugin in INSTALLEDPLUGINLIST:
|
||||||
# supports command 'update pluginname' and skip the updating of every other plugin to speed things up a bit
|
# supports command 'update pluginname' and skip the updating of every other plugin to speed things up a bit
|
||||||
if input_selected_object != "all" and input_selected_object != "*":
|
if input_selected_object != "all" and input_selected_object != "*":
|
||||||
if not re.search(input_selected_object, plugin.plugin_file_name, re.IGNORECASE):
|
if not re.search(input_selected_object, plugin.plugin_file_name, re.IGNORECASE):
|
||||||
|
plugins_skipped += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if plugin.plugin_is_outdated == False:
|
if plugin.plugin_is_outdated == False:
|
||||||
|
plugins_skipped += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
rich_console.print(
|
||||||
|
"\n [not bold][bright_white]● [bright_magenta]" +
|
||||||
|
f"{plugin.plugin_name} [bright_green]{plugin.plugin_latest_version}"
|
||||||
|
)
|
||||||
|
|
||||||
|
plugins_updated += 1
|
||||||
plugin_path = get_download_path(config_values)
|
plugin_path = get_download_path(config_values)
|
||||||
match config_values.connection:
|
match config_values.connection:
|
||||||
# local plugin folder
|
# local plugin folder
|
||||||
@ -368,7 +377,6 @@ def update_installed_plugins(input_selected_object : str="all", no_confirmation
|
|||||||
match (plugin.plugin_repository):
|
match (plugin.plugin_repository):
|
||||||
case "spigot":
|
case "spigot":
|
||||||
try:
|
try:
|
||||||
plugins_updated += 1
|
|
||||||
get_specific_plugin(plugin.plugin_repository_data[0])
|
get_specific_plugin(plugin.plugin_repository_data[0])
|
||||||
except HTTPError as err:
|
except HTTPError as err:
|
||||||
rich_print_error(f"HTTPError: {err.code} - {err.reason}")
|
rich_print_error(f"HTTPError: {err.code} - {err.reason}")
|
||||||
@ -382,11 +390,12 @@ def update_installed_plugins(input_selected_object : str="all", no_confirmation
|
|||||||
case _:
|
case _:
|
||||||
rich_print_error("Error: Plugin repository wasn't found")
|
rich_print_error("Error: Plugin repository wasn't found")
|
||||||
return None
|
return None
|
||||||
|
# don't delete files if they are downloaded to a seperate download path
|
||||||
try:
|
if config_values.local_seperate_download_path == False:
|
||||||
os.remove(Path(f"{plugin_path}/{plugin.plugin_file_name}"))
|
try:
|
||||||
except FileNotFoundError:
|
os.remove(Path(f"{plugin_path}/{plugin.plugin_file_name}"))
|
||||||
rich_print_error("Error: Old plugin file couldn't be deleted")
|
except FileNotFoundError:
|
||||||
|
rich_print_error("Error: Old plugin file couldn't be deleted")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -396,7 +405,6 @@ def update_installed_plugins(input_selected_object : str="all", no_confirmation
|
|||||||
match (plugin.plugin_repository):
|
match (plugin.plugin_repository):
|
||||||
case "spigot":
|
case "spigot":
|
||||||
try:
|
try:
|
||||||
plugins_updated += 1
|
|
||||||
get_specific_plugin(plugin.plugin_repository_data[0])
|
get_specific_plugin(plugin.plugin_repository_data[0])
|
||||||
except HTTPError as err:
|
except HTTPError as err:
|
||||||
rich_print_error(f"HTTPError: {err.code} - {err.reason}")
|
rich_print_error(f"HTTPError: {err.code} - {err.reason}")
|
||||||
@ -410,17 +418,24 @@ def update_installed_plugins(input_selected_object : str="all", no_confirmation
|
|||||||
case _:
|
case _:
|
||||||
rich_print_error("Error: Plugin repository wasn't found")
|
rich_print_error("Error: Plugin repository wasn't found")
|
||||||
return None
|
return None
|
||||||
match config_values.connection:
|
# don't delete old plugin files if they are downloaded to a seperate download path
|
||||||
case "sftp":
|
if config_values.remote_seperate_download_path == False:
|
||||||
try:
|
match config_values.connection:
|
||||||
connection.remove(plugin_path)
|
case "sftp":
|
||||||
except FileNotFoundError:
|
try:
|
||||||
rich_print_error("Error: Old plugin file couldn't be deleted")
|
connection.remove(plugin_path)
|
||||||
case "ftp":
|
except FileNotFoundError:
|
||||||
try:
|
rich_print_error("Error: Old plugin file couldn't be deleted")
|
||||||
connection.delete(plugin_path)
|
case "ftp":
|
||||||
except FileNotFoundError:
|
try:
|
||||||
rich_print_error("Error: Old plugin file couldn't be deleted")
|
connection.delete(plugin_path)
|
||||||
|
except FileNotFoundError:
|
||||||
|
rich_print_error("Error: Old plugin file couldn't be deleted")
|
||||||
|
|
||||||
|
rich_console.print(
|
||||||
|
f"\n[not bold][bright_green]Plugins updated: {plugins_updated}/{(len(INSTALLEDPLUGINLIST) - plugins_skipped)}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def search_plugin_spigot(plugin_file : str, plugin_file_name : str, plugin_file_version : str) -> int:
|
def search_plugin_spigot(plugin_file : str, plugin_file_name : str, plugin_file_version : str) -> int:
|
||||||
|
Loading…
Reference in New Issue
Block a user