Fix search by SHA256, didn't finish implementing.

This commit is contained in:
voussoir 2022-10-29 14:15:16 -07:00
parent 9e204a04c8
commit 328e84b0c7
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
3 changed files with 5 additions and 0 deletions

View file

@ -581,6 +581,7 @@ class PDBPhotoMixin:
is_searchhidden = searchhelpers.normalize_is_searchhidden(is_searchhidden)
sha256 = searchhelpers.normalize_sha256(sha256)
mimetype = searchhelpers.normalize_extension(mimetype)
sha256 = searchhelpers.normalize_extension(sha256)
within_directory = searchhelpers.normalize_within_directory(within_directory, warning_bag=warning_bag)
yield_albums = searchhelpers.normalize_yield_albums(yield_albums)
yield_photos = searchhelpers.normalize_yield_photos(yield_photos)
@ -671,6 +672,7 @@ class PDBPhotoMixin:
'has_tags': has_tags,
'has_thumbnail': has_thumbnail,
'mimetype': list(mimetype) or None,
'sha256': list(sha256) or None,
'tag_musts': tag_musts or None,
'tag_mays': tag_mays or None,
'tag_forbids': tag_forbids or None,

View file

@ -377,6 +377,7 @@ def get_search_core():
extension = request.args.get('extension')
extension_not = request.args.get('extension_not')
mimetype = request.args.get('mimetype')
sha256 = request.args.get('sha256')
is_searchhidden = request.args.get('is_searchhidden', False)
yield_albums = request.args.get('yield_albums', True)
yield_photos = request.args.get('yield_photos', True)
@ -427,6 +428,7 @@ def get_search_core():
'has_thumbnail': has_thumbnail,
'is_searchhidden': is_searchhidden,
'mimetype': mimetype,
'sha256': sha256,
'tag_musts': tag_musts,
'tag_mays': tag_mays,
'tag_forbids': tag_forbids,

View file

@ -202,6 +202,7 @@
<li>Overall bitrate: <a href="/search?bitrate={{photo.bitrate|round(method='floor')|int}}..{{photo.bitrate|round(method='ceil')|int}}">{{photo.bitrate|int}}</a> kbps</li>
{% endif %}
<li>Created <a href="/search?created={{photo.created.timestamp()|int-43200}}..{{photo.created.timestamp()|int+43200}}">{{photo.created|timestamp_to_naturaldate}}</a></li>
<li>SHA256: <a href="/search?sha256={{photo.sha256}}"><code>{{photo.sha256[:16]}}</code></a></li>
<li><button id="refresh_metadata_button" class="green_button button_with_spinner" onclick="return refresh_metadata_form();">Refresh metadata</button></li>
{% if request.is_localhost %}
<li><button id="show_in_folder_button" onclick="return show_in_folder_form();">Show in folder</button></li>