ranger gcode preview script

This commit is contained in:
Emmet
2025-03-19 11:04:07 -05:00
parent 1fb21a0543
commit 1a2ac810e3
2 changed files with 17 additions and 0 deletions

View File

@ -31,6 +31,20 @@ in {
fi fi
fi fi
'') '')
(pkgs.writeScriptBin "gcode-stats" ''
#!/bin/sh
filename="$1";
printtime=$(awk -F ":" '/;TIME:/{print $NF; exit}' "$filename");
actualprinttime=$(echo "scale=2; $printtime / 3600" | bc);
filamentused=$(awk -F ": " '/;Filament used:/{print $NF; exit}' "$filename");
bedtemp=$(awk -F " S" '/M140 S/{print $NF; exit}' "$filename");
exttemp=$(awk -F " S" '/M104 S/{print $NF; exit}' "$filename");
echo "Print Time: $actualprinttime""hr""
Filament Used: $filamentused
Bed Temp: $bedtemp""C
Extruder Temp: $exttemp ""C" > /dev/stdout;
'')
]; ];
xdg.mimeApps.associations.added = { xdg.mimeApps.associations.added = {

View File

@ -52,6 +52,9 @@ SQLITE_ROW_LIMIT=5 # Display only the first and the last (<limit> - 1) recor
handle_extension() { handle_extension() {
case "${FILE_EXTENSION_LOWER}" in case "${FILE_EXTENSION_LOWER}" in
gcode)
gcode-stats "${FILE_PATH}" && exit 5
exit 1;;
## Archive ## Archive
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\ a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip) rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)