Commit 3f2e65ae authored by Joakim Nylén's avatar Joakim Nylén

Fix for donwloading

parent afeb946d
......@@ -11,8 +11,8 @@ a = Mechanize.new { |agent|
# Channels
channels = [
{ :xmltvid => "ftv.com", :info => "fashiontv_", info2: "HotBird" },
{ :xmltvid => "hd.ftv.com", :info => "fashiontvHD_", info2: "HotBird" },
{ :xmltvid => "ftv.com", :info => "fashiontv_", info2: "Hotbird" },
{ :xmltvid => "hd.ftv.com", :info => "fashiontvHD_", info2: "Hotbird" },
]
page = a.get('http://company.fashiontv.com/program-guide/').body
......@@ -25,7 +25,9 @@ page = a.get('http://company.fashiontv.com/program-guide/').body
# Only add files that is this year or next.
if url =~ /#{Date.today.year}/ or url =~ /#{Date.today.year + 1}/
channels.each do |c|
next if file_name !~ /#{c[:info]}/i or file_name !~ /#{c[:info2]}/i or File.exist?('/content/channels/' + c[:xmltvid] + '/' + file_name)
next if file_name !~ /#{c[:info]}/i or file_name !~ /#{c[:info2]}/i
puts url
next if File.exist?('/content/channels/' + c[:xmltvid] + '/' + file_name)
File.open('/content/channels/' + c[:xmltvid] + '/' + file_name, 'wb'){|f| f << a.get(url).body}
puts "Added #{file_name} to #{c[:xmltvid]}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment