movies box office

This commit is contained in:
Justin 2023-02-23 13:20:44 +08:00 committed by GitHub
parent 20bb53b207
commit 9ba096b9ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4136,7 +4136,22 @@ class StockTicker():
vote_img = self.textImage(movie['votes'], small_font, r = 255, g = 255, b = 255)
star_img = Image.open('logos/star.png').convert('RGB')
date_img = self.textImage(movie['date'], small_font, r = 0, g = 162, b = 255)
try:
if movie['media_type'] == 'Movie':
if movie['budget'] == '0':
budget_img = self.textImage('$N/A', small_font, r = 255, g = 0, b = 0)
else:
budget_img = self.textImage('$' + movie['budget'], small_font, r = 255, g = 0, b = 0)
except:
pass
try:
if movie['media_type'] == 'Movie':
if movie['revenue'] == '0':
rev_img = self.textImage('$N/A', small_font, r = 0, g = 255, b = 0)
else:
rev_img = self.textImage('$' + movie['revenue'], small_font, r = 0, g = 255, b = 0)
except:
pass
try:
logo = Image.open('logos/movies/' + movie['backdrop'])
logo.thumbnail((9000,32))
@ -4151,7 +4166,13 @@ class StockTicker():
genre_img = self.textImage(genre + ',', small_font, r = 255, g = 255, b = 255)
genre_offset += genre_img.size[0]
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0], x_offset + date_img.size[0] + 3 + star_img.size[0] + vote_img.size[0] + 3, x_offset + date_img.size[0] + 3 + genre_offset) + 15, 32))
try:
if movie['media_type'] == 'Movie':
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0], x_offset + date_img.size[0] + 3 + star_img.size[0] + vote_img.size[0] + 3 + 5 + budget_img.size[0] + 5 + rev_img.size[0], x_offset + date_img.size[0] + 3 + genre_offset) + 15, 32))
else:
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0], x_offset + date_img.size[0] + 3 + star_img.size[0] + vote_img.size[0] + 3, x_offset + date_img.size[0] + 3 + genre_offset) + 15, 32))
except:
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0], x_offset + date_img.size[0] + 3 + star_img.size[0] + vote_img.size[0] + 3, x_offset + date_img.size[0] + 3 + genre_offset) + 15, 32))
img.paste(logo, (0, 0))
@ -4163,6 +4184,16 @@ class StockTicker():
img.paste(star_img, (x_offset2 , 14))
img.paste(vote_img, (x_offset2 + star_img.size[0] + 3, 14))
try:
if movie['media_type'] == 'Movie':
img.paste(budget_img, (x_offset2 + star_img.size[0] + 3 + vote_img.size[0] + 5, 14))
except:
pass
try:
if movie['media_type'] == 'Movie':
img.paste(rev_img,(x_offset2 + star_img.size[0] + 3 + vote_img.size[0] + 5 + budget_img.size[0] + 5, 14))
except:
pass
for genre in movie['genre'][:-1]:
genre_img = self.textImage(genre + ',', small_font, r = 255, g = 255, b = 255)
img.paste(genre_img, (x_offset2, 23))
@ -4201,7 +4232,22 @@ class StockTicker():
vote_img = self.textImage(movie['votes'], small_font, r = 255, g = 255, b = 255)
star_img = Image.open('logos/star.png').convert('RGB')
date_img = self.textImage(movie['date'], small_font, r = 0, g = 162, b = 255)
try:
if movie['media_type'] == 'Movie':
if movie['budget'] == '0':
budget_img = self.textImage('$N/A', small_font, r = 255, g = 0, b = 0)
else:
budget_img = self.textImage('$' + movie['budget'], small_font, r = 255, g = 0, b = 0)
except:
pass
try:
if movie['media_type'] == 'Movie':
if movie['revenue'] == '0':
rev_img = self.textImage('$N/A', small_font, r = 0, g = 255, b = 0)
else:
rev_img = self.textImage('$' + movie['revenue'], small_font, r = 0, g = 255, b = 0)
except:
pass
try:
logo = Image.open('logos/movies/' + movie['backdrop'])
logo.thumbnail((1000,16))
@ -4217,7 +4263,13 @@ class StockTicker():
genre_img = self.textImage(genre + ',', small_font, r = 255, g = 255, b = 255)
genre_offset += genre_img.size[0]
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0] + 3 + star_img.size[0] + 2 + vote_img.size[0] + 10, x_offset + date_img.size[0] + 7 + lang_img.size[0] + 7 + genre_offset + 10), 16))
try:
if movie['media_type'] == 'Movie':
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0] + 3 + star_img.size[0] + 2 + vote_img.size[0] + 10 + 3 + budget_img.size[0] + 3 + rev_img.size[0], x_offset + date_img.size[0] + 7 + lang_img.size[0] + 7 + genre_offset + 10), 16))
else:
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0] + 3 + star_img.size[0] + 2 + vote_img.size[0] + 10, x_offset + date_img.size[0] + 7 + lang_img.size[0] + 7 + genre_offset + 10), 16))
except:
img = Image.new('RGB', (max(x_offset + movie_title_img.size[0] + 3 + star_img.size[0] + 2 + vote_img.size[0] + 10, x_offset + date_img.size[0] + 7 + lang_img.size[0] + 7 + genre_offset + 10), 16))
img.paste(logo, (0, 0))
img.paste(movie_title_img, (x_offset,0))
@ -4225,6 +4277,18 @@ class StockTicker():
img.paste(star_img, (x_offset2, 1))
x_offset2 += star_img.size[0] + 2
img.paste(vote_img, (x_offset2, 2))
x_offset2 += vote_img.size[0]
try:
if movie['media_type'] == 'Movie':
img.paste(budget_img, (x_offset2 + 3, 2))
except:
pass
try:
if movie['media_type'] == 'Movie':
img.paste(rev_img,(x_offset2 + 3 + budget_img.size[0] + 3, 2))
except:
pass
img.paste(date_img, (x_offset, 10))
x_offset += date_img.size[0] + 7
img.paste(lang_img, (x_offset, 10))