Documents no longer duplicated when indexing twice in a row. Thumbnails and documents erased when directory is removed

This commit is contained in:
simon987 2018-04-24 16:59:16 -04:00
parent 41f8294733
commit c1a59b7e9b
3 changed files with 14 additions and 8 deletions

View File

@ -124,6 +124,8 @@ class TaskManager:
def execute_crawl(self, directory: Directory, counter: Value, done: Value): def execute_crawl(self, directory: Directory, counter: Value, done: Value):
Search("changeme").delete_directory(directory.id)
chksum_calcs = [] chksum_calcs = []
for arg in directory.get_option("CheckSumCalculators").split(","): for arg in directory.get_option("CheckSumCalculators").split(","):

4
run.py
View File

@ -296,6 +296,10 @@ def directory_update_opt(dir_id):
@app.route("/directory/<int:dir_id>/del") @app.route("/directory/<int:dir_id>/del")
def directory_del(dir_id): def directory_del(dir_id):
search.delete_directory(dir_id)
if os.path.exists("static/thumbnails/" + str(dir_id)):
shutil.rmtree("static/thumbnails/" + str(dir_id))
storage.remove_directory(dir_id) storage.remove_directory(dir_id)
flash("<strong>Deleted directory</strong>", "success") flash("<strong>Deleted directory</strong>", "success")

View File

@ -276,15 +276,15 @@ function createDocCard(hit) {
break; break;
case "video": case "video":
thumbnailOverlay = document.createElement("div");
thumbnailOverlay.setAttribute("class", "card-img-overlay");
//Duration //Duration
let durationBadge = document.createElement("span"); if (hit["_source"].hasOwnProperty("duration")) {
durationBadge.setAttribute("class", "badge badge-resolution"); thumbnailOverlay = document.createElement("div");
durationBadge.appendChild(document.createTextNode(humanTime(hit["_source"]["duration"]))); thumbnailOverlay.setAttribute("class", "card-img-overlay");
thumbnailOverlay.appendChild(durationBadge); let durationBadge = document.createElement("span");
durationBadge.setAttribute("class", "badge badge-resolution");
durationBadge.appendChild(document.createTextNode(humanTime(hit["_source"]["duration"])));
thumbnailOverlay.appendChild(durationBadge);
}
} }
//Tags //Tags