Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ mypy_result.xml
pauperformance_bot/secrets.py
pauperformance_bot/p13_secrets.py
pauperformance_bot/task/dev.py

# Claude Code
CLAUDE.md
.claude
8 changes: 7 additions & 1 deletion pauperformance_bot/constant/mtg/mtggoldfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
DECK_API_ENDPOINT = f"{API_ENDPOINT}/{DECK_API_TOKEN}"
DECK_DOWNLOAD_TOKEN = f"{DECK_API_TOKEN}/download"
DECK_DOWNLOAD_API_ENDPOINT = f"{API_ENDPOINT}/{DECK_DOWNLOAD_TOKEN}"
DECK_PROXY_API_ENDPOINT = f"{API_ENDPOINT}/proxies/new?id="

MTGGOLDFISH_DECK_PAGE_DATE_FORMAT = "%b %d, %Y"
MTGGOLDFISH_EVENT_LINE_TEXT = "Event: "
MTGGOLDFISH_DECK_DATE_TEXT = "Deck Date: "

FULL_PAUPER_METAGAME_URL = f"{API_ENDPOINT}/metagame/pauper/full"
METAGAME_SHARE_CLASS = ".metagame-percentage"
DECK_PROXY_CLASS = "textarea"
METAGAME_ARCHETYPE_TITLE_URL_CLASS = ".archetype-tile-image a"
DECK_TOOLS_CONTAINER_CLASS = ".tools-container a"

Expand All @@ -21,6 +23,10 @@
"q=0.9",
}

REQUESTS_SLEEP_SECONDS = 1
REQUEST_HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) "
"Gecko/20100101 Firefox/126.0",
}
REQUESTS_SLEEP_SECONDS = 5
MTGGOLDFISH_THROTTLE_ERROR_RESPONSE = "Throttled"
MIN_AUTHENTICITY_TOKEN_LEN = 80
2 changes: 1 addition & 1 deletion pauperformance_bot/constant/mtg/scryfall.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
WEBSITE_URL = "https://scryfall.com"
API_ENDPOINT = "https://api.scryfall.com"
REQUESTS_SLEEP_SECONDS = 0.3
REQUESTS_SLEEP_SECONDS = 1
18 changes: 1 addition & 17 deletions pauperformance_bot/constant/pauperformance/academy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from pauperformance_bot.constant.pauperformance.myr import TOP_PATH
from pauperformance_bot.util.path import posix_path
from pauperformance_bot.util.web_page import WebPage

# ACADEMY_PATH must resolve to the top directory of the website
# (i.e. the cloned twin repo), for example:
Expand All @@ -12,28 +11,13 @@
posix_path(TOP_PATH.parent.as_posix(), "pauperformance.github.io"),
)

HOME_PAGE_NAME = WebPage("index")
HOME_OUTPUT_FILE = posix_path(ACADEMY_PATH, HOME_PAGE_NAME.as_markdown())

ARCHETYPES_DIR = posix_path(ACADEMY_PATH, "archetypes")
FAMILIES_DIR = posix_path(ACADEMY_PATH, "families")
PAGES_DIR = posix_path(ACADEMY_PATH, "pages")
RESOURCES_DIR = posix_path(ACADEMY_PATH, "resources")

ARCHETYPES_INDEX_PAGE_NAME = WebPage("archetypes_index")
ARCHETYPES_INDEX_OUTPUT_FILE = posix_path(
PAGES_DIR, ARCHETYPES_INDEX_PAGE_NAME.as_markdown()
)
DEV_PAGE_NAME = WebPage("dev")
DEV_OUTPUT_FILE = posix_path(PAGES_DIR, DEV_PAGE_NAME.as_markdown())
PAUPER_POOL_PAGE_NAME = WebPage("pauper_pool")
PAUPER_POOL_OUTPUT_FILE = posix_path(PAGES_DIR, PAUPER_POOL_PAGE_NAME.as_markdown())
SET_INDEX_PAGE_NAME = WebPage("set_index")
SET_INDEX_OUTPUT_FILE = posix_path(PAGES_DIR, SET_INDEX_PAGE_NAME.as_markdown())

ARCHETYPES_DIR_RELATIVE_URL = posix_path("archetypes")
FAMILIES_DIR_RELATIVE_URL = posix_path("families")
RESOURCES_IMAGES_MANA_RELATIVE_URL = posix_path("resources", "images", "mana")


class AcademyFileSystem:
Expand Down Expand Up @@ -61,7 +45,7 @@ def __init__(self, root_dir=ACADEMY_PATH):
self.ASSETS_DATA_INTEL_CARD_DIR: str = posix_path(
self.ASSETS_DATA_INTEL_DIR, "card"
)
self.ASSETS_DATA_PHD_DIR: str = posix_path(self.ASSETS_DATA_DIR, "phd")
self.ASSETS_DATA_CREATOR_DIR: str = posix_path(self.ASSETS_DATA_DIR, "creator")
self.ASSETS_DATA_TOURNAMENT_DIR: str = posix_path(
self.ASSETS_DATA_DIR, "tournament"
)
Expand Down
26 changes: 10 additions & 16 deletions pauperformance_bot/constant/pauperformance/myr.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
if (
"VIRTUAL_ENV" in os.environ and "PYCHARM_HOSTED" not in os.environ
): # running in venv, outside PyCharm
RESOURCES_DIR = posix_path(os.getenv("VIRTUAL_ENV"), "resources")
RESOURCES_DIR = posix_path(os.getenv("VIRTUAL_ENV", ""), "resources")
else:
RESOURCES_DIR = posix_path(TOP_PATH.as_posix(), "resources")

Expand All @@ -66,21 +66,9 @@
CONFIG_DIR = posix_path(RESOURCES_DIR, "config")
CONFIG_ARCHETYPES_DIR = posix_path(CONFIG_DIR, "archetypes")
CONFIG_FAMILIES_DIR = posix_path(CONFIG_DIR, "families")
CONFIG_PHDS_DIR = posix_path(CONFIG_DIR, "phds")
CONFIG_CREATORS_DIR = posix_path(CONFIG_DIR, "creators")
CONFIG_NEWSPAUPER_FILE = "newspauper.ini"

TEMPLATES_DIR = posix_path(RESOURCES_DIR, "templates")
TEMPLATES_ARCHETYPES_DIR = posix_path(TEMPLATES_DIR, "archetypes")
ARCHETYPE_TEMPLATE_FILE = "archetype.md.j2"
TEMPLATES_FAMILIES_DIR = posix_path(TEMPLATES_DIR, "families")
FAMILY_TEMPLATE_FILE = "family.md.j2"
TEMPLATES_PAGES_DIR = posix_path(TEMPLATES_DIR, "pages")
ARCHETYPES_INDEX_TEMPLATE_FILE = "archetypes_index.md.j2"
DEV_TEMPLATE_FILE = "dev.md.j2"
HOME_TEMPLATE_FILE = "index.md.j2"
PAUPER_POOL_TEMPLATE_FILE = "pauper_pool.md.j2"
SET_INDEX_TEMPLATE_FILE = "set_index.md.j2"

SET_INDEX_FILE = posix_path(RESOURCES_DIR, "set_index.json")


Expand All @@ -104,15 +92,18 @@ def __init__(
self.RESOURCES_CONFIG_FAMILIES_DIR: str = posix_path(
self.RESOURCES_CONFIG_DIR, "families"
)
self.RESOURCES_CONFIG_PHDS_DIR: str = posix_path(
self.RESOURCES_CONFIG_DIR, "phds"
self.RESOURCES_CONFIG_CREATORS_DIR: str = posix_path(
self.RESOURCES_CONFIG_DIR, "creators"
)
self.RESOURCES_CONFIG_NEWSPAUPER: str = posix_path(
self.RESOURCES_CONFIG_DIR, "newspauper.ini"
)
self.RESOURCES_CONFIG_CHANGELOG: str = posix_path(
self.RESOURCES_CONFIG_DIR, "changelog.ini"
)
self.RESOURCES_JSON_TIMELINE: str = posix_path(
self.RESOURCES_CONFIG_DIR, "timeline.json"
)

self.RESOURCES_SILVER_DIR: str = posix_path(self.RESOURCES_DIR, "silver")
self.RESOURCES_SILVER_TRAINING_DATA_ARCHETYPES_DIR: str = posix_path(
Expand All @@ -126,6 +117,9 @@ def __init__(
self.RESOURCES_SILVER_TRAINING_DATA_ARCHETYPES_DIR,
"dpl_decks.csv",
)
self.MTGGOLDFISH_DECKS_CACHE_DIR: str = posix_path(
self.RESOURCES_CACHE_DIR, "mtggoldfish_decks"
)


MYR_FILE_SYSTEM = MyrFileSystem()
33 changes: 17 additions & 16 deletions pauperformance_bot/constant/pauperformance/pauperformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@
769,
770,
771,
772,
774,
775,
776,
Expand Down Expand Up @@ -533,9 +534,6 @@
840,
841,
842,
843,
845,
846,
847,
848,
849,
Expand Down Expand Up @@ -600,8 +598,6 @@
923,
924,
925,
926,
928,
930,
931,
932,
Expand All @@ -612,13 +608,11 @@
938,
939,
940,
941,
942,
943,
944,
947,
948,
949,
950,
951,
952,
953,
Expand All @@ -627,12 +621,16 @@
957,
958,
959,
960,
961,
962,
963,
964,
966,
967,
969,
970,
972,
973,
974,
976,
Expand All @@ -645,7 +643,9 @@
985,
986,
987,
988,
989,
990,
993,
994,
995,
Expand All @@ -657,12 +657,8 @@
1003,
1004,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1014,
1015,
1016,
Expand All @@ -687,9 +683,7 @@
1041,
1042,
1043,
1044,
1045,
1046,
1048,
1049,
1050,
Expand All @@ -706,8 +700,14 @@
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1073,
1074,
1075,
]

INCREMENTAL_CARDS_INDEX_SKIP_SETS = [
Expand Down Expand Up @@ -873,4 +873,5 @@
1032,
1038,
1058,
1069,
]
4 changes: 2 additions & 2 deletions pauperformance_bot/entity/academy_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(
published_at,
deck_name,
archetype,
phd,
creator,
url,
fa_icon,
):
Expand All @@ -25,7 +25,7 @@ def __init__(
self.published_at = published_at
self.deck_name = deck_name
self.archetype = archetype
self.phd = phd
self.creator = creator
self.url = url
self.fa_icon = fa_icon

Expand Down
25 changes: 25 additions & 0 deletions pauperformance_bot/entity/api/creator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from typing import Optional

from pauperformance_bot.util.decorators import auto_repr, auto_str


@auto_repr
@auto_str
class CreatorSheet:
def __init__(
self,
*,
name: str,
mtgo_name: Optional[str],
mtgo_name2: Optional[str],
twitch_channel_url: Optional[str],
youtube_channel_url: Optional[str],
):
self.name: str = name
self.mtgo_name: Optional[str] = mtgo_name
self.mtgo_name2: Optional[str] = mtgo_name2
self.twitch_channel_url: Optional[str] = twitch_channel_url
self.youtube_channel_url: Optional[str] = youtube_channel_url

def __hash__(self) -> int:
return hash(self.name)
10 changes: 9 additions & 1 deletion pauperformance_bot/entity/api/deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,22 @@ def __init__(
tournament_date: str,
):
self.url: str = url
self.archetype: str = archetype
self.place: str = place
self.pilot: str = pilot
self.tabletop_price: Optional[int] = tabletop_price
self.mtgo_price: Optional[int] = mtgo_price
self.tournament_id: str = tournament_id
self.tournament_name: str = tournament_name
self.tournament_date: str = tournament_date
self._archetype: str = archetype

@property
def archetype(self) -> str:
return self._archetype

@archetype.setter
def archetype(self, value: str) -> None:
self._archetype = value

@property
def identifier(self) -> str:
Expand Down
59 changes: 0 additions & 59 deletions pauperformance_bot/entity/api/phd.py

This file was deleted.

Loading
Loading