Fix small things
This commit is contained in:
@ -19,13 +19,14 @@ DATA_DIR = Path(
|
|||||||
|
|
||||||
DEBUG: bool = os.getenv(key="DEBUG", default="True").lower() == "true"
|
DEBUG: bool = os.getenv(key="DEBUG", default="True").lower() == "true"
|
||||||
|
|
||||||
sentry_sdk.init(
|
if not DEBUG:
|
||||||
dsn="https://35519536b56710e51cac49522b2cc29f@o4505228040339456.ingest.sentry.io/4506447308914688",
|
sentry_sdk.init(
|
||||||
environment="Development" if DEBUG else "Production",
|
dsn="https://35519536b56710e51cac49522b2cc29f@o4505228040339456.ingest.sentry.io/4506447308914688",
|
||||||
send_default_pii=True,
|
environment="Production",
|
||||||
traces_sample_rate=0.2,
|
send_default_pii=True,
|
||||||
profiles_sample_rate=0.2,
|
traces_sample_rate=0.2,
|
||||||
)
|
profiles_sample_rate=0.2,
|
||||||
|
)
|
||||||
|
|
||||||
BASE_DIR: Path = Path(__file__).resolve().parent.parent
|
BASE_DIR: Path = Path(__file__).resolve().parent.parent
|
||||||
ADMINS: list[tuple[str, str]] = [("Joakim Hellsén", "tlovinator@gmail.com")]
|
ADMINS: list[tuple[str, str]] = [("Joakim Hellsén", "tlovinator@gmail.com")]
|
||||||
@ -46,9 +47,8 @@ STATIC_ROOT.mkdir(exist_ok=True)
|
|||||||
if DEBUG:
|
if DEBUG:
|
||||||
INTERNAL_IPS: list[str] = ["127.0.0.1"]
|
INTERNAL_IPS: list[str] = ["127.0.0.1"]
|
||||||
|
|
||||||
|
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
ALLOWED_HOSTS: list[str] = ["ttvdrops.lovinator.space"]
|
ALLOWED_HOSTS: list[str] = ["ttvdrops.lovinator.space", "localhost"]
|
||||||
|
|
||||||
EMAIL_HOST = "smtp.gmail.com"
|
EMAIL_HOST = "smtp.gmail.com"
|
||||||
EMAIL_PORT = 587
|
EMAIL_PORT = 587
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% for campaign in game.campaigns %}
|
{% for campaign in game.drop_campaigns.all %}
|
||||||
{% if not forloop.first %}<br>{% endif %}
|
{% if not forloop.first %}<br>{% endif %}
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<h3 class="h6">{{ campaign.name }}</h3>
|
<h3 class="h6">{{ campaign.name }}</h3>
|
||||||
@ -61,15 +61,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-2">
|
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-2">
|
||||||
{% for drop in campaign.drops %}
|
{% for drop in campaign.drops.all %}
|
||||||
<div class="col d-flex align-items-center position-relative">
|
<div class="col d-flex align-items-center position-relative">
|
||||||
<img src="{{ drop.image_url }}"
|
<img src="{{ drop.image_asset_url }}"
|
||||||
alt="{{ drop.name }} drop image"
|
alt="{{ drop.name }} drop image"
|
||||||
class="img-fluid rounded me-3"
|
class="img-fluid rounded me-3"
|
||||||
height="50"
|
height="50"
|
||||||
width="50"
|
width="50"
|
||||||
loading="lazy">
|
loading="lazy">
|
||||||
{{ drop.name }}
|
{{ drop.name }} - {{ drop.required_minutes_watched }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -144,14 +144,14 @@ async def insert_data(data: dict) -> None: # noqa: C901, PLR0914
|
|||||||
"image_asset_url": benefit_data.get("imageAssetURL"),
|
"image_asset_url": benefit_data.get("imageAssetURL"),
|
||||||
"is_ios_available": benefit_data.get("isIosAvailable"),
|
"is_ios_available": benefit_data.get("isIosAvailable"),
|
||||||
"name": benefit_data.get("name"),
|
"name": benefit_data.get("name"),
|
||||||
"owner_organization": org,
|
|
||||||
"game": benefit_game,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
if created:
|
if created:
|
||||||
logger.debug("Drop created: %s", drop)
|
logger.debug("Drop created: %s", drop)
|
||||||
|
|
||||||
|
await sync_to_async(drop.save)()
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Scrape Twitch Drops Campaigns with login using Firefox"
|
help = "Scrape Twitch Drops Campaigns with login using Firefox"
|
||||||
@ -227,6 +227,9 @@ class Command(BaseCommand):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if "dropCampaign" in campaign.get("data", {}).get("user", {}):
|
if "dropCampaign" in campaign.get("data", {}).get("user", {}):
|
||||||
|
if not campaign["data"]["user"]["dropCampaign"]:
|
||||||
|
continue
|
||||||
|
|
||||||
await insert_data(campaign)
|
await insert_data(campaign)
|
||||||
|
|
||||||
if "dropCampaigns" in campaign.get("data", {}).get("user", {}):
|
if "dropCampaigns" in campaign.get("data", {}).get("user", {}):
|
||||||
|
Reference in New Issue
Block a user