-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstor.txt
30 lines (27 loc) · 1.5 KB
/
stor.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
for search in searchTerms:
#Make the query have '%' around it to make it a wildcard
query = "%" + search + "%"
print(query)
cursor.execute(FIND_INSTANCE_OF_IN_TOP_SONGS, (query, query,))
for index, row in enumerate(cursor.fetchall()):
print(row)
if row['top_songs_token'] in allTokens:
resultTokens[index][1] += 1
else:
resultTokens.append([row['top_songs_token'], 0])
allTokens.append([row['top_songs_token']])
cursor.execute(FIND_INSTANCE_OF_IN_TOP_ARTISTS, (query,))
for index, row in enumerate(cursor.fetchall()):
print(row)
if row['top_artists_token'] in allTokens:
resultTokens[index][1] += 1
else:
resultTokens.append([row['top_artists_token'], 0])
allTokens.append([row['top_songs_token']])
cursor.execute(FIND_INSTANCE_OF_IN_RECENT_SONGS, (query, query,))
for index, row in enumerate(cursor.fetchall()):
if row['recent_songs_token'] in allTokens:
resultTokens[index][1] += 1
else:
resultTokens.append([row['recent_songs_token'], 0])
allTokens.append([row['top_songs_token']])