mirror of
https://github.com/DrewThomasson/ebook2audiobook.git
synced 2026-01-09 13:58:14 -05:00
move test files to tests folder, recreate models folder
This commit is contained in:
54
app.py
54
app.py
@@ -8,11 +8,11 @@ import sys
|
||||
from lib.conf import *
|
||||
from lib.lang import language_mapping, default_language_code
|
||||
|
||||
import unidic
|
||||
#import unidic
|
||||
|
||||
script_mode = NATIVE
|
||||
share = False
|
||||
|
||||
"""
|
||||
try:
|
||||
# Check if the UniDic dictionary data directory exists and is not empty
|
||||
if not os.path.isdir(unidic.DICDIR) or not os.listdir(unidic.DICDIR):
|
||||
@@ -23,7 +23,7 @@ try:
|
||||
print("UniDic dictionary already present. Skipping download.")
|
||||
except Exception as e:
|
||||
print(f"Error during UniDic check/download: {e}")
|
||||
|
||||
"""
|
||||
def check_python_version():
|
||||
current_version = sys.version_info[:2] # (major, minor)
|
||||
if current_version < min_python_version or current_version > max_python_version:
|
||||
@@ -62,29 +62,28 @@ def check_and_install_requirements(file_path):
|
||||
print(f"Failed to install packages: {e}")
|
||||
return False
|
||||
|
||||
# This will check if the base xtts model files exist, and if they don't or if any are missing then itll download them
|
||||
from lib.functions import check_files_in_folder, download_xttsv2_model
|
||||
xtts_base_model_existance_status, error_message, xtts_missing_files = check_files_in_folder(xttsv2_base_model_dir, xtts_base_model_files)
|
||||
if xtts_base_model_existance_status:
|
||||
print("All specified xtts base model files are present in the folder.")
|
||||
else:
|
||||
print("The following files are missing:", xtts_missing_files)
|
||||
print("Downloading xtts files . . .")
|
||||
download_xttsv2_model(xttsv2_base_model_dir, zip_link_to_xtts_model)
|
||||
|
||||
from lib.functions import check_missing_files, download_model
|
||||
for mod in models.keys():
|
||||
if mod == "xtts":
|
||||
mod_exists, err, list = check_missing_files(models[mod]["local"], models[mod]["files"])
|
||||
if mod_exists:
|
||||
print("All specified xtts base model files are present in the folder.")
|
||||
else:
|
||||
print("The following files are missing:", list)
|
||||
print(f"Downloading {mod} files . . .")
|
||||
download_model(models[model]["local"], models[mod]["url"])
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
|
||||
return True
|
||||
|
||||
def check_dictionary(language):
|
||||
print(f"An error occurred: {e}")
|
||||
return False
|
||||
"""
|
||||
def check_dictionary():
|
||||
import unidic
|
||||
import spacy.cli
|
||||
|
||||
version_obj = sys.version_info
|
||||
version = f"{version_obj.major}.{version_obj.minor}"
|
||||
|
||||
required_model = f"{language}_core_web_sm"
|
||||
required_model = f"en_core_web_sm"
|
||||
|
||||
if os.path.isdir(unidic.DICDIR):
|
||||
if not os.listdir(unidic.DICDIR):
|
||||
@@ -117,7 +116,7 @@ def check_dictionary(language):
|
||||
except Exception as e:
|
||||
print(f"Error during spaCy model download: {e}")
|
||||
return False
|
||||
|
||||
"""
|
||||
def is_port_in_use(port):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
return s.connect_ex(('0.0.0.0', port)) == 0
|
||||
@@ -165,7 +164,7 @@ Linux/Mac:
|
||||
help=f"Path to the directory containing ebooks for batch conversion. Defaults to '{os.path.basename(ebooks_dir)}' if 'default' value is provided.")
|
||||
parser.add_argument(options[5], type=str,
|
||||
help="Path to the target voice file for TTS. Optional, uses a default voice if not provided.")
|
||||
parser.add_argument(options[6], type=str, default="en",
|
||||
parser.add_argument(options[6], type=str, default=default_language_code,
|
||||
help=f"Language for the audiobook conversion. Options: {lang_list_str}. Defaults to English (en).")
|
||||
parser.add_argument(options[7], type=str, default="cpu", choices=["cpu", "gpu"],
|
||||
help=f"Type of processor unit for the audiobook conversion. If not specified: check first if gpu available, if not cpu is selected.")
|
||||
@@ -211,10 +210,13 @@ Linux/Mac:
|
||||
if script_mode == NATIVE:
|
||||
check_pkg = check_and_install_requirements(requirements_file)
|
||||
if check_pkg:
|
||||
check_dic = check_dictionary(args.language)
|
||||
if not check_dic:
|
||||
sys.exit(1)
|
||||
#check_dict = check_dictionary()
|
||||
#f not check_dict:
|
||||
# print("Unidic Dictionary folder not found")
|
||||
# sys.exit(1)
|
||||
print("Package requirements ok")
|
||||
else:
|
||||
print("Some packages could not be installed")
|
||||
sys.exit(1)
|
||||
|
||||
from lib.functions import web_interface, convert_ebook
|
||||
@@ -244,7 +246,7 @@ Linux/Mac:
|
||||
if os.path.exists(ebooks_dir):
|
||||
for file in os.listdir(ebooks_dir):
|
||||
# Process files with supported ebook formats
|
||||
if any(file.endswith(ext) for ext in supported_ebook_formats):
|
||||
if any(file.endswith(ext) for ext in ebook_formats):
|
||||
full_path = os.path.join(ebooks_dir, file)
|
||||
print(f"Processing eBook file: {full_path}")
|
||||
args.ebook = full_path
|
||||
|
||||
@@ -11,7 +11,7 @@ set "FULL_DOCKER=full_docker"
|
||||
set "SCRIPT_MODE=%NATIVE%"
|
||||
set "SCRIPT_DIR=%~dp0"
|
||||
|
||||
set "PYTHON_VERSION=3.11"
|
||||
set "PYTHON_VERSION=3.12"
|
||||
set "DOCKER_UTILS_IMG=utils"
|
||||
set "PYTHON_ENV=python_env"
|
||||
set "CURRENT_ENV="
|
||||
@@ -248,7 +248,6 @@ if "%PROGRAMS_CHECK%"=="0" (
|
||||
)
|
||||
)
|
||||
)
|
||||
echo Some check failed: (1 = failed)
|
||||
echo PROGRAMS_CHECK: %PROGRAMS_CHECK%
|
||||
echo CONDA_CHECK_STATUS: %CONDA_CHECK_STATUS%
|
||||
echo DOCKER_CHECK_STATUS: %DOCKER_CHECK_STATUS%
|
||||
@@ -269,10 +268,7 @@ if "%SCRIPT_MODE%"=="%FULL_DOCKER%" (
|
||||
call conda create --prefix %SCRIPT_DIR%\%PYTHON_ENV% python=%PYTHON_VERSION% -y
|
||||
call conda activate %SCRIPT_DIR%\%PYTHON_ENV%
|
||||
call python -m pip install --upgrade pip
|
||||
call python -m pip install --upgrade -r requirements.txt
|
||||
call python -m unidic download
|
||||
call python -m spacy download en_core_web_sm
|
||||
call python -m nltk.downloader punkt_tab
|
||||
call python -m pip install --upgrade -r requirements.txt --progress-bar=on
|
||||
) else (
|
||||
call conda activate %SCRIPT_DIR%\%PYTHON_ENV%
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PYTHON_VERSION="3.11"
|
||||
PYTHON_VERSION="3.12"
|
||||
export TTS_CACHE="./models"
|
||||
|
||||
ARGS="$@"
|
||||
@@ -214,10 +214,7 @@ function conda_check {
|
||||
source $CONDA_ENV
|
||||
conda activate $SCRIPT_DIR/$PYTHON_ENV
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade -r requirements.txt
|
||||
python -m unidic download
|
||||
python -m spacy download en_core_web_sm
|
||||
python -m nltk.downloader punkt_tab
|
||||
python -m pip install --upgrade -r requirements.txt --progress-bar=on
|
||||
conda deactivate
|
||||
fi
|
||||
return 0
|
||||
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Eyi ne sɔhwɛ a efi nea efi text file mu kɔ audiobook nsakrae mu ba no mu.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
ይህ ከጽሑፍ ፋይል ወደ ኦዲዮ መጽሐፍት ልወጣ የተደረገው ሙከራ ነው።
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
هذا هو الاختبار من نتيجة تحويل ملف نصي إلى كتاب صوتي.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
এইটো হৈছে টেক্সট ফাইলৰ ফলাফলৰ পৰা অডিঅ'বুক ৰূপান্তৰলৈ পৰীক্ষা।
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Това е тестът от резултата от преобразуването на текстов файл в аудиокнига.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
এটি পাঠ্য ফাইলের ফলাফল থেকে অডিওবুক রূপান্তরের পরীক্ষা।
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Aquesta és la prova del resultat de la conversió d'un fitxer de text a un audiollibre.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Kini ang pagsulay gikan sa resulta sa text file ngadto sa pagkakabig sa audiobook.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Toto je test od výsledku převodu textového souboru na audioknihu.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Dyma'r prawf o ganlyniad ffeil testun i drosi llyfr sain.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Dies ist der Test des Ergebnisses der Konvertierung einer Textdatei in ein Hörbuch.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
एह् पाठ फाइल दे नतीजे थमां ऑडियोबुक रूपांतरण च परीक्षण ऐ।
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Αυτή είναι η δοκιμή από το αποτέλεσμα της μετατροπής αρχείου κειμένου σε ηχητικό βιβλίο.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
This is the test from the result of text file to audiobook conversion.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Esta es la prueba del resultado de la conversión de archivo de texto a audiolibro.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Testu-fitxategiaren emaitzatik audio-liburu bihurtzerako proba da.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Esia nye dodokpɔ tso text file ƒe tɔtrɔ yi audiobook ƒe tɔtrɔ me tsonu me.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
این تست از نتیجه تبدیل فایل متنی به کتاب صوتی است.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Tämä on testi tekstitiedoston muuntamisen tuloksesta äänikirjaksi.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Ceci est le test provenant d'un fichier text en livre audio.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Kóva haꞌehína pe prueba oúva archivo de texto resultado guive audiolibro ñembohasápe.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
આ ટેક્સ્ટ ફાઇલના પરિણામથી ઑડિઓબુક રૂપાંતર સુધીની કસોટી છે.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Wannan shine gwajin daga sakamakon fayil ɗin rubutu zuwa canjin littafin mai jiwuwa.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
यह टेक्स्ट फ़ाइल से ऑडियोबुक रूपांतरण के परिणाम का परीक्षण है।
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Sa a se tès la soti nan rezilta a nan dosye tèks konvèsyon liv odyo.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Ez a teszt a szöveges fájl eredményétől a hangoskönyv-konverzióig.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Ini adalah pengujian dari hasil konversi file teks ke buku audio.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Daytoy ti pagsubok manipud iti resulta ti text file agingga iti audiobook conversion.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Þetta er prófið frá niðurstöðu textaskrár í hljóðbók umbreytingu.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Questo è il test del risultato della conversione del file di testo in audiolibro.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
これは、テキスト ファイルからオーディオブックへの変換結果のテストです。
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Бұл мәтіндік файл нәтижесінен аудиокітапты түрлендіруге арналған сынақ.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
នេះគឺជាការសាកល្បងពីលទ្ធផលនៃឯកសារអត្ថបទទៅជាការបំប្លែងសៀវភៅអូឌីយ៉ូ។
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
ಪಠ್ಯ ಫೈಲ್ನಿಂದ ಆಡಿಯೊಬುಕ್ ಪರಿವರ್ತನೆಯ ಫಲಿತಾಂಶದಿಂದ ಇದು ಪರೀಕ್ಷೆಯಾಗಿದೆ.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
이는 텍스트 파일을 오디오북으로 변환한 결과에 대한 테스트입니다.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Dis na di tɛst frɔm di rizɔlt fɔ tɛks fayl to ɔdiobuk kɔnvɔshɔn.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Бул тексттик файлдын жыйынтыгынан аудиокитепке айландыруу сыноосу.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Hoc est experimentum e eventu electronicarum fasciculi ad conversionem audiobook.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Kino kye kigezo okuva ku bivudde mu kukyusa fayiro y’ebiwandiiko okudda mu kukyusa ebitabo ebiwulikika.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
ນີ້ແມ່ນການທົດສອບຈາກຜົນໄດ້ຮັບຂອງໄຟລ໌ຂໍ້ຄວາມເພື່ອປ່ຽນ audiobook.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Šis ir tests no teksta faila rezultāta līdz audiogrāmatas konvertēšanai.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
इ टेक्स्ट फाइल कें परिणाम सं ऑडियोबुक रूपांतरण कें परीक्षण छै.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
ടെക്സ്റ്റ് ഫയലിൻ്റെ ഫലത്തിൽ നിന്ന് ഓഡിയോബുക്കിലേക്കുള്ള പരിവർത്തനത്തിൻ്റെ പരിശോധനയാണിത്.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Энэ бол текст файлын үр дүнгээс аудио ном хөрвүүлэх туршилт юм.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
मजकूर फाइलच्या निकालापासून ते ऑडिओबुक रूपांतरणापर्यंतची ही चाचणी आहे.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Ini ialah ujian daripada keputusan fail teks kepada penukaran buku audio.
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
၎င်းသည် စာသားဖိုင်မှ အသံစာအုပ်သို့ ပြောင်းလဲခြင်း၏ ရလဒ်စမ်းသပ်မှုဖြစ်သည်။
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Dit is de test op basis van het resultaat van de conversie van een tekstbestand naar een audioboek.
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user