Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Prints MIME types supported by the llppac script
- # Misc MIME types listed in the llppac script
- read -d '' miscMime <<"EOF"
- application/postscript
- application/pdf
- image/vnd.djvu
- text/html
- application/msword
- application/vnd.ms-powerpoint
- application/vnd.ms-excel
- image/svg+xml
- image/png
- image/jpeg
- application/x-dvi
- EOF
- # MIME types of some office documents
- officeMimeOne=$(grep -E "application/vnd\.openxmlformats-officedocument\." /etc/mime.types | sed -r 's/\t+.+$//g')
- officeMimeTwo=$(grep -E "application/vnd\.oasis\.opendocument\." /etc/mime.types | sed -r 's/\t+.+$//g')
- # lower case extensions of ImageMagick readable image formats
- # http://www.imagemagick.org/script/formats.php
- imExt=$(identify -list format | grep -E "^.{21}r" | grep -Eio "^ +[0-9a-z]+" | sed -r 's/ +//g' | tr '[:upper:]' '[:lower:]')
- # MIME types starting with "image/" collected from /etc/mime.types
- grep "image/" /etc/mime.types | sed -rn '/^[^\t]+\t+[^\t]+$/p' | sed -r 's/^([^\t]+)\t+([^\t]+)$/\2\t\1/' > image-mime.txt
- # MIME types of ImageMagick readable image formats starting with "image/"
- imMime=$(for i in $imExt; do sed -rn "/(^| )$i( |\t)/p" image-mime.txt | sed -r 's/.+\t//g'; done | sort -u)
- # cleanup
- rm -f image-mime.txt
- # Print results separated with ";" (suitable in the MimeType field of .desktop files)
- echo -e "$miscMime\n$officeMimeOne\n$officeMimeTwo\n$imMime" | sort -u | tr "\n" ";"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement