diff --git a/lib/philomena/duplicate_reports.ex b/lib/philomena/duplicate_reports.ex index e36b1cc5..1b7db279 100644 --- a/lib/philomena/duplicate_reports.ex +++ b/lib/philomena/duplicate_reports.ex @@ -15,9 +15,8 @@ defmodule Philomena.DuplicateReports do def generate_reports(source) do source = Repo.preload(source, :intensity) - duplicates_of(source.intensity, source.image_aspect_ratio, 0.2, 0.05) + duplicates_of(source.intensity, source.image_aspect_ratio, 0.5, 0.1) |> where([i, _it], i.id != ^source.id) - |> where([i, _it], i.duplication_checked != true) |> Repo.all() |> Enum.map(fn target -> create_duplicate_report(source, target, %{}, %{ @@ -37,7 +36,7 @@ defmodule Philomena.DuplicateReports do where: i.image_aspect_ratio >= ^(aspect_ratio - aspect_dist) and i.image_aspect_ratio <= ^(aspect_ratio + aspect_dist), - limit: 20 + limit: 10 end @doc """ diff --git a/lib/philomena/images/thumbnailer.ex b/lib/philomena/images/thumbnailer.ex index 5540a987..0b13a530 100644 --- a/lib/philomena/images/thumbnailer.ex +++ b/lib/philomena/images/thumbnailer.ex @@ -28,8 +28,8 @@ defmodule Philomena.Images.Thumbnailer do {:ok, analysis} = Analyzers.analyze(file) apply_edit_script(image, Processors.process(analysis, file, @versions)) - recompute_meta(image, file, &Image.thumbnail_changeset/2) generate_dupe_reports(image) + recompute_meta(image, file, &Image.thumbnail_changeset/2) apply_edit_script(image, Processors.post_process(analysis, file)) recompute_meta(image, file, &Image.process_changeset/2) @@ -53,8 +53,11 @@ defmodule Philomena.Images.Thumbnailer do defp apply_thumbnail(image, thumb_dir, {:symlink_original, destination}), do: symlink(image_file(image), Path.join(thumb_dir, destination)) - defp generate_dupe_reports(image), - do: DuplicateReports.generate_reports(image) + defp generate_dupe_reports(image) do + if not image.duplication_checked do + DuplicateReports.generate_reports(image) + end + end defp recompute_meta(image, file, changeset_fn) do {:ok, %{dimensions: {width, height}}} = Analyzers.analyze(file)