diff options
author | hut <hut@lavabit.com> | 2009-06-13 02:20:46 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-06-13 02:20:46 +0200 |
commit | 2887ca25fb58362d5d644ecda5f0bc51c80ec404 (patch) | |
tree | b066f5542d97b1a4a9134d0910692b873fe32363 /data/types.rb | |
parent | 325ec37f65172b5b640d998eba300d86d1ddbfa5 (diff) | |
download | ranger-2887ca25fb58362d5d644ecda5f0bc51c80ec404.tar.gz |
rewrite of the way files are executed, easier config
Diffstat (limited to 'data/types.rb')
-rw-r--r-- | data/types.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/data/types.rb b/data/types.rb new file mode 100644 index 00000000..773df758 --- /dev/null +++ b/data/types.rb @@ -0,0 +1,35 @@ +class Directory::Entry + INTERPRETED_LANGUAGES = %w[haskell perl python ruby sh] + MOVIE_EXTENSIONS = %w[avi mpg mpeg mp4 mp5 ogv ogm wmv mkv flv fid vob div divx] + + def get_handler + ## directories or sockets don't have any handler + use.no_handler if dir? or socket? + + ## at first, look at the mime type + case @mimetype + when /^video|audio/ + use.mplayer + + when "application/pdf" + use.evince + + when /^image/ + use.feh + + when /^(text|application).x-(#{INTERPRETED_LANGUAGES.join('|')})$/ + use.interpreted_language + + end + + ## second, look at the extension + case @ext + when 'swc', 'smc' + use.zsnes + + end + + use.vi + end +end + |