ayadn 1.8.2 → 2.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 +4 -4
- data/.gitignore +4 -0
- data/CHANGELOG.md +73 -52
- data/README.md +17 -3
- data/ayadn.gemspec +3 -4
- data/doc/01-index.md +6 -5
- data/doc/02-install.md +23 -1
- data/doc/03-first-steps.md +22 -28
- data/doc/04-options.md +1 -1
- data/doc/05-streams.md +29 -9
- data/doc/06-post.md +13 -5
- data/doc/07-actions.md +63 -1
- data/doc/08-listings.md +112 -4
- data/doc/09-accounts.md +17 -3
- data/doc/10-nicerank.md +5 -5
- data/doc/11-blacklist.md +8 -14
- data/doc/12-alias.md +1 -13
- data/doc/14-set.md +8 -110
- data/doc/15-nowplaying.md +16 -4
- data/doc/18-contact.md +14 -13
- data/doc/19-examples.md +2 -0
- data/lib/ayadn/action.rb +322 -183
- data/lib/ayadn/alias.rb +17 -45
- data/lib/ayadn/annotations.rb +1 -1
- data/lib/ayadn/api.rb +7 -8
- data/lib/ayadn/app.rb +99 -12
- data/lib/ayadn/authorize.rb +92 -57
- data/lib/ayadn/blacklist.rb +52 -62
- data/lib/ayadn/check.rb +81 -74
- data/lib/ayadn/cnx.rb +77 -26
- data/lib/ayadn/databases.rb +890 -105
- data/lib/ayadn/debug.rb +30 -89
- data/lib/ayadn/descriptions.rb +876 -329
- data/lib/ayadn/endpoints.rb +2 -2
- data/lib/ayadn/errors.rb +9 -9
- data/lib/ayadn/extend.rb +8 -1
- data/lib/ayadn/fileops.rb +10 -8
- data/lib/ayadn/mark.rb +79 -56
- data/lib/ayadn/migration.rb +427 -0
- data/lib/ayadn/nicerank.rb +74 -72
- data/lib/ayadn/nowplaying.rb +123 -60
- data/lib/ayadn/nowwatching.rb +26 -10
- data/lib/ayadn/pinboard.rb +12 -7
- data/lib/ayadn/post.rb +40 -37
- data/lib/ayadn/profile.rb +5 -2
- data/lib/ayadn/scroll.rb +20 -5
- data/lib/ayadn/search.rb +30 -22
- data/lib/ayadn/set.rb +146 -50
- data/lib/ayadn/settings.rb +66 -67
- data/lib/ayadn/status.rb +459 -234
- data/lib/ayadn/stream.rb +80 -46
- data/lib/ayadn/switch.rb +51 -47
- data/lib/ayadn/tvshow.rb +47 -15
- data/lib/ayadn/version.rb +1 -1
- data/lib/ayadn/view.rb +119 -60
- data/lib/ayadn/workers.rb +144 -92
- data/lib/ayadn.rb +7 -8
- data/spec/mock/ayadn/accounts.sqlite +0 -0
- data/spec/mock/ayadn.sqlite +0 -0
- data/spec/unit/annotations_spec.rb +12 -13
- data/spec/unit/api_spec.rb +3 -4
- data/spec/unit/blacklistworkers_spec.rb +18 -23
- data/spec/unit/databases_spec.rb +51 -36
- data/spec/unit/endpoints_spec.rb +5 -2
- data/spec/unit/extend_spec.rb +24 -0
- data/spec/unit/nicerank_spec.rb +13 -13
- data/spec/unit/post_spec.rb +47 -36
- data/spec/unit/set_spec.rb +67 -96
- data/spec/unit/view_spec.rb +12 -6
- data/spec/unit/workers_spec.rb +38 -12
- data/tags +1285 -0
- metadata +29 -39
- data/spec/mock/aliases.db +0 -0
- data/spec/mock/blacklist.db +0 -0
- data/spec/mock/bookmarks.db +0 -0
- data/spec/mock/channels.db +0 -0
- data/spec/mock/index.db +0 -0
- data/spec/mock/nicerank.db +0 -0
- data/spec/mock/pagination.db +0 -0
- data/spec/mock/users.db +0 -0
- data/spec/unit/status_spec.rb +0 -9
data/lib/ayadn/stream.rb
CHANGED
@@ -7,17 +7,19 @@ module Ayadn
|
|
7
7
|
@api = api
|
8
8
|
@view = view
|
9
9
|
@workers = workers
|
10
|
+
@check = Check.new
|
11
|
+
@status = Status.new
|
10
12
|
end
|
11
13
|
|
12
14
|
def global settings
|
13
|
-
Settings.
|
15
|
+
Settings.global[:force] = true if settings[:force]
|
14
16
|
options = settings.dup
|
15
17
|
options[:filter] = nicerank_true()
|
16
18
|
@view.downloading(options)
|
17
19
|
unless options[:scroll]
|
18
20
|
stream = @api.get_global(options)
|
19
|
-
Settings.
|
20
|
-
|
21
|
+
Settings.global[:force] == true ? niceranks = {} : niceranks = NiceRank.new.get_ranks(stream)
|
22
|
+
@check.no_new_posts(stream, options, 'global')
|
21
23
|
Databases.save_max_id(stream, 'global') unless stream['meta']['max_id'].nil?
|
22
24
|
@view.render(stream, options, niceranks)
|
23
25
|
end
|
@@ -43,11 +45,11 @@ module Ayadn
|
|
43
45
|
end
|
44
46
|
|
45
47
|
def stream meth, options, target
|
46
|
-
Settings.
|
48
|
+
Settings.global[:force] = true if options[:force]
|
47
49
|
@view.downloading(options)
|
48
50
|
unless options[:scroll]
|
49
51
|
stream = @api.send("get_#{meth}".to_sym, options)
|
50
|
-
|
52
|
+
@check.no_new_posts(stream, options, target)
|
51
53
|
Databases.save_max_id(stream)
|
52
54
|
@view.render(stream, options)
|
53
55
|
end
|
@@ -60,15 +62,15 @@ module Ayadn
|
|
60
62
|
|
61
63
|
|
62
64
|
def mentions username, options
|
63
|
-
Settings.
|
64
|
-
|
65
|
+
Settings.global[:force] = true if options[:force]
|
66
|
+
@check.no_username(username)
|
65
67
|
username = @workers.add_arobase(username)
|
66
68
|
@view.downloading(options)
|
67
69
|
unless options[:scroll]
|
68
70
|
stream = @api.get_mentions(username, options)
|
69
|
-
|
71
|
+
@check.no_user(stream, username)
|
70
72
|
Databases.save_max_id(stream)
|
71
|
-
|
73
|
+
@check.no_data(stream, 'mentions')
|
72
74
|
options = options.dup
|
73
75
|
options[:in_mentions] = true
|
74
76
|
@view.render(stream, options)
|
@@ -81,16 +83,28 @@ module Ayadn
|
|
81
83
|
end
|
82
84
|
|
83
85
|
def posts username, options
|
84
|
-
Settings.
|
85
|
-
|
86
|
+
Settings.global[:force] = true if options[:force]
|
87
|
+
@check.no_username(username)
|
86
88
|
username = @workers.add_arobase(username)
|
87
89
|
@view.downloading(options)
|
88
90
|
stream = @api.get_posts(username, options)
|
89
|
-
|
91
|
+
@check.no_user(stream, username)
|
90
92
|
Databases.save_max_id(stream) unless stream['meta']['marker'].nil?
|
91
|
-
|
92
|
-
|
93
|
-
|
93
|
+
@check.no_data(stream, 'mentions')
|
94
|
+
unless options[:raw] || Settings.global[:force]
|
95
|
+
# this is just to show a message rather than an empty screen
|
96
|
+
if Settings.options[:blacklist][:active] == true
|
97
|
+
if Databases.is_in_blacklist?('mention', username)
|
98
|
+
@status.no_force("#{username.downcase}")
|
99
|
+
exit
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
if stream['data'][0]['user']['you_muted'] || stream['data'][0]['user']['you_blocked']
|
104
|
+
unless options[:raw] || Settings.global[:force]
|
105
|
+
@status.no_force("#{username.downcase}")
|
106
|
+
exit
|
107
|
+
end
|
94
108
|
end
|
95
109
|
@view.render(stream, options)
|
96
110
|
Scroll.new(@api, @view).posts(username, options) if options[:scroll]
|
@@ -98,36 +112,37 @@ module Ayadn
|
|
98
112
|
end
|
99
113
|
|
100
114
|
def whatstarred(username, options)
|
101
|
-
|
115
|
+
@check.no_username(username)
|
102
116
|
username = @workers.add_arobase(username)
|
103
117
|
@view.downloading(options)
|
104
118
|
stream = @api.get_whatstarred(username, options)
|
105
|
-
|
106
|
-
|
119
|
+
@check.no_user(stream, username)
|
120
|
+
@check.no_data(stream, 'whatstarred')
|
107
121
|
options[:extract] ? @view.all_stars_links(stream) : @view.render(stream, options)
|
122
|
+
puts "\n" if Settings.options[:timeline][:compact] == true
|
108
123
|
end
|
109
124
|
|
110
125
|
def followings(username, options)
|
111
|
-
|
126
|
+
@check.no_username(username)
|
112
127
|
username = @workers.add_arobase(username)
|
113
128
|
@view.downloading(options)
|
114
129
|
show_raw_list(username, :followings, options)
|
115
130
|
list = @api.get_followings(username)
|
116
|
-
|
131
|
+
@check.auto_save_followings(list)
|
117
132
|
Errors.no_data('followings') if list.empty?
|
118
|
-
@view.list(:followings, list, username)
|
133
|
+
@view.list(:followings, list, username, options)
|
119
134
|
Databases.add_to_users_db_from_list(list)
|
120
135
|
end
|
121
136
|
|
122
137
|
def followers(username, options)
|
123
|
-
|
138
|
+
@check.no_username(username)
|
124
139
|
username = @workers.add_arobase(username)
|
125
140
|
@view.downloading(options)
|
126
141
|
show_raw_list(username, :followers, options)
|
127
142
|
list = @api.get_followers(username)
|
128
|
-
|
143
|
+
@check.auto_save_followers(list)
|
129
144
|
Errors.no_data('followers') if list.empty?
|
130
|
-
@view.list(:followers, list, username)
|
145
|
+
@view.list(:followers, list, username, options)
|
131
146
|
Databases.add_to_users_db_from_list(list)
|
132
147
|
end
|
133
148
|
|
@@ -135,9 +150,9 @@ module Ayadn
|
|
135
150
|
@view.downloading(options)
|
136
151
|
show_raw_list(nil, :muted, options)
|
137
152
|
list = @api.get_muted
|
138
|
-
|
153
|
+
@check.auto_save_muted(list)
|
139
154
|
Errors.no_data('muted') if list.empty?
|
140
|
-
@view.list(:muted, list, nil)
|
155
|
+
@view.list(:muted, list, nil, options)
|
141
156
|
Databases.add_to_users_db_from_list(list)
|
142
157
|
end
|
143
158
|
|
@@ -146,7 +161,7 @@ module Ayadn
|
|
146
161
|
show_raw_list(nil, :blocked, options)
|
147
162
|
list = @api.get_blocked
|
148
163
|
Errors.no_data('blocked') if list.empty?
|
149
|
-
@view.list(:blocked, list, nil)
|
164
|
+
@view.list(:blocked, list, nil, options)
|
150
165
|
Databases.add_to_users_db_from_list(list)
|
151
166
|
end
|
152
167
|
|
@@ -156,42 +171,59 @@ module Ayadn
|
|
156
171
|
@view.if_raw(stream, options)
|
157
172
|
@view.clear_screen
|
158
173
|
@view.show_interactions(stream['data'])
|
174
|
+
puts "\n" if Settings.options[:timeline][:compact] == true
|
159
175
|
end
|
160
176
|
|
161
177
|
def whoreposted(post_id, options)
|
162
|
-
|
178
|
+
@check.bad_post_id(post_id)
|
179
|
+
unless options[:force]
|
180
|
+
post_id = @workers.get_real_post_id(post_id)
|
181
|
+
end
|
163
182
|
@view.downloading(options)
|
164
183
|
details = @api.get_details(post_id, options)
|
165
|
-
|
184
|
+
@check.no_post(details, post_id)
|
166
185
|
id = @workers.get_original_id(post_id, details)
|
167
186
|
list = @api.get_whoreposted(id)
|
168
187
|
@view.if_raw(list, options)
|
169
|
-
|
188
|
+
if list['data'].empty?
|
189
|
+
@status.nobody_reposted
|
190
|
+
exit
|
191
|
+
end
|
170
192
|
@view.list(:whoreposted, list['data'], post_id)
|
171
193
|
end
|
172
194
|
|
173
195
|
def whostarred(post_id, options)
|
174
|
-
|
196
|
+
@check.bad_post_id(post_id)
|
197
|
+
unless options[:force]
|
198
|
+
post_id = @workers.get_real_post_id(post_id)
|
199
|
+
end
|
175
200
|
@view.downloading(options)
|
176
201
|
details = @api.get_details(post_id, options)
|
177
|
-
|
202
|
+
@check.no_post(details, post_id)
|
178
203
|
id = @workers.get_original_id(post_id, details)
|
179
204
|
list = @api.get_whostarred(id)
|
180
205
|
@view.if_raw(list, options)
|
181
|
-
|
206
|
+
if list['data'].empty?
|
207
|
+
@status.nobody_starred
|
208
|
+
exit
|
209
|
+
end
|
182
210
|
@view.list(:whostarred, list['data'], id)
|
183
211
|
end
|
184
212
|
|
185
213
|
def convo(post_id, options)
|
186
|
-
|
187
|
-
|
214
|
+
@check.bad_post_id(post_id)
|
215
|
+
if options[:force]
|
216
|
+
Settings.global[:force] = true
|
217
|
+
else
|
218
|
+
post_id = @workers.get_real_post_id(post_id)
|
219
|
+
end
|
188
220
|
@view.downloading(options)
|
189
221
|
details = @api.get_details(post_id, options)
|
190
|
-
|
222
|
+
@check.no_post(details, post_id)
|
191
223
|
id = @workers.get_original_id(post_id, details)
|
192
224
|
stream = @api.get_convo(id, options)
|
193
|
-
|
194
|
-
Databases.
|
225
|
+
@check.no_post(stream, id)
|
226
|
+
Databases.pagination_insert("replies:#{id}", stream['meta']['max_id'])
|
195
227
|
options = options.dup
|
196
228
|
options[:reply_to] = details['data']['reply_to'].to_i unless details['data']['reply_to'].nil?
|
197
229
|
options[:post_id] = post_id.to_i
|
@@ -202,14 +234,14 @@ module Ayadn
|
|
202
234
|
|
203
235
|
def messages(channel_id, options)
|
204
236
|
if options[:silent]
|
205
|
-
Settings.options[:marker][:
|
237
|
+
Settings.options[:marker][:messages] = false
|
206
238
|
end
|
207
239
|
channel_id = @workers.get_channel_id_from_alias(channel_id)
|
208
240
|
@view.downloading(options)
|
209
241
|
resp = @api.get_messages(channel_id, options)
|
210
242
|
name = "channel:#{channel_id}"
|
211
|
-
|
212
|
-
if Settings.options[:marker][:
|
243
|
+
@check.no_new_posts(resp, options, name)
|
244
|
+
if Settings.options[:marker][:messages] == true
|
213
245
|
unless resp['meta']['max_id'].nil?
|
214
246
|
marked = @api.update_marker(name, resp['meta']['max_id'])
|
215
247
|
updated = JSON.parse(marked)
|
@@ -220,22 +252,23 @@ module Ayadn
|
|
220
252
|
end
|
221
253
|
Databases.save_max_id(resp)
|
222
254
|
@view.if_raw(resp, options)
|
223
|
-
|
255
|
+
@check.no_data(resp, 'messages') unless options[:scroll]
|
224
256
|
@view.render(resp, options)
|
225
257
|
Scroll.new(@api, @view).messages(channel_id, options) if options[:scroll]
|
226
258
|
puts "\n" if Settings.options[:timeline][:compact] && options[:raw].nil?
|
227
259
|
end
|
228
260
|
|
229
261
|
def random_posts(options)
|
262
|
+
Settings.global[:force] = true
|
230
263
|
#_, cols = @view.winsize
|
231
264
|
#max_posts = cols / 16
|
232
265
|
max_posts = 6
|
233
266
|
@view.clear_screen
|
234
|
-
|
267
|
+
@status.info("connected", "fetching random posts", "cyan")
|
235
268
|
@max_id = @api.get_global({count: 1})['meta']['max_id'].to_i
|
236
269
|
@view.clear_screen
|
237
270
|
counter = 1
|
238
|
-
wait = options[:wait] ||
|
271
|
+
wait = options[:wait] || 10
|
239
272
|
loop do
|
240
273
|
begin
|
241
274
|
@random_post_id = rand(@max_id)
|
@@ -245,14 +278,15 @@ module Ayadn
|
|
245
278
|
counter += 1
|
246
279
|
if counter == max_posts
|
247
280
|
wait.downto(1) do |i|
|
248
|
-
print "\r#{sprintf("%02d", i)} sec...
|
281
|
+
print "\r#{sprintf("%02d", i)} sec... ([CTRL+C] to quit)".color(:cyan)
|
249
282
|
sleep 1
|
250
283
|
end
|
251
284
|
@view.clear_screen
|
252
285
|
counter = 1
|
253
286
|
end
|
254
287
|
rescue Interrupt
|
255
|
-
|
288
|
+
@status.canceled
|
289
|
+
exit
|
256
290
|
end
|
257
291
|
end
|
258
292
|
end
|
data/lib/ayadn/switch.rb
CHANGED
@@ -2,72 +2,76 @@
|
|
2
2
|
module Ayadn
|
3
3
|
class Switch
|
4
4
|
|
5
|
+
def initialize
|
6
|
+
@thor = Thor::Shell::Color.new # local statuses
|
7
|
+
@status = Status.new # global statuses + utils
|
8
|
+
@acc_db = Amalgalite::Database.new(Dir.home + "/ayadn/accounts.sqlite")
|
9
|
+
end
|
10
|
+
|
5
11
|
def list
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
puts "\n"
|
13
|
+
accounts = Databases.all_accounts(@acc_db)
|
14
|
+
please if accounts.empty?
|
15
|
+
accounts.sort_by! { |acc| acc[0] }
|
16
|
+
table = Terminal::Table.new do |t|
|
17
|
+
t.style = { :width => 80 }
|
18
|
+
t.title = "Ayadn accounts"
|
19
|
+
t.headings = ['Username', 'ID', 'Path']
|
20
|
+
end
|
21
|
+
accounts.each do |acc|
|
22
|
+
username = acc[2]
|
23
|
+
id = acc[1].to_s
|
24
|
+
path = "~/ayadn/#{File.basename(acc[3])}"
|
25
|
+
if acc[4] == 1
|
26
|
+
username = username.color(:green)
|
27
|
+
id = id.color(:green)
|
28
|
+
path = path.color(:green)
|
23
29
|
end
|
24
|
-
|
25
|
-
please
|
30
|
+
table << [username, id, path]
|
26
31
|
end
|
32
|
+
puts table
|
33
|
+
puts "\n"
|
27
34
|
end
|
28
35
|
|
29
36
|
def switch(user)
|
30
37
|
if user.empty? || user.nil?
|
31
|
-
|
38
|
+
@status.no_username
|
32
39
|
exit
|
33
40
|
end
|
34
|
-
#puts "\e[H\e[2J"
|
35
41
|
username = Workers.new.remove_arobase_if_present([user.first])[0]
|
36
|
-
|
37
|
-
if
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
accounts = Databases.all_accounts(@acc_db)
|
43
|
+
please if accounts.empty?
|
44
|
+
active = accounts.select { |acc| acc[4] == 1 }[0]
|
45
|
+
active_user = active[0]
|
46
|
+
if username == active_user
|
47
|
+
@status.say do
|
48
|
+
@thor.say_status :done, "already authorized with username @#{username}", :green
|
43
49
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
puts "\nThis account isn't in the database. Please run 'ayadn authorize'.\n".color(:red)
|
52
|
-
cancel(accounts_db)
|
50
|
+
exit
|
51
|
+
end
|
52
|
+
flag = accounts.select { |acc| acc[0] == username }.flatten
|
53
|
+
if flag.empty?
|
54
|
+
@status.say do
|
55
|
+
@thor.say_status :error, "@#{username} isn't in the database", :red
|
56
|
+
@thor.say_status :next, "please run `ayadn -auth` to authorize this account", :yellow
|
53
57
|
end
|
58
|
+
exit
|
54
59
|
else
|
55
|
-
|
60
|
+
@status.say do
|
61
|
+
@thor.say_status :switching, "from @#{active_user} to @#{username}", :cyan
|
62
|
+
Databases.set_active_account(@acc_db, username)
|
63
|
+
@thor.say_status :done, "@#{username} is now the active account", :green
|
64
|
+
end
|
65
|
+
exit
|
56
66
|
end
|
57
67
|
end
|
58
68
|
|
59
69
|
private
|
60
70
|
|
61
|
-
def cancel(accounts_db)
|
62
|
-
accounts_db.close
|
63
|
-
exit
|
64
|
-
end
|
65
|
-
def close_db(db)
|
66
|
-
db.flush
|
67
|
-
db.close
|
68
|
-
end
|
69
71
|
def please
|
70
|
-
|
72
|
+
@status.say do
|
73
|
+
@thor.say_status :error, "please run `ayadn -auth` to authorize an account", :red
|
74
|
+
end
|
71
75
|
exit
|
72
76
|
end
|
73
77
|
end
|
data/lib/ayadn/tvshow.rb
CHANGED
@@ -3,7 +3,13 @@ module Ayadn
|
|
3
3
|
|
4
4
|
class TvShow
|
5
5
|
|
6
|
-
|
6
|
+
begin
|
7
|
+
require 'tvdb_party'
|
8
|
+
rescue LoadError => e
|
9
|
+
puts "\nAYADN: Error while loading Gems\n\n"
|
10
|
+
puts "RUBY: #{e}\n\n"
|
11
|
+
exit
|
12
|
+
end
|
7
13
|
|
8
14
|
AYADN_TVDB_API_KEY = 'E874ACBC542CAA53'
|
9
15
|
|
@@ -13,28 +19,37 @@ module Ayadn
|
|
13
19
|
@language = 'en'
|
14
20
|
@view = View.new
|
15
21
|
@tvdb = TvdbParty::Search.new(AYADN_TVDB_API_KEY)
|
22
|
+
@status = Status.new
|
16
23
|
end
|
17
24
|
|
18
25
|
def find title
|
19
26
|
res = find_all(title)
|
20
|
-
|
27
|
+
if res[0].nil?
|
28
|
+
@status.no_show
|
29
|
+
exit
|
30
|
+
end
|
21
31
|
if res[0].has_key?('FirstAired')
|
22
32
|
return @tvdb.get_series_by_id(res[0]['seriesid'])
|
23
33
|
else
|
24
34
|
return @tvdb.get_series_by_id(res[1]['seriesid']) unless res[1].nil?
|
25
35
|
end
|
26
|
-
|
36
|
+
@status.no_show
|
37
|
+
exit
|
27
38
|
end
|
28
39
|
|
29
40
|
def find_alt title
|
30
41
|
res = find_all(title)
|
31
|
-
|
42
|
+
if res[0].nil?
|
43
|
+
@status.no_show
|
44
|
+
exit
|
45
|
+
end
|
32
46
|
if res[0].has_key?('FirstAired')
|
33
47
|
return @tvdb.get_series_by_id(res[1]['seriesid']) unless res[1].nil?
|
34
48
|
else
|
35
49
|
return @tvdb.get_series_by_id(res[2]['seriesid']) unless res[2].nil?
|
36
50
|
end
|
37
|
-
|
51
|
+
@status.no_show
|
52
|
+
exit
|
38
53
|
end
|
39
54
|
|
40
55
|
def create_details show_obj
|
@@ -65,10 +80,15 @@ module Ayadn
|
|
65
80
|
|
66
81
|
def ok
|
67
82
|
@view.clear_screen
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
puts "\n
|
83
|
+
@status.writing
|
84
|
+
@status.to_be_posted
|
85
|
+
thor = Thor::Shell::Basic.new
|
86
|
+
puts "\n"
|
87
|
+
@text.split("\n").each do |line|
|
88
|
+
thor.say_status(nil, line.color(Settings.options[:colors][:excerpt]))
|
89
|
+
end
|
90
|
+
puts "\n"
|
91
|
+
@status.ok?
|
72
92
|
STDIN.getch == ("y" || "Y") ? true : false
|
73
93
|
end
|
74
94
|
|
@@ -82,7 +102,7 @@ module Ayadn
|
|
82
102
|
FileOps.download_url(filename, @poster_url)
|
83
103
|
end
|
84
104
|
@view.clear_screen
|
85
|
-
|
105
|
+
@status.info("uploading", "show poster", "yellow")
|
86
106
|
options[:embed] = ["#{Settings.config[:paths][:downloads]}/#{filename}"]
|
87
107
|
options[:tvshow] = true
|
88
108
|
dic = {
|
@@ -92,14 +112,16 @@ module Ayadn
|
|
92
112
|
source: 'TVDb'
|
93
113
|
}
|
94
114
|
resp = Post.new.post(dic)
|
95
|
-
FileOps.save_post(resp) if Settings.options[:backup][:
|
115
|
+
FileOps.save_post(resp) if Settings.options[:backup][:posts]
|
96
116
|
@view.clear_screen
|
97
|
-
|
117
|
+
@status.yourpost
|
118
|
+
puts "\n\n"
|
98
119
|
@view.show_posted(resp)
|
99
120
|
end
|
100
121
|
|
101
122
|
def cancel
|
102
|
-
|
123
|
+
@status.canceled
|
124
|
+
exit
|
103
125
|
end
|
104
126
|
|
105
127
|
private
|
@@ -110,12 +132,22 @@ module Ayadn
|
|
110
132
|
|
111
133
|
def find_poster_url show_obj
|
112
134
|
poster = show_obj.posters(@language).first
|
113
|
-
poster.nil?
|
135
|
+
if poster.nil?
|
136
|
+
@status.no_show_infos
|
137
|
+
exit
|
138
|
+
else
|
139
|
+
poster.url
|
140
|
+
end
|
114
141
|
end
|
115
142
|
|
116
143
|
def find_banner_url show_obj
|
117
144
|
banner = show_obj.series_banners(@language).first
|
118
|
-
banner.nil?
|
145
|
+
if banner.nil?
|
146
|
+
@status.no_show_infos
|
147
|
+
exit
|
148
|
+
else
|
149
|
+
banner.url
|
150
|
+
end
|
119
151
|
end
|
120
152
|
|
121
153
|
def find_plot show_obj
|
data/lib/ayadn/version.rb
CHANGED