Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
|
abd3221801 |
7 changed files with 43 additions and 28 deletions
23
README.md
23
README.md
|
@ -1,21 +1,22 @@
|
|||
# ../imgur::Albumkeeper
|
||||
|
||||
Download imgur.com galleries easily
|
||||
#
|
||||
# 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
|
||||
TODO: Write a gem description
|
||||
|
||||
## Installation
|
||||
|
||||
Install it yourself as:
|
||||
Add this line to your application's Gemfile:
|
||||
|
||||
$ gem install imgur2comicbook
|
||||
```ruby
|
||||
gem '../imgur-albumkeeper'
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
||||
$ bundle
|
||||
|
||||
Or install it yourself as:
|
||||
|
||||
$ gem install ../imgur-albumkeeper
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
#!/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 'nokogiri'
|
||||
require 'open-uri'
|
||||
require 'date'
|
||||
|
@ -8,7 +22,6 @@ require 'optparse'
|
|||
require 'pp'
|
||||
require "shellwords"
|
||||
|
||||
require 'imgur2comicbook'
|
||||
|
||||
def album_url origin_url
|
||||
url = URI.parse origin_url
|
||||
|
@ -50,14 +63,15 @@ end
|
|||
|
||||
options = parse_cmdline ARGV
|
||||
|
||||
#pp options
|
||||
#pp ARGV
|
||||
#exit 0
|
||||
|
||||
images = []
|
||||
now = Time.now
|
||||
if ARGV[0].nil? then
|
||||
STDERR.puts "Missing URL."
|
||||
exit 1
|
||||
end
|
||||
url = album_url(ARGV[0])
|
||||
directory = ( defined?(ARGV[1]) ? ARGV[1] : nil )
|
||||
#namespace = ( defined?(ARGV[2]) ? ARGV[2] : "image" )
|
||||
namespace = "image"
|
||||
|
||||
# filter url
|
||||
|
@ -109,7 +123,7 @@ end
|
|||
FileUtils.touch "#{directory}/.imguralbum"
|
||||
|
||||
if options[:zip] then
|
||||
system "zip -r #{directory.shellescape}.cbz #{directory.shellescape}"
|
||||
%x{zip -r #{directory.shellescape}.cbz #{directory.shellescape}}
|
||||
FileUtils.rm_rf directory
|
||||
end
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
# coding: utf-8
|
||||
lib = File.expand_path('../lib', __FILE__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'imgur2comicbook/version'
|
||||
require 'imgur-albumkeeper/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "imgur2comicbook"
|
||||
spec.version = Imgur2ComicBook::VERSION
|
||||
spec.name = "imgur-albumkeeper"
|
||||
spec.version = Gsfe::VERSION
|
||||
spec.authors = ["Glenn Y. Rolland"]
|
||||
spec.email = ["glenn.rolland@netcat.io"]
|
||||
spec.summary = %q{Archive imgur albums.}
|
5
lib/imgur-albumkeeper.rb
Normal file
5
lib/imgur-albumkeeper.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
require_relative "imgur-albumkeeper/version"
|
||||
|
||||
module Albumkeeper
|
||||
# Your code goes here...
|
||||
end
|
3
lib/imgur-albumkeeper/version.rb
Normal file
3
lib/imgur-albumkeeper/version.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
module Albumkeeper
|
||||
VERSION = "0.0.1"
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
require "imgur2comicbook/version"
|
||||
|
||||
module Imgur2ComicBook
|
||||
# Your code goes here...
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
module Imgur2ComicBook
|
||||
VERSION = "0.0.1"
|
||||
end
|
Loading…
Reference in a new issue