aa-intel-tool 2.6.1__py3-none-any.whl → 2.6.3__py3-none-any.whl
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.
- aa_intel_tool/__init__.py +1 -1
- aa_intel_tool/helper/eve_character.py +24 -36
- aa_intel_tool/helper/static_files.py +2 -2
- aa_intel_tool/locale/cs_CZ/LC_MESSAGES/django.po +30 -29
- aa_intel_tool/locale/de/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/de/LC_MESSAGES/django.po +36 -35
- aa_intel_tool/locale/django.pot +31 -30
- aa_intel_tool/locale/es/LC_MESSAGES/django.po +32 -29
- aa_intel_tool/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/fr_FR/LC_MESSAGES/django.po +38 -33
- aa_intel_tool/locale/it_IT/LC_MESSAGES/django.po +30 -29
- aa_intel_tool/locale/ja/LC_MESSAGES/django.po +30 -29
- aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.po +39 -33
- aa_intel_tool/locale/nl_NL/LC_MESSAGES/django.po +30 -29
- aa_intel_tool/locale/pl_PL/LC_MESSAGES/django.po +30 -29
- aa_intel_tool/locale/ru/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/ru/LC_MESSAGES/django.po +38 -33
- aa_intel_tool/locale/sk/LC_MESSAGES/django.po +30 -29
- aa_intel_tool/locale/uk/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/uk/LC_MESSAGES/django.po +129 -123
- aa_intel_tool/locale/zh_Hans/LC_MESSAGES/django.po +32 -29
- aa_intel_tool/parser/general.py +11 -16
- aa_intel_tool/parser/helper/db.py +8 -11
- aa_intel_tool/parser/module/chatlist.py +97 -126
- aa_intel_tool/parser/module/dscan.py +115 -147
- aa_intel_tool/parser/module/fleetcomp.py +85 -102
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.css +6 -19
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css +1 -1
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.js +104 -64
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.js +59 -59
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.js +43 -43
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.js +146 -105
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.js +51 -51
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.js +69 -59
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.js +54 -32
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js.map +1 -1
- aa_intel_tool/templates/aa_intel_tool/base.html +4 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html +0 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html +0 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html +0 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/evetime.html +1 -1
- aa_intel_tool/tests/test-data/dscan.txt +250 -0
- aa_intel_tool/tests/test_admin.py +50 -38
- aa_intel_tool/tests/test_helper_eve_character.py +405 -0
- aa_intel_tool/tests/test_models.py +188 -4
- aa_intel_tool/tests/test_parser_general.py +771 -0
- aa_intel_tool/tests/test_parser_module_chatlist.py +154 -0
- {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/METADATA +4 -4
- {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/RECORD +66 -64
- aa_intel_tool/tests/test_parser.py +0 -135
- {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/WHEEL +0 -0
- {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -12,7 +12,7 @@ msgid ""
|
|
|
12
12
|
msgstr ""
|
|
13
13
|
"Project-Id-Version: AA Intel Tool 2.5.1\n"
|
|
14
14
|
"Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-intel-tool/issues\n"
|
|
15
|
-
"POT-Creation-Date: 2025-
|
|
15
|
+
"POT-Creation-Date: 2025-05-05 22:48+0200\n"
|
|
16
16
|
"PO-Revision-Date: 2025-02-18 09:17+0000\n"
|
|
17
17
|
"Last-Translator: Peter Pfeufer <info@ppfeufer.de>\n"
|
|
18
18
|
"Language-Team: Chinese (Simplified Han script) <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-intel-tool/zh_Hans/>\n"
|
|
@@ -165,33 +165,33 @@ msgstr ""
|
|
|
165
165
|
msgid "No suitable parser found. Input is not a supported intel type or malformed …"
|
|
166
166
|
msgstr ""
|
|
167
167
|
|
|
168
|
-
#: aa_intel_tool/parser/general.py:
|
|
168
|
+
#: aa_intel_tool/parser/general.py:63
|
|
169
169
|
msgid "No data to parse …"
|
|
170
170
|
msgstr ""
|
|
171
171
|
|
|
172
|
-
#: aa_intel_tool/parser/module/chatlist.py:
|
|
172
|
+
#: aa_intel_tool/parser/module/chatlist.py:60
|
|
173
173
|
msgid "Something went wrong while fetching the character information from ESI."
|
|
174
174
|
msgstr ""
|
|
175
175
|
|
|
176
|
-
#: aa_intel_tool/parser/module/chatlist.py:
|
|
176
|
+
#: aa_intel_tool/parser/module/chatlist.py:67
|
|
177
177
|
msgid "Character unknown to ESI."
|
|
178
178
|
msgstr ""
|
|
179
179
|
|
|
180
|
-
#: aa_intel_tool/parser/module/chatlist.py:
|
|
180
|
+
#: aa_intel_tool/parser/module/chatlist.py:256
|
|
181
181
|
msgid "The chat list module is currently disabled."
|
|
182
182
|
msgstr ""
|
|
183
183
|
|
|
184
|
-
#: aa_intel_tool/parser/module/chatlist.py:
|
|
184
|
+
#: aa_intel_tool/parser/module/chatlist.py:275
|
|
185
185
|
#, python-brace-format
|
|
186
186
|
msgid "Chat scans are currently limited to a maximum of {max_allowed_pilots} pilot per scan. Your list of pilots exceeds this limit."
|
|
187
187
|
msgid_plural "Chat scans are currently limited to a maximum of {max_allowed_pilots} pilots per scan. Your list of pilots exceeds this limit."
|
|
188
188
|
msgstr[0] ""
|
|
189
189
|
|
|
190
|
-
#: aa_intel_tool/parser/module/dscan.py:
|
|
190
|
+
#: aa_intel_tool/parser/module/dscan.py:362
|
|
191
191
|
msgid "The D-Scan module is currently disabled."
|
|
192
192
|
msgstr ""
|
|
193
193
|
|
|
194
|
-
#: aa_intel_tool/parser/module/fleetcomp.py:
|
|
194
|
+
#: aa_intel_tool/parser/module/fleetcomp.py:181
|
|
195
195
|
msgid "The fleet composition module is currently disabled."
|
|
196
196
|
msgstr ""
|
|
197
197
|
|
|
@@ -204,13 +204,16 @@ msgid "Something went wrong. Nothing copied. Maybe your browser does not support
|
|
|
204
204
|
msgstr ""
|
|
205
205
|
|
|
206
206
|
#: aa_intel_tool/templates/aa_intel_tool/base.html:25
|
|
207
|
-
|
|
208
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:4
|
|
209
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:3
|
|
210
|
-
msgid "Unaffiliated / No Alliance"
|
|
207
|
+
msgid "Unaffiliated"
|
|
211
208
|
msgstr ""
|
|
212
209
|
|
|
213
210
|
#: aa_intel_tool/templates/aa_intel_tool/base.html:26
|
|
211
|
+
#, fuzzy
|
|
212
|
+
#| msgid "Alliance list"
|
|
213
|
+
msgid "No Alliance"
|
|
214
|
+
msgstr "联盟列表"
|
|
215
|
+
|
|
216
|
+
#: aa_intel_tool/templates/aa_intel_tool/base.html:27
|
|
214
217
|
msgid "NPC Corp"
|
|
215
218
|
msgstr ""
|
|
216
219
|
|
|
@@ -274,26 +277,26 @@ msgstr ""
|
|
|
274
277
|
msgid "Copy permalink"
|
|
275
278
|
msgstr ""
|
|
276
279
|
|
|
277
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:
|
|
280
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:7
|
|
278
281
|
msgid "Alliances breakdown"
|
|
279
282
|
msgstr ""
|
|
280
283
|
|
|
281
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:
|
|
282
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:
|
|
284
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:18
|
|
285
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:18
|
|
283
286
|
msgid "Alliance"
|
|
284
287
|
msgstr ""
|
|
285
288
|
|
|
286
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:
|
|
287
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:
|
|
289
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:19
|
|
290
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:19
|
|
288
291
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/interesting-on-grid/items.html:18
|
|
289
292
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown/ship-classes.html:24
|
|
290
293
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown/ship-types.html:21
|
|
291
294
|
msgid "Count"
|
|
292
295
|
msgstr "计数"
|
|
293
296
|
|
|
294
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:
|
|
295
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:
|
|
296
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:
|
|
297
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:27
|
|
298
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:27
|
|
299
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:27
|
|
297
300
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/interesting-on-grid/items.html:25
|
|
298
301
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown/ship-classes.html:37
|
|
299
302
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown/ship-types.html:30
|
|
@@ -301,29 +304,29 @@ msgstr "计数"
|
|
|
301
304
|
msgid "Loading data …"
|
|
302
305
|
msgstr "数据加载中…"
|
|
303
306
|
|
|
304
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:
|
|
305
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:
|
|
306
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:
|
|
307
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html:33
|
|
308
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:33
|
|
309
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:33
|
|
307
310
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/interesting-on-grid/items.html:31
|
|
308
311
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown/ship-classes.html:43
|
|
309
312
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/fleetcomp/fleet-details/pilots.html:35
|
|
310
313
|
msgid "No data …"
|
|
311
314
|
msgstr ""
|
|
312
315
|
|
|
313
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:
|
|
316
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:7
|
|
314
317
|
msgid "Corporations breakdown"
|
|
315
318
|
msgstr ""
|
|
316
319
|
|
|
317
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:
|
|
318
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:
|
|
320
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html:18
|
|
321
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:19
|
|
319
322
|
msgid "Corporation"
|
|
320
323
|
msgstr ""
|
|
321
324
|
|
|
322
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:
|
|
325
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:6
|
|
323
326
|
msgid "Pilots breakdown"
|
|
324
327
|
msgstr ""
|
|
325
328
|
|
|
326
|
-
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:
|
|
329
|
+
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html:17
|
|
327
330
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/fleetcomp/fleet-details/pilots.html:17
|
|
328
331
|
msgid "Pilot"
|
|
329
332
|
msgstr ""
|
|
@@ -386,7 +389,7 @@ msgid "No data."
|
|
|
386
389
|
msgstr ""
|
|
387
390
|
|
|
388
391
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/evetime.html:5
|
|
389
|
-
msgid "Scan taken at (
|
|
392
|
+
msgid "Scan taken at (EVE time)"
|
|
390
393
|
msgstr ""
|
|
391
394
|
|
|
392
395
|
#: aa_intel_tool/templates/aa_intel_tool/partials/scan/fleetcomp/fleet-details.html:8
|
aa_intel_tool/parser/general.py
CHANGED
|
@@ -57,24 +57,19 @@ def parse_intel(form_data: str) -> str:
|
|
|
57
57
|
:return:
|
|
58
58
|
:rtype:
|
|
59
59
|
"""
|
|
60
|
-
|
|
61
60
|
scan_data = form_data.splitlines()
|
|
62
61
|
|
|
63
|
-
if
|
|
64
|
-
|
|
65
|
-
intel_type = check_intel_type(scan_data=scan_data)
|
|
66
|
-
except ParserError as exc:
|
|
67
|
-
raise ParserError(message=exc.message) from exc
|
|
68
|
-
|
|
69
|
-
try:
|
|
70
|
-
new_scan = SUPPORTED_INTEL_TYPES[intel_type]["parser"](scan_data=scan_data)
|
|
71
|
-
except ParserError as exc:
|
|
72
|
-
# Re-raise the Exception
|
|
73
|
-
raise ParserError(message=exc.message) from exc
|
|
62
|
+
if not scan_data:
|
|
63
|
+
raise ParserError(message=_("No data to parse …"))
|
|
74
64
|
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
try:
|
|
66
|
+
intel_type = check_intel_type(scan_data=scan_data)
|
|
67
|
+
new_scan = SUPPORTED_INTEL_TYPES[intel_type]["parser"](scan_data=scan_data)
|
|
68
|
+
except ParserError as exc:
|
|
69
|
+
# Re-raise the Exception
|
|
70
|
+
raise ParserError(message=exc.message) from exc
|
|
77
71
|
|
|
78
|
-
|
|
72
|
+
new_scan.raw_data = form_data
|
|
73
|
+
new_scan.save()
|
|
79
74
|
|
|
80
|
-
|
|
75
|
+
return new_scan.hash
|
|
@@ -18,23 +18,20 @@ def safe_scan_to_db(scan_type: Scan.Type, parsed_data: dict) -> Scan:
|
|
|
18
18
|
:rtype:
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
|
-
# Creating a new Scan object
|
|
22
|
-
new_scan = Scan(scan_type=scan_type)
|
|
23
|
-
new_scan.save()
|
|
21
|
+
# Creating a new Scan object and saving it
|
|
22
|
+
new_scan = Scan.objects.create(scan_type=scan_type)
|
|
24
23
|
|
|
25
|
-
# Creating the associated ScanData objects
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
scan_data_objects.append(
|
|
24
|
+
# Creating and saving the associated ScanData objects
|
|
25
|
+
ScanData.objects.bulk_create(
|
|
26
|
+
[
|
|
29
27
|
ScanData(
|
|
30
28
|
scan=new_scan,
|
|
31
29
|
section=scan_data["section"],
|
|
32
30
|
processed_data=scan_data["data"],
|
|
33
31
|
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ScanData.objects.bulk_create(scan_data_objects)
|
|
32
|
+
for scan_data in parsed_data.values()
|
|
33
|
+
]
|
|
34
|
+
)
|
|
38
35
|
|
|
39
36
|
# Return the Scan object
|
|
40
37
|
return new_scan
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Chat list parser
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
# Standard Library
|
|
6
|
+
from collections import defaultdict
|
|
7
|
+
|
|
5
8
|
# Django
|
|
6
9
|
from django.db.models import QuerySet
|
|
7
10
|
from django.utils.translation import gettext_lazy as _
|
|
@@ -38,22 +41,13 @@ def _get_character_info(scan_data: list) -> QuerySet[EveCharacter]:
|
|
|
38
41
|
:rtype:
|
|
39
42
|
"""
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
# Excluding corporation_id=1000001 (Doomheim) to potentially force an update here …
|
|
45
|
+
eve_characters = EveCharacter.objects.filter(character_name__in=scan_data).exclude(
|
|
46
|
+
corporation_id=1000001
|
|
47
|
+
)
|
|
42
48
|
|
|
43
49
|
# Check if we have to bother Eve Universe or if we have all characters already
|
|
44
|
-
|
|
45
|
-
try:
|
|
46
|
-
eve_characters = EveCharacter.objects.filter(
|
|
47
|
-
character_name__in=scan_data
|
|
48
|
-
).exclude(corporation_id=1000001)
|
|
49
|
-
except EveCharacter.DoesNotExist: # pylint: disable=no-member
|
|
50
|
-
fetch_from_eveuniverse = True
|
|
51
|
-
else:
|
|
52
|
-
if len(scan_data) != eve_characters.count():
|
|
53
|
-
fetch_from_eveuniverse = True
|
|
54
|
-
|
|
55
|
-
# Fetch the character information from Eve Universe if needed
|
|
56
|
-
if fetch_from_eveuniverse:
|
|
50
|
+
if len(scan_data) != eve_characters.count():
|
|
57
51
|
try:
|
|
58
52
|
eve_character_ids = (
|
|
59
53
|
EveEntity.objects.fetch_by_names_esi(names=scan_data, update=True)
|
|
@@ -61,21 +55,16 @@ def _get_character_info(scan_data: list) -> QuerySet[EveCharacter]:
|
|
|
61
55
|
.values_list("id", flat=True)
|
|
62
56
|
)
|
|
63
57
|
except EveEntity.DoesNotExist as exc: # pylint: disable=no-member
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
raise ParserError(message=message) from exc
|
|
70
|
-
|
|
71
|
-
logger.debug(msg=f"Got {len(eve_character_ids)} ID(s) back from Eve Universe …")
|
|
58
|
+
raise ParserError(
|
|
59
|
+
message=_(
|
|
60
|
+
"Something went wrong while fetching the character information from ESI."
|
|
61
|
+
)
|
|
62
|
+
) from exc
|
|
72
63
|
|
|
73
64
|
# In case the name does not belong to an Eve character,
|
|
74
65
|
# EveEntity returns an empty object
|
|
75
|
-
if
|
|
76
|
-
message
|
|
77
|
-
|
|
78
|
-
raise ParserError(message=message)
|
|
66
|
+
if not eve_character_ids:
|
|
67
|
+
raise ParserError(message=_("Character unknown to ESI."))
|
|
79
68
|
|
|
80
69
|
eve_characters = get_or_create_character(character_ids=eve_character_ids)
|
|
81
70
|
|
|
@@ -110,22 +99,24 @@ def _parse_alliance_info(
|
|
|
110
99
|
:rtype:
|
|
111
100
|
"""
|
|
112
101
|
|
|
113
|
-
# Build alliance info dict
|
|
114
102
|
if eve_character.alliance_id is None:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
103
|
+
return _get_unaffiliated_alliance_info()
|
|
104
|
+
|
|
105
|
+
alliance_info = {
|
|
106
|
+
"id": eve_character.alliance_id,
|
|
107
|
+
"name": eve_character.alliance_name,
|
|
108
|
+
"ticker": eve_character.alliance_ticker,
|
|
109
|
+
"logo": eve_character.alliance_logo_url_32,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Add eve links if requested
|
|
113
|
+
if with_evelinks:
|
|
114
|
+
alliance_info.update(
|
|
115
|
+
{
|
|
116
|
+
"dotlan": dotlan.alliance_url(eve_character.alliance_name),
|
|
117
|
+
"zkillboard": zkillboard.alliance_url(eve_character.alliance_id),
|
|
118
|
+
}
|
|
119
|
+
)
|
|
129
120
|
|
|
130
121
|
return alliance_info
|
|
131
122
|
|
|
@@ -153,11 +144,13 @@ def _parse_corporation_info(
|
|
|
153
144
|
|
|
154
145
|
# Add eve links if requested
|
|
155
146
|
if with_evelinks:
|
|
156
|
-
corporation_info
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
corporation_info.update(
|
|
148
|
+
{
|
|
149
|
+
"dotlan": dotlan.corporation_url(name=eve_character.corporation_name),
|
|
150
|
+
"zkillboard": zkillboard.corporation_url(
|
|
151
|
+
eve_id=eve_character.corporation_id
|
|
152
|
+
),
|
|
153
|
+
}
|
|
161
154
|
)
|
|
162
155
|
|
|
163
156
|
# Add alliance info if requested
|
|
@@ -205,52 +198,35 @@ def _parse_chatscan_data(eve_characters: QuerySet[EveCharacter]) -> dict:
|
|
|
205
198
|
:rtype:
|
|
206
199
|
"""
|
|
207
200
|
|
|
208
|
-
counter =
|
|
201
|
+
counter = defaultdict(int)
|
|
209
202
|
alliance_info = {}
|
|
210
203
|
corporation_info = {}
|
|
211
204
|
character_info = {}
|
|
212
205
|
|
|
213
206
|
# Loop through the characters
|
|
214
|
-
for eve_character in eve_characters:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
# If the character is in an alliance, use the alliance name
|
|
218
|
-
if eve_character.alliance_name is not None:
|
|
219
|
-
eve_character__alliance_name = eve_character.alliance_name
|
|
220
|
-
|
|
221
|
-
counter[eve_character__alliance_name] = (
|
|
222
|
-
counter.get(eve_character__alliance_name, 0) + 1
|
|
223
|
-
)
|
|
207
|
+
for eve_character in list(eve_characters):
|
|
208
|
+
alliance_name = eve_character.alliance_name or "Unaffiliated"
|
|
209
|
+
corporation_name = eve_character.corporation_name
|
|
224
210
|
|
|
225
|
-
counter[
|
|
226
|
-
|
|
227
|
-
)
|
|
211
|
+
counter[alliance_name] += 1
|
|
212
|
+
counter[corporation_name] += 1
|
|
228
213
|
|
|
229
214
|
# Alliance Info
|
|
230
|
-
if
|
|
231
|
-
alliance_info[
|
|
232
|
-
eve_character=eve_character
|
|
233
|
-
)
|
|
215
|
+
if alliance_name not in alliance_info:
|
|
216
|
+
alliance_info[alliance_name] = _parse_alliance_info(eve_character)
|
|
234
217
|
|
|
235
218
|
# Corporation Info
|
|
236
|
-
if
|
|
237
|
-
corporation_info[
|
|
238
|
-
eve_character=eve_character
|
|
239
|
-
)
|
|
219
|
+
if corporation_name not in corporation_info:
|
|
220
|
+
corporation_info[corporation_name] = _parse_corporation_info(eve_character)
|
|
240
221
|
|
|
241
222
|
# Character Info
|
|
242
223
|
character_info[eve_character.character_name] = _parse_character_info(
|
|
243
|
-
eve_character
|
|
224
|
+
eve_character
|
|
244
225
|
)
|
|
245
226
|
|
|
246
227
|
# Update the counter
|
|
247
|
-
alliance_info[
|
|
248
|
-
|
|
249
|
-
]
|
|
250
|
-
|
|
251
|
-
corporation_info[eve_character.corporation_name]["count"] = counter[
|
|
252
|
-
eve_character.corporation_name
|
|
253
|
-
]
|
|
228
|
+
alliance_info[alliance_name]["count"] = counter[alliance_name]
|
|
229
|
+
corporation_info[corporation_name]["count"] = counter[corporation_name]
|
|
254
230
|
|
|
255
231
|
return {
|
|
256
232
|
"pilots": dict_to_list(input_dict=character_info),
|
|
@@ -275,60 +251,55 @@ def parse(
|
|
|
275
251
|
:rtype:
|
|
276
252
|
"""
|
|
277
253
|
|
|
278
|
-
message = _("The chat list module is currently disabled.")
|
|
279
|
-
|
|
280
254
|
# Only parse the chat scan if the module is enabled
|
|
281
|
-
if AppSettings.INTELTOOL_ENABLE_MODULE_CHATSCAN
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
pilots_in_scan = len(scan_data)
|
|
285
|
-
max_allowed_pilots = AppSettings.INTELTOOL_CHATSCAN_MAX_PILOTS
|
|
286
|
-
|
|
287
|
-
# Check if the number of pilots in the scan exceeds the maximum allowed number
|
|
288
|
-
if 0 < max_allowed_pilots < pilots_in_scan and ignore_limit is False:
|
|
289
|
-
logger.debug(
|
|
290
|
-
msg=(
|
|
291
|
-
f"Number of pilots in scan ({pilots_in_scan}) exceeds the maximum "
|
|
292
|
-
f"allowed number ({max_allowed_pilots}). Throwing a tantrum …"
|
|
293
|
-
)
|
|
294
|
-
)
|
|
255
|
+
if not AppSettings.INTELTOOL_ENABLE_MODULE_CHATSCAN:
|
|
256
|
+
raise ParserError(message=_("The chat list module is currently disabled."))
|
|
295
257
|
|
|
296
|
-
|
|
297
|
-
raise ParserError(
|
|
298
|
-
message=ngettext(
|
|
299
|
-
singular=f"Chat scans are currently limited to a maximum of {max_allowed_pilots} pilot per scan. Your list of pilots exceeds this limit.", # pylint: disable=line-too-long
|
|
300
|
-
plural=f"Chat scans are currently limited to a maximum of {max_allowed_pilots} pilots per scan. Your list of pilots exceeds this limit.", # pylint: disable=line-too-long
|
|
301
|
-
number=max_allowed_pilots,
|
|
302
|
-
)
|
|
303
|
-
)
|
|
258
|
+
logger.debug(msg=f"{len(scan_data)} name(s) to work through …")
|
|
304
259
|
|
|
305
|
-
|
|
260
|
+
pilots_in_scan = len(scan_data)
|
|
261
|
+
max_allowed_pilots = AppSettings.INTELTOOL_CHATSCAN_MAX_PILOTS
|
|
306
262
|
|
|
263
|
+
# Check if the number of pilots in the scan exceeds the maximum allowed number
|
|
264
|
+
if 0 < max_allowed_pilots < pilots_in_scan and not ignore_limit:
|
|
307
265
|
logger.debug(
|
|
308
|
-
msg=
|
|
266
|
+
msg=(
|
|
267
|
+
f"Number of pilots in scan ({pilots_in_scan}) exceeds the maximum "
|
|
268
|
+
f"allowed number ({max_allowed_pilots}). Throwing a tantrum …"
|
|
269
|
+
)
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
# Throw a tantrum
|
|
273
|
+
raise ParserError(
|
|
274
|
+
message=ngettext(
|
|
275
|
+
singular=f"Chat scans are currently limited to a maximum of {max_allowed_pilots} pilot per scan. Your list of pilots exceeds this limit.",
|
|
276
|
+
plural=f"Chat scans are currently limited to a maximum of {max_allowed_pilots} pilots per scan. Your list of pilots exceeds this limit.",
|
|
277
|
+
number=max_allowed_pilots,
|
|
278
|
+
)
|
|
309
279
|
)
|
|
310
280
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
"
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
"
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
281
|
+
eve_characters = _get_character_info(scan_data=scan_data)
|
|
282
|
+
logger.debug(msg=f"Got {len(eve_characters)} EveCharacter object(s) back from AA …")
|
|
283
|
+
|
|
284
|
+
# Parse the data
|
|
285
|
+
parsed_chatscan = _parse_chatscan_data(eve_characters=eve_characters)
|
|
286
|
+
parsed_data = {
|
|
287
|
+
"pilots": {
|
|
288
|
+
"section": ScanData.Section.PILOTLIST,
|
|
289
|
+
"data": parsed_chatscan["pilots"],
|
|
290
|
+
},
|
|
291
|
+
"corporations": {
|
|
292
|
+
"section": ScanData.Section.CORPORATIONLIST,
|
|
293
|
+
"data": parsed_chatscan["corporations"],
|
|
294
|
+
},
|
|
295
|
+
"alliances": {
|
|
296
|
+
"section": ScanData.Section.ALLIANCELIST,
|
|
297
|
+
"data": parsed_chatscan["alliances"],
|
|
298
|
+
},
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
parsed_data
|
|
303
|
+
if not safe_to_db
|
|
304
|
+
else safe_scan_to_db(scan_type=Scan.Type.CHATLIST, parsed_data=parsed_data)
|
|
305
|
+
)
|