pandora_amp/tasks.py

15 lines
345 B
Python
Raw Permalink Normal View History

2018-11-05 19:45:42 +00:00
import os
import subprocess
2023-08-21 21:25:03 +00:00
from app.celery import app
2018-11-05 19:45:42 +00:00
base = os.path.dirname(__file__)
2023-08-21 21:25:03 +00:00
@app.task(queue="encoding")
2018-11-05 19:45:42 +00:00
def import_documents(urls):
for url in urls:
2018-11-05 20:27:03 +00:00
url = url.strip()
if url and url.startswith('http'):
2018-11-05 19:45:42 +00:00
subprocess.call(['/srv/pandora/bin/python', os.path.join(base, 'add_website_as_pdf.py'), url])