Skip to content

Commit

Permalink
Update MIVS images and show info step
Browse files Browse the repository at this point in the history
Two changes requested via Slack -- the accepted image download now includes the guidebook header/thumbnail AND the best screenshots, and the full description is now available on the show info step.
  • Loading branch information
kitsuta committed Jan 4, 2025
1 parent 5e6b027 commit 822cbac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
18 changes: 11 additions & 7 deletions uber/models/mivs.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,27 +368,31 @@ def best_screenshots(self):
img for img in self.images
if img.is_screenshot and img.use_in_promo]

def best_screenshot_downloads(self, count=2):
all_images = reversed(sorted(
self.images,
def accepted_image_downloads(self, count=2):
all_screenshots = reversed(sorted(
[image for image in self.images if not image.is_header and not image.is_thumbnail],
key=lambda img: (
img.is_screenshot and img.use_in_promo,
img.is_screenshot,
img.use_in_promo)))

screenshots = []
for i, screenshot in enumerate(all_images):
for i, screenshot in enumerate(all_screenshots):
if os.path.exists(screenshot.filepath):
screenshots.append(screenshot)
if len(screenshots) >= count:
break
if self.guidebook_header:
screenshots.append(self.guidebook_header)
if self.guidebook_thumbnail:
screenshots.append(self.guidebook_thumbnail)
return screenshots

def best_screenshot_download_filenames(self, count=2):
def accepted_image_download_filenames(self, count=2):
nonchars = re.compile(r'[\W]+')
best_screenshots = self.best_screenshot_downloads(count)
accepted_images = self.accepted_image_downloads(count)
screenshots = []
for i, screenshot in enumerate(best_screenshots):
for i, screenshot in enumerate(accepted_images):
if os.path.exists(screenshot.filepath):
name = '_'.join([s for s in self.title.lower().split() if s])
name = nonchars.sub('', name)
Expand Down
8 changes: 4 additions & 4 deletions uber/site_sections/mivs_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def discussion_group_emails(self, out, session):
def accepted_games_xlsx(self, out, session):
rows = []
for game in session.query(IndieGame).filter_by(status=c.ACCEPTED):
screenshots = game.best_screenshot_download_filenames()
screenshots = game.accepted_image_download_filenames()
rows.append([
game.studio.name, game.studio.website,
game.title, game.brief_description, game.link_to_webpage,
Expand All @@ -127,9 +127,9 @@ def accepted_games_zip(self, zip_file, session):
output = self.accepted_games_xlsx(set_headers=False)
zip_file.writestr('mivs_accepted_games.xlsx', output)
for game in session.query(IndieGame).filter_by(status=c.ACCEPTED):
filenames = game.best_screenshot_download_filenames()
screenshots = game.best_screenshot_downloads()
for filename, screenshot in zip(filenames, screenshots):
filenames = game.accepted_image_download_filenames()
images = game.accepted_image_downloads()
for filename, screenshot in zip(filenames, images):
if filename:
filepath = os.path.join(c.MIVS_GAME_IMAGE_DIR, screenshot.id)
zip_file.write(filepath, os.path.join('mivs_accepted_game_images', filename))
Expand Down
7 changes: 7 additions & 0 deletions uber/templates/mivs/show_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ <h4>Promo Information</h4>
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label">Full Description</label>
<div class="col-sm-6">
<textarea class="form-control" name="description" rows="4">{{ game.description }}</textarea>
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label">Gameplay Video</label>
<div class="col-sm-6">
Expand Down

0 comments on commit 822cbac

Please sign in to comment.