diff --git a/crawler.py b/crawler.py index d6fe673..ff425d8 100644 --- a/crawler.py +++ b/crawler.py @@ -124,6 +124,8 @@ class TaskManager: def execute_crawl(self, directory: Directory, counter: Value, done: Value): + Search("changeme").delete_directory(directory.id) + chksum_calcs = [] for arg in directory.get_option("CheckSumCalculators").split(","): diff --git a/run.py b/run.py index 9c4a1ca..4bfa00f 100644 --- a/run.py +++ b/run.py @@ -296,6 +296,10 @@ def directory_update_opt(dir_id): @app.route("/directory//del") 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) flash("Deleted directory", "success") diff --git a/static/js/search.js b/static/js/search.js index 359df57..8e9d2bd 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -276,15 +276,15 @@ function createDocCard(hit) { break; case "video": - thumbnailOverlay = document.createElement("div"); - thumbnailOverlay.setAttribute("class", "card-img-overlay"); - //Duration - let durationBadge = document.createElement("span"); - durationBadge.setAttribute("class", "badge badge-resolution"); - durationBadge.appendChild(document.createTextNode(humanTime(hit["_source"]["duration"]))); - thumbnailOverlay.appendChild(durationBadge); - + if (hit["_source"].hasOwnProperty("duration")) { + thumbnailOverlay = document.createElement("div"); + thumbnailOverlay.setAttribute("class", "card-img-overlay"); + let durationBadge = document.createElement("span"); + durationBadge.setAttribute("class", "badge badge-resolution"); + durationBadge.appendChild(document.createTextNode(humanTime(hit["_source"]["duration"]))); + thumbnailOverlay.appendChild(durationBadge); + } } //Tags