diff options
author | hut <hut@lavabit.com> | 2009-04-10 00:00:00 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-04-10 00:00:00 +0200 |
commit | 34bfb32ecf2cea5e5de95980beedb681139d9c01 (patch) | |
tree | 68acd3339f575782b5ebccbb70d8c1efd0dffc62 /code/types.rb | |
parent | adfea091f816cc2f4007e99b6b2be35a821857da (diff) | |
download | ranger-0.2.0.tar.gz |
new minor version v0.2.0
Diffstat (limited to 'code/types.rb')
-rw-r--r-- | code/types.rb | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/code/types.rb b/code/types.rb index 7fc614e9..0fc0bf7c 100644 --- a/code/types.rb +++ b/code/types.rb @@ -1,22 +1,56 @@ module Fm - def self.getfilehandler(file) - bn = File.basename(file) - case bn - when /\.(avi|mpe?g|flv|mkv|ogm|mov|mp4|wmv|vob|php|divx?|mp3|ogg)$/i - return "mplayer -fs #{file.sh}", false + def self.getfilehandler_frompath(file) + case file + when /\.(part|avi|mpe?[g\d]|flv|fid|mkv|mov|wm[av]|vob|php|divx?|og[gmv])$/i + if file =~ /720p/ + return "mplayer -vm sdl #{file.sh}", false + else + return "mplayer -fs #{file.sh}", false + end + + when /\.part$/ + test = getfilehandler_frompath($`) + if test + return test + end + + when /\.(swc|smc)$/i + return "zsnes -ad sdl -u -o #{file.sh}" + + when /\.(zip|rar|tar|gz|7z|jar|bz2)$/i + return "aunpack #{file.sh}", false + + when "Makefile" + return "make" + when /\.(jpe?g|png)$/i return "feh #{file.sh}", false - when /\.(pdf)$/i + + when /\.html?$/i + return "firefox #{file.sh}" + + when /\.pdf$/i return "evince #{file.sh}" - when /\.(txt)$/i + + when /\.txt$/i return VI % file.sh + when /\.wav$/i return "aplay -q #{file.sh}" + when /\.m3u$/i return "cmus-remote -c && cmus-remote -P #{file} && cmus-remote -C 'set play_library=false' && sleep 0.3 && cmus-remote -n", false + + end + + end + def self.getfilehandler(file) + test = getfilehandler_frompath(file.basename) + if test + return test end - if File.executable?(file) + if file.executable? return "#{file.sh}", true end |