diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2021-09-11 00:36:13 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2021-09-11 00:36:13 -0500 |
commit | 0a9053c2902adab8b94eaacdb15390441143078c (patch) | |
tree | 1f1a38272dbd554cde8cdec263187112b9c6a7e8 /misc/mime | |
download | scripts-0a9053c2902adab8b94eaacdb15390441143078c.tar.xz scripts-0a9053c2902adab8b94eaacdb15390441143078c.zip |
redid repo cus of fucking chromium rip old commit messages
Diffstat (limited to 'misc/mime')
-rwxr-xr-x | misc/mime | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/misc/mime b/misc/mime new file mode 100755 index 0000000..2070376 --- /dev/null +++ b/misc/mime @@ -0,0 +1,47 @@ +#!/bin/sh +cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mimewiz" +types="`grep -v '#'`"<< TYPES +application +audio +font +#example +image +#message +#model +#multipart +text +video +TYPES +typesrc="https://www.iana.org/assignments/media-types" + +#dlcsv() { curl -sS -C - -e "$typesrc" "$typesrc" > "$typefile" || exit; } +dlcsv() { curl -sS -C - -o "$2" "$1" || exit; } + +# Download all media type csv's if they're not avaliable +mkdir -p "$cachedir" +for type in $types; do + typefile="$cachedir/$type.csv" + [ -e "$typefile" ] || dlcsv "$typesrc/$type.csv" "$typefile" + #[ "$2" = "$type" ] && mimetype="`cut -d',' -f2 $typefile`" && break +done + +#[ -n "$mimetype" ] && xdg-mime default $application.desktop $mimetype + +# Choose mimetype: +types="$types\npdf\nspreadsheet ms-excel\nwordprocessing ms-word\npresentation ms-powerpoint\ndrawing\nzip gzip" +echo "$types" | nl -s': ' + +echo "$types" | head -7 | tail -1 + +# Choose subtype +#cut -d',' -f1 "$cachedir/application.csv" | grep drawing | nl -s': ' | column + +# Choose program +ls /usr/share/applications | sed 's/\.desktop//' | nl -s': ' | column + + +#cut -d',' -f1 "$cachedir/image.csv" | nl -s': ' | column +cut -d',' -f2 "$cachedir/image.csv" + +#jcho "$types" | while read type; do +#done |