-
- {% if video.source.player.progress %}
-
+
+ {% if video.player.progress %}
+
{% else %}
-
+
{% endif %}
@@ -25,17 +25,17 @@
-
- {% if video.source.player.watched %}
-
+
+ {% if video.player.watched %}
+
{% else %}
-
+
{% endif %}
-
{{ video.source.published }} | {{ video.source.player.duration_str }}
+
{{ video.published }} | {{ video.player.duration_str }}
diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py
index 24c10fa..06129d4 100644
--- a/tubearchivist/home/views.py
+++ b/tubearchivist/home/views.py
@@ -216,21 +216,20 @@ class ArchivistResultsView(ArchivistViewConfig):
"query": {"bool": {"should": ids}},
"sort": [{"published": {"order": "desc"}}],
}
- search = SearchHandler(
- "ta_video/_search", self.default_conf, data=data
- )
- videos = search.get_data()
+ response, _ = ElasticWrap("ta_video/_search").get(data)
+ videos = SearchProcess(response).process()
+
if not videos:
return False
for video in videos:
- youtube_id = video["source"]["youtube_id"]
+ youtube_id = video["youtube_id"]
matched = [i for i in results if i["youtube_id"] == youtube_id]
played_sec = matched[0]["position"]
- total = video["source"]["player"]["duration"]
+ total = video["player"]["duration"]
if not total:
total = matched[0].get("position") * 2
- video["source"]["player"]["progress"] = 100 * (played_sec / total)
+ video["player"]["progress"] = 100 * (played_sec / total)
return videos