Use constant for location providers
This commit is contained in:
7
vrobbler/apps/locations/constants.py
Normal file
7
vrobbler/apps/locations/constants.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
|
LOCATION_PROVIDERS = defaultdict(lambda: "Unknown")
|
||||||
|
LOCATION_PROVIDERS["gps"] = "GPS"
|
||||||
|
LOCATION_PROVIDERS["network"] = "Wifi Triangulation"
|
||||||
@ -24,6 +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
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -273,7 +274,8 @@ def gpslogger_scrobble_location(
|
|||||||
}
|
}
|
||||||
|
|
||||||
scrobble = Scrobble.create_or_update(location, user_id, extra_data)
|
scrobble = Scrobble.create_or_update(location, user_id, extra_data)
|
||||||
provider = f"gps source - {data_dict.get('prov')}"
|
|
||||||
|
provider = f"data source: {LOCATION_PROVIDERS[data_dict.get('prov')]}"
|
||||||
if scrobble.notes:
|
if scrobble.notes:
|
||||||
scrobble.notes = scrobble.notes + f"\n{provider}"
|
scrobble.notes = scrobble.notes + f"\n{provider}"
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user