about summary refs log blame commit diff stats
path: root/code/types.rb
blob: 7fc614e9b938db9b9e2d518d14e91889696bb915 (plain) (tree)

























                                                                                                                                                          
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
		when /\.(jpe?g|png)$/i
			return "feh #{file.sh}", false
		when /\.(pdf)$/i
			return "evince #{file.sh}"
		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

		if File.executable?(file)
			return "#{file.sh}", true
		end

		return VI % file.sh
	end
end