The time now is Thu 23 May 2013, 07:56
All times are UTC - 4 |
| Author |
Message |
darkcity

Joined: 23 May 2010 Posts: 2215 Location: near here
|
Posted: Sun 05 Aug 2012, 15:58 Post subject:
MIME types and associations and .desktops Subject description: /usr/local/apps the red herring? |
|
Adding MIME types is harder is Puppy than some Linux.
Take for example Audacity, it includes the mime xml file
/usr/share/mime/packages/audacity.xml
Normally the update-mime-database command would run after installation. This has been remove - along with the standard freedesktop.org xml descriptions (about 2MB).
the update-mime-database takes all the descriptions in /usr/share/mime/packages/ and compiles them in various files including /usr/share/mime/globs
This isn't a problem for associating currently existing MIME types. But Audacity wants to add its x-audacity-project type - for its native filetype.
----
work around - simply add the new mime types to the end of non-binary files in files in /usr/share/mime/
here for my script examples for adding and remove mime type (and associations) for my Audacity packaging
/pinstall
| Code: | #!/bin/bash
#post-install script.
#add mime-type (without using update-mime-database)
echo application/x-audacity-project:*.aup >> /usr/share/mime/globs
echo 50:application/x-audacity-project:*.aup >> /usr/share/mime/globs2
echo application/x-audacity-project text/xml >> /usr/share/mime/subclasses
echo application/x-audacity-project >> /usr/share/mime/types
#link MIME actions to .desktop description
#-direct-action (can be over ridden with ~/.config/rox.sourceforge.net/MIME-types/application_x-audacity-project)
ln -s /usr/share/applications/audacity.desktop ~/Choices/MIME-types/application_x-audacity-project
#-right-click association to aup, flac, mp3, ogg, wav
if ! [ -d ~/.config/rox.sourceforge.net/OpenWith/.application_x-audacity-project ] ; then mkdir ~/.config/rox.sourceforge.net/OpenWith/.application_x-audacity-project ; fi
ln -s /usr/share/applications/audacity.desktop ~/.config/rox.sourceforge.net/OpenWith/.application_x-audacity-project/audacity
if ! [ -d ~/.config/rox.sourceforge.net/OpenWith/.audio_x-flac/ ] ; then mkdir ~/.config/rox.sourceforge.net/OpenWith/.audio_x-flac/ ; fi
ln -s /usr/share/applications/audacity.desktop ~/.config/rox.sourceforge.net/OpenWith/.audio_x-flac/audacity
if ! [ -d ~/.config/rox.sourceforge.net/OpenWith/.audio_mpeg/ ] ; then mkdir ~/.config/rox.sourceforge.net/OpenWith/.audio_mpeg/ ; fi
ln -s /usr/share/applications/audacity.desktop ~/.config/rox.sourceforge.net/OpenWith/.audio_mpeg/audacity
if ! [ -d ~/.config/rox.sourceforge.net/OpenWith/.audio_x-vorbis+ogg/ ] ; then mkdir ~/.config/rox.sourceforge.net/OpenWith/.audio_x-vorbis+ogg/ ; fi
ln -s /usr/share/applications/audacity.desktop ~/.config/rox.sourceforge.net/OpenWith/.audio_x-vorbis+ogg/audacity
if ! [ -d ~/.config/rox.sourceforge.net/OpenWith/.audio_x-wav/ ] ; then mkdir ~/.config/rox.sourceforge.net/OpenWith/.audio_x-wav/ ; fi
ln -s /usr/share/applications/audacity.desktop ~/.config/rox.sourceforge.net/OpenWith/.audio_x-wav/audacity
#-open-with association (open any file with this app)
ln -s /usr/share/applications/audacity.desktop ~/.config/rox.sourceforge.net/OpenWith/audacity |
/puninstall
| Code: | #!/bin/bash
#post-uninstall script.
#remove mime-type on uninstall (without using update-mime-database)
sed -i '/application\/x-audacity-project:\*.aup$/ d' /usr/share/mime/globs
sed -i '/50:application\/x-audacity-project:\*.aup$/ d' /usr/share/mime/globs2
sed -i '/application\/x-audacity-project text\/xml$/ d' /usr/share/mime/subclasses
sed -i '/application\/x-audacity-project$/ d' /usr/share/mime/types
#rm links to MIME actions to .desktop description
#-direct-action (can be over ridden with ~/.config/rox.sourceforge.net/MIME-types/application_x-audacity-project)
rm ~/Choices/MIME-types/application_x-audacity-project
#-right-click association to aup, flac, mp3, ogg, wav
rm ~/.config/rox.sourceforge.net/OpenWith/.application_x-audacity-project/audacity
rm ~/.config/rox.sourceforge.net/OpenWith/.audio_x-flac/audacity
rm ~/.config/rox.sourceforge.net/OpenWith/.audio_mpeg/audacity
rm ~/.config/rox.sourceforge.net/OpenWith/.audio_x-vorbis+ogg/audacity
rm ~/.config/rox.sourceforge.net/OpenWith/.audio_x-wav/audacity
#-open-with association (open any file with this app)
rm ~/.config/rox.sourceforge.net/OpenWith/audacity |
a script could be written to interpret mime xml files and append globs etc , would this be worth while?
----
/usr/local/apps the red herring?
there is no need to use this directory if a .desktop entry exists, passing files to the .desktop works even (maybe oddly) without the "$@"
_________________ Wiki Audacity 2.0.1
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|
[ Time: 0.0445s ][ Queries: 11 (0.0061s) ][ GZIP on ] |