maps4fs 1.8.218__tar.gz → 1.8.220__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of maps4fs might be problematic. Click here for more details.

Files changed (66) hide show
  1. {maps4fs-1.8.218 → maps4fs-1.8.220}/PKG-INFO +1 -1
  2. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/map.py +19 -0
  3. maps4fs-1.8.220/maps4fs/generator/statistics.py +59 -0
  4. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs.egg-info/PKG-INFO +1 -1
  5. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs.egg-info/SOURCES.txt +1 -0
  6. {maps4fs-1.8.218 → maps4fs-1.8.220}/pyproject.toml +1 -1
  7. {maps4fs-1.8.218 → maps4fs-1.8.220}/LICENSE.md +0 -0
  8. {maps4fs-1.8.218 → maps4fs-1.8.220}/README.md +0 -0
  9. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/__init__.py +0 -0
  10. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/__init__.py +0 -0
  11. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/__init__.py +0 -0
  12. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/background.py +0 -0
  13. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/base/__init__.py +0 -0
  14. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/base/component.py +0 -0
  15. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/base/component_image.py +0 -0
  16. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/base/component_mesh.py +0 -0
  17. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/base/component_xml.py +0 -0
  18. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/config.py +0 -0
  19. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/grle.py +0 -0
  20. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/i3d.py +0 -0
  21. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/layer.py +0 -0
  22. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/satellite.py +0 -0
  23. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/component/texture.py +0 -0
  24. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dem.py +0 -0
  25. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/__init__.py +0 -0
  26. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/arctic.py +0 -0
  27. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/baden.py +0 -0
  28. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/base/wcs.py +0 -0
  29. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/base/wms.py +0 -0
  30. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/bavaria.py +0 -0
  31. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/canada.py +0 -0
  32. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/czech.py +0 -0
  33. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/denmark.py +0 -0
  34. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/dtm.py +0 -0
  35. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/england.py +0 -0
  36. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/finland.py +0 -0
  37. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/flanders.py +0 -0
  38. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/france.py +0 -0
  39. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/hessen.py +0 -0
  40. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/italy.py +0 -0
  41. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/lithuania.py +0 -0
  42. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/mv.py +0 -0
  43. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/niedersachsen.py +0 -0
  44. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/norway.py +0 -0
  45. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/nrw.py +0 -0
  46. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/rema.py +0 -0
  47. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/sachsenanhalt.py +0 -0
  48. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/scotland.py +0 -0
  49. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/spain.py +0 -0
  50. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/srtm.py +0 -0
  51. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/switzerland.py +0 -0
  52. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/usgs_wcs.py +0 -0
  53. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/dtm/utils.py +0 -0
  54. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/game.py +0 -0
  55. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/qgis.py +0 -0
  56. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/generator/settings.py +0 -0
  57. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/logger.py +0 -0
  58. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/toolbox/__init__.py +0 -0
  59. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/toolbox/background.py +0 -0
  60. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/toolbox/custom_osm.py +0 -0
  61. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs/toolbox/dem.py +0 -0
  62. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs.egg-info/dependency_links.txt +0 -0
  63. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs.egg-info/requires.txt +0 -0
  64. {maps4fs-1.8.218 → maps4fs-1.8.220}/maps4fs.egg-info/top_level.txt +0 -0
  65. {maps4fs-1.8.218 → maps4fs-1.8.220}/setup.cfg +0 -0
  66. {maps4fs-1.8.218 → maps4fs-1.8.220}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.218
3
+ Version: 1.8.220
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -20,6 +20,7 @@ from maps4fs.generator.settings import (
20
20
  SplineSettings,
21
21
  TextureSettings,
22
22
  )
23
+ from maps4fs.generator.statistics import send_advanced_settings, send_main_settings
23
24
  from maps4fs.logger import Logger
24
25
 
25
26
 
@@ -74,6 +75,19 @@ class Map:
74
75
  self.coordinates = coordinates
75
76
  self.map_directory = map_directory
76
77
 
78
+ try:
79
+ main_settings = {
80
+ "game": game.code,
81
+ "coordinates": coordinates,
82
+ "size": size,
83
+ "rotation": rotation,
84
+ "dtm_provider": dtm_provider.name(),
85
+ "custom_osm": bool(custom_osm),
86
+ }
87
+ send_main_settings(main_settings)
88
+ except Exception as e:
89
+ self.logger.error("Error sending main settings: %s", e)
90
+
77
91
  log_entry = ""
78
92
  log_entry += f"Map instance created for Game: {game.code}. "
79
93
  log_entry += f"Coordinates: {coordinates}. Size: {size}. Rotation: {rotation}. "
@@ -128,6 +142,11 @@ class Map:
128
142
  for setting in settings:
129
143
  settings_json[setting.__class__.__name__] = setting.model_dump()
130
144
 
145
+ try:
146
+ send_advanced_settings(settings_json)
147
+ except Exception as e:
148
+ self.logger.error("Error sending advanced settings: %s", e)
149
+
131
150
  save_path = os.path.join(self.map_directory, "generation_settings.json")
132
151
 
133
152
  with open(save_path, "w", encoding="utf-8") as file:
@@ -0,0 +1,59 @@
1
+ """Module for sending settings to the statistics server."""
2
+
3
+ import os
4
+ from typing import Any
5
+
6
+ import requests
7
+
8
+ from maps4fs.logger import Logger
9
+
10
+ logger = Logger()
11
+
12
+ try:
13
+ from dotenv import load_dotenv
14
+
15
+ load_dotenv("local.env")
16
+ except Exception:
17
+ pass
18
+
19
+ STATS_HOST = os.getenv("STATS_HOST")
20
+ if not STATS_HOST:
21
+ print("STATS_HOST not set in environment")
22
+ API_TOKEN = os.getenv("API_TOKEN")
23
+ if not API_TOKEN:
24
+ print("API_TOKEN not set in environment")
25
+
26
+
27
+ def send_settings(endpoint: str, data: dict[str, Any]) -> None:
28
+ """Send settings to the statistics server.
29
+
30
+ Arguments:
31
+ endpoint (str): The endpoint to send the settings to.
32
+ data (dict[str, Any]): The settings to send.
33
+ """
34
+ headers = {"Authorization": f"Bearer {API_TOKEN}", "Content-Type": "application/json"}
35
+ response = requests.post(endpoint, headers=headers, json=data, timeout=10)
36
+ if response.status_code != 200:
37
+ logger.error("Failed to send settings: %s", response.text)
38
+ else:
39
+ logger.info("Settings sent successfully")
40
+
41
+
42
+ def send_main_settings(data: dict[str, Any]) -> None:
43
+ """Send main settings to the statistics server.
44
+
45
+ Arguments:
46
+ data (dict[str, Any]): The main settings to send.
47
+ """
48
+ endpoint = f"{STATS_HOST}/receive_main_settings"
49
+ send_settings(endpoint, data)
50
+
51
+
52
+ def send_advanced_settings(data: dict[str, Any]) -> None:
53
+ """Send advanced settings to the statistics server.
54
+
55
+ Arguments:
56
+ data (dict[str, Any]): The advanced settings to send.
57
+ """
58
+ endpoint = f"{STATS_HOST}/receive_advanced_settings"
59
+ send_settings(endpoint, data)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.218
3
+ Version: 1.8.220
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -14,6 +14,7 @@ maps4fs/generator/game.py
14
14
  maps4fs/generator/map.py
15
15
  maps4fs/generator/qgis.py
16
16
  maps4fs/generator/settings.py
17
+ maps4fs/generator/statistics.py
17
18
  maps4fs/generator/component/__init__.py
18
19
  maps4fs/generator/component/background.py
19
20
  maps4fs/generator/component/config.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "1.8.218"
7
+ version = "1.8.220"
8
8
  description = "Generate map templates for Farming Simulator from real places."
9
9
  authors = [{name = "iwatkot", email = "iwatkot@gmail.com"}]
10
10
  license = {text = "MIT License"}
File without changes
File without changes
File without changes
File without changes
File without changes