diff --git a/conf/paperless.conf.example b/conf/paperless.conf.example index 1220152..4a0de65 100644 --- a/conf/paperless.conf.example +++ b/conf/paperless.conf.example @@ -25,6 +25,7 @@ PAPERLESS_DATA_DIR=__DATADIR__/data PAPERLESS_MEDIA_ROOT=__DATADIR__/media #PAPERLESS_STATICDIR=../static #PAPERLESS_FILENAME_FORMAT= +PAPERLESS_NLTK_DIR=__FINALPATH_/nltk_data # Security and hosting diff --git a/scripts/install b/scripts/install index f9c9882..604d0b8 100755 --- a/scripts/install +++ b/scripts/install @@ -128,6 +128,14 @@ pushd $final_path source "$final_path/venv/bin/activate" ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade pip setuptools wheel ynh_exec_as $app $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" + + # Installing NLTK data + mkdir -p "$final_path/nltk_data" + chown -R "$app:" "$final_path/nltk_data" + ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" snowball_data + ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" stopwords + ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" punkt + deactivate ) popd diff --git a/scripts/restore b/scripts/restore index a6933ea..9576832 100755 --- a/scripts/restore +++ b/scripts/restore @@ -38,6 +38,7 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) datadir=$(ynh_app_setting_get --app=$app --key=datadir) paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key) +ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language) redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db diff --git a/scripts/upgrade b/scripts/upgrade index e40ff2a..7db5401 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -124,6 +124,15 @@ pushd $final_path source "$final_path/venv/bin/activate" ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade pip setuptools wheel ynh_exec_as $app $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" + + # Installing NLTK data + ynh_secure_remove --file="$final_path/nltk_data" + mkdir -p "$final_path/nltk_data" + chown -R "$app:" "$final_path/nltk_data" + ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" snowball_data + ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" stopwords + ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" punkt + deactivate ) popd