Skip to content

Commit d31ff6b

Browse files
Updates
1 parent b555665 commit d31ff6b

File tree

7 files changed

+30
-8
lines changed

7 files changed

+30
-8
lines changed

app/frames/frame0.jpg

-101 KB
Loading

app/frames/frame1.jpg

-59.6 KB
Loading

app/frames/frame2.jpg

-56.4 KB
Loading

app/frames/removed_noise.png

-37.9 KB
Loading

app/frames/thresh.png

-6.99 KB
Loading

app/views.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,29 @@ def index(request):
107107

108108
def searchView(request):
109109
toSearch = request.GET.get("toSearch")
110-
print (toSearch)
110+
toSearch = toSearch.lower()
111+
print ("Searched Item:", toSearch)
111112
videos = Video.objects.all()
113+
targetVideos = []
114+
for video in videos:
115+
print("\nVideo Title ->", video.title)
116+
f=0
117+
count=0
118+
for key, value in (video.data).items():
119+
key = key.lower()
120+
if toSearch in key:
121+
print("\tKey:", key, "\tCount: ", value)
122+
count += value
123+
f=1
124+
if f==1:
125+
targetVideos.append({"video": video, "count": count})
126+
print("\n")
127+
# Sort videos according to the count of the searched item
128+
targetVideos.sort(key=lambda x: x["count"], reverse=True)
129+
112130
return render(request, "list.html", {
113131
"toSearch": toSearch,
114-
"videos": videos,
132+
"videos": targetVideos,
115133
})
116134

117135

templates/list.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,20 @@ <h1>Content Based Video Retrieval <br/> Using Video Text Information</h1>
3232
<h2>You have searched for: {{toSearch}}</h2>
3333
<table width="100%" border="1">
3434
{% comment %} <tr><th>Results</th></tr> {% endcomment %}
35-
35+
<tr>
36+
<th>Title</th>
37+
<th>Link To The Video</th>
38+
<th>Count of the searched item</th>
39+
</tr>
3640
<hr>
3741
{% for video in videos %}
38-
<tr>
39-
<td align="center">
40-
{{video.title}}
41-
</td>
42-
<td>Link to the video: <a href="{{video.videoFile.url}}">Open Video</a></td>
42+
<tr align="center">
43+
<td>{{video.video.title}}</td>
44+
<td><a style="color: black;" href="{{video.video.videoFile.url}}">Open This Video</a></td>
45+
<td>{{video.count}}</td>
4346
</tr>
4447
{% endfor %}
48+
4549
</table>
4650
</div>
4751
</div>

0 commit comments

Comments
 (0)