Compare commits
No commits in common. "f36660d5bdf36d7c8de4599ad735fe646025be3f" and "95e7804a4accbea78778989b192196e1968562cb" have entirely different histories.
f36660d5bd
...
95e7804a4a
@ -1,16 +0,0 @@
|
|||||||
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,22 +121,10 @@ def get_film_list(films):
|
|||||||
film_links = []
|
film_links = []
|
||||||
|
|
||||||
for film in films:
|
for film in films:
|
||||||
film_link = generate_imdb_film_link(film)
|
film_link = "[{}](https://www.imdb.com/title/tt{}/)".format(film['title'], film['imdb_id'])
|
||||||
film_links.append(film_link)
|
film_links.append(film_link)
|
||||||
|
|
||||||
if len(film_links) > 0:
|
if len(film_links) > 0:
|
||||||
return "<br>".join(film_links)
|
return "<br>".join(film_links)
|
||||||
else:
|
else:
|
||||||
return ""
|
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
|
from collections import Counter, OrderedDict
|
||||||
import csv
|
import csv
|
||||||
import os
|
import os
|
||||||
import pyvips
|
from wand.image import Image
|
||||||
import worldmap
|
import worldmap
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
@ -94,10 +94,8 @@ def draw_map(films_by_country, file_name="vcinema_map.svg"):
|
|||||||
|
|
||||||
worldmap.plot(countries, cmap=["#FF4000"], opacity=opacity, filename=file_name, verbose=False)
|
worldmap.plot(countries, cmap=["#FF4000"], opacity=opacity, filename=file_name, verbose=False)
|
||||||
|
|
||||||
image = pyvips.Image.new_from_file(file_name)
|
with Image(filename=file_name, width=1000, height=655) as i:
|
||||||
image = image.thumbnail_image(1000, crop=pyvips.Interesting.ALL)
|
png_data = i.make_blob("png")
|
||||||
|
|
||||||
png_data = image.write_to_buffer(".png")
|
|
||||||
|
|
||||||
os.remove(file_name)
|
os.remove(file_name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user