diff options
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 |