tumblr_draftking 0.9.0.3 → 0.9.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19b8f8d0b44e95c6f4cb027946cab3822bf3afb0
4
- data.tar.gz: 90eaaa8b530770b958ded47566b8ac0044ac7066
3
+ metadata.gz: e7e8c7b5b045f41f100e52afe1faec27dcca83db
4
+ data.tar.gz: 206cecc7a334f8083965c7e0adb0761f20b400cb
5
5
  SHA512:
6
- metadata.gz: f4abd939e2d8cc687e7a5fbcf4a7e97a146ff8c5880f08fd6747247452d8315b3774bff641b50df5090bee037273220bf8cc9b233d76a7bb70c471fd18595e70
7
- data.tar.gz: 90d2a12404235f1d3f36852bea1da71a0e11b8e28a9e762532d78d79ab5bd9144f25be538f20014e29751871b74d6e1a3bcdfd14dac78a006a05906f7bc55dcf
6
+ metadata.gz: c9f9d25fe5a8c88a1b2f014bf096c5133a6f0bed1fc913621f80fa7fede68d335f0e2a506a4c6e7a92e7aeaacb790ae86e65503aed5c76b407f00e3987b2e410
7
+ data.tar.gz: ea3553b4e384dbb3146affca11b05324b32bbb2c26feb3518a28564f1f8c5504db98f03d1f2f2e917c3229c42f0ef223c96745783085d1d1903f4d7348edc5e1
@@ -1,4 +1,7 @@
1
1
  # Changelog :: tumblr_draftking
2
+ ## Version 0.9.1.0
3
+ + Added CLI option (--no-show-pi) to hide progress indicators. (--mute) can still be used to silence progress messages and the final report.
4
+
2
5
  ## Version 0.9.0.3
3
6
  + Shuffle posts more during movedrafts
4
7
 
data/README.md CHANGED
@@ -15,8 +15,8 @@ DraftKing for Tumblr takes the hassle out of managing your draft queue!
15
15
  + **Randomize post order to add variety.**
16
16
  + **Manage multiple accounts.**
17
17
 
18
- Version 0.9.0.2
19
- + Updated gemspec constraints for Psych
18
+ Version 0.9.1.0
19
+ + Added CLI option (--no-show-pi) to hide progress indicators. (--mute) can still be used to silence progress messages and the final report.
20
20
 
21
21
  + Please report any [issues] you encounter!
22
22
  + [Change Log](./CHANGELOG.md)
@@ -22,6 +22,7 @@ module DK
22
22
  d[:greedy] = 'Select entire queue before processing the action.'
23
23
  d[:file] = 'File path.'
24
24
  d[:link] = 'URL to visit when photo is clicked.'
25
+ d[:show_pi] = 'Show progress indicators.'
25
26
  d
26
27
  end
27
28
 
@@ -19,8 +19,9 @@ module DK
19
19
  option :simulate, type: :boolean, aliases: :s, desc: Options.op_strings[:simulate]
20
20
  option :keep_tags, type: :boolean, aliases: :k, desc: Options.op_strings[:keep_tags]
21
21
  option :keep_comments, type: :boolean, aliases: :K, desc: Options.op_strings[:keep_comments]
22
- option :credit, type: :boolean, desc: Options.op_strings[:credit], default: true
23
- option :tags, type: :boolean, desc: Options.op_strings[:tags], default: true
22
+ option :credit, type: :boolean, desc: Options.op_strings[:credit], default: true
23
+ option :tags, type: :boolean, desc: Options.op_strings[:tags], default: true
24
+ option :show_pi, type: :boolean, desc: Options.op_strings[:show_pi], default: true
24
25
  option :config, type: :string, desc: Options.op_strings[:config]
25
26
  def autoposter
26
27
  configured?
@@ -20,8 +20,9 @@ module DK
20
20
  option :mute, type: :boolean, aliases: :m, desc: Options.op_strings[:mute]
21
21
  option :keep_tags, type: :boolean, aliases: :k, desc: Options.op_strings[:keep_tags]
22
22
  option :keep_comments, type: :boolean, aliases: :K, desc: Options.op_strings[:keep_comments]
23
- option :credit, type: :boolean, desc: Options.op_strings[:credit], default: true
24
- option :tags, type: :boolean, desc: Options.op_strings[:tags], default: true
23
+ option :credit, type: :boolean, desc: Options.op_strings[:credit], default: true
24
+ option :tags, type: :boolean, desc: Options.op_strings[:tags], default: true
25
+ option :show_pi, type: :boolean, desc: Options.op_strings[:show_pi], default: true
25
26
  option :config, type: :string, desc: Options.op_strings[:config]
26
27
  def comment(comm)
27
28
  configured?
@@ -20,8 +20,9 @@ module DK
20
20
  option :keep_tags, type: :boolean, aliases: :k, desc: Options.op_strings[:keep_tags]
21
21
  option :keep_comments, type: :boolean, aliases: :K, desc: Options.op_strings[:keep_comments]
22
22
  option :greedy, type: :boolean, aliases: :g, desc: Options.op_strings[:greedy]
23
- option :credit, type: :boolean, desc: Options.op_strings[:credit], default: true
24
- option :tags, type: :boolean, desc: Options.op_strings[:tags], default: true
23
+ option :show_pi, type: :boolean, desc: Options.op_strings[:show_pi], default: true
24
+ option :credit, type: :boolean, desc: Options.op_strings[:credit], default: true
25
+ option :tags, type: :boolean, desc: Options.op_strings[:tags], default: true
25
26
  option :config, type: :string, desc: Options.op_strings[:config]
26
27
  def movedrafts
27
28
  configured?
@@ -8,6 +8,7 @@ module DK
8
8
  option :blog, type: :string, aliases: :b, desc: Options.op_strings[:blog]
9
9
  option :source, type: :string, aliases: :S, desc: Options.op_strings[:source]
10
10
  option :simulate, type: :boolean, aliases: :s, desc: Options.op_strings[:simulate]
11
+ option :show_pi, type: :boolean, desc: Options.op_strings[:show_pi], default: true
11
12
  option :config, type: :string, desc: Options.op_strings[:config]
12
13
  def strip
13
14
  configured?
@@ -11,6 +11,7 @@ module DK
11
11
  option :keep_tags, type: :boolean, aliases: :k, desc: Options.op_strings[:keep_tags]
12
12
  option :keep_comments, type: :boolean, aliases: :K, desc: Options.op_strings[:keep_comments]
13
13
  option :credit, type: :boolean, desc: Options.op_strings[:credit], default: false
14
+ option :show_pi, type: :boolean, desc: Options.op_strings[:show_pi], default: true
14
15
  option :config, type: :string, desc: Options.op_strings[:config]
15
16
  def tag
16
17
  opts = process_options(options)
@@ -33,6 +33,7 @@ module DK
33
33
  option :simulate, type: :boolean, aliases: :s, desc: Options.op_strings[:simulate]
34
34
  option :mute, type: :boolean, aliases: :m, desc: Options.op_strings[:mute]
35
35
  option :add_tags, type: :string, aliases: :t, desc: Options.op_strings[:add_tags]
36
+ option :show_pi, type: :boolean, desc: Options.op_strings[:show_pi], default: true
36
37
  option :config, type: :string, desc: Options.op_strings[:config]
37
38
  def uploads
38
39
  configured?
@@ -49,6 +49,7 @@ module DK
49
49
  @limit = options[:limit]
50
50
  @type = options[:type]
51
51
  @blog_url = tumblr_url(@blog_name)
52
+ @show_pi = options[:show_pi]
52
53
  end
53
54
 
54
55
  # Configure tumblr_client gem
@@ -42,7 +42,7 @@ module DK
42
42
 
43
43
  # Common initialization for post operations
44
44
  def setup_operation(options)
45
- print "Setup\r" unless @mute
45
+ pprint "Setup\r"
46
46
  process_options(options)
47
47
  act_on_blog(name: @blog_name)
48
48
  posts = @shuffle ? shufflex(get_posts.reverse, 3) : get_posts.reverse
@@ -126,7 +126,7 @@ module DK
126
126
  # @param options[:offset] [Int] [:queue] Post index to start reading from
127
127
  # @return [[Post]] Array of Post Hash data
128
128
  def get_posts
129
- print "Getting posts...\r" unless @mute
129
+ pprint "Getting posts...\r"
130
130
  return some_test_data if @test_data
131
131
  return some_posts(offset: @offset) if dashboard?
132
132
  return all_posts.uniq if @greedy || @limit.nil?
@@ -210,14 +210,14 @@ module DK
210
210
  def auto_poster(options = {})
211
211
  process_options(options)
212
212
  act_on_blog(name: @blog_name)
213
- print "Retrieving posts...(can take a while for large queues)\r"
213
+ pprint "Retrieving posts...(can take a while for large queues)\r"
214
214
  posts = all_posts.reverse # FIFO
215
215
  total = posts.size
216
- puts "Found #{total} posts in #{@source.capitalize}#{'s' if @source[0] == 'd'}."
217
- puts 'Press CTRL + C to exit.'
216
+ pputs "Found #{total} posts in #{@source.capitalize}#{'s' if @source[0] == 'd'}."
217
+ pputs 'Press CTRL + C to exit.'
218
218
  interval = 432 # 200 posts / 24 hours = 432sec
219
219
  posts.each_with_index do |current, idx|
220
- print "Publishing post #{idx}/#{total}.\r"
220
+ pprint "Publishing post #{idx}/#{total}.\r"
221
221
  post = Post.new(current, keep_tree: @keep_tags)
222
222
  post.change_state(DK::PUBLISH)
223
223
  post.replace_comment_with(@comment)
@@ -226,15 +226,15 @@ module DK
226
226
  exclude: @comment,
227
227
  credit: true) if @auto_tag
228
228
  unless post.save(client: @client, simulate: @simulate) > 0
229
- puts "Error at Index: #{idx}. Unable to save post!"
230
- puts "reblog_key: #{post.reblog_key}, id: #{post.post_id}"
231
- puts 'Quitting auto-poster.'
229
+ pputs "Error at Index: #{idx}. Unable to save post!"
230
+ pputs "reblog_key: #{post.reblog_key}, id: #{post.post_id}"
231
+ pputs 'Quitting auto-poster.'
232
232
  exit 1
233
233
  end
234
- print "Published #{idx}/#{total} posts. Next post at #{Time.now + interval}\r"
234
+ pprint "Published #{idx}/#{total} posts. Next post at #{Time.now + interval}\r"
235
235
  sleep interval unless idx == total
236
236
  end # End of auto-posting
237
- puts 'Auto-Poster has completed!'
237
+ pputs 'Auto-Poster has completed!'
238
238
  end
239
239
  end
240
240
  end
@@ -164,7 +164,7 @@ module DK
164
164
  end
165
165
 
166
166
  def process_state(state)
167
- return DK::DRAFT unless state
167
+ return DK::DRAFT unless state || state.empty
168
168
  return DK::QUEUE if state == 'queued'
169
169
  state
170
170
  end
@@ -1,6 +1,13 @@
1
1
  module DK
2
2
  # Helper Methods
3
3
  module Posts
4
+ def pputs(str)
5
+ puts str unless @mute || !@show_pi
6
+ end
7
+ def pprint(str)
8
+ puts str unless @mute || !@show_pi
9
+ end
10
+
4
11
  # Display progress percentage
5
12
  # @param current [Int] Progress Counter
6
13
  # @param total [Int] # Items to be processed
@@ -8,9 +15,10 @@ module DK
8
15
  # @param done [Bool] Processing Complete?
9
16
  # @param modified [Int] # of items modified
10
17
  def show_progress(current: 0, total: 0, message: '', done: false, modified: 0)
18
+ return unless @show_pi
11
19
  indicator, newline, progress = setup_done(modified) if done
12
20
  indicator, newline, progress = setup_undone(current, total) unless done
13
- print "#{indicator}#{message}#{progress}#{' ' * 30}\r#{newline}"
21
+ pprint "#{indicator}#{message}#{progress}#{' ' * 30}\r#{newline}"
14
22
  $stdout.flush unless done
15
23
  end
16
24
 
@@ -1,3 +1,3 @@
1
1
  module DK
2
- VERSION = '0.9.0.3'.freeze
2
+ VERSION = '0.9.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tumblr_draftking
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.3
4
+ version: 0.9.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meissa Dia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2018-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tumblr_client