14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'deliver/lib/deliver/download_screenshots.rb', line 14
def self.download(options, folder_path)
v = options[:use_live_version] ? options[:app].live_version : options[:app].latest_version
v.screenshots.each do |language, screenshots|
screenshots.each do |screenshot|
file_name = [screenshot.sort_order, screenshot.device_type, screenshot.sort_order].join("_")
original_file_extension = File.basename(screenshot.original_file_name)
file_name += "." + original_file_extension
UI.message("Downloading existing screenshot '#{file_name}' for language '#{language}'")
if screenshot.device_type == "appleTV"
containing_folder = File.join(folder_path, "appleTV", screenshot.language)
else
containing_folder = File.join(folder_path, screenshot.language)
end
if screenshot.is_imessage
containing_folder = File.join(folder_path, "iMessage", screenshot.language)
end
begin
FileUtils.mkdir_p(containing_folder)
rescue
end
path = File.join(containing_folder, file_name)
File.write(path, open(screenshot.url).read)
end
end
end
|