cs2tracker 2.1.13__py3-none-any.whl → 2.1.14__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.
Potentially problematic release.
This version of cs2tracker might be problematic. Click here for more details.
- cs2tracker/_version.py +2 -2
- cs2tracker/app/application.py +72 -76
- cs2tracker/app/editor_frame.py +208 -127
- cs2tracker/app/scraper_frame.py +27 -10
- cs2tracker/constants.py +58 -321
- cs2tracker/data/config.ini +153 -153
- cs2tracker/data/get_inventory.js +64 -21
- cs2tracker/main.py +1 -16
- cs2tracker/scraper/parsers.py +192 -0
- cs2tracker/scraper/scraper.py +102 -212
- cs2tracker/util/padded_console.py +19 -0
- cs2tracker/util/validated_config.py +72 -18
- {cs2tracker-2.1.13.dist-info → cs2tracker-2.1.14.dist-info}/METADATA +3 -2
- cs2tracker-2.1.14.dist-info/RECORD +28 -0
- cs2tracker-2.1.13.dist-info/RECORD +0 -27
- {cs2tracker-2.1.13.dist-info → cs2tracker-2.1.14.dist-info}/WHEEL +0 -0
- {cs2tracker-2.1.13.dist-info → cs2tracker-2.1.14.dist-info}/entry_points.txt +0 -0
- {cs2tracker-2.1.13.dist-info → cs2tracker-2.1.14.dist-info}/licenses/LICENSE +0 -0
- {cs2tracker-2.1.13.dist-info → cs2tracker-2.1.14.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import re
|
|
3
|
-
from configparser import ConfigParser
|
|
4
|
-
from urllib.parse import quote
|
|
3
|
+
from configparser import ConfigParser, ParsingError
|
|
4
|
+
from urllib.parse import quote, unquote
|
|
5
5
|
|
|
6
|
-
from cs2tracker.constants import
|
|
6
|
+
from cs2tracker.constants import CAPSULE_PAGES, CONFIG_FILE, INVENTORY_IMPORT_FILE
|
|
7
7
|
from cs2tracker.util.padded_console import get_console
|
|
8
8
|
|
|
9
9
|
STEAM_MARKET_LISTING_BASEURL_CS2 = "https://steamcommunity.com/market/listings/730/"
|
|
@@ -20,13 +20,26 @@ class ValidatedConfig(ConfigParser):
|
|
|
20
20
|
|
|
21
21
|
self.valid = False
|
|
22
22
|
self.last_error = None
|
|
23
|
-
|
|
23
|
+
try:
|
|
24
|
+
self.load_from_file()
|
|
25
|
+
except (FileNotFoundError, ParsingError) as error:
|
|
26
|
+
console.error(f"Config error: {error}")
|
|
27
|
+
self.last_error = error
|
|
24
28
|
|
|
25
|
-
def
|
|
26
|
-
"""
|
|
29
|
+
def delete_display_sections(self):
|
|
30
|
+
"""
|
|
31
|
+
Delete all sections that are displayed to the user from the config.
|
|
32
|
+
|
|
33
|
+
(This excludes the internal App Settings section)
|
|
34
|
+
"""
|
|
35
|
+
use_proxy = self.getboolean("App Settings", "use_proxy", fallback=False)
|
|
36
|
+
discord_notifications = self.getboolean(
|
|
37
|
+
"App Settings", "discord_notifications", fallback=False
|
|
38
|
+
)
|
|
27
39
|
self.clear()
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
40
|
+
self.add_section("App Settings")
|
|
41
|
+
self.set("App Settings", "use_proxy", str(use_proxy))
|
|
42
|
+
self.set("App Settings", "discord_notifications", str(discord_notifications))
|
|
30
43
|
|
|
31
44
|
def _validate_config_sections(self):
|
|
32
45
|
"""Validate that the configuration file has all required sections."""
|
|
@@ -38,7 +51,7 @@ class ValidatedConfig(ConfigParser):
|
|
|
38
51
|
raise ValueError("Missing 'Custom Items' section in the configuration file.")
|
|
39
52
|
if not self.has_section("Cases"):
|
|
40
53
|
raise ValueError("Missing 'Cases' section in the configuration file.")
|
|
41
|
-
for capsule_section in
|
|
54
|
+
for capsule_section in CAPSULE_PAGES:
|
|
42
55
|
if not self.has_section(capsule_section):
|
|
43
56
|
raise ValueError(f"Missing '{capsule_section}' section in the configuration file.")
|
|
44
57
|
|
|
@@ -55,16 +68,21 @@ class ValidatedConfig(ConfigParser):
|
|
|
55
68
|
raise ValueError(
|
|
56
69
|
f"Invalid value in 'Custom Items' section: {custom_item_href} = {custom_item_owned}"
|
|
57
70
|
)
|
|
58
|
-
for
|
|
71
|
+
for case_href, case_owned in self.items("Cases"):
|
|
72
|
+
if not re.match(STEAM_MARKET_LISTING_REGEX, case_href):
|
|
73
|
+
raise ValueError(
|
|
74
|
+
f"Invalid Steam market listing URL in 'Cases' section: {case_href}"
|
|
75
|
+
)
|
|
76
|
+
|
|
59
77
|
if int(case_owned) < 0:
|
|
60
78
|
raise ValueError(
|
|
61
|
-
f"Invalid value in 'Cases' section: {
|
|
79
|
+
f"Invalid value in 'Cases' section: {case_href} = {case_owned}"
|
|
62
80
|
)
|
|
63
|
-
for capsule_section in
|
|
64
|
-
for
|
|
81
|
+
for capsule_section in CAPSULE_PAGES:
|
|
82
|
+
for capsule_href, capsule_owned in self.items(capsule_section):
|
|
65
83
|
if int(capsule_owned) < 0:
|
|
66
84
|
raise ValueError(
|
|
67
|
-
f"Invalid value in '{capsule_section}' section: {
|
|
85
|
+
f"Invalid value in '{capsule_section}' section: {capsule_href} = {capsule_owned}"
|
|
68
86
|
)
|
|
69
87
|
except ValueError as error:
|
|
70
88
|
if "Invalid " in str(error):
|
|
@@ -88,6 +106,12 @@ class ValidatedConfig(ConfigParser):
|
|
|
88
106
|
self.valid = False
|
|
89
107
|
self.last_error = error
|
|
90
108
|
|
|
109
|
+
def load_from_file(self):
|
|
110
|
+
"""Load the configuration file and validate it."""
|
|
111
|
+
self.clear()
|
|
112
|
+
self.read(CONFIG_FILE)
|
|
113
|
+
self._validate_config()
|
|
114
|
+
|
|
91
115
|
def write_to_file(self):
|
|
92
116
|
"""Validate the current configuration and write it to the configuration file if
|
|
93
117
|
it is valid.
|
|
@@ -107,13 +131,13 @@ class ValidatedConfig(ConfigParser):
|
|
|
107
131
|
try:
|
|
108
132
|
with open(INVENTORY_IMPORT_FILE, "r", encoding="utf-8") as inventory_file:
|
|
109
133
|
inventory_data = json.load(inventory_file)
|
|
110
|
-
|
|
111
134
|
added_to_config = set()
|
|
135
|
+
|
|
112
136
|
for item_name, item_owned in inventory_data.items():
|
|
113
|
-
|
|
137
|
+
option_name_href = self.name_to_option(item_name, href=True)
|
|
114
138
|
for section in self.sections():
|
|
115
|
-
if
|
|
116
|
-
self.set(section,
|
|
139
|
+
if option_name_href in self.options(section):
|
|
140
|
+
self.set(section, option_name_href, str(item_owned))
|
|
117
141
|
added_to_config.add(item_name)
|
|
118
142
|
|
|
119
143
|
for item_name, item_owned in inventory_data.items():
|
|
@@ -128,6 +152,36 @@ class ValidatedConfig(ConfigParser):
|
|
|
128
152
|
self.last_error = error
|
|
129
153
|
self.valid = False
|
|
130
154
|
|
|
155
|
+
def option_to_name(self, option, href=False):
|
|
156
|
+
"""
|
|
157
|
+
Convert an internal option representation to a reader-friendly name.
|
|
158
|
+
|
|
159
|
+
:param option: The internal option representation to convert.
|
|
160
|
+
:param custom: If True, the option is for a custom item.
|
|
161
|
+
:return: The reader-friendly name.
|
|
162
|
+
"""
|
|
163
|
+
if href:
|
|
164
|
+
converted_option = unquote(option.split("/")[-1])
|
|
165
|
+
else:
|
|
166
|
+
converted_option = option.replace("_", " ").title()
|
|
167
|
+
|
|
168
|
+
return converted_option
|
|
169
|
+
|
|
170
|
+
def name_to_option(self, name, href=False):
|
|
171
|
+
"""
|
|
172
|
+
Convert a reader-friendly name to an internal option representation.
|
|
173
|
+
|
|
174
|
+
:param name: The reader-friendly name to convert.
|
|
175
|
+
:param custom: If True, the name is for a custom item.
|
|
176
|
+
:return: The internal option representation.
|
|
177
|
+
"""
|
|
178
|
+
if href:
|
|
179
|
+
converted_name = STEAM_MARKET_LISTING_BASEURL_CS2 + quote(name)
|
|
180
|
+
else:
|
|
181
|
+
converted_name = name.replace(" ", "_").lower()
|
|
182
|
+
|
|
183
|
+
return converted_name
|
|
184
|
+
|
|
131
185
|
def toggle_use_proxy(self, enabled: bool):
|
|
132
186
|
"""
|
|
133
187
|
Toggle the use of proxies for requests. This will update the configuration file.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cs2tracker
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.14
|
|
4
4
|
Summary: Tracking the steam market prices of CS2 items
|
|
5
5
|
Home-page: https://github.com/ashiven/cs2tracker
|
|
6
6
|
Author: Jannik Novak
|
|
@@ -23,6 +23,7 @@ Requires-Dist: sv_ttk==2.6.1
|
|
|
23
23
|
Requires-Dist: tksheet==7.5.12
|
|
24
24
|
Requires-Dist: nodejs-bin==18.4.0a4
|
|
25
25
|
Requires-Dist: ttk-text==0.2.0
|
|
26
|
+
Requires-Dist: requests-cache==1.2.1
|
|
26
27
|
Dynamic: license-file
|
|
27
28
|
|
|
28
29
|
<p align="center">
|
|
@@ -106,7 +107,7 @@ Dynamic: license-file
|
|
|
106
107
|
## Configuration
|
|
107
108
|
|
|
108
109
|
You can configure the app settings via the **Edit Config** option.
|
|
109
|
-
This will open the config editor where you can change any setting by
|
|
110
|
+
This will open the config editor where you can change any setting by double clicking on it or navigating to it with the arrow keys and hitting enter. On top of that, the config editor allows you to:
|
|
110
111
|
|
|
111
112
|
- Automatically import items from your Storage Units
|
|
112
113
|
- Manually Specify the number of items you own
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
cs2tracker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
cs2tracker/__main__.py,sha256=Ub--oSMv48YzfWF1CZqYlkn1-HvZ7Bhxoc7urn1oY6o,249
|
|
3
|
+
cs2tracker/_version.py,sha256=80wtCyj9QUrrEVvuEW7o-ILwCKz10sXaQFnSq4DOKBE,513
|
|
4
|
+
cs2tracker/constants.py,sha256=9E1CPVEohDmV_F2PLLrPRmtYAHHVDimbUFfohhjci1c,6742
|
|
5
|
+
cs2tracker/main.py,sha256=_Y8be0bVDaoO4SE-TZjJ0wpXjvXDYF3VPKC4f32nZc0,1019
|
|
6
|
+
cs2tracker/app/__init__.py,sha256=uqAxdDzoR2-2IrDc1riIU3Pi9vLEDwr68eg93-0RFmM,105
|
|
7
|
+
cs2tracker/app/application.py,sha256=wjUFt5RzRZ8gRqprtPaCTtHW_cEWS3DzmcdRz48vmFg,9135
|
|
8
|
+
cs2tracker/app/editor_frame.py,sha256=zbNaZOBhFCWjJrl-kCgdbBPafeRgEcYG31tDgMaZ3_s,21313
|
|
9
|
+
cs2tracker/app/scraper_frame.py,sha256=9m5tQFhPGCqWWtkgSG_XuH9ELj-km83lU93tSBqndNA,4007
|
|
10
|
+
cs2tracker/data/config.ini,sha256=oLm6Ggfqjr8coDZE4NAMVomZZDJqMia0VxNO3wCzHsQ,15059
|
|
11
|
+
cs2tracker/data/convert_inventory.js,sha256=5bEDfe9Rf2wYC4dIlmvjhbslfnuKuBBNjuTk67jEV9Q,5370
|
|
12
|
+
cs2tracker/data/get_inventory.js,sha256=YL0RJV1j2K0J20mRZVXSakwU8fpRtjyMLrAYFl0-rsM,5793
|
|
13
|
+
cs2tracker/data/output.csv,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
cs2tracker/scraper/__init__.py,sha256=kfUB9yfshSche92ZvTqQQYBkVqujRez46djPoa9u0YU,335
|
|
15
|
+
cs2tracker/scraper/background_task.py,sha256=1_lKnFWn9wuABpru58JdQbfDHjL0Up-7h6Nlcc4TsZ4,3671
|
|
16
|
+
cs2tracker/scraper/discord_notifier.py,sha256=-PdTRAtzMHTjDH17zguI0LKB7INITEohx0da0fWRdKI,2962
|
|
17
|
+
cs2tracker/scraper/parsers.py,sha256=BcCRU39RXtkpXOZouh2LLTDlCOJAFAJmyaQVVwK1i4A,6897
|
|
18
|
+
cs2tracker/scraper/scraper.py,sha256=sotDjZMrMxkM_bCOhPm9S-Pq82-pJp-8RPNcxtY9cPs,10462
|
|
19
|
+
cs2tracker/util/__init__.py,sha256=Pgltyrkotd5ijU-srmY5vaFP7gzz9itSAl2LfS-D7-E,322
|
|
20
|
+
cs2tracker/util/padded_console.py,sha256=u8SNbjvR_YyePhpiqREt4Kh4NiDI5NAPCPL5toqh8dg,1622
|
|
21
|
+
cs2tracker/util/price_logs.py,sha256=JuZ2ptDtxA-NzKjpG_4q0eeOr1IaUvVah-Qth6GrDDU,4165
|
|
22
|
+
cs2tracker/util/validated_config.py,sha256=ZsUTaahs08HBEoCM2XUzAHqjKeaeU3XzBNhGxr1kEfg,8740
|
|
23
|
+
cs2tracker-2.1.14.dist-info/licenses/LICENSE,sha256=doPNswWMPXbkhplb9cnZLwJoqqS72pJPhkSib8kIF08,19122
|
|
24
|
+
cs2tracker-2.1.14.dist-info/METADATA,sha256=hehgmIANx4SmR2lJOlurlsV54ERx9TVg3fi80No46kM,5782
|
|
25
|
+
cs2tracker-2.1.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
cs2tracker-2.1.14.dist-info/entry_points.txt,sha256=K8IwDIkg8QztSB9g9c89B9jR_2pG4QyJGrNs4z5RcZw,63
|
|
27
|
+
cs2tracker-2.1.14.dist-info/top_level.txt,sha256=2HB4xDDOxaU5BDc_yvdi9UlYLgL768n8aR-hRhFM6VQ,11
|
|
28
|
+
cs2tracker-2.1.14.dist-info/RECORD,,
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
cs2tracker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
cs2tracker/__main__.py,sha256=Ub--oSMv48YzfWF1CZqYlkn1-HvZ7Bhxoc7urn1oY6o,249
|
|
3
|
-
cs2tracker/_version.py,sha256=MzsJ263HZYR6SmK-vVyZsM4dSlCzgRW6jJZBsjDPWV8,513
|
|
4
|
-
cs2tracker/constants.py,sha256=65tLl30rCbR78xoNJSV0ubWc0ZWbytztj0S_uwgNrvU,22879
|
|
5
|
-
cs2tracker/main.py,sha256=Ahsu1gk0RuMS9FdVsv7exnnWENd8-vj_dcCEWjZP1DM,1552
|
|
6
|
-
cs2tracker/app/__init__.py,sha256=uqAxdDzoR2-2IrDc1riIU3Pi9vLEDwr68eg93-0RFmM,105
|
|
7
|
-
cs2tracker/app/application.py,sha256=TEoGvqxyCTJKdfC1Su7bh9fzTr71jiVqlTC_K4Wdu2Q,9395
|
|
8
|
-
cs2tracker/app/editor_frame.py,sha256=V_8SRWgterkEYiADrZww9prpKfX-3ccjd2OWVrx7-2g,18074
|
|
9
|
-
cs2tracker/app/scraper_frame.py,sha256=yrtnWtaNQqd8Ho6hVUxLP3A5oCBmtvEHJa3p8STEJtA,3399
|
|
10
|
-
cs2tracker/data/config.ini,sha256=anKg7t3JB7kQcvcMKHls4oxTEGwWnGkM9obn-_l0gEE,6806
|
|
11
|
-
cs2tracker/data/convert_inventory.js,sha256=5bEDfe9Rf2wYC4dIlmvjhbslfnuKuBBNjuTk67jEV9Q,5370
|
|
12
|
-
cs2tracker/data/get_inventory.js,sha256=O9w7w-diI7tD5NMgGMDyvrNfrv5ObE46m5rMK8PlpBE,4108
|
|
13
|
-
cs2tracker/data/output.csv,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
cs2tracker/scraper/__init__.py,sha256=kfUB9yfshSche92ZvTqQQYBkVqujRez46djPoa9u0YU,335
|
|
15
|
-
cs2tracker/scraper/background_task.py,sha256=1_lKnFWn9wuABpru58JdQbfDHjL0Up-7h6Nlcc4TsZ4,3671
|
|
16
|
-
cs2tracker/scraper/discord_notifier.py,sha256=-PdTRAtzMHTjDH17zguI0LKB7INITEohx0da0fWRdKI,2962
|
|
17
|
-
cs2tracker/scraper/scraper.py,sha256=Zj-8EZZNAjifiOywfvJrOQ8KtJK-SeaZerwx8plvLI8,15358
|
|
18
|
-
cs2tracker/util/__init__.py,sha256=Pgltyrkotd5ijU-srmY5vaFP7gzz9itSAl2LfS-D7-E,322
|
|
19
|
-
cs2tracker/util/padded_console.py,sha256=LXgPDqccgrIowwjV6CLsxn5zxuoiPA-9pomURPSLllU,936
|
|
20
|
-
cs2tracker/util/price_logs.py,sha256=JuZ2ptDtxA-NzKjpG_4q0eeOr1IaUvVah-Qth6GrDDU,4165
|
|
21
|
-
cs2tracker/util/validated_config.py,sha256=bQDIuu42hK0ZbFY1fYGTeYTip7tUNmxJLou88F3r4q8,6638
|
|
22
|
-
cs2tracker-2.1.13.dist-info/licenses/LICENSE,sha256=doPNswWMPXbkhplb9cnZLwJoqqS72pJPhkSib8kIF08,19122
|
|
23
|
-
cs2tracker-2.1.13.dist-info/METADATA,sha256=Os14jGDiniACP9PCaaaGL9SK2otVtIBkYt3mD-MtSIk,5694
|
|
24
|
-
cs2tracker-2.1.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
25
|
-
cs2tracker-2.1.13.dist-info/entry_points.txt,sha256=K8IwDIkg8QztSB9g9c89B9jR_2pG4QyJGrNs4z5RcZw,63
|
|
26
|
-
cs2tracker-2.1.13.dist-info/top_level.txt,sha256=2HB4xDDOxaU5BDc_yvdi9UlYLgL768n8aR-hRhFM6VQ,11
|
|
27
|
-
cs2tracker-2.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|