Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KiCad
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
libraries
electronics
KiCad
Commits
90a3b125
Commit
90a3b125
authored
2 years ago
by
Krisjanis Rijnieks
Browse files
Options
Downloads
Patches
Plain Diff
Add inventory whitelist with items to ignore. Not everything from DigiKey is an electronics part.
parent
71750827
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/inventory.sh
+18
-4
18 additions, 4 deletions
tests/inventory.sh
tests/whitelist.txt
+18
-0
18 additions, 0 deletions
tests/whitelist.txt
with
36 additions
and
4 deletions
tests/inventory.sh
+
18
−
4
View file @
90a3b125
...
...
@@ -3,12 +3,10 @@
# Author: Krisjanis Rijnieks
# Created: 2022-04-27
# TODO: Create whitelist (some parts from DigiKey are not electronics parts)
# The location of the library can change. Supply it from outside.
if
[[
!
${
1
}
]]
;
then
echo
"Please specify KiCad library file."
echo
"Usage: ./inventory.sh ../fab.kicad_sym"
echo
"Please specify KiCad library
file and optional whitelist
file."
echo
"Usage: ./inventory.sh ../fab.kicad_sym
./whitelist.txt
"
exit
1
fi
...
...
@@ -19,10 +17,21 @@ if [[ ! -f ${1} ]]; then
exit
1
fi
if
[[
${
2
}
&&
!
-f
${
2
}
]]
;
then
echo
"Provided whitelist file node not exist."
echo
"Make sure the path to the whitelist file is correct."
exit
1
fi
LIBRARY_FILE
=
${
1
}
WHITELIST_FILE
=
${
2
}
INVENTORY_URL
=
"http://inventory.fabcloud.io/data/inv.json"
SOURCE
=
"Digi-Key"
# Whitelist. All the tools and materials from Digi-Key go here.
readarray
-t
WHITELIST <
${
WHITELIST_FILE
}
WHITELIST
=
${
WHITELIST
[@]
}
# Colored output
RED
=
'\033[0;31m'
GREEN
=
'\033[0;32m'
...
...
@@ -51,6 +60,11 @@ ITEMS=$(curl -s ${INVENTORY_URL} | jq -r '.topics[] | .sources."Digi-Key".catego
echo
"Looking for matches in the library..."
for
ITEM
in
${
ITEMS
}
;
do
# TODO: Look for item in whitelist
if
[[
${
WHITELIST
}
==
*
"
${
ITEM
}
"
*
]]
;
then
echo
"
${
ITEM
}
found in whitelist"
continue
fi
# Look for item in KiCad symbol library
if
[[
${
KEYWORDS
}
==
*
"
${
ITEM
}
"
*
]]
;
then
echo
-e
"
${
GREEN
}${
ITEM
}
found
${
RESET
}
"
...
...
This diff is collapsed.
Click to expand it.
tests/whitelist.txt
0 → 100644
+
18
−
0
View file @
90a3b125
EROP7SA
MS54VN
L4GN
26034
201
XP600
PA70057-ND
TS391SNL
SMDSWLF.020 4OZ
SMDSW.020 4OZ
Q-B-10AS
13605
13630
13660
ATATMEL-ICE-BASIC
8022
8193
112990066
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment