diff --git a/vrobbler/apps/beers/admin.py b/vrobbler/apps/beers/admin.py index 9073a21..acc7e90 100644 --- a/vrobbler/apps/beers/admin.py +++ b/vrobbler/apps/beers/admin.py @@ -10,6 +10,13 @@ class BeerInline(admin.TabularInline): extra = 0 +@admin.register(Beer) +class BeerProducer(admin.ModelAdmin): + date_hierarchy = "created" + list_display = ("uuid",) + search_fields = ("name",) + + @admin.register(Beer) class BeerAdmin(admin.ModelAdmin): date_hierarchy = "created" diff --git a/vrobbler/apps/beers/models.py b/vrobbler/apps/beers/models.py index 1e15bdd..65b37c0 100644 --- a/vrobbler/apps/beers/models.py +++ b/vrobbler/apps/beers/models.py @@ -14,6 +14,7 @@ class BeerProducer(TimeStampedModel): description = models.TextField(**BNULL) location = models.CharField(max_length=255, **BNULL) beeradvocate_id = models.CharField(max_length=255, **BNULL) + untappd_id = models.CharField(max_length=255, **BNULL) def find_or_create(cls, title: str) -> "BeerProducer": return cls.objects.filter(title=title).first() @@ -27,22 +28,21 @@ class Beer(ScrobblableMixin): non_alcoholic = models.BooleanField(default=False) beeradvocate_id = models.CharField(max_length=255, **BNULL) beeradvocate_score = models.SmallIntegerField(**BNULL) - beeradvocate_image = models.ImageField( - upload_to="beers/beeradvcoate/", **BNULL - ) - beeradvocate_image_small = ImageSpecField( - source="cover", + untappd_image = models.ImageField(upload_to="beers/untappd/", **BNULL) + untappd_image_small = ImageSpecField( + source="untappd_image", processors=[ResizeToFit(100, 100)], format="JPEG", options={"quality": 60}, ) - beeradvocate_image_medium = ImageSpecField( - source="cover", + untappd_image_medium = ImageSpecField( + source="untappd_image", processors=[ResizeToFit(300, 300)], format="JPEG", options={"quality": 75}, ) untappd_id = models.CharField(max_length=255, **BNULL) + untappd_rating = models.FloatField(**BNULL) producer = models.ForeignKey( BeerProducer, on_delete=models.DO_NOTHING, **BNULL ) diff --git a/vrobbler/apps/scrobbles/constants.py b/vrobbler/apps/scrobbles/constants.py index fe6477b..c73634d 100644 --- a/vrobbler/apps/scrobbles/constants.py +++ b/vrobbler/apps/scrobbles/constants.py @@ -30,6 +30,7 @@ SCROBBLE_CONTENT_URLS = { "-i": "https://www.imdb.com/title/", "-s": "https://www.thesportsdb.com/event/", "-g": "https://boardgamegeek.com/boardgame/", + "-d": "https://beeradvocate.com/beer/profile/", "-b": "https://www.amazon.com/", "-t": "https://app.todoist.com/app/task/{id}", } @@ -42,6 +43,7 @@ MANUAL_SCROBBLE_FNS = { "-s": "manual_scrobble_event", "-i": "manual_scrobble_video", "-g": "manual_scrobble_board_game", + "-d": "manual_scrobble_beer", "-w": "manual_scrobble_webpage", "-t": "manual_scrobble_task", }