rubyhexagon 0.2.6 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/examples/sync.rb +2 -34
  2. data/lib/rubyhexagon.rb +1 -1
  3. metadata +2 -2
data/lib/examples/sync.rb CHANGED
@@ -18,7 +18,6 @@
18
18
  =end
19
19
 
20
20
  require "logger"
21
- require "pg"
22
21
 
23
22
  include E621
24
23
 
@@ -45,35 +44,11 @@ class Sync
45
44
  @log.info("Program #$0 started.")
46
45
  @uid = api.get("index",{"name"=>api.user}).first["id"]
47
46
  @max_wait = 1
48
- tags
49
47
  end
50
48
 
51
- def tags
52
- tags = File.expand_path("~/.hexagon/tags.json")
53
- if !File.exist?(tags) then
54
- @tags = Array.new
55
- else
56
- File.open(tags) do |f|
57
- @tags = f.read.parse
58
- end
59
- end
60
- @tags = @tags.sort{|k1,k2|k1["id"]<=>k2["id"]}
61
- api = API.new("tag")
62
- body,page = [2],1
63
- until body == Array.new do
64
- body = api.get("index",{"limit"=>0,"order"=>"count","after_id"=>@tags.last["id"],"page"=>page})
65
- body = body.map{|x|x["name"] = x["name"].encode("us-ascii", :invalid => :replace, :undef => :replace, :replace => "");x}
66
- @tags += body
67
- page += 1
68
- end
69
- jtags = @tags.to_json
70
- File.open(tags,"w"){|f|f.print jtags}
71
- @tags = @tags.reject{|x|x["type"]!=1}.map{|x|x["name"]}
72
- end
73
-
74
49
  def worker(mod)
75
50
  @mod = mod
76
- Dir.chdir(File.expand_path("~/Dropbox/Furry/e621/#{mod}s")) do
51
+ Dir.chdir(File.expand_path("~/Pictures/e621/#{mod}s")) do
77
52
  sets = Array.new
78
53
  File.open(File.expand_path(E621::Config.paths["j#{mod}s"])) do |f|
79
54
  sets = f.read.parse
@@ -180,14 +155,7 @@ class Sync
180
155
  end
181
156
  end
182
157
  def download(post,name,set,id=0)
183
- artist = post.tags.split(/\s+/).map do |t|
184
- @tags[@tags.index(t)] if @tags.index(t)
185
- end
186
- begin
187
- artist = artist.compact.first.sub("_(artist)","")
188
- rescue
189
- artist = "unknown"
190
- end
158
+ artist = post.artist.first
191
159
  if @mod == "set" then
192
160
  string = [post.created_at.to_i,post.id.pad(8),artist+"_"+name,post.file_ext]
193
161
  elsif @mod == "pool" then
data/lib/rubyhexagon.rb CHANGED
@@ -30,5 +30,5 @@ require "pool"
30
30
 
31
31
  module E621
32
32
  Name = "rubyhexagon"
33
- Version = "0.2.6"
33
+ Version = "0.3.1"
34
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyhexagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-28 00:00:00.000000000 Z
12
+ date: 2015-05-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Rubyhexagon provides Ruby bindings for the e621 [dot] net API.
15
15
  email: maxine_red1@yahoo.com