Skip to content

Commit

Permalink
Use only large images for the debian.net screenshot harvester.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed Jun 19, 2024
1 parent e9499ac commit 4947b96
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions usr/lib/linuxmint/mintinstall/mintinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,19 +385,18 @@ def run(self):
# Add additional screenshots from Debian
from bs4 import BeautifulSoup
page = BeautifulSoup(urllib.request.urlopen("https://screenshots.debian.net/package/%s" % self.pkginfo.name, timeout=5), "lxml")
images = page.findAll('img')
images = page.findAll(href=re.compile(r"/shrine/screenshot/simage/large-"))
for image in images:
if num_screenshots >= 4:
break
if image['src'].startswith('/screenshots') or image['src'].startswith("/shrine/screenshot"):
num_screenshots += 1

thumb = "https://screenshots.debian.net%s" % image['src']
link = thumb.replace("_small", "_large")
local_name = os.path.join(SCREENSHOT_DIR, "%s_%s.png" % (self.pkginfo.name, num_screenshots))
self.save_to_file(link, None, local_name)
num_screenshots += 1

thumb = "https://screenshots.debian.net%s" % image['href']
local_name = os.path.join(SCREENSHOT_DIR, "%s_%s.png" % (self.pkginfo.name, num_screenshots))
self.save_to_file(thumb, None, local_name)

self.add_screenshot(self.pkginfo, local_name, num_screenshots)
self.add_screenshot(self.pkginfo, local_name, num_screenshots)
except Exception as e:
pass

Expand Down

0 comments on commit 4947b96

Please sign in to comment.