Skip to content
Snippets Groups Projects
Commit 90a3b125 authored by Krisjanis Rijnieks's avatar Krisjanis Rijnieks :lion_face:
Browse files

Add inventory whitelist with items to ignore. Not everything from DigiKey is an electronics part.

parent 71750827
No related branches found
No related tags found
No related merge requests found
......@@ -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}"
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment