adds support for comppleted files
This commit is contained in:
@@ -9,13 +9,21 @@ from .api import (
|
||||
is_file,
|
||||
list_input_files,
|
||||
pre_process_a_dictionary_file,
|
||||
proccess_a_completed_file,
|
||||
process_a_dictation_file,
|
||||
process_a_dictionary_file,
|
||||
process_a_phrases_file,
|
||||
select_file,
|
||||
select_folder,
|
||||
)
|
||||
from .constants import DICTATION_TYPE, DICT_TYPE, INPUT, LANGUAGES, PHRASES_TYPE
|
||||
from .constants import (
|
||||
COMPLETED_TYPE,
|
||||
DICTATION_TYPE,
|
||||
DICT_TYPE,
|
||||
INPUT,
|
||||
LANGUAGES,
|
||||
PHRASES_TYPE,
|
||||
)
|
||||
from .utility import ProcessFile, ProcessFolder
|
||||
|
||||
|
||||
@@ -24,7 +32,7 @@ def cli_choose_work_type() -> str:
|
||||
option = None
|
||||
while not option in ["s", "f", "e"]:
|
||||
option = input(
|
||||
"Please select the work option:\n" "s: single file, f:folder, e:exit\n"
|
||||
"Please select the work option:\n" "s:single file, f:folder, e:exit\n"
|
||||
)
|
||||
return option
|
||||
|
||||
@@ -66,7 +74,7 @@ def cli_select_folder() -> ProcessFolder:
|
||||
print(f"Selected {selected}")
|
||||
s = None
|
||||
while s not in ("yes", "y", "no", "n"):
|
||||
s = input("if this the folder? (yes/no, go inside)")
|
||||
s = input("if this the folder? (yes / no, go inside) : ")
|
||||
if s in ("yes", "y"):
|
||||
in_folder = selected
|
||||
else:
|
||||
@@ -100,9 +108,10 @@ def cli_select_language(languages: list = None) -> str:
|
||||
for language_id, language in avaliable_languages:
|
||||
if languages and language_id in languages:
|
||||
print(f"{language_id} - {language}")
|
||||
print("all - All languages")
|
||||
s = None
|
||||
while not s or s not in LANGUAGES.AvailableLanguages:
|
||||
lan_codes = [lan_id for lan_id, lan in avaliable_languages]
|
||||
while not s or s not in LANGUAGES.AvailableLanguages + ("all",):
|
||||
lan_codes = [lan_id for lan_id, lan in avaliable_languages] + ["all"]
|
||||
s = input(f"Please select the language {', '.join(lan_codes)}: ")
|
||||
return s
|
||||
|
||||
@@ -137,8 +146,16 @@ def main():
|
||||
language_id = cli_select_language()
|
||||
print(f"processing file {input_file} with language {language_id}")
|
||||
process_a_dictation_file(input_file, language_id)
|
||||
elif COMPLETED_TYPE in input_file.input_file.suffixes:
|
||||
language_id = input_file.input_file.suffixes[1][1:]
|
||||
print(f"processing file {input_file} with language {language_id}")
|
||||
proccess_a_completed_file(input_file, language_id)
|
||||
elif option == "f":
|
||||
for language_id in LANGUAGES.AvailableLanguages:
|
||||
language_id = cli_select_language()
|
||||
langs = (
|
||||
LANGUAGES.AvailableLanguages if language_id == "all" else [language_id]
|
||||
)
|
||||
for language_id in langs:
|
||||
in_folder = cli_select_folder()
|
||||
print(f"Selected: {in_folder} with language {language_id}")
|
||||
for dirpath, dirnames, filenames in tuple(
|
||||
|
||||
Reference in New Issue
Block a user