Skip to content

Commit

Permalink
Pick the biggest thumbnail (#218)
Browse files Browse the repository at this point in the history
Pick the biggest thumbnail
  • Loading branch information
Sam565 authored Oct 28, 2023
1 parent ddaafe5 commit 18e189e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions custom_components/moonraker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ async def _async_get_gcode_file_detail(self, gcode_filename):
try:
# Keep last since this can fail but, we still want the other data
path = gcode["thumbnails"][len(gcode["thumbnails"]) - 1]["relative_path"]
thumbnailSize = 0
for t in gcode["thumbnails"]:
if t["size"] > thumbnailSize:
thumbnailSize = t["size"]
path = t["relative_path"]

return_gcode["thumbnails_path"] = os.path.join(dirname, path)
return return_gcode
Expand Down

0 comments on commit 18e189e

Please sign in to comment.