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
|
# ../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
|
||||||
|
|
||||||
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
|
## Usage
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
#!/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'
|
||||||
|
@ -8,7 +22,6 @@ 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
|
||||||
|
@ -50,14 +63,15 @@ 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
|
||||||
|
@ -109,7 +123,7 @@ end
|
||||||
FileUtils.touch "#{directory}/.imguralbum"
|
FileUtils.touch "#{directory}/.imguralbum"
|
||||||
|
|
||||||
if options[:zip] then
|
if options[:zip] then
|
||||||
system "zip -r #{directory.shellescape}.cbz #{directory.shellescape}"
|
%x{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 'imgur2comicbook/version'
|
require 'imgur-albumkeeper/version'
|
||||||
|
|
||||||
Gem::Specification.new do |spec|
|
Gem::Specification.new do |spec|
|
||||||
spec.name = "imgur2comicbook"
|
spec.name = "imgur-albumkeeper"
|
||||||
spec.version = Imgur2ComicBook::VERSION
|
spec.version = Gsfe::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.}
|
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