Skip to content

Commit d176b68

Browse files
committed
Merge branch 'reichelt_provider'
2 parents f592ab6 + 1e80be1 commit d176b68

File tree

9 files changed

+388
-75
lines changed

9 files changed

+388
-75
lines changed

.docker/symfony.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
PassEnv PROVIDER_MOUSER_KEY PROVIDER_MOUSER_SEARCH_OPTION PROVIDER_MOUSER_SEARCH_LIMIT PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE
4545
PassEnv PROVIDER_LCSC_ENABLED PROVIDER_LCSC_CURRENCY
4646
PassEnv PROVIDER_OEMSECRETS_KEY PROVIDER_OEMSECRETS_COUNTRY_CODE PROVIDER_OEMSECRETS_CURRENCY PROVIDER_OEMSECRETS_ZERO_PRICE PROVIDER_OEMSECRETS_SET_PARAM PROVIDER_OEMSECRETS_SORT_CRITERIA
47+
PassEnv PROVIDER_REICHELT_ENABLED PROVIDER_REICHELT_CURRENCY PROVIDER_REICHELT_COUNTRY PROVIDER_REICHELT_LANGUAGE PROVIDER_REICHELT_INCLUDE_VAT
4748
PassEnv EDA_KICAD_CATEGORY_DEPTH
4849

4950
# For most configuration files from conf-available/, which are

.env

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,22 @@ PROVIDER_OEMSECRETS_SET_PARAM=1
216216
#If unset or set to any other value, no sorting is performed.
217217
PROVIDER_OEMSECRETS_SORT_CRITERIA=C
218218

219+
220+
# Reichelt provider:
221+
# Reichelt.com offers no official API, so this info provider webscrapes the website to extract info
222+
# It could break at any time, use it at your own risk
223+
224+
# We dont require an API key for Reichelt, just set this to 1 to enable Reichelt support
225+
PROVIDER_REICHELT_ENABLED=0
226+
# The country to get prices for
227+
PROVIDER_REICHELT_COUNTRY=DE
228+
# The language to get results in (en, de, fr, nl, pl, it, es)
229+
PROVIDER_REICHELT_LANGUAGE=en
230+
# Include VAT in prices (set to 1 to include VAT, 0 to exclude VAT)
231+
PROVIDER_REICHELT_INCLUDE_VAT=1
232+
# The currency to get prices in (only for countries with countries other than EUR)
233+
PROVIDER_REICHELT_CURRENCY=EUR
234+
219235
##################################################################################
220236
# EDA integration related settings
221237
##################################################################################

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
"symfony/apache-pack": "^1.0",
5555
"symfony/asset": "6.4.*",
5656
"symfony/console": "6.4.*",
57+
"symfony/css-selector": "6.4.*",
58+
"symfony/dom-crawler": "6.4.*",
5759
"symfony/dotenv": "6.4.*",
5860
"symfony/expression-language": "6.4.*",
5961
"symfony/flex": "^v2.3.1",
@@ -104,7 +106,6 @@
104106
"rector/rector": "^2.0.4",
105107
"roave/security-advisories": "dev-latest",
106108
"symfony/browser-kit": "6.4.*",
107-
"symfony/css-selector": "6.4.*",
108109
"symfony/debug-bundle": "6.4.*",
109110
"symfony/maker-bundle": "^1.13",
110111
"symfony/phpunit-bridge": "6.4.*",

composer.lock

Lines changed: 68 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Services/InfoProviderSystem/DTOs/ParameterDTO.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public static function parseValueField(string $name, string|float $value, ?strin
7272
group: $group);
7373
}
7474

75-
//If the attribute contains "..." or a tilde we assume it is a range
76-
if (preg_match('/(\.{3}|~)/', $value) === 1) {
77-
$parts = preg_split('/\s*(\.{3}|~)\s*/', $value);
75+
//If the attribute contains ".." or "..." or a tilde we assume it is a range
76+
if (preg_match('/(\.{2,3}|~)/', $value) === 1) {
77+
$parts = preg_split('/\s*(\.{2,3}|~)\s*/', $value);
7878
if (count($parts) === 2) {
7979
//Try to extract number and unit from value (allow leading +)
8080
if ($unit === null || trim($unit) === '') {

src/Services/InfoProviderSystem/PartInfoRetriever.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
final class PartInfoRetriever
3434
{
3535

36-
private const CACHE_DETAIL_EXPIRATION = 60 * 60 * 24 * 4; // 4 days
37-
private const CACHE_RESULT_EXPIRATION = 60 * 60 * 24 * 7; // 7 days
36+
private const CACHE_DETAIL_EXPIRATION = 5; // 4 days
37+
private const CACHE_RESULT_EXPIRATION = 5; // 7 days
3838

3939
public function __construct(private readonly ProviderRegistry $provider_registry,
4040
private readonly DTOtoEntityConverter $dto_to_entity_converter, private readonly CacheInterface $partInfoCache)

src/Services/InfoProviderSystem/Providers/LCSCProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private function queryDetail(string $id): PartDetailDTO
7676
'Cookie' => new Cookie('currencyCode', $this->currency)
7777
],
7878
'query' => [
79-
'productCode' => $id,
79+
'prductCode' => $id,
8080
],
8181
]);
8282

0 commit comments

Comments
 (0)