@@ -38,3 +38,5 @@ Seattle Sounders FC,134149,SEA,Green,Seattle.png
|
||||
Sporting Kansas City,134143,KC,Blue,Kansas-City.png
|
||||
Toronto FC,134148,TOR,Red,Toronto.png
|
||||
Vancouver Whitecaps,134147,VAN,Blue,Vancouver.png
|
||||
St. Louis City SC,147062,STL,Red,St-Louis.png
|
||||
St. Louis CITY SC,147062,STL,Red,St-Louis.png
|
||||
|
||||
|
@@ -159,6 +159,15 @@ def updateCommodities(api_key, logf):
|
||||
#logf.close()
|
||||
|
||||
|
||||
def human_format(num):
|
||||
num = float('{:.3g}'.format(num))
|
||||
magnitude = 0
|
||||
while abs(num) >= 1000:
|
||||
magnitude += 1
|
||||
num /= 1000.0
|
||||
return '{}{}'.format('{:f}'.format(num).rstrip('0').rstrip('.'), ['', 'K', 'M', 'B', 'T'][magnitude])
|
||||
|
||||
|
||||
def updateMovies(api_key, logf):
|
||||
|
||||
f = open('csv/movie_settings.json', 'r')
|
||||
@@ -198,6 +207,18 @@ def updateMovies(api_key, logf):
|
||||
movies = data['results']
|
||||
|
||||
for movie in movies:
|
||||
|
||||
if movie['media_type'] == 'movie':
|
||||
movie_id = movie['id']
|
||||
box_office_url = 'https://api.themoviedb.org/3/movie/' + str(movie_id) + '?api_key=' + api_key
|
||||
box_office_response = requests.get(box_office_url)
|
||||
box_office_data = box_office_response.json()
|
||||
budget = human_format(box_office_data['budget'])
|
||||
revenue = human_format(box_office_data['revenue'])
|
||||
else:
|
||||
budget = '0'
|
||||
revenue = '0'
|
||||
|
||||
movie_language = movie['original_language']
|
||||
movie_votes = movie['vote_average']
|
||||
movie_votes = "{:.1f}".format(movie_votes)
|
||||
@@ -248,13 +269,17 @@ def updateMovies(api_key, logf):
|
||||
'date':movie_date,
|
||||
'media_type':movie_type.capitalize(),
|
||||
'genre':genrefinal,
|
||||
'budget':budget,
|
||||
'revenue':revenue,
|
||||
'backdrop':movie['backdrop_path'][1:],
|
||||
'logo': movie_logo
|
||||
})
|
||||
|
||||
logo_files.append(movie['backdrop_path'][1:])
|
||||
|
||||
urllib.request.urlretrieve(movie_logo,'logos/movies/' + movie['backdrop_path'])
|
||||
if movie['backdrop_path'][1:] not in os.listdir('logos/movies/'):
|
||||
urllib.request.urlretrieve(movie_logo,'logos/movies/' + movie['backdrop_path'])
|
||||
time.sleep(0.5)
|
||||
|
||||
for file in os.listdir('logos/movies/'):
|
||||
if file not in logo_files:
|
||||
|
||||
|
After Width: | Height: | Size: 495 B |
|
After Width: | Height: | Size: 148 B |
|
After Width: | Height: | Size: 152 B |
|
After Width: | Height: | Size: 150 B |
|
After Width: | Height: | Size: 150 B |
|
After Width: | Height: | Size: 143 B |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 890 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1005 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 357 B |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 830 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 993 B |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 966 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 417 B |
|
After Width: | Height: | Size: 574 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 708 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 883 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 915 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 754 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 239 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 837 B |
|
After Width: | Height: | Size: 837 B |
|
After Width: | Height: | Size: 909 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 814 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.3 KiB |