Created
December 2, 2016 07:23
-
-
Save Largo/af6d3065cf4eae01e1b0f5750ea2aa63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'open-uri' | |
zeilen = CSV.read('images.csv', { :col_sep => ';' }) | |
listeMitBilderProSku = zeilen.group_by{|x| x[0] } | |
#p listeMitBilderProSku | |
listeMitBilderProSku.each do |bilderProSku| | |
sku = bilderProSku[0] | |
bildNr = 0 | |
bilderProSku[1].each do |bildProSku| | |
url = bildProSku[1] | |
if url == 'value' | |
next | |
end | |
p url | |
download = open(url) | |
extension = File.extname(url) | |
filename = 'B_' + sku + '_' + bildNr.to_s + extension | |
IO.copy_stream(download, 'downloads/' + filename) | |
bildNr += 1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment