Application/octet-stream

Dave Forrest <[email protected]>
Newsgroups gmane.mail.pine.general
Message-ID <[email protected]>
As a very long time pine user, I have been annoyed by the many mime formats sent 
using octet-stream.  I found a little script on another list that I installed to 
sort these out and thought it might be of interest to others. The script runs as 
octet-stream from mailcap and installed in /usr/local/bin/ on my system, a 
Linux FC4 installation.


#!/bin/sh
# Converts octet-stream to display calls
# Borrowed from James Budiono 6/15/06 from Hyla Fax List posting
# D. R. Forrest 6/15/06

FILETYPE=`file $1 | cut -d ":" -f 2- | awk '/Microsoft Office/ { print "office"
}; /JPEG/ {print "jpg"};  /PDF/ {print "pdf"}; /ASCII/ {print "ascii"}; /PostScript/ {print "ps"}; /MPEG/ {print "mpeg"}; '`

#echo $FILETYPE
if [ "$FILETYPE" = "office" ] ; then
     #if it's MS-Office, then use ooffice
     /bin/echo " "
/usr/bin/ooffice $1

elif [ "$FILETYPE" = "pdf" ] ; then
     #if it is PDF, then convert it
     /bin/echo " "
/usr/local/bin/evince $1

elif [ "$FILETYPE" = "ascii" ] ; then
     #if it's a text file in disguise, convert it
     /bin/echo " "
/usr/bin/gedit  $1

elif [ "$FILETYPE" = "ps" ] ; then
     #if it's postscript, print it out directly
      /bin/echo " "
     /usr/bin/evince $1

elif [ "$FILETYPE" = "jpg" ] ; then
 	# jpg to eog
 	/bin/echo " "
 	/usr/bin/eog $1

elif [ "$FILETYPE" = "mpeg" ] ; then
     #if it's a mpeg, play it
      /usr/local/bin/mplayer $1

fi



-- 
David Forrest                     e-mail   [email protected]
Maple Park Development Corporation  http://www.maplepark.com
St. Louis, Missouri
_______________________________________________
Pine-info mailing list
[email protected]
http://mailman1.u.washington.edu/mailman/listinfo/pine-info
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.