mirror of
https://github.com/rakuri255/UltraSinger.git
synced 2026-11-20 13:07:52 +09:00
remove cache folder after run
This commit is contained in:
1 parent
fe27fa344e
commit
c062063258
5 files changed
+21
-4
No files matched your search
@@ -159,6 +159,7 @@ _Not all options working now!_
|
||||
--disable_separation True|False >> ((default) is False)
|
||||
--disable_karaoke True|False >> ((default) is False)
|
||||
--create_audio_chunks True|False >> ((default) is False)
|
||||
--keep_cache True|False >> ((default) is False)
|
||||
--plot True|False >> ((default) is False)
|
||||
--format_version 0.3.0|1.0.0|1.1.0 >> ((default) is 1.0.0)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Date: 2024.06.02
|
||||
- Changes:
|
||||
- Better linebreak calculation
|
||||
- Remove cache folder when finished
|
||||
|
||||
# Version: 0.0.10
|
||||
Date: 2024.05.01
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
class Settings:
|
||||
APP_VERSION = "0.0.11-dev1"
|
||||
APP_VERSION = "0.0.11-dev2"
|
||||
|
||||
create_midi = True
|
||||
create_plot = False
|
||||
@@ -7,6 +7,7 @@ class Settings:
|
||||
hyphenation = True
|
||||
use_separated_vocal = True
|
||||
create_karaoke = True
|
||||
keep_cache = False
|
||||
|
||||
input_file_path = ""
|
||||
output_file_path = ""
|
||||
|
||||
+12
-3
@@ -226,6 +226,7 @@ def print_help() -> None:
|
||||
--disable_separation True|False >> ((default) is False)
|
||||
--disable_karaoke True|False >> ((default) is False)
|
||||
--create_audio_chunks True|False >> ((default) is False)
|
||||
--keep_cache True|False >> ((default) is False)
|
||||
--plot True|False >> ((default) is False)
|
||||
--format_version 0.3.0|1.0.0|1.1.0 >> ((default) is 1.0.0)
|
||||
|
||||
@@ -463,6 +464,10 @@ def run() -> None:
|
||||
if settings.create_midi:
|
||||
create_midi_file(real_bpm, song_output, ultrastar_class, basename_without_ext)
|
||||
|
||||
# Cleanup
|
||||
if not settings.keep_cache:
|
||||
remove_cache_folder(cache_path)
|
||||
|
||||
# Print Support
|
||||
print_support()
|
||||
|
||||
@@ -882,9 +887,11 @@ def main(argv: list[str]) -> None:
|
||||
print_version()
|
||||
init_settings(argv)
|
||||
run()
|
||||
# todo: cleanup
|
||||
sys.exit()
|
||||
|
||||
def remove_cache_folder(cache_path: str) -> None:
|
||||
"""Remove cache folder"""
|
||||
os_helper.remove_folder(cache_path)
|
||||
|
||||
def init_settings(argv: list[str]) -> None:
|
||||
"""Init settings"""
|
||||
@@ -943,7 +950,8 @@ def init_settings(argv: list[str]) -> None:
|
||||
)
|
||||
sys.exit(1)
|
||||
settings.format_version = arg
|
||||
|
||||
elif opt in ("--keep_cache"):
|
||||
settings.keep_cache = arg
|
||||
if settings.output_file_path == "":
|
||||
if settings.input_file_path.startswith("https:"):
|
||||
dirname = os.getcwd()
|
||||
@@ -976,7 +984,8 @@ def arg_options():
|
||||
"force_cpu=",
|
||||
"force_whisper_cpu=",
|
||||
"force_crepe_cpu=",
|
||||
"format_version="
|
||||
"format_version=",
|
||||
"keep_cache"
|
||||
]
|
||||
return long, short
|
||||
|
||||
|
||||
@@ -47,3 +47,8 @@ def check_file_exists(file_path: str) -> bool:
|
||||
def check_if_folder_exists(song_output: str) -> bool:
|
||||
"""Checks if a folder exists."""
|
||||
return os.path.isdir(song_output)
|
||||
|
||||
|
||||
def remove_folder(cache_path):
|
||||
"""Removes a folder."""
|
||||
shutil.rmtree(cache_path)
|
||||
Reference in new issue
Block a user