Class: Oddb2xml::ZurroseDownloader
- Inherits:
-
Downloader
- Object
- Downloader
- Oddb2xml::ZurroseDownloader
- Includes:
- DownloadMethod
- Defined in:
- lib/oddb2xml/downloader.rb
Instance Attribute Summary
Attributes inherited from Downloader
#agent, #file2save, #type, #url
Instance Method Summary collapse
Methods inherited from Downloader
#init, #initialize, #report_download
Constructor Details
This class inherits a constructor from Oddb2xml::Downloader
Instance Method Details
#download ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/oddb2xml/downloader.rb', line 171 def download @url ||= "http://pillbox.oddb.org/TRANSFER.ZIP" zipfile = File.join(WORK_DIR, "transfer.zip") download_as(zipfile) dest = File.join(DOWNLOADS, "transfer.dat") cmd = "unzip -o '#{zipfile}' -d '#{DOWNLOADS}'" system(cmd) if @options[:artikelstamm] cmd = "iconv -f ISO8859-1 -t utf-8 -o #{dest.sub(".dat", ".utf8")} #{dest}" Oddb2xml.log(cmd) system(cmd) end # read file and convert it to utf-8 File.open(dest, "r:iso-8859-1:utf-8").read ensure FileUtils.rm(zipfile, verbose: true) if File.exist?(dest) && File.exist?(zipfile) end |