Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6920c99931 | |||
| d2d71b3c85 | |||
| 6300df8e9e | |||
| b427731bc3 |
@ -13,6 +13,7 @@ logger = logging.getLogger(__name__)
|
||||
BNULL = {"blank": True, "null": True}
|
||||
User = get_user_model()
|
||||
|
||||
ACCURACY = getattr(settings, "GEOLOC_ACCURACY", 3)
|
||||
|
||||
class GeoLocation(ScrobblableMixin):
|
||||
COMPLETION_PERCENT = getattr(settings, "LOCATION_COMPLETION_PERCENT", 100)
|
||||
@ -53,11 +54,11 @@ class GeoLocation(ScrobblableMixin):
|
||||
int_lon, r_lon = str(data_dict.get("lon", "")).split(".")
|
||||
|
||||
try:
|
||||
trunc_lat = r_lat[0:4]
|
||||
trunc_lat = r_lat[0:GEOLOC_ACCURACY]
|
||||
except IndexError:
|
||||
trunc_lat = r_lat
|
||||
try:
|
||||
trunc_lon = r_lon[0:4]
|
||||
trunc_lon = r_lon[0:GEOLOC_ACCURACY]
|
||||
except IndexError:
|
||||
trunc_lon = r_lon
|
||||
|
||||
@ -65,12 +66,8 @@ class GeoLocation(ScrobblableMixin):
|
||||
data_dict["lon"] = float(f"{int_lon}.{trunc_lon}")
|
||||
|
||||
int_alt, r_alt = str(data_dict.get("alt", "")).split(".")
|
||||
try:
|
||||
trunc_alt = r_lon[0:4]
|
||||
except IndexError:
|
||||
trunc_alt = r_alt
|
||||
|
||||
data_dict["altitude"] = float(f"{int_alt}.{trunc_alt}")
|
||||
data_dict["altitude"] = float(int_alt)
|
||||
|
||||
location = cls.objects.filter(
|
||||
lat=data_dict.get("lat"),
|
||||
|
||||
@ -108,6 +108,9 @@ class ScrobbleAdmin(admin.ModelAdmin):
|
||||
"sport_event",
|
||||
"book",
|
||||
"video_game",
|
||||
"board_game",
|
||||
"geo_location",
|
||||
"webpage",
|
||||
)
|
||||
list_filter = (
|
||||
"is_paused",
|
||||
|
||||
@ -201,8 +201,10 @@ def manual_scrobble_event(thesportsdb_id: str, user_id: int):
|
||||
|
||||
|
||||
def manual_scrobble_video_game(hltb_id: str, user_id: int):
|
||||
data_dict = lookup_game_from_hltb(hltb_id)
|
||||
game = VideoGame.find_or_create(data_dict)
|
||||
game = VideoGame.objects.filter(hltb_id=hltb_id).first()
|
||||
if not game:
|
||||
data_dict = lookup_game_from_hltb(hltb_id)
|
||||
game = VideoGame.find_or_create(data_dict)
|
||||
|
||||
scrobble_dict = {
|
||||
"user_id": user_id,
|
||||
|
||||
@ -451,7 +451,7 @@ def scrobble_start(request, uuid):
|
||||
)
|
||||
|
||||
if (
|
||||
user.profile.redirect_on_webpage
|
||||
user.profile.redirect_to_webpage
|
||||
and media_obj.__class__.__name__ == Scrobble.MediaType.WEBPAGE
|
||||
):
|
||||
logger.info(f"Redirecting to {media_obj} detail apge")
|
||||
|
||||
@ -65,6 +65,7 @@ LASTFM_API_KEY = os.getenv("VROBBLER_LASTFM_API_KEY")
|
||||
LASTFM_SECRET_KEY = os.getenv("VROBBLER_LASTFM_SECRET_KEY")
|
||||
IGDB_CLIENT_ID = os.getenv("VROBBLER_IGDB_CLIENT_ID")
|
||||
IGDB_CLIENT_SECRET = os.getenv("VROBBLER_IGDB_CLIENT_SECRET")
|
||||
GEOLOC_ACCURACY = os.getenv("VROBBLER_GEOLOC_ACCURACY", 3)
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user