#!/usr/bin/ruby if ARGV[0].nil? or ARGV[0].empty? or ARGV[1].nil? or ARGV[1].empty? then $stderr.puts "Missing parameter(s). 2 parameters expected, " + ARGV.length.to_s + " was given." exit 127 end link = "#{ARGV[0]}" player = "#{ARGV[1]}" if link =~ /http[s]?:\/\/i\.imgur\.com\/(.+)\.webm/i or link =~ /http[s]?:\/\/i\.imgur\.com\/(.+)\.gifv/i or link =~ /http[s]?:\/\/i\.imgur\.com\/(.+)\.mp4/i link = "http://i.imgur.com/#{$1}.mp4" fork { exec("#{player} -no-close-at-end -actions \"repeat true\" \"#{link}\"") } exit 0 else exit 1 end