[scrobbles] Fix ntfy formatting
This commit is contained in:
@ -7,7 +7,7 @@ from django_extensions.db.models import TimeStampedModel
|
|||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFit
|
from imagekit.processors import ResizeToFit
|
||||||
from scrobbles.dataclasses import BeerLogData
|
from scrobbles.dataclasses import BeerLogData
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
from vrobbler.apps.beers.untappd import (
|
from vrobbler.apps.beers.untappd import (
|
||||||
get_beer_from_untappd_id,
|
get_beer_from_untappd_id,
|
||||||
get_rating_from_soup,
|
get_rating_from_soup,
|
||||||
@ -75,8 +75,8 @@ class Beer(ScrobblableMixin):
|
|||||||
return self.producer.name
|
return self.producer.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Drinking"
|
return ScrobblableConstants(verb="Drinking", tags="beer")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def beeradvocate_link(self) -> str:
|
def beeradvocate_link(self) -> str:
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from django_extensions.db.models import TimeStampedModel
|
|||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFit
|
from imagekit.processors import ResizeToFit
|
||||||
from scrobbles.dataclasses import BoardGameLogData
|
from scrobbles.dataclasses import BoardGameLogData
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
@ -101,8 +101,8 @@ class BoardGame(ScrobblableMixin):
|
|||||||
return BoardGameLogData
|
return BoardGameLogData
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Playing"
|
return ScrobblableConstants(verb="Playing", tags="game_die")
|
||||||
|
|
||||||
def primary_image_url(self) -> str:
|
def primary_image_url(self) -> str:
|
||||||
url = ""
|
url = ""
|
||||||
|
|||||||
@ -19,6 +19,7 @@ from imagekit.processors import ResizeToFit
|
|||||||
from scrobbles.mixins import (
|
from scrobbles.mixins import (
|
||||||
LongPlayScrobblableMixin,
|
LongPlayScrobblableMixin,
|
||||||
ObjectWithGenres,
|
ObjectWithGenres,
|
||||||
|
ScrobblableConstants,
|
||||||
ScrobblableMixin,
|
ScrobblableMixin,
|
||||||
)
|
)
|
||||||
from scrobbles.utils import get_scrobbles_for_media
|
from scrobbles.utils import get_scrobbles_for_media
|
||||||
@ -135,8 +136,8 @@ class Book(LongPlayScrobblableMixin):
|
|||||||
return f" by {self.author}"
|
return f" by {self.author}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Reading"
|
return ScrobblableConstants(verb="Reading", tags="book")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def logdata_cls(self):
|
def logdata_cls(self):
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from django.apps import apps
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from scrobbles.dataclasses import LifeEventLogData
|
from scrobbles.dataclasses import LifeEventLogData
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
|
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ class LifeEvent(ScrobblableMixin):
|
|||||||
return LifeEventLogData
|
return LifeEventLogData
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Experiencing"
|
return ScrobblableConstants(verb="Experiencing", tags="camping")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_or_create(cls, title: str) -> "LifeEvent":
|
def find_or_create(cls, title: str) -> "LifeEvent":
|
||||||
|
|||||||
@ -8,7 +8,7 @@ from django.conf import settings
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django_extensions.db.models import TimeStampedModel
|
from django_extensions.db.models import TimeStampedModel
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
@ -91,8 +91,10 @@ class GeoLocation(ScrobblableMixin):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Going"
|
return ScrobblableConstants(
|
||||||
|
verb="Going", tags="world_map", priority="low"
|
||||||
|
)
|
||||||
|
|
||||||
def loc_diff(self, old_lat_lon: tuple) -> tuple:
|
def loc_diff(self, old_lat_lon: tuple) -> tuple:
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from django.db import models
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFit
|
from imagekit.processors import ResizeToFit
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
|
|
||||||
from vrobbler.apps.scrobbles.dataclasses import MoodLogData
|
from vrobbler.apps.scrobbles.dataclasses import MoodLogData
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ class Mood(ScrobblableMixin):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Feeling"
|
return ScrobblableConstants(verb="Feeling", tags="thinking")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def logdata_cls(self):
|
def logdata_cls(self):
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from imagekit.processors import ResizeToFit
|
|||||||
from music.allmusic import get_allmusic_slug, scrape_data_from_allmusic
|
from music.allmusic import get_allmusic_slug, scrape_data_from_allmusic
|
||||||
from music.bandcamp import get_bandcamp_slug
|
from music.bandcamp import get_bandcamp_slug
|
||||||
from music.theaudiodb import lookup_album_from_tadb, lookup_artist_from_tadb
|
from music.theaudiodb import lookup_album_from_tadb, lookup_artist_from_tadb
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
@ -429,8 +429,8 @@ class Track(ScrobblableMixin):
|
|||||||
return self.artist
|
return self.artist
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Listening"
|
return ScrobblableConstants(verb="Listening", tags="headphones")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mb_link(self):
|
def mb_link(self):
|
||||||
|
|||||||
@ -172,10 +172,10 @@ class VideoLogData(JSONDataclass):
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class VideoGameLogData(LongPlayLogData):
|
class VideoGameLogData(LongPlayLogData):
|
||||||
serial_scrobble_id: Optional[int]
|
serial_scrobble_id: Optional[int] = None
|
||||||
long_play_complete: bool = False
|
long_play_complete: Optional[bool] = False
|
||||||
console: str = ""
|
console: Optional[str] = None
|
||||||
emulated: bool = False
|
emulated: Optional[bool] = False
|
||||||
emulator: Optional[str] = None
|
emulator: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
@ -16,6 +17,23 @@ BNULL = {"blank": True, "null": True}
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class ScrobblableConstants:
|
||||||
|
verb: str
|
||||||
|
tags: str
|
||||||
|
priority: str
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
verb: str = "Scrobbling",
|
||||||
|
tags: str = "green_square",
|
||||||
|
priority: str = "default",
|
||||||
|
):
|
||||||
|
self.verb = verb
|
||||||
|
self.tags = tags
|
||||||
|
self.priority = priority
|
||||||
|
|
||||||
|
|
||||||
class Genre(TagBase):
|
class Genre(TagBase):
|
||||||
source = models.CharField(max_length=255, **BNULL)
|
source = models.CharField(max_length=255, **BNULL)
|
||||||
|
|
||||||
@ -81,8 +99,8 @@ class ScrobblableMixin(TimeStampedModel):
|
|||||||
return reverse("scrobbles:start", kwargs={"uuid": self.uuid})
|
return reverse("scrobbles:start", kwargs={"uuid": self.uuid})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Scrobbling"
|
return ScrobblableConstants()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def primary_image_url(self) -> str:
|
def primary_image_url(self) -> str:
|
||||||
|
|||||||
@ -1192,9 +1192,9 @@ class Scrobble(TimeStampedModel):
|
|||||||
profile.ntfy_url,
|
profile.ntfy_url,
|
||||||
data=f"{scrobble.media_obj}".encode(encoding="utf-8"),
|
data=f"{scrobble.media_obj}".encode(encoding="utf-8"),
|
||||||
headers={
|
headers={
|
||||||
"Title": scrobble.media_obj.verb,
|
"Title": scrobble.media_obj.strings.verb,
|
||||||
"Priority": "default",
|
"Priority": "default",
|
||||||
"Tags": "loudspeaker",
|
"Tags": scrobble.media_obj.strings.tags,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ from django.db import models
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_extensions.db.models import TimeStampedModel
|
from django_extensions.db.models import TimeStampedModel
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
from sports.utils import get_players_from_event, get_round_name_from_event
|
from sports.utils import get_players_from_event, get_round_name_from_event
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -134,8 +134,8 @@ class SportEvent(ScrobblableMixin):
|
|||||||
return self.round.season.league
|
return self.round.season.league
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Watching"
|
return ScrobblableConstants(verb="Watching", tags="trophy")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sportsdb_link(self):
|
def sportsdb_link(self):
|
||||||
|
|||||||
@ -6,7 +6,7 @@ from django.apps import apps
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from scrobbles.dataclasses import JSONDataclass
|
from scrobbles.dataclasses import JSONDataclass
|
||||||
from scrobbles.mixins import LongPlayScrobblableMixin
|
from scrobbles.mixins import LongPlayScrobblableMixin, ScrobblableConstants
|
||||||
|
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
|
|
||||||
@ -39,8 +39,8 @@ class Task(LongPlayScrobblableMixin):
|
|||||||
return reverse("tasks:task_detail", kwargs={"slug": self.uuid})
|
return reverse("tasks:task_detail", kwargs={"slug": self.uuid})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Doing"
|
return ScrobblableConstants(verb="Doing", tags="white_check_mark")
|
||||||
|
|
||||||
# @property
|
# @property
|
||||||
# def logdata_cls(self):
|
# def logdata_cls(self):
|
||||||
|
|||||||
@ -3,7 +3,7 @@ from django.apps import apps
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from scrobbles.dataclasses import TrailLogData
|
from scrobbles.dataclasses import TrailLogData
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
from locations.models import GeoLocation
|
from locations.models import GeoLocation
|
||||||
|
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
@ -39,8 +39,8 @@ class Trail(ScrobblableMixin):
|
|||||||
return TrailLogData
|
return TrailLogData
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Moving"
|
return ScrobblableConstants(verb="Moving", tags="runner")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_or_create(cls, title: str) -> "Trail":
|
def find_or_create(cls, title: str) -> "Trail":
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from django_extensions.db.models import TimeStampedModel
|
|||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFit
|
from imagekit.processors import ResizeToFit
|
||||||
from scrobbles.dataclasses import VideoGameLogData
|
from scrobbles.dataclasses import VideoGameLogData
|
||||||
from scrobbles.mixins import LongPlayScrobblableMixin
|
from scrobbles.mixins import LongPlayScrobblableMixin, ScrobblableConstants
|
||||||
from scrobbles.utils import get_scrobbles_for_media
|
from scrobbles.utils import get_scrobbles_for_media
|
||||||
from videogames.igdb import lookup_game_id_from_gdb
|
from videogames.igdb import lookup_game_id_from_gdb
|
||||||
|
|
||||||
@ -145,8 +145,8 @@ class VideoGame(LongPlayScrobblableMixin):
|
|||||||
return f" On {self.platforms.first()}"
|
return f" On {self.platforms.first()}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Sessioning"
|
return ScrobblableConstants(verb="Sessioning", tags="joystick")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def primary_image_url(self) -> str:
|
def primary_image_url(self) -> str:
|
||||||
|
|||||||
@ -12,7 +12,11 @@ from django_extensions.db.models import TimeStampedModel
|
|||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFit
|
from imagekit.processors import ResizeToFit
|
||||||
from music.constants import JELLYFIN_POST_KEYS
|
from music.constants import JELLYFIN_POST_KEYS
|
||||||
from scrobbles.mixins import ObjectWithGenres, ScrobblableMixin
|
from scrobbles.mixins import (
|
||||||
|
ObjectWithGenres,
|
||||||
|
ScrobblableConstants,
|
||||||
|
ScrobblableMixin,
|
||||||
|
)
|
||||||
from taggit.managers import TaggableManager
|
from taggit.managers import TaggableManager
|
||||||
from videos.imdb import lookup_video_from_imdb
|
from videos.imdb import lookup_video_from_imdb
|
||||||
|
|
||||||
@ -197,8 +201,8 @@ class Video(ScrobblableMixin):
|
|||||||
return url
|
return url
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Watching"
|
return ScrobblableConstants(verb="Watching", tags="movie_camera")
|
||||||
|
|
||||||
def fix_metadata(self, force_update=False):
|
def fix_metadata(self, force_update=False):
|
||||||
imdb_dict = lookup_video_from_imdb(self.imdb_id)
|
imdb_dict = lookup_video_from_imdb(self.imdb_id)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from django.contrib.auth import get_user_model
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from htmldate import find_date
|
from htmldate import find_date
|
||||||
from scrobbles.mixins import ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
@ -86,8 +86,8 @@ class WebPage(ScrobblableMixin):
|
|||||||
return int(self.estimated_time_to_read_in_seconds / 60)
|
return int(self.estimated_time_to_read_in_seconds / 60)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def verb(self) -> str:
|
def strings(self) -> ScrobblableConstants:
|
||||||
return "Browsing"
|
return ScrobblableConstants(verb="Browsing", tags="earth_americas")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def subtitle(self):
|
def subtitle(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user