Skip to content

Commit

Permalink
configurable path to pdfjs-to-text
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed May 23, 2024
1 parent e426dbd commit 6deb290
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions peachjam/helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
import string
import subprocess
import tempfile
from datetime import date, datetime
from functools import wraps

import martor.utils
from django.conf import settings
from django.utils.translation import get_language_from_request
from languages_plus.models import Language

Expand Down Expand Up @@ -46,7 +46,7 @@ def pdfjs_to_text(fname):
"""Extract text from fname using pdfjs-compatible script."""
with tempfile.NamedTemporaryFile(suffix=".txt") as outf:
cmd = [
os.path.join(os.path.dirname(__file__), "..", "bin", "pdfjs-to-text"),
settings.PEACHJAM["PDFJS_TO_TEXT"],
fname,
outf.name,
]
Expand Down
1 change: 1 addition & 0 deletions peachjam/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"SEARCH_JURISDICTION_FILTER": False,
"MULTIPLE_JURISDICTIONS": False,
"MULTIPLE_LOCALITIES": False,
"PDFJS_TO_TEXT": "bin/pdfjs-to-text",
}

PEACHJAM["ES_INDEX"] = os.environ.get("ES_INDEX", slugify(PEACHJAM["APP_NAME"]))
Expand Down

0 comments on commit 6deb290

Please sign in to comment.