From 374b47049532da7b01012ddbf1c3c46a9f695d2d Mon Sep 17 00:00:00 2001 From: HeroponRikiBestest <50224630+HeroponRikiBestest@users.noreply.github.com> Date: Sun, 18 May 2025 11:57:36 -0400 Subject: [PATCH] Add "game" option to File Add "game" option to File that holds game name, should the file be attached to a game --- moddb/pages/file.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/moddb/pages/file.py b/moddb/pages/file.py index eba1e81..44e02b9 100644 --- a/moddb/pages/file.py +++ b/moddb/pages/file.py @@ -83,6 +83,8 @@ class File(BaseMetaClass): Description of the file, as written by the author preview : str URL of the preview image for the file + game : str + The name of the game that the file is attached to. """ def __init__(self, html: bs4.BeautifulSoup): @@ -106,6 +108,11 @@ def __init__(self, html: bs4.BeautifulSoup): downloads = html.find("h5", string="Downloads").parent.a.string self.today = int(re.sub(r"[(),today]", "", downloads.split(" ")[1])) self.downloads = int(downloads.split(" ")[0].replace(",", "")) + location = html.find("h5", string="Location").parent.find_all('a') + if location[0].string == "Games": + self.game = location[1].string + else: + self.game = "None" try: self.category = FileCategory(