Author Topic: Mime Types  (Read 1960 times)

Darth_Sith

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Mime Types
« on: January 31, 2007, 06:03:24 pm »
How to modify mime types in the system?
For example mplayer can play 3gp, but if I select them from the file manager, they aren't associated to mplayer.
And how can open img or other files ftom tree!explorer qt? Every file is open in tree!text.
Thanks.

SL-C1000 + cacko 1.23F + sd4GB + CFBT + CFWiFi
HTC Polaris

Jon_J

  • Hero Member
  • *****
  • Posts: 1853
    • View Profile
    • http://
Mime Types
« Reply #1 on: January 31, 2007, 06:44:22 pm »
Your best bet is to search these forums for "mime". you'll find much info about it.
here's one thread that describes howto associate mimetypes.
There is also a howto on the oesf wiki about mimetypes.
https://www.oesf.org/forums/index.php?showt...c=12070&hl=mime

Also in that thread is mention of a script that was never included on the Zaurus that handles mimetypes for you. qtopia-addmimetype
I was curious, and googled for that script, and found it.
I'll paste it here, in case someone can use it.
Code: [Select]
#!/bin/sh
NEWTYPE=$1
EXT=$2
 
if [ -z "$NEWTYPE" -o -z "$EXT" ]
then
    echo >&2 "Usage: $0 "
    echo >&2 " eg. $0 application/foobar foo"
    exit 1
fi
 
# Can ash do this? If not, use sed.
T=${NEWTYPE%/*}
S=${NEWTYPE#*/}
 
grep -w $EXT $QPEDIR/etc/mime.types |
(
    read TYPE EXTS
    if [ -z "$TYPE" ]
    then
        if grep -q "^$NEWTYPE[ ]" $QPEDIR/etc/mime.types || grep -q "^$NEWTYPE$" $QPEDIR/etc/mime.types
        then
            if sed -e '/^'$T"\\/"$S'[ ]/ s/$/ '$EXT'/' <$QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new ||
               sed -e '/^'$T"\\/"$S'$/ s/$/ '$EXT'/' <$QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new
            then
                mv $QPEDIR/etc/mime.types.new $QPEDIR/etc/mime.types
                exit 0
            else
                echo >&2 "Internal MIME type update error"
                exit 1
            fi
        else
            echo "$NEWTYPE $EXT" >>$QPEDIR/etc/mime.types
            exit 0
        fi
    elif [ "$TYPE" = "$NEWTYPE" ]
    then
        #echo "Already done"
        exit 0
    else
        echo >&2 "$EXT already assigned to $TYPE"
        exit 1
    fi
)
I also found this Japanese mimetype tool, but never figured out how to use it.
All the dialogs, etc. are in Japanese. I have attached it here
Code: [Select]
Mimetypetool requires Ruby be installed in Sharp/Cacko.

ruby-qte_0.5.1-1_arm.ipk
ruby_1.8.0-1_arm.ipk

Install ruby-qte_0.5.1-1_arm.ipk first to avoid dependency warning when installing ruby_1.8.0-1_arm.ipk
For your Tree!Explorer question, you have to have the registered version for images and files to be launched from it's interface.
« Last Edit: January 31, 2007, 07:09:39 pm by Jon_J »
C3100 Multiboot-->Angstrom 2007.12-r18 | Cacko 1.23 | ArchLinuxARM
C3200 pdaxii13v2-5.5-alpha4 Akita on NAND

Ambicom WL1100C-CF Wifi - Ambicom CF modem - Ambicom CF GPS - Belkin-F5D5050 USB LAN
Socket CF Bluetooth rev K - Iogear 4 port USB micro hub - pocket CF card reader
Targus mini USB optical mouse - 2 Targus SD card readers