ayadn 1.8.2 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/status.rb
CHANGED
@@ -1,325 +1,550 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Ayadn
|
3
3
|
class Status
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
"\nUploading file#{pl} to ADN...".color(:cyan)
|
19
|
-
end
|
20
|
-
def self.posting
|
21
|
-
"Posting to ADN...\n\n".inverse
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@thor = Thor::Shell::Color.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def done
|
10
|
+
info("done", "", "green")
|
11
|
+
end
|
12
|
+
|
13
|
+
def canceled
|
14
|
+
say do
|
15
|
+
puts "\n"
|
16
|
+
@thor.say_status :canceled, "", :red
|
17
|
+
end
|
22
18
|
end
|
23
|
-
|
24
|
-
|
19
|
+
|
20
|
+
def downloaded(name)
|
21
|
+
info("downloaded", "#{Settings.config[:paths][:downloads]}/#{name}", "green")
|
25
22
|
end
|
26
|
-
|
27
|
-
|
23
|
+
|
24
|
+
def links_saved(name)
|
25
|
+
info("done", "links exported to file #{Settings.config[:paths][:lists]}/#{name}", "green")
|
28
26
|
end
|
29
|
-
|
30
|
-
|
27
|
+
|
28
|
+
def downloading
|
29
|
+
info("connected", "downloading from ADN", "yellow")
|
31
30
|
end
|
32
|
-
|
33
|
-
|
31
|
+
|
32
|
+
def posting
|
33
|
+
info("connected", "posting to ADN", "yellow")
|
34
34
|
end
|
35
|
-
|
36
|
-
|
35
|
+
|
36
|
+
def deleting_post(post_id)
|
37
|
+
@thor.say_status :deleting, "post #{post_id}", :yellow
|
37
38
|
end
|
38
|
-
|
39
|
-
|
39
|
+
|
40
|
+
def deleting_message(message_id)
|
41
|
+
@thor.say_status :deleting, "message #{message_id}", :yellow
|
40
42
|
end
|
41
|
-
|
42
|
-
|
43
|
+
|
44
|
+
def unfollowing(username)
|
45
|
+
@thor.say_status :unfollowing, username, :yellow
|
43
46
|
end
|
44
|
-
|
45
|
-
|
47
|
+
|
48
|
+
def following(username)
|
49
|
+
@thor.say_status :following, username, :yellow
|
46
50
|
end
|
47
|
-
|
48
|
-
|
51
|
+
|
52
|
+
def unmuting(username)
|
53
|
+
@thor.say_status :unmuting, username, :yellow
|
49
54
|
end
|
50
|
-
|
51
|
-
|
55
|
+
|
56
|
+
def muting(username)
|
57
|
+
@thor.say_status :muting, username, :yellow
|
52
58
|
end
|
53
|
-
|
54
|
-
|
59
|
+
|
60
|
+
def unblocking(username)
|
61
|
+
@thor.say_status :unblocking, username, :yellow
|
55
62
|
end
|
56
|
-
|
57
|
-
|
63
|
+
|
64
|
+
def blocking(username)
|
65
|
+
@thor.say_status :blocking, username, :yellow
|
58
66
|
end
|
59
|
-
|
60
|
-
|
67
|
+
|
68
|
+
def unreposting(post_id)
|
69
|
+
@thor.say_status :unreposting, "post #{post_id}", :yellow
|
61
70
|
end
|
62
|
-
|
63
|
-
|
71
|
+
|
72
|
+
def reposting(post_id)
|
73
|
+
@thor.say_status :reposting, "post #{post_id}", :yellow
|
64
74
|
end
|
65
|
-
|
66
|
-
|
75
|
+
|
76
|
+
def unstarring(post_id)
|
77
|
+
@thor.say_status :unstarring, "post #{post_id}", :yellow
|
67
78
|
end
|
68
|
-
|
69
|
-
|
79
|
+
|
80
|
+
def starring(post_id)
|
81
|
+
@thor.say_status :starring, "post #{post_id}", :yellow
|
70
82
|
end
|
71
|
-
|
72
|
-
|
83
|
+
|
84
|
+
def not_deleted(post_id)
|
85
|
+
info("error", "could not delete post #{post_id} (post isn't yours, or is already deleted)", "red")
|
73
86
|
end
|
74
|
-
|
75
|
-
|
87
|
+
|
88
|
+
def not_deleted_m(post_id)
|
89
|
+
info("error", "could not delete post #{post_id} (post isn't yours, or is already deleted)", "red")
|
76
90
|
end
|
77
|
-
|
78
|
-
|
91
|
+
|
92
|
+
def not_starred(post_id)
|
93
|
+
info("error", "could not star post #{post_id} (post doesn't exist, or is already starred)", "red")
|
79
94
|
end
|
80
|
-
|
81
|
-
|
95
|
+
|
96
|
+
def not_unreposted(post_id)
|
97
|
+
info("error", "could not unrepost post #{post_id} (post isn't yours, isn't a repost, or has been deleted)", "red")
|
82
98
|
end
|
83
|
-
|
84
|
-
|
99
|
+
|
100
|
+
def not_reposted(post_id)
|
101
|
+
info("error", "could not repost post #{post_id} (post has been deleted?)", "red")
|
85
102
|
end
|
86
|
-
|
87
|
-
|
103
|
+
|
104
|
+
def not_unstarred(post_id)
|
105
|
+
info("error", "could not unstar post #{post_id} (post isn't yours, isn't starred, or has been deleted)", "red")
|
88
106
|
end
|
89
|
-
|
90
|
-
|
107
|
+
|
108
|
+
def not_unfollowed(username)
|
109
|
+
info("error", "could not unfollow user #{username} (doesn't exist, or wasn't already followed)", "red")
|
91
110
|
end
|
92
|
-
|
93
|
-
|
111
|
+
|
112
|
+
def not_followed(username)
|
113
|
+
info("error", "could not follow user #{username} (doesn't exist, or you already follow)", "red")
|
94
114
|
end
|
95
|
-
|
96
|
-
|
115
|
+
|
116
|
+
def not_unmuted(username)
|
117
|
+
info("error", "could not unmute user #{username} (doesn't exist, or wasn't already muted)", "red")
|
97
118
|
end
|
98
|
-
|
99
|
-
|
119
|
+
|
120
|
+
def not_muted(username)
|
121
|
+
info("error", "could not mute user #{username} (doesn't exist, or is already muted)", "red")
|
100
122
|
end
|
101
|
-
|
102
|
-
|
123
|
+
|
124
|
+
def not_unblocked(username)
|
125
|
+
info("error", "could not unblock user #{username} (doesn't exist, or wasn't already blocked)", "red")
|
103
126
|
end
|
104
|
-
|
105
|
-
|
127
|
+
|
128
|
+
def not_blocked(username)
|
129
|
+
info("error", "could not block user #{username} (doesn't exist, or is already blocked)", "red")
|
106
130
|
end
|
107
|
-
|
108
|
-
|
131
|
+
|
132
|
+
def deleted(post_id)
|
133
|
+
info("deleted", "post #{post_id}", "green")
|
109
134
|
end
|
110
|
-
|
111
|
-
|
135
|
+
|
136
|
+
def deleted_m(message_id)
|
137
|
+
info("deleted", "message #{message_id}", "green")
|
112
138
|
end
|
113
|
-
|
114
|
-
|
139
|
+
|
140
|
+
def starred(post_id)
|
141
|
+
info("starred", "post #{post_id}", "green")
|
115
142
|
end
|
116
|
-
|
117
|
-
|
143
|
+
|
144
|
+
def unreposted(post_id)
|
145
|
+
info("unreposted", "post #{post_id}", "green")
|
118
146
|
end
|
119
|
-
|
120
|
-
|
147
|
+
|
148
|
+
def reposted(post_id)
|
149
|
+
info("reposted", "post #{post_id}", "green")
|
121
150
|
end
|
122
|
-
|
123
|
-
|
151
|
+
|
152
|
+
def unstarred(post_id)
|
153
|
+
info("unstarred", "post #{post_id}", "green")
|
124
154
|
end
|
125
|
-
|
126
|
-
|
155
|
+
|
156
|
+
def already_starred
|
157
|
+
info("ok", "already starred", "green")
|
127
158
|
end
|
128
|
-
|
129
|
-
|
159
|
+
|
160
|
+
def already_reposted
|
161
|
+
info("ok", "already reposted", "green")
|
130
162
|
end
|
131
|
-
|
132
|
-
|
163
|
+
|
164
|
+
def unfollowed(username)
|
165
|
+
info("unfollowed", username, "green")
|
133
166
|
end
|
134
|
-
|
135
|
-
|
167
|
+
|
168
|
+
def followed(username)
|
169
|
+
info("followed", username, "green")
|
136
170
|
end
|
137
|
-
|
138
|
-
|
171
|
+
|
172
|
+
def unmuted(username)
|
173
|
+
info("unmuted", username, "green")
|
139
174
|
end
|
140
|
-
|
141
|
-
|
175
|
+
|
176
|
+
def muted(username)
|
177
|
+
info("muted", username, "green")
|
142
178
|
end
|
143
|
-
|
144
|
-
|
179
|
+
|
180
|
+
def unblocked(username)
|
181
|
+
info("unblocked", username, "green")
|
145
182
|
end
|
146
|
-
|
147
|
-
|
183
|
+
|
184
|
+
def blocked(username)
|
185
|
+
info("blocked", username, "green")
|
148
186
|
end
|
149
|
-
|
150
|
-
|
187
|
+
|
188
|
+
def error_missing_title
|
189
|
+
info("error", "please specify (part of) a movie title", "red")
|
151
190
|
end
|
152
|
-
|
153
|
-
|
191
|
+
|
192
|
+
def error_missing_username
|
193
|
+
info("error", "please specify a username", "red")
|
154
194
|
end
|
155
|
-
|
156
|
-
|
195
|
+
|
196
|
+
def error_missing_post_id
|
197
|
+
info("error", "please specify a post id", "red")
|
157
198
|
end
|
158
|
-
|
159
|
-
|
199
|
+
|
200
|
+
def error_missing_message_id
|
201
|
+
info("error", "please specify a message id", "red")
|
160
202
|
end
|
161
|
-
|
162
|
-
|
203
|
+
|
204
|
+
def error_missing_channel_id
|
205
|
+
info("error", "please specify a channel id", "red")
|
163
206
|
end
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
"
|
207
|
+
|
208
|
+
def error_missing_parameters
|
209
|
+
say do
|
210
|
+
@thor.say_status :error, "please submit valid items", :red
|
211
|
+
@thor.say_status :info, "see `ayadn -sg` for a list of valid parameters and values", :cyan
|
169
212
|
end
|
170
213
|
end
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
"
|
200
|
-
end
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
"\n No new messages since your last visit.\n".color(:cyan)
|
209
|
-
end
|
210
|
-
def self.type_and_target_missing
|
211
|
-
"\nYou have to submit a TYPE (mention, hashtag, client name) and a TARGET (a @username, a hashtag, a client name)\n\n".color(:red)
|
212
|
-
end
|
213
|
-
def self.wrong_arguments
|
214
|
-
"\nYou have to submit valid arguments.\n\n".color(:red)
|
214
|
+
|
215
|
+
def empty_list
|
216
|
+
info("info", "the list is empty", "yellow")
|
217
|
+
end
|
218
|
+
|
219
|
+
def writing
|
220
|
+
puts "\n"
|
221
|
+
@thor.say_status "author", "#{Settings.config[:identity][:handle]}", "cyan"
|
222
|
+
puts "\n"
|
223
|
+
end
|
224
|
+
|
225
|
+
def yourmessage username = nil
|
226
|
+
if username.nil?
|
227
|
+
@thor.say_status "", "Your message:"
|
228
|
+
else
|
229
|
+
@thor.say_status "", "Your message to #{username}:"
|
230
|
+
end
|
231
|
+
puts "\n\n"
|
232
|
+
end
|
233
|
+
|
234
|
+
def message_from(username)
|
235
|
+
puts "\n"
|
236
|
+
@thor.say_status "from", "#{Settings.config[:identity][:handle]}", "yellow"
|
237
|
+
@thor.say_status "to", "#{username[0]}", "yellow"
|
238
|
+
end
|
239
|
+
|
240
|
+
def replying_to(post_id)
|
241
|
+
puts "\n"
|
242
|
+
@thor.say_status "replying", "to post #{post_id}", "yellow"
|
243
|
+
end
|
244
|
+
|
245
|
+
def readline
|
246
|
+
say do
|
247
|
+
@thor.say_status :next, "type your text", :cyan
|
248
|
+
@thor.say_status :ok, "[CTRL+D] to validate", :cyan
|
249
|
+
@thor.say_status :cancel, "[CTRL+C] to cancel", :cyan
|
250
|
+
end
|
215
251
|
end
|
216
|
-
|
217
|
-
|
252
|
+
|
253
|
+
def reply
|
254
|
+
@thor.say_status "max", "#{Settings.config[:post_max_length]} characters", "cyan"
|
218
255
|
end
|
219
|
-
|
220
|
-
|
256
|
+
|
257
|
+
def post
|
258
|
+
@thor.say_status "max", "#{Settings.config[:post_max_length]} characters", "cyan"
|
221
259
|
end
|
222
|
-
|
223
|
-
|
260
|
+
|
261
|
+
def message
|
262
|
+
@thor.say_status "max", "#{Settings.config[:message_max_length]} characters", "cyan"
|
224
263
|
end
|
225
|
-
|
226
|
-
|
264
|
+
|
265
|
+
def valid_colors(colors_list)
|
266
|
+
@thor.say_status "info", "valid colors:", "cyan"
|
267
|
+
say { puts colors_list }
|
227
268
|
end
|
228
|
-
|
229
|
-
|
269
|
+
|
270
|
+
def must_be_integer
|
271
|
+
info("error", "this paramater must be an integer between 1 and 200", "red")
|
230
272
|
end
|
231
|
-
|
232
|
-
|
273
|
+
|
274
|
+
def no_new_posts
|
275
|
+
info("info", "no new posts since your last visit with Ayadn", "cyan")
|
233
276
|
end
|
234
|
-
|
235
|
-
|
277
|
+
|
278
|
+
def no_new_messages
|
279
|
+
info("info", "no new messages", "cyan")
|
236
280
|
end
|
237
|
-
|
238
|
-
|
281
|
+
|
282
|
+
def type_and_target_missing
|
283
|
+
info("error", "please submit a TYPE ('mention', 'hashtag', 'client') and a TARGET (a @username, a hashtag, a client name)", "red")
|
239
284
|
end
|
240
|
-
|
241
|
-
|
285
|
+
|
286
|
+
def wrong_arguments
|
287
|
+
info("error", "invalid arguments", "red")
|
242
288
|
end
|
243
|
-
|
244
|
-
|
289
|
+
|
290
|
+
def no_pin_creds
|
291
|
+
info("error", "Ayadn couldn't find your Pinboard credentials", "red")
|
245
292
|
end
|
246
|
-
|
247
|
-
|
293
|
+
|
294
|
+
def pin_creds_saved
|
295
|
+
info("done", "credentials successfully encoded and saved", "green")
|
248
296
|
end
|
249
|
-
|
250
|
-
|
297
|
+
|
298
|
+
def saving_pin
|
299
|
+
info("saving", "post text and links to Pinboard", "yellow")
|
251
300
|
end
|
252
|
-
|
253
|
-
|
301
|
+
|
302
|
+
def error_only_osx
|
303
|
+
say do
|
304
|
+
@thor.say_status :error, "this feature only works with iTunes by default", :red
|
305
|
+
@thor.say_status :info, "if you've got a Last.fm account, use `ayadn -NP --lastfm` (short: `-l`)", :cyan
|
306
|
+
end
|
254
307
|
end
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
view << "At any moment, starting now, hit CTRL+C to exit.\n\n".color(:yellow)
|
259
|
-
view << "\n\t--AUTO POSTING MODE ACTIVATED--\n\n".color(:red)
|
308
|
+
|
309
|
+
def empty_fields
|
310
|
+
info("canceled", "couldn't get enough information (empty field)", "red")
|
260
311
|
end
|
261
|
-
|
262
|
-
|
312
|
+
|
313
|
+
def not_authorized
|
314
|
+
say do
|
315
|
+
@thor.say_status :error, "no user authorized", :red
|
316
|
+
@thor.say_status :auth, "please run `ayadn -auth` to authorize an account", :yellow
|
317
|
+
end
|
263
318
|
end
|
264
|
-
|
265
|
-
|
319
|
+
|
320
|
+
def wtf
|
321
|
+
info("error", "an unkown error happened", "red")
|
266
322
|
end
|
267
|
-
|
268
|
-
|
323
|
+
|
324
|
+
def redirecting
|
325
|
+
say do
|
326
|
+
@thor.say_status :info, "post is a repost", :cyan
|
327
|
+
@thor.say_status :action, "redirecting", :yellow
|
328
|
+
end
|
269
329
|
end
|
270
|
-
|
271
|
-
|
330
|
+
|
331
|
+
def nobody_reposted
|
332
|
+
info("error", "nobody reposted this post", "red")
|
333
|
+
end
|
334
|
+
|
335
|
+
def nobody_starred
|
336
|
+
info("error", "nobody starred this post", "red")
|
337
|
+
end
|
338
|
+
|
339
|
+
def not_your_repost
|
340
|
+
info("error", "this post isn't one of your reposts", "red")
|
341
|
+
end
|
342
|
+
|
343
|
+
def not_your_starred
|
344
|
+
info("error", "this isn't one of your starred posts", "red")
|
345
|
+
end
|
346
|
+
|
347
|
+
def auto
|
348
|
+
say do
|
349
|
+
@thor.say_status :info, "entering the auto posting mode", :cyan
|
350
|
+
@thor.say_status :info, "each line you type (each time you hit ENTER) is automatically posted to ADN", :cyan
|
351
|
+
@thor.say_status :info, "at any moment, starting now, hit CTRL+C to exit", :cyan
|
352
|
+
@thor.say_status :info, "AUTO POSTING MODE ACTIVATED", :yellow
|
353
|
+
end
|
272
354
|
end
|
273
|
-
|
274
|
-
|
355
|
+
|
356
|
+
def threshold
|
357
|
+
say do
|
358
|
+
@thor.say_status :error, "please enter a value between 0.1 and 3.5", :red
|
359
|
+
@thor.say_status :info, "example: 2.1", :green
|
360
|
+
end
|
275
361
|
end
|
276
|
-
|
277
|
-
|
362
|
+
|
363
|
+
def must_be_in_index
|
364
|
+
info("error", "number must be in the range of the indexed posts", "red")
|
365
|
+
end
|
366
|
+
|
367
|
+
def user_404(username)
|
368
|
+
info("error", "user #{username} doesn't exist (it could be a deleted account)", "red")
|
369
|
+
end
|
370
|
+
|
371
|
+
def post_404(post_id)
|
372
|
+
info("error", "impossible to find #{post_id} (it may have been deleted)", "red")
|
373
|
+
end
|
374
|
+
|
375
|
+
def no_alias
|
376
|
+
info("error", "this alias doesn't exist", "red")
|
377
|
+
end
|
378
|
+
|
379
|
+
def no_itunes
|
380
|
+
info("canceled", "unable to get info from iTunes", "red")
|
381
|
+
end
|
382
|
+
|
383
|
+
def pin_username
|
384
|
+
info("please", "enter your Pinboard username (CTRL+C to cancel)", "green")
|
385
|
+
end
|
386
|
+
|
387
|
+
def pin_password
|
388
|
+
info("please", "enter your Pinboard password (invisible, CTRL+C to cancel)", "green")
|
389
|
+
end
|
390
|
+
|
391
|
+
def too_long(size, max_size)
|
392
|
+
diff = size - max_size
|
393
|
+
diff > 1 ? pl = "s" : pl = ""
|
394
|
+
say do
|
395
|
+
@thor.say_status :error, "text too long", :red
|
396
|
+
@thor.say_status :info, "#{max_size} max: #{diff} character#{pl} to remove", :green
|
397
|
+
end
|
278
398
|
end
|
279
|
-
|
280
|
-
|
399
|
+
|
400
|
+
def no_text
|
401
|
+
info("error", "no text", "red")
|
281
402
|
end
|
282
|
-
|
283
|
-
|
403
|
+
|
404
|
+
def bad_path
|
405
|
+
info("error", "couldn't upload this file (path seems wrong)", "red")
|
284
406
|
end
|
285
|
-
|
286
|
-
|
407
|
+
|
408
|
+
def no_curl
|
409
|
+
say do
|
410
|
+
@thor.say_status :error, "Ayadn needs 'curl' to upload files", :red
|
411
|
+
@thor.say_status :next, "please install 'curl' (or check that it's properly declared in your $PATH)", :yellow
|
412
|
+
end
|
287
413
|
end
|
288
|
-
|
289
|
-
|
414
|
+
|
415
|
+
def itunes_store
|
416
|
+
info("connexion", "fetching informations from the iTunes Store", "green")
|
290
417
|
end
|
291
|
-
|
292
|
-
|
418
|
+
|
419
|
+
def fetching_from(source)
|
420
|
+
info("connexion", "fetching informations from #{source}", "green")
|
293
421
|
end
|
294
|
-
|
295
|
-
|
422
|
+
|
423
|
+
def no_movie
|
424
|
+
info("error", "sorry, can't find this movie", "red")
|
296
425
|
end
|
297
|
-
|
298
|
-
|
426
|
+
|
427
|
+
def no_show
|
428
|
+
info("error", "sorry, can't find this show", "red")
|
299
429
|
end
|
300
|
-
|
301
|
-
|
430
|
+
|
431
|
+
def no_show_infos
|
432
|
+
info("error", "sorry, can't find informations about this show", "red")
|
302
433
|
end
|
303
|
-
|
304
|
-
|
434
|
+
|
435
|
+
def no_force(target)
|
436
|
+
say do
|
437
|
+
@thor.say_status :error, "'#{target}' can't be displayed (could be muted, blocked, in the Blacklist, etc)", :red
|
438
|
+
@thor.say_status :info, "please use option '--force' ('-f') to try and display this content anyway", :cyan
|
439
|
+
end
|
305
440
|
end
|
306
|
-
|
307
|
-
|
441
|
+
|
442
|
+
def profile_options
|
443
|
+
info("error", "please specify what to update or delete: --bio, --name, --blog, --twitter or --web", "red")
|
308
444
|
end
|
309
|
-
|
310
|
-
|
445
|
+
|
446
|
+
def one_username
|
447
|
+
info("error", "please specify only one username", "red")
|
311
448
|
end
|
312
|
-
|
313
|
-
|
449
|
+
|
450
|
+
def no_username
|
451
|
+
say do
|
452
|
+
@thor.say_status :error, "Ayadn couldn't get your username", :red
|
453
|
+
@thor.say_status :next, "please try again", :yellow
|
454
|
+
end
|
314
455
|
end
|
315
|
-
|
316
|
-
|
456
|
+
|
457
|
+
def has_to_migrate
|
458
|
+
say do
|
459
|
+
@thor.say_status :upgrade, "Ayadn 1.x user data detected", :red
|
460
|
+
@thor.say_status :migrate, "please run `ayadn migrate` to upgrade your account", :yellow
|
461
|
+
end
|
317
462
|
end
|
318
|
-
|
319
|
-
|
463
|
+
|
464
|
+
def updating_profile
|
465
|
+
info("updating", "profile", "yellow")
|
466
|
+
end
|
467
|
+
|
468
|
+
def to_be_posted
|
469
|
+
info("", "Your post:")
|
470
|
+
end
|
471
|
+
|
472
|
+
def yourpost
|
473
|
+
# info("", "Your post:")
|
474
|
+
@thor.say_status nil, "Your post:"
|
475
|
+
end
|
476
|
+
|
477
|
+
def post_info
|
478
|
+
info("info", "post", "cyan")
|
479
|
+
end
|
480
|
+
|
481
|
+
def repost_info
|
482
|
+
info("info", "repost of", "cyan")
|
483
|
+
end
|
484
|
+
|
485
|
+
def unread_from_channel(channel_id)
|
486
|
+
@thor.say_status :info, "unread message(s) from channel #{channel_id}", :cyan
|
487
|
+
puts "\n\n"
|
488
|
+
end
|
489
|
+
|
490
|
+
def ayadn
|
491
|
+
<<-AYADN
|
492
|
+
|
493
|
+
\t\t _____ __ __ _____ ____ _____
|
494
|
+
\t\t | _ | | | _ | \\| | |
|
495
|
+
\t\t | |_ _| | | | | | |
|
496
|
+
\t\t |__|__| |_| |__|__|____/|_|___|
|
497
|
+
|
498
|
+
|
499
|
+
AYADN
|
500
|
+
end
|
501
|
+
def version
|
502
|
+
puts ayadn()
|
503
|
+
@thor.say_status :version, "#{VERSION}", :green
|
504
|
+
@thor.say_status :changelog, "https://github.com/ericdke/na/blob/master/CHANGELOG.md", :yellow
|
505
|
+
@thor.say_status :docs, "https://github.com/ericdke/na/tree/master/doc", :yellow
|
506
|
+
puts "\n\n"
|
507
|
+
end
|
508
|
+
|
509
|
+
def ask_clear_databases
|
510
|
+
info("question", "are you sure you want to erase all the content of your aliases database? [y/N]", "red")
|
511
|
+
end
|
512
|
+
|
513
|
+
def ask_clear_blacklist
|
514
|
+
info("question", "are you sure you want to erase all the content of your blacklist database? [y/N]", "red")
|
515
|
+
end
|
516
|
+
|
517
|
+
def ask_clear_bookmarks
|
518
|
+
info("question", "are you sure you want to erase all the content of your bookmarks database? [y/N]", "red")
|
519
|
+
end
|
520
|
+
|
521
|
+
def ok?
|
522
|
+
info("confirm", "is it ok? [y/N]", "yellow")
|
523
|
+
end
|
524
|
+
|
525
|
+
def itunes_store_track(store)
|
526
|
+
puts "\n"
|
527
|
+
@thor.say_status "next", "Ayadn will use these elements to insert album artwork and a link", :cyan
|
528
|
+
end
|
529
|
+
|
530
|
+
##---
|
531
|
+
|
532
|
+
def info(status, message, color = nil)
|
533
|
+
if color.nil?
|
534
|
+
lamb = lambda { @thor.say_status(status.to_sym, message.to_s) }
|
535
|
+
else
|
536
|
+
lamb = lambda { @thor.say_status(status.to_sym, message.to_s, color.to_sym) }
|
537
|
+
end
|
538
|
+
puts "\n"
|
539
|
+
lamb.call
|
540
|
+
puts "\n"
|
320
541
|
end
|
321
|
-
|
322
|
-
|
542
|
+
|
543
|
+
def say() # expects a block
|
544
|
+
puts "\n"
|
545
|
+
yield
|
546
|
+
puts "\n"
|
323
547
|
end
|
548
|
+
|
324
549
|
end
|
325
550
|
end
|