revert
This commit is contained in:
parent
08c4a99e01
commit
cbd91cb2c5
|
@ -28,28 +28,27 @@ def get_hidden_themes(viewings, token_id, token_secret):
|
||||||
|
|
||||||
# Add hidden themes
|
# Add hidden themes
|
||||||
for date, data in viewings_filtered_watch_date.items():
|
for date, data in viewings_filtered_watch_date.items():
|
||||||
keyword_counts = {}
|
hidden_themes = set()
|
||||||
|
|
||||||
if len(data['viewings']) > 1:
|
if len(data['viewings']) > 1:
|
||||||
|
viewings_keywords = []
|
||||||
|
|
||||||
for viewing in data['viewings']:
|
for viewing in data['viewings']:
|
||||||
if 'keywords' in viewing:
|
if 'keywords' in viewing:
|
||||||
for keyword in viewing['keywords']:
|
viewings_keywords.append(set(viewing['keywords']))
|
||||||
if keyword in keyword_counts.keys():
|
|
||||||
keyword_counts[keyword] += 1
|
|
||||||
else:
|
|
||||||
keyword_counts[keyword] = 1
|
|
||||||
|
|
||||||
keyword_counts = {k: v for k, v in sorted(keyword_counts.items(), key=lambda item: item[1], reverse=True)}
|
if len(viewings_keywords) > 1:
|
||||||
|
hidden_themes = set.intersection(*viewings_keywords)
|
||||||
|
|
||||||
viewings_filtered_watch_date[date]['keyword_counts'] = keyword_counts
|
if hidden_themes != set():
|
||||||
|
viewings_filtered_watch_date[date]['hidden_themes'] = list(hidden_themes)
|
||||||
|
|
||||||
return viewings_filtered_watch_date
|
return viewings_filtered_watch_date
|
||||||
|
|
||||||
|
|
||||||
def update_page(token_id, token_secret, hidden_themes):
|
def update_page(token_id, token_secret, hidden_themes):
|
||||||
page = build_page(hidden_themes)
|
page = build_page(hidden_themes)
|
||||||
print(page)
|
Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, PAGE_ID, markdown=page)
|
||||||
# Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, PAGE_ID, markdown=page)
|
|
||||||
|
|
||||||
|
|
||||||
def build_page(hidden_themes):
|
def build_page(hidden_themes):
|
||||||
|
|
Loading…
Reference in New Issue