ayadn 1.4.6 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/doc/12-alias.md ADDED
@@ -0,0 +1,57 @@
1
+ # ALIAS
2
+
3
+ Aliases are names you give to channels for an easier access.
4
+
5
+ Available subcommands: create, delete, list, import.
6
+
7
+ Example: you're a [Paste-App](http://paste-app.net/) user and your personal Paste-App channel is 46216.
8
+
9
+ Instead of getting this channel's messages with
10
+
11
+ `ayadn -ms 46216`
12
+
13
+ you can create an alias:
14
+
15
+ `ayadn alias create 46216 pasteapp`
16
+
17
+ or
18
+
19
+ `ayadn -A create 46216 pasteapp`
20
+
21
+ Then you can access this channel with
22
+
23
+ `ayadn -ms pasteapp`
24
+
25
+ Words are easier to remember than numbers!
26
+
27
+ ## CREATE
28
+
29
+ Create an alias for a channel.
30
+
31
+ `ayadn alias create 46216 pasteapp`
32
+
33
+ `ayadn -A create 46216 pasteapp`
34
+
35
+ ## DELETE
36
+
37
+ Delete a channel alias.
38
+
39
+ `ayadn alias delete pasteapp`
40
+
41
+ `ayadn -A delete pasteapp`
42
+
43
+ ## LIST
44
+
45
+ List all your channel aliases.
46
+
47
+ `ayadn alias list`
48
+
49
+ `ayadn -A list`
50
+
51
+ ## IMPORT
52
+
53
+ Import a previously backed-up list of aliases.
54
+
55
+ `ayadn alias import '/Users/blah/backups/aliases.db'`
56
+
57
+ `ayadn -A import '/Users/blah/backups/aliases.db'`
@@ -0,0 +1,51 @@
1
+ # BOOKMARK
2
+
3
+ Bookmark a conversation, list and delete bookmarks.
4
+
5
+ Usage:
6
+
7
+ `ayadn mark add 30594331`
8
+
9
+ `ayadn mark add 30594331 'convo title'`
10
+
11
+ `ayadn mark list`
12
+
13
+ `ayadn mark delete 30594331`
14
+
15
+ `ayadn mark rename 30594331 'other name'`
16
+
17
+ ## ADD
18
+
19
+ Add a conversation to your bookmarks.
20
+
21
+ Usage:
22
+
23
+ `ayadn mark add 30594331`
24
+
25
+ `ayadn mark add 30594331 'convo title'`
26
+
27
+ You don't have to specify the root post of the conversation, any post within the thread will work.
28
+
29
+ ## DELETE
30
+
31
+ Delete entry from your bookmarked conversations.
32
+
33
+ Usage:
34
+
35
+ `ayadn mark delete 30594331`
36
+
37
+ ## LIST
38
+
39
+ List your bookmarked conversations.
40
+
41
+ Usage:
42
+
43
+ `ayadn mark list`
44
+
45
+ ## RENAME
46
+
47
+ Rename a bookmarked conversation.
48
+
49
+ Usage:
50
+
51
+ `ayadn mark rename 30594331 'new title'`
data/doc/14-set.md ADDED
@@ -0,0 +1,139 @@
1
+ # SET
2
+
3
+ The 'set' commands allows you to configure some Ayadn parameters.
4
+
5
+ `ayadn set color mentions blue`
6
+
7
+ You can get a list of configurable parameters with
8
+
9
+ `ayadn -sg`
10
+
11
+ ## EXAMPLES
12
+
13
+ `ayadn set color username green`
14
+
15
+ `ayadn set color mentions yellow`
16
+
17
+ `ayadn set counts default 30`
18
+
19
+ `ayadn set counts search 100`
20
+
21
+ `ayadn set timeline directed false`
22
+
23
+ `ayadn set timeline show_real_name false`
24
+
25
+ `ayadn set timeline show_date false`
26
+
27
+ `ayadn set backup auto_save_sent_posts true`
28
+
29
+ `ayadn set scroll timer 5`
30
+
31
+ `ayadn set nicerank filter true`
32
+
33
+ `ayadn set timeline show_spinner true`
34
+
35
+ To reset the configuration to default values:
36
+
37
+ `ayadn set defaults`
38
+
39
+ ## LIST
40
+
41
+ Example list of configured items in Ayadn.
42
+
43
+ `ayadn -sg` will show your own list.
44
+
45
+ ```
46
+ +------------------+---------------------------------+--------------------+
47
+ | Category | Parameter | Value(s) |
48
+ +------------------+---------------------------------+--------------------+
49
+ | timeline | directed | 1 |
50
+ +------------------+---------------------------------+--------------------+
51
+ | timeline | deleted | 0 |
52
+ +------------------+---------------------------------+--------------------+
53
+ | timeline | html | 0 |
54
+ +------------------+---------------------------------+--------------------+
55
+ | timeline | annotations | 1 |
56
+ +------------------+---------------------------------+--------------------+
57
+ | timeline | show_source | true |
58
+ +------------------+---------------------------------+--------------------+
59
+ | timeline | show_symbols | true |
60
+ +------------------+---------------------------------+--------------------+
61
+ | timeline | show_real_name | true |
62
+ +------------------+---------------------------------+--------------------+
63
+ | timeline | show_date | true |
64
+ +------------------+---------------------------------+--------------------+
65
+ | timeline | show_spinner | true |
66
+ +------------------+---------------------------------+--------------------+
67
+ | counts | default | 50 |
68
+ +------------------+---------------------------------+--------------------+
69
+ | counts | unified | 50 |
70
+ +------------------+---------------------------------+--------------------+
71
+ | counts | global | 100 |
72
+ +------------------+---------------------------------+--------------------+
73
+ | counts | checkins | 50 |
74
+ +------------------+---------------------------------+--------------------+
75
+ | counts | conversations | 200 |
76
+ +------------------+---------------------------------+--------------------+
77
+ | counts | photos | 50 |
78
+ +------------------+---------------------------------+--------------------+
79
+ | counts | trending | 50 |
80
+ +------------------+---------------------------------+--------------------+
81
+ | counts | mentions | 50 |
82
+ +------------------+---------------------------------+--------------------+
83
+ | counts | convo | 50 |
84
+ +------------------+---------------------------------+--------------------+
85
+ | counts | posts | 50 |
86
+ +------------------+---------------------------------+--------------------+
87
+ | counts | messages | 50 |
88
+ +------------------+---------------------------------+--------------------+
89
+ | counts | search | 200 |
90
+ +------------------+---------------------------------+--------------------+
91
+ | counts | whoreposted | 50 |
92
+ +------------------+---------------------------------+--------------------+
93
+ | counts | whostarred | 50 |
94
+ +------------------+---------------------------------+--------------------+
95
+ | counts | whatstarred | 200 |
96
+ +------------------+---------------------------------+--------------------+
97
+ | counts | files | 100 |
98
+ +------------------+---------------------------------+--------------------+
99
+ | formats | table | width = 75 |
100
+ +------------------+---------------------------------+--------------------+
101
+ | colors | id | blue |
102
+ +------------------+---------------------------------+--------------------+
103
+ | colors | index | red |
104
+ +------------------+---------------------------------+--------------------+
105
+ | colors | username | green |
106
+ +------------------+---------------------------------+--------------------+
107
+ | colors | name | magenta |
108
+ +------------------+---------------------------------+--------------------+
109
+ | colors | date | cyan |
110
+ +------------------+---------------------------------+--------------------+
111
+ | colors | link | yellow |
112
+ +------------------+---------------------------------+--------------------+
113
+ | colors | dots | blue |
114
+ +------------------+---------------------------------+--------------------+
115
+ | colors | hashtags | cyan |
116
+ +------------------+---------------------------------+--------------------+
117
+ | colors | mentions | red |
118
+ +------------------+---------------------------------+--------------------+
119
+ | colors | source | cyan |
120
+ +------------------+---------------------------------+--------------------+
121
+ | colors | symbols | green |
122
+ +------------------+---------------------------------+--------------------+
123
+ | colors | nicerank | cyan |
124
+ +------------------+---------------------------------+--------------------+
125
+ | backup | auto_save_sent_posts | false |
126
+ +------------------+---------------------------------+--------------------+
127
+ | backup | auto_save_sent_messages | false |
128
+ +------------------+---------------------------------+--------------------+
129
+ | backup | auto_save_lists | false |
130
+ +------------------+---------------------------------+--------------------+
131
+ | scroll | timer | 3 |
132
+ +------------------+---------------------------------+--------------------+
133
+ | nicerank | threshold | 2.0 |
134
+ +------------------+---------------------------------+--------------------+
135
+ | nicerank | filter | true |
136
+ +------------------+---------------------------------+--------------------+
137
+ | nicerank | filter_unranked | true |
138
+ +------------------+---------------------------------+--------------------+
139
+ ```
@@ -0,0 +1,23 @@
1
+ # NOWPLAYING
2
+
3
+ Post what you're listening to!
4
+
5
+ ## iTunes
6
+
7
+ OS X only.
8
+
9
+ `ayadn nowplaying`
10
+
11
+ `ayadn -np`
12
+
13
+ Ayadn will grab information from your running iTunes, format it, insert the *#nowplaying* hashtag then ask for your confirmation before posting it.
14
+
15
+ It will also grab a 30 seconds preview and the album art from the iTunes Store. You can prevent this behavior by adding the `--no-url` option (short: `-n`).
16
+
17
+ ## Last.fm
18
+
19
+ `ayadn nowplaying --last-fm`
20
+
21
+ `ayadn -np -l`
22
+
23
+ Same behaviour and options as above.
data/doc/16-contact.md ADDED
@@ -0,0 +1,29 @@
1
+ ## CONTACT
2
+
3
+ [@ericd](http://app.net/ericd)
4
+
5
+ [email](eric@aya.io)
6
+
7
+ [@ayadn](http://app.net/ayadn)
8
+
9
+ [ayadn-app.net](http://ayadn-app.net)
10
+
11
+ ## THANK YOU
12
+
13
+ [@matigo](http://app.net/matigo)
14
+ [@ksniod](http://app.net/ksniod)
15
+ [@donnywdavis](http://app.net/donnywdavis)
16
+ [@manx](http://app.net/manx)
17
+ [@bcallah](http://app.net/bcallah)
18
+ [@0xmf](http://app.net/0xmf)
19
+ [@sr_rolando](http://app.net/sr_rolando)
20
+ [@charl](http://app.net/charl)
21
+ [@jws](http://app.net/jws)
22
+ [@joeltimmins](http://app.net/joeltimmins)
23
+ [@berklee](http://app.net/berklee)
24
+ [@nguarracino](http://app.net/nguarracino)
25
+ [@matthewlang](http://app.net/matthewlang)
26
+ [@schmidt_fu](http://app.net/schmidt_fu)
27
+ [@jextxadore](http://app.net/jextxadore)
28
+ [@jvimedia](http://app.net/jvimedia)
29
+ [@fredvd](http://app.net/fredvd)
@@ -0,0 +1,8 @@
1
+ # SHORTCUTS
2
+
3
+ Most examples will include the 'complete' command followed by the 'shortcut' command.
4
+
5
+ Of course, using Ayadn is much faster with the shortcut commands.
6
+
7
+ If you're like me, you'll even want to create aliases in bash/zsh or TextExpander snippets for the combinations of Ayadn commands and options you use the most...
8
+
@@ -0,0 +1,43 @@
1
+ ## EXAMPLES
2
+
3
+ Just a few examples to give you a hint at the flexible syntax.
4
+
5
+ Complete:
6
+
7
+ `ayadn timeline`
8
+
9
+ `ayadn checkins --count=10 --index`
10
+
11
+ `ayadn global --scroll`
12
+
13
+ `ayadn userposts @ericd`
14
+
15
+ `ayadn post 'Hello guys!'`
16
+
17
+ `ayadn reply 23362460`
18
+
19
+ `ayadn convo 23362788`
20
+
21
+ `ayadn search movies hollywood`
22
+
23
+ `ayadn follow @ericd`
24
+
25
+ Shortcuts:
26
+
27
+ `ayadn -tl`
28
+
29
+ `ayadn -ck -c10 -i`
30
+
31
+ `ayadn -gl -s`
32
+
33
+ `ayadn -up @ericd`
34
+
35
+ `ayadn -P 'Hello guys!'`
36
+
37
+ `ayadn -R 23362460`
38
+
39
+ `ayadn -co 23362788`
40
+
41
+ `ayadn -se movies hollywood`
42
+
43
+ `ayadn -FO @ericd`
data/lib/ayadn/action.rb CHANGED
@@ -132,7 +132,7 @@ module Ayadn
132
132
  begin
133
133
  doing(options)
134
134
  stream = @api.get_interactions
135
- option_show_raw(stream, options)
135
+ if_raw_show(stream, options)
136
136
  @view.clear_screen
137
137
  @view.show_interactions(stream['data'])
138
138
  rescue => e
@@ -162,7 +162,7 @@ module Ayadn
162
162
  stop_if_404(details, post_id)
163
163
  id = get_original_id(post_id, details)
164
164
  list = @api.get_whoreposted(id)
165
- option_show_raw(list, options)
165
+ if_raw_show(list, options)
166
166
  unless list['data'].empty?
167
167
  get_list(:whoreposted, list['data'], post_id)
168
168
  else
@@ -181,7 +181,7 @@ module Ayadn
181
181
  stop_if_404(details, post_id)
182
182
  id = get_original_id(post_id, details)
183
183
  list = @api.get_whostarred(id)
184
- option_show_raw(list, options)
184
+ if_raw_show(list, options)
185
185
  unless list['data'].empty?
186
186
  get_list(:whostarred, list['data'], id)
187
187
  else
@@ -201,6 +201,11 @@ module Ayadn
201
201
  id = get_original_id(post_id, details)
202
202
  stream = get_convo id, options
203
203
  Databases.pagination["replies:#{id}"] = stream['meta']['max_id']
204
+ options = options.dup
205
+ unless details['data']['reply_to'].nil?
206
+ options[:reply_to] = details['data']['reply_to'].to_i
207
+ end
208
+ options[:post_id] = post_id.to_i
204
209
  render_view(stream, options)
205
210
  Scroll.new(@api, @view).convo(id, options) if options[:scroll]
206
211
  rescue => e
@@ -238,69 +243,93 @@ module Ayadn
238
243
  end
239
244
  end
240
245
 
241
- def unfollow(username)
246
+ def unfollow(usernames)
242
247
  begin
243
- stop_if_no_username(username)
244
- username = add_arobase(username)
245
- puts Status.unfollowing(username)
246
- check_has_been_unfollowed(username, @api.unfollow(username))
248
+ stop_if_no_username(usernames)
249
+ users = all_but_me(usernames)
250
+ puts Status.unfollowing(users.join(','))
251
+ users.each do |user|
252
+ resp = @api.unfollow(user)
253
+ check_has_been_unfollowed(user, resp)
254
+ sleep 1 unless users.length == 1
255
+ end
247
256
  rescue => e
248
- Errors.global_error({error: e, caller: caller, data: [username]})
257
+ Errors.global_error({error: e, caller: caller, data: [usernames]})
249
258
  end
250
259
  end
251
260
 
252
- def follow(username)
261
+ def follow(usernames)
253
262
  begin
254
- stop_if_no_username(username)
255
- username = add_arobase(username)
256
- puts Status.following(username)
257
- check_has_been_followed(username, @api.follow(username))
263
+ stop_if_no_username(usernames)
264
+ users = all_but_me(usernames)
265
+ puts Status.following(users.join(','))
266
+ users.each do |user|
267
+ resp = @api.follow(user)
268
+ check_has_been_followed(user, resp)
269
+ sleep 1 unless users.length == 1
270
+ end
258
271
  rescue => e
259
- Errors.global_error({error: e, caller: caller, data: [username]})
272
+ Errors.global_error({error: e, caller: caller, data: [usernames]})
260
273
  end
261
274
  end
262
275
 
263
- def unmute(username)
276
+ def unmute(usernames)
264
277
  begin
265
- stop_if_no_username(username)
266
- username = add_arobase(username)
267
- puts Status.unmuting(username)
268
- check_has_been_unmuted(username, @api.unmute(username))
278
+ stop_if_no_username(usernames)
279
+ users = all_but_me(usernames)
280
+ puts Status.unmuting(users.join(','))
281
+ users.each do |user|
282
+ resp = @api.unmute(user)
283
+ check_has_been_unmuted(user, resp)
284
+ sleep 1 unless users.length == 1
285
+ end
269
286
  rescue => e
270
- Errors.global_error({error: e, caller: caller, data: [username]})
287
+ Errors.global_error({error: e, caller: caller, data: [usernames]})
271
288
  end
272
289
  end
273
290
 
274
- def mute(username)
291
+ def mute(usernames)
275
292
  begin
276
- stop_if_no_username(username)
277
- username = add_arobase(username)
278
- puts Status.muting(username)
279
- check_has_been_muted(username, @api.mute(username))
293
+ stop_if_no_username(usernames)
294
+ users = all_but_me(usernames)
295
+ puts Status.muting(users.join(','))
296
+ users.each do |user|
297
+ resp = @api.mute(user)
298
+ check_has_been_muted(user, resp)
299
+ sleep 1 unless users.length == 1
300
+ end
280
301
  rescue => e
281
- Errors.global_error({error: e, caller: caller, data: [username]})
302
+ Errors.global_error({error: e, caller: caller, data: [usernames]})
282
303
  end
283
304
  end
284
305
 
285
- def unblock(username)
306
+ def unblock(usernames)
286
307
  begin
287
- stop_if_no_username(username)
288
- username = add_arobase(username)
289
- puts Status.unblocking(username)
290
- check_has_been_unblocked(username, @api.unblock(username))
308
+ stop_if_no_username(usernames)
309
+ users = all_but_me(usernames)
310
+ puts Status.unblocking(users.join(','))
311
+ users.each do |user|
312
+ resp = @api.unblock(user)
313
+ check_has_been_unblocked(user, resp)
314
+ sleep 1 unless users.length == 1
315
+ end
291
316
  rescue => e
292
- Errors.global_error({error: e, caller: caller, data: [username]})
317
+ Errors.global_error({error: e, caller: caller, data: [usernames]})
293
318
  end
294
319
  end
295
320
 
296
- def block(username)
321
+ def block(usernames)
297
322
  begin
298
- stop_if_no_username(username)
299
- username = add_arobase(username)
300
- puts Status.blocking(username)
301
- check_has_been_blocked(username, @api.block(username))
323
+ stop_if_no_username(usernames)
324
+ users = all_but_me(usernames)
325
+ puts Status.blocking(users.join(','))
326
+ users.each do |user|
327
+ resp = @api.block(user)
328
+ check_has_been_blocked(user, resp)
329
+ sleep 1 unless users.length == 1
330
+ end
302
331
  rescue => e
303
- Errors.global_error({error: e, caller: caller, data: [username]})
332
+ Errors.global_error({error: e, caller: caller, data: [usernames]})
304
333
  end
305
334
  end
306
335
 
@@ -401,7 +430,7 @@ module Ayadn
401
430
  stream['data'].sort_by! {|obj| obj['counts']['followers']}
402
431
  stream['data'].each do |obj|
403
432
  puts @view.big_separator
404
- @view.show_userinfos(obj, nil)
433
+ @view.show_userinfos(obj, nil, false)
405
434
  end
406
435
  elsif options[:channels]
407
436
  @view.show_channels stream, options
@@ -422,7 +451,7 @@ module Ayadn
422
451
  stop_if_no_username(username)
423
452
  username = add_arobase(username)
424
453
  doing(options)
425
- option_show_raw(@api.get_raw_list(username, :followings), options)
454
+ if_raw_list(username, :followings, options)
426
455
  list = @api.get_followings(username)
427
456
  auto_save_followings(list)
428
457
  no_data('followings') if list.empty?
@@ -438,7 +467,7 @@ module Ayadn
438
467
  stop_if_no_username(username)
439
468
  username = add_arobase(username)
440
469
  doing(options)
441
- option_show_raw(@api.get_raw_list(username, :followers), options)
470
+ if_raw_list(username, :followers, options)
442
471
  list = @api.get_followers(username)
443
472
  auto_save_followers(list)
444
473
  no_data('followers') if list.empty?
@@ -452,7 +481,7 @@ module Ayadn
452
481
  def muted(options)
453
482
  begin
454
483
  doing(options)
455
- option_show_raw(@api.get_raw_list(nil, :muted), options)
484
+ if_raw_list(nil, :muted, options)
456
485
  list = @api.get_muted
457
486
  auto_save_muted(list)
458
487
  no_data('muted') if list.empty?
@@ -466,7 +495,7 @@ module Ayadn
466
495
  def blocked(options)
467
496
  begin
468
497
  doing(options)
469
- option_show_raw(@api.get_raw_list(nil, :blocked), options)
498
+ if_raw_list(nil, :blocked, options)
470
499
  list = @api.get_blocked
471
500
  no_data('blocked') if list.empty?
472
501
  get_list(:blocked, list, nil)
@@ -489,7 +518,11 @@ module Ayadn
489
518
  stop_if_no_username(username)
490
519
  username = add_arobase(username)
491
520
  doing(options)
492
- option_show_raw(@api.get_user(username), options)
521
+ if options[:raw]
522
+ resp = @api.get_user(username)
523
+ @view.show_raw(resp, options)
524
+ exit
525
+ end
493
526
  stream = @api.get_user(username)
494
527
  stop_if_no_user(stream, username)
495
528
  same_username?(stream) ? token = @api.get_token_info['data'] : token = nil
@@ -503,7 +536,11 @@ module Ayadn
503
536
  begin
504
537
  stop_if_bad_post_id(post_id)
505
538
  doing(options)
506
- option_show_raw(@api.get_details(post_id, options), options)
539
+ if options[:raw]
540
+ details = @api.get_details(post_id, options)
541
+ @view.show_raw(details, options)
542
+ exit
543
+ end
507
544
  @view.clear_screen
508
545
  response = @api.get_details(post_id, options)
509
546
  stop_if_no_post(response, post_id)
@@ -520,9 +557,9 @@ module Ayadn
520
557
  end
521
558
  puts "AUTHOR:\n".inverse
522
559
  if response['data']['username'] == Settings.config[:identity][:username]
523
- @view.show_userinfos(stream, @api.get_token_info['data'])
560
+ @view.show_userinfos(stream, @api.get_token_info['data'], true)
524
561
  else
525
- @view.show_userinfos(stream, nil)
562
+ @view.show_userinfos(stream, nil, true)
526
563
  end
527
564
  rescue => e
528
565
  Errors.global_error({error: e, caller: caller, data: [post_id, options]})
@@ -532,7 +569,10 @@ module Ayadn
532
569
  def files(options)
533
570
  begin
534
571
  doing(options)
535
- option_show_raw(@api.get_files_list(options), options)
572
+ if options[:raw]
573
+ @view.show_raw(@api.get_files_list(options), options)
574
+ exit
575
+ end
536
576
  list = @api.get_files_list(options)
537
577
  @view.clear_screen
538
578
  list.empty? ? no_data('files') : @view.show_files_list(list)
@@ -569,7 +609,7 @@ module Ayadn
569
609
  resp = @api.get_messages(channel_id, options)
570
610
  stop_if_no_new_posts(resp, options, "channel:#{channel_id}")
571
611
  Databases.save_max_id(resp)
572
- option_show_raw(resp, options)
612
+ if_raw_show(resp, options)
573
613
  stop_if_no_data(resp, 'messages')
574
614
  render_view(resp, options)
575
615
  Scroll.new(@api, @view).messages(channel_id, options) if options[:scroll]
@@ -623,14 +663,8 @@ module Ayadn
623
663
  writer = Post.new
624
664
  @view.clear_screen
625
665
  if options['embed']
626
- if options['embed'].length > 1 # if args are inversed on the cl
627
- opts = options['embed'].dup
628
- embed = [opts.shift]
629
- text = opts.join(" ")
630
- else
631
- embed = options['embed']
632
- text = args.join(" ")
633
- end
666
+ embed = options['embed']
667
+ text = args.join(" ")
634
668
  puts Status.uploading(embed)
635
669
  resp = writer.send_embedded(text, FileOps.make_paths(embed))
636
670
  else
@@ -752,7 +786,14 @@ module Ayadn
752
786
  FileOps.save_post(resp) if Settings.options[:backup][:auto_save_sent_posts]
753
787
  @view.clear_screen
754
788
  puts Status.done
755
- render_view(@api.get_convo(post_id))
789
+
790
+ options = options.dup
791
+ unless resp['data']['reply_to'].nil?
792
+ options[:reply_to] = resp['data']['reply_to'].to_i
793
+ end
794
+ options[:post_id] = resp['data']['id'].to_i
795
+
796
+ render_view(@api.get_convo(post_id), options)
756
797
  rescue => e
757
798
  Errors.global_error({error: e, caller: caller, data: [post_id, options]})
758
799
  end
@@ -793,21 +834,43 @@ module Ayadn
793
834
  end
794
835
  end
795
836
 
837
+ def version
838
+ begin
839
+ puts "\nAYADN\n".color(:red)
840
+ puts "Version:\t".color(:cyan) + "#{VERSION}\n".color(:green)
841
+ puts "Changelog:\t".color(:cyan) + "https://github.com/ericdke/na/blob/master/CHANGELOG.md\n".color(Settings.options[:colors][:link])
842
+ puts "Docs:\t\t".color(:cyan) + "http://ayadn-app.net/doc/".color(Settings.options[:colors][:link])
843
+ puts "\n"
844
+ rescue => e
845
+ Errors.global_error({error: e, caller: caller, data: []})
846
+ end
847
+ end
848
+
796
849
  private
797
850
 
851
+ def if_raw_list username, what, options
852
+ if options[:raw]
853
+ @view.show_raw(@api.get_raw_list(username, what), options)
854
+ exit
855
+ end
856
+ end
857
+
858
+ def if_raw_show what, options
859
+ if options[:raw]
860
+ @view.show_raw(what, options)
861
+ exit
862
+ end
863
+ end
864
+
865
+ def all_but_me usernames
866
+ all_but_me = usernames.select {|user| user != 'me'}
867
+ Workers.at(all_but_me)
868
+ end
869
+
798
870
  def np_lastfm options
799
871
  require 'rss'
800
872
  begin
801
- if Settings.options[:nowplaying]
802
- if Settings.options[:nowplaying][:lastfm]
803
- user = Settings.options[:nowplaying][:lastfm]
804
- else
805
- user = create_lastfm_user()
806
- end
807
- else
808
- Settings.options[:nowplaying] = {}
809
- user = create_lastfm_user()
810
- end
873
+ user = Settings.options[:nowplaying][:lastfm] || create_lastfm_user()
811
874
  puts Status.fetching_from('Last.fm')
812
875
  artist, track = get_lastfm_track_infos(user)
813
876
  puts Status.itunes_store
@@ -852,26 +915,33 @@ module Ayadn
852
915
  @view.clear_screen
853
916
  puts Status.writing
854
917
  show_nowplaying("\n#{text_to_post}", options, store)
855
- unless options['no_url'] || store['code'] != 200
856
- #text_to_post += "\n \n[> Listen](#{store['preview']})"
918
+ unless options['no_url'] || store.nil?
857
919
  text_to_post += "\n \n[iTunes Store](#{store['link']})"
858
920
  end
859
921
  abort(Status.canceled) unless STDIN.getch == ("y" || "Y")
860
922
  puts "\n#{Status.yourpost}"
861
- unless options['no_url'] || store['code'] != 200
862
- visible, track, artwork, artwork_thumb = true, store['track'], store['artwork'], store['artwork_thumb']
923
+ unless store.nil? || options['no_url']
924
+ visible, track, artwork, artwork_thumb, link, artist = true, store['track'], store['artwork'], store['artwork_thumb'], store['link'], store['artist']
925
+ else
926
+ visible, track, artwork, artwork_thumb, link, artist = false
927
+ end
928
+ if options['lastfm']
929
+ source = 'Last.fm'
863
930
  else
864
- visible, track, artwork, artwork_thumb = false
931
+ source = 'iTunes'
865
932
  end
866
933
  dic = {
867
934
  'text' => text_to_post,
868
935
  'title' => track,
936
+ 'artist' => artist,
869
937
  'artwork' => artwork,
870
938
  'artwork_thumb' => artwork_thumb,
871
939
  'width' => 1200,
872
940
  'height' => 1200,
873
941
  'width_thumb' => 200,
874
942
  'height_thumb' => 200,
943
+ 'link' => link,
944
+ 'source' => source,
875
945
  'visible' => visible
876
946
  }
877
947
  @view.show_posted(Post.new.send_nowplaying(dic))
@@ -958,22 +1028,11 @@ module Ayadn
958
1028
  else
959
1029
  puts text + "\n\n\nThe iTunes Store thinks this track is: ".color(:green) + "'#{store['track']}'".color(:magenta) + " by ".color(:green) + "'#{store['artist']}'".color(:magenta) + ".\n\nAyadn will use these elements to insert album artwork and a link to the track.\n\n".color(:green)
960
1030
  end
961
- puts "Do you confirm? (y/N) ".color(:yellow)
1031
+ puts "Is it ok? (y/N) ".color(:yellow)
962
1032
  end
963
1033
 
964
1034
  def nicerank_true
965
- if Settings.options[:nicerank]
966
- if Settings.options[:nicerank][:filter] == true
967
- return true
968
- end
969
- end
970
- end
971
-
972
- def option_show_raw stream, options
973
- if options[:raw]
974
- @view.show_raw(stream)
975
- exit
976
- end
1035
+ return true if Settings.options[:nicerank][:filter] == true
977
1036
  end
978
1037
 
979
1038
  def stop_if_bad_post_id post_id
@@ -1220,7 +1279,7 @@ module Ayadn
1220
1279
 
1221
1280
  def get_infos(stream, token)
1222
1281
  @view.clear_screen
1223
- @view.show_userinfos(stream, token)
1282
+ @view.show_userinfos(stream, token, true)
1224
1283
  end
1225
1284
 
1226
1285
  def get_list(what, list, target)