Try and fix things
This commit is contained in:
6
vrobbler/apps/locations/apps.py
Normal file
6
vrobbler/apps/locations/apps.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class LocationConfig(AppConfig):
|
||||||
|
name = "locations"
|
||||||
|
|
||||||
@ -28,6 +28,7 @@ class GeoLocation(ScrobblableMixin):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.lat} x {self.lon}"
|
return f"{self.lat} x {self.lon}"
|
||||||
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse(
|
return reverse(
|
||||||
"locations:geo_location_detail", kwargs={"slug": self.uuid}
|
"locations:geo_location_detail", kwargs={"slug": self.uuid}
|
||||||
|
|||||||
@ -56,6 +56,11 @@ class ScrobblableMixin(TimeStampedModel):
|
|||||||
def find_or_create(cls):
|
def find_or_create(cls):
|
||||||
logger.warn("find_or_create() not implemented yet")
|
logger.warn("find_or_create() not implemented yet")
|
||||||
|
|
||||||
|
def scrobble(self, user_id, **kwargs):
|
||||||
|
"""Given a user ID and a dictionary of data, attempts to scrobble it"""
|
||||||
|
from scrobbles.models import Scrobble
|
||||||
|
Scrobble.create_or_update(self, user_id, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class LongPlayScrobblableMixin(ScrobblableMixin):
|
class LongPlayScrobblableMixin(ScrobblableMixin):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@ -13,6 +13,7 @@ from django.urls import reverse
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django_extensions.db.models import TimeStampedModel
|
from django_extensions.db.models import TimeStampedModel
|
||||||
|
from locations.models import GeoLocation
|
||||||
from music.lastfm import LastFM
|
from music.lastfm import LastFM
|
||||||
from music.models import Artist, Track
|
from music.models import Artist, Track
|
||||||
from podcasts.models import Episode
|
from podcasts.models import Episode
|
||||||
@ -34,7 +35,6 @@ from sports.models import SportEvent
|
|||||||
from videogames import retroarch
|
from videogames import retroarch
|
||||||
from videogames.models import VideoGame
|
from videogames.models import VideoGame
|
||||||
from videos.models import Series, Video
|
from videos.models import Series, Video
|
||||||
from locations.models import GeoLocation
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from videogames.howlongtobeat import lookup_game_from_hltb
|
|||||||
from videogames.models import VideoGame
|
from videogames.models import VideoGame
|
||||||
from videos.models import Video
|
from videos.models import Video
|
||||||
from locations.models import GeoLocation, RawGeoLocation
|
from locations.models import GeoLocation, RawGeoLocation
|
||||||
from vrobbler.apps.locations.constants import LOCATION_PROVIDERS
|
from locations.constants import LOCATION_PROVIDERS
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user