Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 26 Nov 2014, 08:52
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
MIME types and associations and .desktops
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count_1  
Author Message
darkcity


Joined: 23 May 2010
Posts: 2479
Location: near here

PostPosted: 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 "$@"

_________________
helping Wiki for help | IF SendSpace link = "dead" THEN PM me ("up file to http://meownplanet.net/")
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count_1  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

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.0492s ][ Queries: 12 (0.0042s) ][ GZIP on ]