ayadn 1.7.6 → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d61fe173d14e26de92c795038dd27fea3772413
4
- data.tar.gz: 54f031328188efe4a55774916f0f0a719456741e
3
+ metadata.gz: be6bf71c51621964932bfa952f50e7622cf90d1f
4
+ data.tar.gz: 772b97b6a9f4257ef2e9bc56f67690c238e49ff4
5
5
  SHA512:
6
- metadata.gz: 1dd6b47722459df1fd84c27abb1a690563b57f9b662078cf64b413da52e00738fa94b3f2daf28d0193dae6553d815a2a5a9b0c40082524bd908ee8e5f9897f46
7
- data.tar.gz: 69bc850c7b96aec17dd0619c4bcca4eb9ed00a4a094f3ca8214c4f72effe5096d1d315a77daff61309bcd32fbb8bbf6bd27f3765a5e99a64acc0237e34bbfc3f
6
+ metadata.gz: 88b558768373966f568626ddbbfb9c2bc6cec3d96f45f48a0786d374e0d0bb44aef7eefe488cff17badf4f6eff0912e5532d019eab9e741ce1372f7cede6ad6f
7
+ data.tar.gz: 75e1ff70e91f48e29340256f2e0db255dfd3555c5fecdbf7271b66281d5133ace8d3f13a275548e51c784f878534dbfd7b68efd1e982ccbe66d57b5d162b2826
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 1.7.7 - 2014-10-26 - 'The Twins'
2
+
3
+ - Fix: max characters information when sending to a channel
4
+ - Fix: line break at the end of stream if compact view
5
+ - Fix: save posts/messages if backup enabled
6
+ - New: embed an image in a message to a channel
7
+ - New: embed a Youtube video in a message
8
+ - New: embed a Vimeo video in a message
9
+ - New: embed a movie poster in a message
10
+ - New: option to show OEmbed links from channels/messages
11
+ - New: extracted links are exported to a json file
12
+
1
13
  # 1.7.6 - 2014-10-25 - 'Barrie'
2
14
 
3
15
  - Fix: channels parser (response != 200, working status)
data/doc/02-install.md CHANGED
@@ -20,5 +20,4 @@ You can of course use the Ruby shipped with your system but it will require root
20
20
 
21
21
  ## WINDOWS
22
22
 
23
- Ayadn 1.0.x isn't compatible with Windows: there's too many issues due to external Gems and POSIX-dependant tools.
24
-
23
+ Ayadn 1.x isn't compatible with Windows: there's too many issues due to external Gems and POSIX-dependant tools.
data/doc/05-streams.md CHANGED
@@ -19,13 +19,11 @@ Scroll your timeline with:
19
19
 
20
20
  `ayadn -tl -s`
21
21
 
22
- #### SCROLL
22
+ #### SCROLL REFRESH
23
23
 
24
- A note about `--scroll`.
24
+ *Read this if you want to launch several scroll streams at once*
25
25
 
26
- **Ayadn pulls the stream every 3 seconds by default.**
27
-
28
- It means you can launch up to 3 scroll streams at a time _per account_ if you want.
26
+ Ayadn pulls the stream every 3 seconds by default. It means you can launch up to 3 scroll streams at a time _per account_ if you want.
29
27
 
30
28
  To launch even more streams at the same time, increment the timer by one second for each stream.
31
29
 
@@ -221,6 +219,8 @@ You can replace the channel id with its alias if you previously defined one:
221
219
 
222
220
  `ayadn -ms mychannelalias`
223
221
 
222
+ Since version 1.7.7, Ayadn shows the full oembed links in messages if any. As these links can be quite long and complex, you can remove them from the view if you want with `ayadn set timeline show_channel_oembed false`.
223
+
224
224
  # WHATSTARRED
225
225
 
226
226
  Show posts starred by a specific user.
data/lib/ayadn/action.rb CHANGED
@@ -583,6 +583,7 @@ module Ayadn
583
583
  options = NowWatching.new.get_poster(settings[:poster], settings)
584
584
  end
585
585
  resp = writer.reply({options: options, text: text, id: post_id, reply_to: replied_to})
586
+ FileOps.save_post(resp) if Settings.options[:backup][:auto_save_sent_posts]
586
587
  # ----
587
588
  options = options.dup
588
589
  unless resp['data']['reply_to'].nil?
@@ -595,18 +596,25 @@ module Ayadn
595
596
  end
596
597
  end
597
598
 
598
- def send_to_channel(channel_id)
599
+ def send_to_channel(channel_id, options = {})
599
600
  begin
600
601
  channel_id = @workers.get_channel_id_from_alias(channel_id)
601
602
  writer = Post.new
602
603
  puts Status.writing
603
- puts Status.post
604
+ puts Status.message
604
605
  lines_array = writer.compose
605
606
  writer.check_message_length(lines_array)
606
607
  @view.clear_screen
607
608
  puts Status.posting
608
- resp = writer.message({id: channel_id, text: lines_array.join("\n")})
609
- save_and_view(resp)
609
+ if options[:poster]
610
+ settings = options.dup
611
+ options = NowWatching.new.get_poster(settings[:poster], settings)
612
+ end
613
+ resp = writer.message({options: options, id: channel_id, text: lines_array.join("\n")})
614
+ FileOps.save_message(resp) if Settings.options[:backup][:auto_save_sent_messages]
615
+ @view.clear_screen
616
+ puts Status.yourpost
617
+ @view.show_posted(resp)
610
618
  rescue => e
611
619
  Errors.global_error({error: e, caller: caller, data: [channel_id]})
612
620
  end
data/lib/ayadn/app.rb CHANGED
@@ -401,10 +401,10 @@ module Ayadn
401
401
 
402
402
  desc "pm @USERNAME", "Send a private message to @username"
403
403
  long_desc Descriptions.pmess
404
- option :embed, aliases: "-E", type: :array, desc: "Embed one or several pictures in the new post"
405
- option :youtube, aliases: "-Y", type: :array, desc: "Embed a Youtube video in the new post"
406
- option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new post"
407
- option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new post"
404
+ option :embed, aliases: "-E", type: :array, desc: "Embed one or several pictures in the new message"
405
+ option :youtube, aliases: "-Y", type: :array, desc: "Embed a Youtube video in the new message"
406
+ option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new message"
407
+ option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new message"
408
408
  def pm(*username)
409
409
  Action.new.pmess(username, options)
410
410
  end
@@ -412,8 +412,12 @@ module Ayadn
412
412
  desc "send CHANNEL", "Send a message to a CHANNEL (-C)"
413
413
  map "-C" => :send_to_channel
414
414
  long_desc Descriptions.send_to_channel
415
+ option :embed, aliases: "-E", type: :array, desc: "Embed one or several pictures in the new message"
416
+ option :youtube, aliases: "-Y", type: :array, desc: "Embed a Youtube video in the new message"
417
+ option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new message"
418
+ option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new message"
415
419
  def send_to_channel(channel_id)
416
- Action.new.send_to_channel(channel_id)
420
+ Action.new.send_to_channel(channel_id, options)
417
421
  end
418
422
 
419
423
  desc "reply POST", "Reply to post n°POST (-R)"
@@ -461,8 +465,9 @@ module Ayadn
461
465
  long_desc Descriptions.blacklist
462
466
  subcommand "blacklist", Blacklist
463
467
 
464
- desc "nowplaying", "Post the current playing track from iTunes or Last.fm (-np)"
468
+ desc "nowplaying", "Post the current playing track from iTunes or Last.fm (-NP)"
465
469
  map "-np" => :nowplaying
470
+ map "-NP" => :nowplaying
466
471
  long_desc Descriptions.nowplaying
467
472
  option :no_url, aliases: "-n", type: :boolean, desc: "Don't append preview or album art at the end of the post"
468
473
  option :lastfm, aliases: "-l", type: :boolean, desc: "Get current track from Last.fm instead of iTunes"
data/lib/ayadn/fileops.rb CHANGED
@@ -2,6 +2,10 @@
2
2
  module Ayadn
3
3
  class FileOps
4
4
 
5
+ def self.save_links(obj, name)
6
+ File.write(Settings.config[:paths][:lists] + "/#{name}", obj.to_json)
7
+ end
8
+
5
9
  def self.save_post(resp)
6
10
  File.write(Settings.config[:paths][:posts] + "/#{resp['data']['id']}.json", resp['data'].to_json)
7
11
  end
@@ -92,7 +92,9 @@ module Ayadn
92
92
  source: source,
93
93
  visible: visible
94
94
  }
95
- @view.show_posted(Post.new.post(dic))
95
+ resp = Post.new.post(dic)
96
+ FileOps.save_post(resp) if Settings.options[:backup][:auto_save_sent_posts]
97
+ @view.show_posted(resp)
96
98
  rescue => e
97
99
  puts Status.wtf
98
100
  Errors.global_error({error: e, caller: caller, data: [dic, store, options]})
data/lib/ayadn/post.rb CHANGED
@@ -83,7 +83,8 @@ module Ayadn
83
83
  begin
84
84
  #while buffer = Readline.readline("#{Settings.config[:identity][:handle]} >> ".color(:red))
85
85
  while buffer = Readline.readline(">> ".color(:red))
86
- post({text: buffer})
86
+ resp = post({text: buffer})
87
+ FileOps.save_post(resp) if Settings.options[:backup][:auto_save_sent_posts]
87
88
  puts Status.done
88
89
  end
89
90
  rescue Interrupt
data/lib/ayadn/set.rb CHANGED
@@ -431,7 +431,7 @@ module Ayadn
431
431
  @input = meth.to_s
432
432
  @output = validate(options)
433
433
  case @input
434
- when 'directed', 'html', 'show_source', 'show_symbols', 'show_real_name', 'show_date', 'show_spinner', 'show_debug', 'compact'
434
+ when 'directed', 'html', 'show_source', 'show_symbols', 'show_real_name', 'show_date', 'show_spinner', 'show_debug', 'compact', 'show_channel_oembed'
435
435
  Settings.options[:timeline][meth.to_sym] = @output
436
436
  when 'deleted', 'annotations'
437
437
  abort(Status.not_mutable)
@@ -100,6 +100,7 @@ module Ayadn
100
100
  conf[:tvshow] = {hashtag: 'nowwatching'} if conf[:tvshow].nil?
101
101
  conf[:formats][:list] = {reverse: true} if conf[:formats][:list].nil?
102
102
  conf[:timeline][:compact] = false if conf[:timeline][:compact].nil?
103
+ conf[:timeline][:show_channel_oembed] = true if conf[:timeline][:show_channel_oembed].nil?
103
104
 
104
105
  @options = conf
105
106
  self.write_config_file(config_file, @options)
@@ -176,6 +177,7 @@ module Ayadn
176
177
  show_date: true,
177
178
  show_spinner: true,
178
179
  show_debug: false,
180
+ show_channel_oembed: true,
179
181
  compact: false
180
182
  },
181
183
  counts: {
data/lib/ayadn/status.rb CHANGED
@@ -7,6 +7,9 @@ module Ayadn
7
7
  def self.downloaded(name)
8
8
  "\nFile downloaded in #{Settings.config[:paths][:downloads]}/#{name}\n".color(:green)
9
9
  end
10
+ def self.links_saved(name)
11
+ "\nLinks exported to file #{Settings.config[:paths][:lists]}/#{name}\n".color(:green)
12
+ end
10
13
  def self.downloading
11
14
  "Downloading from ADN...\n\n".inverse
12
15
  end
@@ -156,7 +159,7 @@ module Ayadn
156
159
  "\nPosting as ".color(:cyan) + "#{Settings.config[:identity][:handle]}".color(:green) + ".".color(:cyan)
157
160
  end
158
161
  def self.yourpost
159
- "Your post:\n\n".color(:cyan)
162
+ "Your post:\n".color(:cyan)
160
163
  end
161
164
  def self.yourmessage username = nil
162
165
  if username.nil?
data/lib/ayadn/stream.rb CHANGED
@@ -25,6 +25,7 @@ module Ayadn
25
25
  @view.clear_screen()
26
26
  end
27
27
  Scroll.new(@api, @view).global(options) if options[:scroll]
28
+ puts "\n" if Settings.options[:timeline][:compact] && options[:raw].nil?
28
29
  end
29
30
 
30
31
 
@@ -54,6 +55,7 @@ module Ayadn
54
55
  @view.clear_screen()
55
56
  end
56
57
  Scroll.new(@api, @view).send(meth, options) if options[:scroll]
58
+ puts "\n" if Settings.options[:timeline][:compact] && options[:raw].nil?
57
59
  end
58
60
 
59
61
 
@@ -75,6 +77,7 @@ module Ayadn
75
77
  @view.clear_screen()
76
78
  end
77
79
  Scroll.new(@api, @view).mentions(username, options) if options[:scroll]
80
+ puts "\n" if Settings.options[:timeline][:compact] && options[:raw].nil?
78
81
  end
79
82
 
80
83
  def posts username, options
@@ -91,6 +94,7 @@ module Ayadn
91
94
  end
92
95
  @view.render(stream, options)
93
96
  Scroll.new(@api, @view).posts(username, options) if options[:scroll]
97
+ puts "\n" if Settings.options[:timeline][:compact] && options[:raw].nil?
94
98
  end
95
99
 
96
100
  def whatstarred(username, options)
@@ -193,6 +197,7 @@ module Ayadn
193
197
  options[:post_id] = post_id.to_i
194
198
  @view.render(stream, options)
195
199
  Scroll.new(@api, @view).convo(id, options) if options[:scroll]
200
+ puts "\n" if Settings.options[:timeline][:compact] && options[:raw].nil?
196
201
  end
197
202
 
198
203
  def messages(channel_id, options)
@@ -205,6 +210,7 @@ module Ayadn
205
210
  Check.no_data(resp, 'messages')
206
211
  @view.render(resp, options)
207
212
  Scroll.new(@api, @view).messages(channel_id, options) if options[:scroll]
213
+ puts "\n" if Settings.options[:timeline][:compact] && options[:raw].nil?
208
214
  end
209
215
 
210
216
  def random_posts(options)
data/lib/ayadn/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Ayadn
3
- VERSION = "1.7.6"
3
+ VERSION = "1.7.7"
4
4
  end
data/lib/ayadn/view.rb CHANGED
@@ -43,6 +43,7 @@ module Ayadn
43
43
 
44
44
  def show_posted(resp)
45
45
  show_simple_post([resp['data']], {})
46
+ puts "\n" if Settings.options[:timeline][:compact]
46
47
  end
47
48
 
48
49
  def show_list_reposted(list, target)
@@ -325,19 +326,28 @@ module Ayadn
325
326
  def all_hashtag_links(stream, hashtag)
326
327
  clear_screen()
327
328
  puts "Links from posts containing hashtag '##{hashtag}': \n".color(:cyan)
328
- show_links(@workers.links_from_posts(stream))
329
+ links = @workers.links_from_posts(stream)
330
+ links.uniq!
331
+ show_links(links)
332
+ @workers.save_links(links, "hashtag", hashtag)
329
333
  end
330
334
 
331
335
  def all_search_links(stream, words)
332
336
  clear_screen()
333
337
  puts "Links from posts containing word(s) '#{words}': \n".color(:cyan)
334
- show_links(@workers.links_from_posts(stream))
338
+ links = @workers.links_from_posts(stream)
339
+ links.uniq!
340
+ show_links(links)
341
+ @workers.save_links(links, "search", words)
335
342
  end
336
343
 
337
344
  def all_stars_links(stream)
338
345
  clear_screen()
339
346
  puts "Links from your starred posts: \n".color(:cyan)
340
- show_links(@workers.links_from_posts(stream))
347
+ links = @workers.links_from_posts(stream)
348
+ links.uniq!
349
+ show_links(links)
350
+ @workers.save_links(links, 'starred')
341
351
  end
342
352
 
343
353
  def infos(stream, token)
data/lib/ayadn/workers.rb CHANGED
@@ -262,13 +262,34 @@ module Ayadn
262
262
  unless post['annotations'].nil? || post['annotations'].empty?
263
263
  post['annotations'].each do |ann|
264
264
  if ann['type'] == "net.app.core.oembed"
265
- links << ann['value']['embeddable_url'] if ann['value']['embeddable_url']
265
+ if ann['value']['embeddable_url']
266
+ links << ann['value']['embeddable_url']
267
+ elsif ann['value']['url'] && Settings.options[:timeline][:show_channel_oembed] == true
268
+ links << ann['value']['url']
269
+ end
266
270
  end
267
271
  end
268
272
  end
269
273
  links.uniq
270
274
  end
271
275
 
276
+ def save_links(links, origin, args = "")
277
+ links.sort!
278
+ obj = {
279
+ 'meta' => {
280
+ 'type' => 'links',
281
+ 'origin' => origin,
282
+ 'args' => args,
283
+ 'created_at' => Time.now,
284
+ 'username' => Settings.config[:identity][:handle]
285
+ },
286
+ 'data' => links
287
+ }
288
+ filename = "#{Settings.config[:identity][:handle]}_#{origin}_links.json"
289
+ FileOps.save_links(obj, filename)
290
+ puts Status.links_saved(filename)
291
+ end
292
+
272
293
  def extract_hashtags(post)
273
294
  post['entities']['hashtags'].map { |h| h['name'] }
274
295
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ayadn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.6
4
+ version: 1.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dejonckheere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-25 00:00:00.000000000 Z
11
+ date: 2014-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor