Merge branch 'master' into feature/improve-references-page
This commit is contained in:
commit
f36660d5bd
|
@ -0,0 +1,16 @@
|
|||
import json
|
||||
|
||||
from wiki_pages import ViewingsCsv
|
||||
|
||||
|
||||
def update_viewings_csv(token_id, token_secret):
|
||||
print("Updating CSV")
|
||||
ViewingsCsv.update_viewings_csv(token_id, token_secret)
|
||||
print("Done!")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with open('token.json') as json_file:
|
||||
token = json.load(json_file)
|
||||
|
||||
update_viewings_csv(token['token_id'], token['token_secret'])
|
|
@ -121,10 +121,22 @@ def get_film_list(films):
|
|||
film_links = []
|
||||
|
||||
for film in films:
|
||||
film_link = "[{}](https://www.imdb.com/title/tt{}/)".format(film['title'], film['imdb_id'])
|
||||
film_link = generate_imdb_film_link(film)
|
||||
film_links.append(film_link)
|
||||
|
||||
if len(film_links) > 0:
|
||||
return "<br>".join(film_links)
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def generate_markdown_link(text, url):
|
||||
return "[{}]({})".format(text, url)
|
||||
|
||||
|
||||
def generate_imdb_film_link(film):
|
||||
return generate_markdown_link(film['title'], "https://www.imdb.com/title/tt{}/".format(film['imdb_id']))
|
||||
|
||||
|
||||
def generate_wikipedia_page_link(page_title):
|
||||
return generate_markdown_link(page_title, "https://en.wikipedia.org/wiki/{}".format(page_title.replace(" ", "_")))
|
||||
|
|
|
@ -2,7 +2,7 @@ import base64
|
|||
from collections import Counter, OrderedDict
|
||||
import csv
|
||||
import os
|
||||
from wand.image import Image
|
||||
import pyvips
|
||||
import worldmap
|
||||
import warnings
|
||||
|
||||
|
@ -94,8 +94,10 @@ def draw_map(films_by_country, file_name="vcinema_map.svg"):
|
|||
|
||||
worldmap.plot(countries, cmap=["#FF4000"], opacity=opacity, filename=file_name, verbose=False)
|
||||
|
||||
with Image(filename=file_name, width=1000, height=655) as i:
|
||||
png_data = i.make_blob("png")
|
||||
image = pyvips.Image.new_from_file(file_name)
|
||||
image = image.thumbnail_image(1000, crop=pyvips.Interesting.ALL)
|
||||
|
||||
png_data = image.write_to_buffer(".png")
|
||||
|
||||
os.remove(file_name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue