The time now is Wed 19 Jun 2013, 07:58
All times are UTC - 4 |
|
Page 1 of 1 Posts_count_1 |
|
| Author |
Message |
darkcity

Joined: 23 May 2010 Posts: 2218 Location: near here
|
Posted: Sun 05 Aug 2012, 15:58 Post_subject:
MIME types and associations and .desktops Sub_title: /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
|
|
 |
|
|
Page 1 of 1 Posts_count_1 |
|
|
|
Rules_post_cannot Rules_reply_cannot Rules_edit_cannot Rules_delete_cannot Rules_vote_cannot You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|
[ Time: 0.0407s ][ Queries: 11 (0.0036s) ][ GZIP on ] |