Cleanup comments & obsolete code.
This commit is contained in:
parent
6bdcf4fb41
commit
1109fff818
1 changed files with 2 additions and 21 deletions
|
@ -1,20 +1,5 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
# Download imgur.com galleries easily
|
|
||||||
#
|
|
||||||
# Requirements:
|
|
||||||
# gem install nokogiri
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# ruby imgur.rb [url of gallery] [directory to download into] [namespace for files]
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# ruby imgur.rb http://imgur.com/a/npV94 battlefield3 scenery
|
|
||||||
# All files will be downloaded into battlefield3 with filenames in the pattern of
|
|
||||||
# scenery-[number].jpg
|
|
||||||
|
|
||||||
require 'imgur2comicbook'
|
|
||||||
|
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
require 'date'
|
require 'date'
|
||||||
|
@ -23,6 +8,7 @@ require 'optparse'
|
||||||
require 'pp'
|
require 'pp'
|
||||||
require "shellwords"
|
require "shellwords"
|
||||||
|
|
||||||
|
require 'imgur2comicbook'
|
||||||
|
|
||||||
def album_url origin_url
|
def album_url origin_url
|
||||||
url = URI.parse origin_url
|
url = URI.parse origin_url
|
||||||
|
@ -64,10 +50,6 @@ end
|
||||||
|
|
||||||
options = parse_cmdline ARGV
|
options = parse_cmdline ARGV
|
||||||
|
|
||||||
#pp options
|
|
||||||
#pp ARGV
|
|
||||||
#exit 0
|
|
||||||
|
|
||||||
images = []
|
images = []
|
||||||
now = Time.now
|
now = Time.now
|
||||||
if ARGV[0].nil? then
|
if ARGV[0].nil? then
|
||||||
|
@ -76,7 +58,6 @@ if ARGV[0].nil? then
|
||||||
end
|
end
|
||||||
url = album_url(ARGV[0])
|
url = album_url(ARGV[0])
|
||||||
directory = ( defined?(ARGV[1]) ? ARGV[1] : nil )
|
directory = ( defined?(ARGV[1]) ? ARGV[1] : nil )
|
||||||
#namespace = ( defined?(ARGV[2]) ? ARGV[2] : "image" )
|
|
||||||
namespace = "image"
|
namespace = "image"
|
||||||
|
|
||||||
# filter url
|
# filter url
|
||||||
|
@ -128,7 +109,7 @@ end
|
||||||
FileUtils.touch "#{directory}/.imguralbum"
|
FileUtils.touch "#{directory}/.imguralbum"
|
||||||
|
|
||||||
if options[:zip] then
|
if options[:zip] then
|
||||||
%x{zip -r #{directory.shellescape}.cbz #{directory.shellescape}}
|
system "zip -r #{directory.shellescape}.cbz #{directory.shellescape}"
|
||||||
FileUtils.rm_rf directory
|
FileUtils.rm_rf directory
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue