about summary refs log tree commit diff stats
path: root/code/types.rb
blob: 7fc614e9b938db9b9e2d518d14e91889696bb915 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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