From 34bfb32ecf2cea5e5de95980beedb681139d9c01 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 10 Apr 2009 00:00:00 +0200 Subject: new minor version --- code/types.rb | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) (limited to 'code/types.rb') 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 -- cgit 1.4.1-2-gfad0