Class: MyJobDojin

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/job.rb

Direct Known Subclasses

MyJobDojinEventMachine

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = { }) ⇒ MyJobDojin

Returns a new instance of MyJobDojin.



601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
# File 'lib/lib/job.rb', line 601

def initialize(args = { })
  require 'net/http'
  @args = args

  #sample http://1patu.net/data/20591/preview/000.jpg
  @args[:path]   = "/data/#{@args[:book].to_s}/preview/" +
    sprintf("%0#{3}d", @args[:page]) + ".jpg"
  @args[:cookie] ||= { 'Cookie' => '1patu_view=1'}
  @args[:status] = :new
  @args[:try]    = 0

  @args[:savedir] ||= "/Users/seijiro/Downloads/jpg"
  @args[:savebookdir] = "#{@args[:savedir].to_s}/#{@args[:book].to_s}"
  checkdir
  @args[:savepath] = "#{@args[:savebookdir]}/" +
    sprintf("%0#{3}d", @args[:page]) + ".jpg"
  @machine = @args[:machine]

  #debug
  @args[:debug]  ||= false
  @args[:savepath] = '/dev/null' if @args[:dryrun]
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



599
600
601
# File 'lib/lib/job.rb', line 599

def args
  @args
end

Instance Method Details

#runObject



624
625
626
# File 'lib/lib/job.rb', line 624

def run
  do_connect
end