|
|
|
@ -137,6 +137,7 @@ class import_distill_io_json(Importer):
|
|
|
|
|
|
|
|
|
|
flash("{} Imported from Distill.io in {:.2f}s, {} Skipped.".format(len(self.new_uuids), time.time() - now, len(self.remaining_data)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class import_xlsx_wachete(Importer):
|
|
|
|
|
|
|
|
|
|
def run(self,
|
|
|
|
@ -154,11 +155,12 @@ class import_xlsx_wachete(Importer):
|
|
|
|
|
try:
|
|
|
|
|
wb = load_workbook(data)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
#@todo correct except
|
|
|
|
|
# @todo correct except
|
|
|
|
|
flash("Unable to read export XLSX file, something wrong with the file?", 'error')
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
for row in wb.active.iter_rows(min_row=2):
|
|
|
|
|
row_id = 2
|
|
|
|
|
for row in wb.active.iter_rows(min_row=row_id):
|
|
|
|
|
try:
|
|
|
|
|
extras = {}
|
|
|
|
|
data = {}
|
|
|
|
|
for cell in row:
|
|
|
|
@ -174,7 +176,7 @@ class import_xlsx_wachete(Importer):
|
|
|
|
|
extras['fetch_backend'] = 'html_webdriver'
|
|
|
|
|
|
|
|
|
|
if data.get('xpath'):
|
|
|
|
|
#@todo split by || ?
|
|
|
|
|
# @todo split by || ?
|
|
|
|
|
extras['include_filters'] = [data.get('xpath')]
|
|
|
|
|
if data.get('name'):
|
|
|
|
|
extras['title'] = data.get('name').strip()
|
|
|
|
@ -202,10 +204,16 @@ class import_xlsx_wachete(Importer):
|
|
|
|
|
# Straight into the queue.
|
|
|
|
|
self.new_uuids.append(new_uuid)
|
|
|
|
|
good += 1
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(e)
|
|
|
|
|
flash(f"Error processing row number {row_id}, check all cell data types are correct")
|
|
|
|
|
else:
|
|
|
|
|
row_id += 1
|
|
|
|
|
|
|
|
|
|
flash(
|
|
|
|
|
"{} imported from Wachete .xlsx in {:.2f}s".format(len(self.new_uuids), time.time() - now))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class import_xlsx_custom(Importer):
|
|
|
|
|
|
|
|
|
|
def run(self,
|
|
|
|
@ -223,14 +231,15 @@ class import_xlsx_custom(Importer):
|
|
|
|
|
try:
|
|
|
|
|
wb = load_workbook(data)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
#@todo correct except
|
|
|
|
|
# @todo correct except
|
|
|
|
|
flash("Unable to read export XLSX file, something wrong with the file?", 'error')
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
# @todo cehck atleast 2 rows, same in other method
|
|
|
|
|
|
|
|
|
|
from .forms import validate_url
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
row_i = 1
|
|
|
|
|
for row in wb.active.iter_rows():
|
|
|
|
|
url = None
|
|
|
|
|
tags = None
|
|
|
|
@ -278,6 +287,11 @@ class import_xlsx_custom(Importer):
|
|
|
|
|
# Straight into the queue.
|
|
|
|
|
self.new_uuids.append(new_uuid)
|
|
|
|
|
good += 1
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(e)
|
|
|
|
|
flash(f"Error processing row number {row_i}, check all cell data types are correct")
|
|
|
|
|
else:
|
|
|
|
|
row_i += 1
|
|
|
|
|
|
|
|
|
|
flash(
|
|
|
|
|
"{} imported from custom .xlsx in {:.2f}s".format(len(self.new_uuids), time.time() - now))
|
|
|
|
|