Faster extraction and also levels of toner
This commit is contained in:
21
pull_info.sh
21
pull_info.sh
@@ -1,7 +1,22 @@
|
||||
#curl -X GET http://192.168.1.42/wcd/system_consumable.xml -H "Cookie: ID=vGeeQa3qLQtd7sxYwl2jFOFUmQqIbuYN"
|
||||
echo "Start extract from system_counter"
|
||||
data=$(cat system_counter.xml)
|
||||
for i in "Total" "DuplexTotal" "Document" "Paper" "TotalLarge" "PaperSizeA3" "PaperSizeA4";
|
||||
data=$(echo "$data" | xq ".MFP.Count.UserCounterInfo.TotalCounterList.TotalCounter | .[]")
|
||||
for key in "Total" "DuplexTotal" "Document" "Paper" "TotalLarge" "PaperSizeA3" "PaperSizeA4";
|
||||
do
|
||||
value=$(cat system_counter.xml | xq ".MFP.Count.UserCounterInfo.TotalCounterList.TotalCounter | .[] | select(.Type==\"$i\") | .Count")
|
||||
echo "Key: $i; Value: $value"
|
||||
value=$(echo "$data" | jq "select(.Type==\"$key\") | .Count")
|
||||
echo "Key: $key; Value: $value"
|
||||
done
|
||||
echo "Stop extract from system_counter"
|
||||
echo
|
||||
echo "Start extract from system_consumables"
|
||||
|
||||
data=$(cat system_consumables.xml)
|
||||
data=$(echo "$data" | xq ".[] |.DeviceInfo.ConsumableList.Consumable | .[]")
|
||||
for key in "Toner (Yellow)" "Toner (Magenta)" "Toner (Cyan)" "Toner (Black)" "Drum Cartridge (Cyan)" "Developer Cartridge (Cyan)" "Drum Cartridge (Magenta)" "Developer Cartridge (Magenta)" "Drum Cartridge (Yellow)" "Developer Cartridge (Yellow)" "Drum Cartridge (Black)" "Developer Cartridge (Black)" "Fusing Unit" "Image Transfer Belt Unit" "Transfer Roller Unit";
|
||||
do
|
||||
value=$(echo "$data" | jq "select(.Name==\"$key\") | .CurrentLevel.LevelPer")
|
||||
echo "Key: $key; Level: $value"
|
||||
done
|
||||
echo "Stop extract from system_consumables"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user