Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
1109fff818 | |||
6bdcf4fb41 | |||
7b59637189 | |||
98836d8ad8 |
7 changed files with 28 additions and 43 deletions
23
README.md
23
README.md
|
@ -1,22 +1,21 @@
|
||||||
# ../imgur::Albumkeeper
|
# ../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
|
TODO: Write a gem description
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Add this line to your application's Gemfile:
|
Install it yourself as:
|
||||||
|
|
||||||
```ruby
|
$ gem install imgur2comicbook
|
||||||
gem '../imgur-albumkeeper'
|
|
||||||
```
|
|
||||||
|
|
||||||
And then execute:
|
|
||||||
|
|
||||||
$ bundle
|
|
||||||
|
|
||||||
Or install it yourself as:
|
|
||||||
|
|
||||||
$ gem install ../imgur-albumkeeper
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
|
@ -1,19 +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 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
require 'date'
|
require 'date'
|
||||||
|
@ -22,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
|
||||||
|
@ -63,15 +50,14 @@ 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
|
||||||
|
STDERR.puts "Missing URL."
|
||||||
|
exit 1
|
||||||
|
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
|
||||||
|
@ -123,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
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
lib = File.expand_path('../lib', __FILE__)
|
lib = File.expand_path('../lib', __FILE__)
|
||||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||||
require 'imgur-albumkeeper/version'
|
require 'imgur2comicbook/version'
|
||||||
|
|
||||||
Gem::Specification.new do |spec|
|
Gem::Specification.new do |spec|
|
||||||
spec.name = "imgur-albumkeeper"
|
spec.name = "imgur2comicbook"
|
||||||
spec.version = Gsfe::VERSION
|
spec.version = Imgur2ComicBook::VERSION
|
||||||
spec.authors = ["Glenn Y. Rolland"]
|
spec.authors = ["Glenn Y. Rolland"]
|
||||||
spec.email = ["glenn.rolland@netcat.io"]
|
spec.email = ["glenn.rolland@netcat.io"]
|
||||||
spec.summary = %q{Archive imgur albums.}
|
spec.summary = %q{Archive imgur albums.}
|
|
@ -1,5 +0,0 @@
|
||||||
require_relative "imgur-albumkeeper/version"
|
|
||||||
|
|
||||||
module Albumkeeper
|
|
||||||
# Your code goes here...
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
module Albumkeeper
|
|
||||||
VERSION = "0.0.1"
|
|
||||||
end
|
|
5
lib/imgur2comicbook.rb
Normal file
5
lib/imgur2comicbook.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "imgur2comicbook/version"
|
||||||
|
|
||||||
|
module Imgur2ComicBook
|
||||||
|
# Your code goes here...
|
||||||
|
end
|
3
lib/imgur2comicbook/version.rb
Normal file
3
lib/imgur2comicbook/version.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module Imgur2ComicBook
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
Loading…
Reference in a new issue