ayadn 0.6.3 → 0.6.4
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/CHANGELOG.md +15 -6
- data/README.md +37 -61
- data/bin/ayadn +1 -352
- data/lib/ayadn.rb +25 -24
- data/lib/ayadn/api.rb +2 -2
- data/lib/ayadn/app.rb +367 -0
- data/lib/ayadn/client-http.rb +7 -7
- data/lib/ayadn/config.yml +9 -9
- data/lib/ayadn/get-api.rb +1 -1
- data/lib/ayadn/main.rb +0 -2
- data/lib/ayadn/tools.rb +3 -3
- data/lib/ayadn/view-object.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e60ae311797897e5786fc096a4698195b64e5226
|
4
|
+
data.tar.gz: 9ebf742cf8da514c4499e5af9cfa3a4260ec04c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d30d8e6304d77899de33fa7653090985ed7786217004c6d7cbddf82994c84bdccb87d811501c5d20b817057a95d5fdaf47c16b7e26466b63e4728db8dbd57a8e
|
7
|
+
data.tar.gz: 743647412a7ad23681c2ec03ce8ad7debb694195ea210dc200b959681248766b3970a63e2b4ba1be32c8fb90745645443be7f624a22887287801d21952e3e421
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
AYADN
|
2
2
|
=====
|
3
3
|
|
4
|
+
## 0.6.4
|
5
|
+
- fixed 'random'
|
6
|
+
- fixed a few edge case bugs
|
7
|
+
- reorganized the gem files
|
8
|
+
- updated explanations in Readme
|
9
|
+
- show client name is now true by default
|
10
|
+
- show reply symbols is now true by default
|
11
|
+
- show repost symbols is now true by default
|
12
|
+
|
4
13
|
## 0.6.3
|
5
|
-
- better
|
6
|
-
-
|
7
|
-
-
|
8
|
-
- autostart browser only in OSX
|
9
|
-
- fixed
|
10
|
-
- fixed save to pinboard without tag
|
14
|
+
- better 'help screen'
|
15
|
+
- better platform detection in 'nowplaying'
|
16
|
+
- fixed 'channels' folder
|
17
|
+
- fixed 'autostart browser' (only in OSX)
|
18
|
+
- fixed 'alias-channel' when arg is nil
|
19
|
+
- fixed 'save to pinboard' when saving without tag
|
11
20
|
|
12
21
|
## 2014-02-15 v0.6.2
|
13
22
|
- fixed config
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ AYADN
|
|
6
6
|
[](http://badge.fury.io/rb/ayadn)
|
7
7
|
|
8
8
|
- [FEATURES](#features)
|
9
|
-
- [TL;DR](#
|
9
|
+
- [TL;DR](#tldr)
|
10
10
|
- [IMPORTANT NOTE](#important-note)
|
11
11
|
- [INSTALL](#install)
|
12
12
|
- [HOW TO USE](#how-to-use)
|
@@ -91,7 +91,7 @@ AYADN
|
|
91
91
|
|
92
92
|
- change file attribute: public/private
|
93
93
|
|
94
|
-
- upload files to your ADN account *(
|
94
|
+
- upload files to your ADN account *(only OS X and Linux)*
|
95
95
|
|
96
96
|
- list your subscribed channels
|
97
97
|
|
@@ -99,7 +99,7 @@ AYADN
|
|
99
99
|
|
100
100
|
- save a post link to your Pinboard account
|
101
101
|
|
102
|
-
- post the current iTunes song with #nowplaying hashtag *(OS X
|
102
|
+
- post the current iTunes song with #nowplaying hashtag *(only OS X)*
|
103
103
|
|
104
104
|
- [and more!](https://github.com/ericdke/ayadn#list-of-commands)
|
105
105
|
|
@@ -117,17 +117,11 @@ ayadn write 'Posting to App.net with Ruby!'
|
|
117
117
|
|
118
118
|
Ayadn is currently in a transition process from beta to v1.
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
The current [na](https://github.com/ericdke/na) repository will become Ayadn v1 when ready and complete (multi account, configuration with ayadn commands, fresh clean code, OSS rules compliant, new layout, new features, new options, etc).
|
120
|
+
The current [na](https://github.com/ericdke/na) repository will become Ayadn v1 when ready and complete (multi account, automatic initial configuration, configuration with ayadn commands, modular code, OSS rules compliant, new layout, new features, new options, etc).
|
123
121
|
|
124
122
|
## INSTALL
|
125
123
|
|
126
|
-
|
127
|
-
|
128
|
-
Ayadn is also compatible with Windows (install Ruby with Rubygems at [http://rubyinstaller.org](http://rubyinstaller.org)).
|
129
|
-
|
130
|
-
Run gem install:
|
124
|
+
In your console/terminal:
|
131
125
|
|
132
126
|
```
|
133
127
|
gem install ayadn
|
@@ -143,15 +137,15 @@ You have to authorize Ayadn to use your App.net credentials.
|
|
143
137
|
|
144
138
|
If you don't provide any option to Ayadn, your personnalized stream is displayed.
|
145
139
|
|
146
|
-
If you provide the `write` command without text, you will enter the compose message feature. *(recommended)*
|
147
|
-
|
148
140
|
By default, Ayadn displays only the new posts in the stream since your last visit.
|
149
141
|
|
150
142
|
**I strongly recommend you run this command after install:**
|
151
143
|
|
152
144
|
`ayadn install config`
|
153
145
|
|
154
|
-
**so that you can customize the `~/ayadn/data/config.yml` file this command will create.**
|
146
|
+
**so that you can then customize the `~/ayadn/data/config.yml` file this command will create.**
|
147
|
+
|
148
|
+
*Note: Ayadn will try and use your existing authorization if you had a previous version installed. If it fails, just run `ayadn authorize` again.*
|
155
149
|
|
156
150
|
## LIST OF COMMANDS
|
157
151
|
|
@@ -253,6 +247,31 @@ ayadn webhelp
|
|
253
247
|
ayadn random
|
254
248
|
```
|
255
249
|
|
250
|
+
## HELP
|
251
|
+
|
252
|
+
### Writing in the console/terminal
|
253
|
+
|
254
|
+
Be aware of the way the console/terminal treats what you type if you're using ayadn inline, like this: `ayadn write "Hello"`
|
255
|
+
|
256
|
+
When posting with `"double quotes"`, any special character will be interpreted by the command line!
|
257
|
+
|
258
|
+
So you have to post with `'simple quotes'` instead, this way the console don't mess with your content.
|
259
|
+
|
260
|
+
But it creates other problems...
|
261
|
+
|
262
|
+
**My advice: post with the compose feature, that is to say without providing your text inline:**
|
263
|
+
|
264
|
+
`ayadn write`
|
265
|
+
|
266
|
+
Then just write your text, nothing else is needed, no single or double quotes.
|
267
|
+
|
268
|
+
### Database
|
269
|
+
|
270
|
+
Ayadn keeps a database of the ids of all the users it sees (it reduces the number of API calls and speeds up the app.)
|
271
|
+
|
272
|
+
If you think that this file is causing problems to Ayadn or if it's simply getting too big, just trash it.
|
273
|
+
|
274
|
+
The file is: `%USERNAME%/ayadn/data/username/db/users.db`
|
256
275
|
|
257
276
|
## TIPS
|
258
277
|
|
@@ -404,61 +423,18 @@ then read its messages with `ayadn messages mychannel`.
|
|
404
423
|
|
405
424
|
List your existing aliases with `ayadn list alias`.
|
406
425
|
|
407
|
-
Aliases are cumulable. If something goes
|
426
|
+
Aliases are cumulable. If something goes wrong, just trash the file: `%USERNAME%/ayadn/data/username/db/channels_alias.db`
|
408
427
|
|
409
428
|
### Just for fun
|
410
429
|
|
411
430
|
`ayadn random`
|
412
431
|
|
413
|
-
## HELP
|
414
|
-
|
415
|
-
### Console
|
416
|
-
|
417
|
-
Be aware of the way the console/terminal treats what you type.
|
418
|
-
|
419
|
-
When posting with `"double quotes"`, any special character will be interpreted!
|
420
|
-
|
421
|
-
So `"echo !"` becomes `"echo last command"`. You may not want to do that...
|
422
|
-
|
423
|
-
So you have to post with `'simple quotes'`, this way the console don't mess with your content.
|
424
|
-
|
425
|
-
The thing is, how do you then post a text *containing one ore more exclamation marks AND/OR one or more simple quotes?*
|
426
|
-
|
427
|
-
The answer is to post with *"double quotes"* but use `\`, the *antislash* character, before any exclamation mark:
|
428
|
-
|
429
|
-
```
|
430
|
-
ayadn write "Here's an escaped exclamation mark \! and a normal simple quote in the same text"
|
431
|
-
```
|
432
|
-
|
433
|
-
**My advice: to avoid any problems, post with the compose feature, that is to say without providing arguments:**
|
434
|
-
|
435
|
-
`ayadn write`
|
436
|
-
|
437
|
-
### Database
|
438
|
-
|
439
|
-
Ayadn keeps a database of the ids of all the users it sees (it reduces the number of API calls and speeds up the app.)
|
440
|
-
|
441
|
-
If you think that this file is causing problems to Ayadn or if it's simply getting too big, just trash it.
|
442
|
-
|
443
|
-
The file is: `%USERNAME%/ayadn/data/username/db/users.db`
|
444
|
-
|
445
432
|
## CONTACT
|
446
433
|
|
447
434
|
Contact me on ADN [(@ericd)](http://alpha.app.net/ericd) if you have questions, ideas, or... if you know Ruby and you want to help a newbie to code better. ;)
|
448
435
|
|
449
|
-
The
|
436
|
+
The app's account is [@ayadn](http://alpha.app.net/ayadn) and will be used for support, bug report, etc.
|
450
437
|
|
451
|
-
|
438
|
+
There's also a [Broadcast channel](https://app.net/c/2zqf) for important announcements.
|
452
439
|
|
453
|
-
|
454
|
-
|
455
|
-
### Beta-testers
|
456
|
-
|
457
|
-
- Windows: [@ksniod](http://alpha.app.net/ksniod)
|
458
|
-
|
459
|
-
- Linux:
|
460
|
-
|
461
|
-
- [@martner_mala](http://alpha.app.net/martner_mala)
|
462
|
-
- [@nguarracino](http://alpha.app.net/nguarracino)
|
463
|
-
|
464
|
-
- OpenBSD: *(soon)*
|
440
|
+
Don't bother with @ayaio or @aya_tests, they're bots.
|
data/bin/ayadn
CHANGED
@@ -5,356 +5,5 @@
|
|
5
5
|
# http://alpha.app.net/ericd
|
6
6
|
# © 2013
|
7
7
|
|
8
|
-
|
9
|
-
puts "\n\nAYADN".red + " - " + "App.net command-line client\n".brown
|
8
|
+
require_relative '../lib/ayadn'
|
10
9
|
|
11
|
-
$status = AyaDN::ClientStatus.new
|
12
|
-
$tools = AyaDN::Tools.new
|
13
|
-
$files = AyaDN::Files.new
|
14
|
-
$files.makedir($tools.ayadn_configuration[:db_path])
|
15
|
-
|
16
|
-
token = $files.auth_read
|
17
|
-
if token != nil
|
18
|
-
client = AyaDN.new(token)
|
19
|
-
client.configAPI
|
20
|
-
else
|
21
|
-
puts $status.errorNotAuthorized
|
22
|
-
AyaDN.new(nil).ayadnAuthorize(nil)
|
23
|
-
exit
|
24
|
-
end
|
25
|
-
|
26
|
-
arg1, arg2, arg3, arg4 = ARGV[0], ARGV[1], ARGV[2], ARGV[3]
|
27
|
-
|
28
|
-
case arg1
|
29
|
-
|
30
|
-
when "scroll"
|
31
|
-
client.ayadnScroll(arg2, arg3)
|
32
|
-
|
33
|
-
when nil
|
34
|
-
client.ayadnUnified(nil)
|
35
|
-
|
36
|
-
when "unified", "uni"
|
37
|
-
client.ayadnUnified(arg2)
|
38
|
-
|
39
|
-
when "write", "w"
|
40
|
-
arg2 != nil ? client.ayadnSendPost(arg2, nil) : client.ayadn_compose_post
|
41
|
-
|
42
|
-
when "reply", "r"
|
43
|
-
if arg2 != nil
|
44
|
-
arg2.is_integer? ? client.ayadn_reply(arg2) : (puts $status.errorPostID(arg2))
|
45
|
-
else
|
46
|
-
puts $status.errorNoID
|
47
|
-
end
|
48
|
-
|
49
|
-
when "global", "g"
|
50
|
-
client.ayadnGlobal(arg2)
|
51
|
-
|
52
|
-
when "mentions", "m"
|
53
|
-
(arg2 =~ /^@/ || arg2 == "me") ? client.ayadnUserMentions(arg2, arg3) : (puts $status.errorUserID(arg2))
|
54
|
-
|
55
|
-
when "posts", "p"
|
56
|
-
(arg2 =~ /^@/ || arg2 == "me") ? client.ayadnUserPosts(arg2, arg3) : (puts $status.errorUserID(arg2))
|
57
|
-
|
58
|
-
when "trending", "conversations", "checkins", "photos"
|
59
|
-
client.ayadnExplore(arg1, arg2)
|
60
|
-
|
61
|
-
when "infos", "i", "info"
|
62
|
-
if arg2 =~ /^@/ || arg2 == "me"
|
63
|
-
client.ayadnUserInfos(arg2)
|
64
|
-
elsif arg2.is_integer?
|
65
|
-
client.ayadnPostInfos(arg2)
|
66
|
-
else
|
67
|
-
puts $status.errorInfos(arg2)
|
68
|
-
end
|
69
|
-
|
70
|
-
when "convo", "c", "thread"
|
71
|
-
arg2.is_integer? ? client.ayadnConversation(arg2) : (puts $status.errorPostID(arg2))
|
72
|
-
|
73
|
-
when "tag", "t", "hashtag"
|
74
|
-
theTag = arg2.dup
|
75
|
-
theTag[0] = "" if theTag =~ /^#/
|
76
|
-
client.ayadnHashtags(theTag)
|
77
|
-
|
78
|
-
when "delete"
|
79
|
-
if arg2.is_integer?
|
80
|
-
puts "\nAre you sure you want to delete post ".green + "#{arg2}? ".brown + "(n/y) ".green
|
81
|
-
input = STDIN.getch
|
82
|
-
(input == "y" || input == "Y") ? client.ayadnDeletePost(arg2) : (puts "\nCanceled.\n\n".red)
|
83
|
-
else
|
84
|
-
puts $status.errorPostID(arg2)
|
85
|
-
end
|
86
|
-
|
87
|
-
when "list"
|
88
|
-
case arg2
|
89
|
-
when "followings", "fwings"
|
90
|
-
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnShowList("followings", arg3) : (puts $status.errorSyntax)
|
91
|
-
when "followers", "fwers"
|
92
|
-
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnShowList("followers", arg3) : (puts $status.errorSyntax)
|
93
|
-
when "muted"
|
94
|
-
client.ayadnShowList("muted", "me")
|
95
|
-
when "blocked"
|
96
|
-
client.ayadnShowList("blocked", "me")
|
97
|
-
when "files"
|
98
|
-
client.ayadn_list_files(arg3)
|
99
|
-
when "options","config"
|
100
|
-
client.ayadn_show_options
|
101
|
-
when "channels", "ch"
|
102
|
-
client.get_loaded_channels
|
103
|
-
client.ayadn_get_channels
|
104
|
-
when "aliases", "alias", "channel-alias", "alias-channel"
|
105
|
-
client.ayadn_list_aliases
|
106
|
-
else
|
107
|
-
puts $status.errorSyntax
|
108
|
-
end
|
109
|
-
|
110
|
-
when "star"
|
111
|
-
arg2.is_integer? ? client.ayadnStarringPost("star", arg2) : (puts $status.errorPostID(arg2))
|
112
|
-
|
113
|
-
when "unstar"
|
114
|
-
arg2.is_integer? ? client.ayadnStarringPost("unstar", arg2) : (puts $status.errorPostID(arg2))
|
115
|
-
|
116
|
-
when "repost"
|
117
|
-
arg2.is_integer? ? client.ayadnReposting("repost", arg2) : (puts $status.errorPostID(arg2))
|
118
|
-
|
119
|
-
when "unrepost"
|
120
|
-
arg2.is_integer? ? client.ayadnReposting("unrepost", arg2) : (puts $status.errorPostID(arg2))
|
121
|
-
|
122
|
-
when "follow"
|
123
|
-
arg2 =~ /^@/ ? client.ayadnFollowing("follow", arg2) : (puts $status.errorUserID(arg2))
|
124
|
-
|
125
|
-
when "unfollow"
|
126
|
-
arg2 =~ /^@/ ? client.ayadnFollowing("unfollow", arg2) : (puts $status.errorUserID(arg2))
|
127
|
-
|
128
|
-
when "pm"
|
129
|
-
if arg2 =~ /^@/
|
130
|
-
if arg3 != nil
|
131
|
-
# ayadn pm @ericd "hello!"
|
132
|
-
client.ayadnSendMessage(arg2, arg3)
|
133
|
-
else
|
134
|
-
client.ayadnComposeMessage(arg2)
|
135
|
-
end
|
136
|
-
else
|
137
|
-
puts $status.errorSyntax
|
138
|
-
end
|
139
|
-
|
140
|
-
when "send"
|
141
|
-
if arg3 != nil
|
142
|
-
# ayadn send 12345 "hello, channel!"
|
143
|
-
client.ayadnSendMessageToChannel(arg2, arg3)
|
144
|
-
else
|
145
|
-
client.ayadnComposeMessageToChannel(arg2)
|
146
|
-
end
|
147
|
-
|
148
|
-
when "channels", "ch"
|
149
|
-
client.get_loaded_channels
|
150
|
-
client.ayadn_get_channels
|
151
|
-
|
152
|
-
when "messages", "msg"
|
153
|
-
# arg2 is integer -> display channel stream
|
154
|
-
# arg3 == nil = with pagination, arg3 == "all" = no pagination
|
155
|
-
client.ayadnGetMessages(arg2, arg3)
|
156
|
-
|
157
|
-
when "quote", "comment", "q"
|
158
|
-
if arg2.is_integer?
|
159
|
-
client.ayadn_quote(arg2)
|
160
|
-
else
|
161
|
-
puts $status.errorSyntax
|
162
|
-
end
|
163
|
-
|
164
|
-
when "nowplaying", "itunes", "np"
|
165
|
-
client.ayadn_nowplaying
|
166
|
-
|
167
|
-
when "search", "s"
|
168
|
-
arg2 != nil ? client.ayadnSearch(arg2) : (puts $status.errorSyntax)
|
169
|
-
|
170
|
-
when "starred"
|
171
|
-
if arg2 =~ /^@/ || arg2 == "me"
|
172
|
-
client.ayadnStarredPosts(arg2, arg3)
|
173
|
-
elsif arg2.is_integer?
|
174
|
-
client.ayadnWhoStarred(arg2)
|
175
|
-
else
|
176
|
-
puts $status.errorUserID(arg2)
|
177
|
-
end
|
178
|
-
|
179
|
-
when "reposted"
|
180
|
-
arg2.is_integer? ? client.ayadnWhoReposted(arg2) : (puts $status.errorPostID(arg2))
|
181
|
-
|
182
|
-
when "inter", "interactions", "events"
|
183
|
-
client.ayadnInteractions
|
184
|
-
|
185
|
-
when "save"
|
186
|
-
arg2.is_integer? ? client.ayadnSavePost(arg2) : (puts $status.errorPostID(arg2))
|
187
|
-
|
188
|
-
when "load"
|
189
|
-
arg2.is_integer? ? client.ayadnLoadPost(arg2) : (puts $status.errorPostID(arg2))
|
190
|
-
|
191
|
-
when "backup"
|
192
|
-
if arg2 == "followings"
|
193
|
-
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnSaveList("followings", arg3) : (puts $status.errorSyntax)
|
194
|
-
elsif arg2 == "followers"
|
195
|
-
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnSaveList("followers", arg3) : (puts $status.errorSyntax)
|
196
|
-
elsif arg2 == "muted"
|
197
|
-
client.ayadnSaveList("muted", "me")
|
198
|
-
end
|
199
|
-
|
200
|
-
when "help", "h"
|
201
|
-
puts $tools.helpScreen
|
202
|
-
|
203
|
-
when "commands", "usage"
|
204
|
-
puts $tools.list_of_commands
|
205
|
-
|
206
|
-
when "webhelp"
|
207
|
-
puts $tools.helpScreen
|
208
|
-
begin
|
209
|
-
if $tools.ayadn_configuration[:platform] =~ /darwin/
|
210
|
-
$tools.startBrowser("https://github.com/ericdke/ayadn#ayadn")
|
211
|
-
else
|
212
|
-
puts "\nCan't start a browser automatically. Please visit ".cyan + "https://github.com/ericdke/ayadn#ayadn".magenta
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
when "options"
|
217
|
-
client.ayadn_show_options
|
218
|
-
|
219
|
-
when "debug"
|
220
|
-
if arg2 == nil
|
221
|
-
client.ayadnDebugStream
|
222
|
-
elsif arg2 =~ /^@/
|
223
|
-
client.ayadnDebugUser(arg2)
|
224
|
-
elsif arg3.is_integer?
|
225
|
-
if arg2 == "post"
|
226
|
-
client.ayadnDebugPost(arg3)
|
227
|
-
elsif arg2 == "message"
|
228
|
-
# channel_id, message_id
|
229
|
-
client.ayadnDebugMessage(arg3, arg4)
|
230
|
-
elsif arg2 == "channel"
|
231
|
-
client.ayadnDebugChannel(arg3)
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
when "skip-source", "skip-client"
|
236
|
-
case arg2
|
237
|
-
when "add"
|
238
|
-
client.ayadn_skip_add("sources", arg3)
|
239
|
-
when "remove"
|
240
|
-
client.ayadn_skip_remove("sources", arg3)
|
241
|
-
when "show"
|
242
|
-
client.ayadn_show_options
|
243
|
-
else
|
244
|
-
puts $status.errorSyntax
|
245
|
-
end
|
246
|
-
|
247
|
-
when "skip-tag", "skip-hashtag"
|
248
|
-
case arg2
|
249
|
-
when "add"
|
250
|
-
client.ayadn_skip_add("hashtags", arg3)
|
251
|
-
when "remove"
|
252
|
-
client.ayadn_skip_remove("hashtags", arg3)
|
253
|
-
when "show"
|
254
|
-
client.ayadn_show_options
|
255
|
-
else
|
256
|
-
puts $status.errorSyntax
|
257
|
-
end
|
258
|
-
|
259
|
-
when "skip-mention", "skip-name", "skip-username"
|
260
|
-
case arg2
|
261
|
-
when "add"
|
262
|
-
client.ayadn_skip_add("mentions", arg3)
|
263
|
-
when "remove"
|
264
|
-
client.ayadn_skip_remove("mentions", arg3)
|
265
|
-
when "show"
|
266
|
-
client.ayadn_show_options
|
267
|
-
else
|
268
|
-
puts $status.errorSyntax
|
269
|
-
end
|
270
|
-
|
271
|
-
when "mute"
|
272
|
-
arg2 =~ /^@/ ? client.ayadnMuting("mute", arg2) : (puts $status.errorUserID(arg2))
|
273
|
-
|
274
|
-
when "unmute"
|
275
|
-
arg2 =~ /^@/ ? client.ayadnMuting("unmute", arg2) : (puts $status.errorUserID(arg2))
|
276
|
-
|
277
|
-
when "block"
|
278
|
-
arg2 =~ /^@/ ? client.ayadnBlocking("block", arg2) : (puts $status.errorUserID(arg2))
|
279
|
-
|
280
|
-
when "unblock"
|
281
|
-
arg2 =~ /^@/ ? client.ayadnBlocking("unblock", arg2) : (puts $status.errorUserID(arg2))
|
282
|
-
|
283
|
-
when "reset"
|
284
|
-
if arg2 == "pagination"
|
285
|
-
client.ayadnReset(arg3, arg4)
|
286
|
-
elsif arg2 == nil
|
287
|
-
client.ayadnReset(nil, nil)
|
288
|
-
end
|
289
|
-
|
290
|
-
# when "deactivate"
|
291
|
-
# # deactivate a user channel
|
292
|
-
# client.ayadnDeactivateChannel(arg2)
|
293
|
-
|
294
|
-
when "random"
|
295
|
-
# just for fun :)
|
296
|
-
api = AyaDN::API.new(token)
|
297
|
-
puts "Fetching random posts, wait a second... (quit with CTRL+C)\n\n".green
|
298
|
-
$tools.config['counts']['global'] = 20
|
299
|
-
hash = api.getGlobal(nil)
|
300
|
-
last_post = hash['data'][0]['id'].to_i
|
301
|
-
loop do
|
302
|
-
begin
|
303
|
-
rnd_post_num = rand(last_post + 1)
|
304
|
-
hash = api.getPostInfos("call", rnd_post_num)
|
305
|
-
hash = hash['data']
|
306
|
-
if hash['text'] == nil
|
307
|
-
sleep 0.2
|
308
|
-
next
|
309
|
-
end
|
310
|
-
puts AyaDN::View.new(nil).buildSimplePost(hash)
|
311
|
-
sleep 2
|
312
|
-
rescue Exception
|
313
|
-
abort($status.stopped)
|
314
|
-
end
|
315
|
-
end
|
316
|
-
|
317
|
-
when "delete-message"
|
318
|
-
client.ayadn_delete_message(arg2, arg3) #channel, message
|
319
|
-
|
320
|
-
when "download"
|
321
|
-
client.ayadn_download_files(arg2)
|
322
|
-
|
323
|
-
when "delete-file"
|
324
|
-
client.ayadn_delete_file(arg2)
|
325
|
-
|
326
|
-
when "upload"
|
327
|
-
client.ayadn_upload_files(arg2)
|
328
|
-
|
329
|
-
when "private", "public"
|
330
|
-
client.ayadn_attribute_file(arg1, arg2)
|
331
|
-
|
332
|
-
when "pin"
|
333
|
-
client.ayadnBookmark(ARGV)
|
334
|
-
|
335
|
-
when "alias-channel"
|
336
|
-
client.ayadn_alias_channel(arg2, arg3)
|
337
|
-
|
338
|
-
when "stream_global"
|
339
|
-
client.ayadn_userstream
|
340
|
-
|
341
|
-
when "does", "do", "is", "has"
|
342
|
-
client.ayadn_does(ARGV)
|
343
|
-
|
344
|
-
when "authorize", "login"
|
345
|
-
AyaDN.new(nil).ayadnAuthorize("reset")
|
346
|
-
|
347
|
-
when "install"
|
348
|
-
if arg2 == "config"
|
349
|
-
$tools.installConfig
|
350
|
-
else
|
351
|
-
puts $status.errorSyntax
|
352
|
-
end
|
353
|
-
|
354
|
-
else
|
355
|
-
# if not any known argument
|
356
|
-
puts $status.errorSyntax
|
357
|
-
puts "#{ARGV.join(" ")} ".brown + "is not a valid option.\n\n".red
|
358
|
-
puts $tools.helpScreen
|
359
|
-
|
360
|
-
end
|
data/lib/ayadn.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
require_relative 'ayadn/requires.rb'
|
2
|
+
require_relative 'ayadn/adn_files.rb'
|
3
|
+
require_relative 'ayadn/api.rb'
|
4
|
+
require_relative 'ayadn/authorize.rb'
|
5
|
+
require_relative 'ayadn/client-http.rb'
|
6
|
+
require_relative 'ayadn/colors.rb'
|
7
|
+
require_relative 'ayadn/debug.rb'
|
8
|
+
require_relative 'ayadn/endpoints.rb'
|
9
|
+
require_relative 'ayadn/extend.rb'
|
10
|
+
require_relative 'ayadn/files.rb'
|
11
|
+
require_relative 'ayadn/get-api.rb'
|
12
|
+
require_relative 'ayadn/help.rb'
|
13
|
+
require_relative 'ayadn/list.rb'
|
14
|
+
require_relative 'ayadn/main.rb'
|
15
|
+
require_relative 'ayadn/pinboard.rb'
|
16
|
+
require_relative 'ayadn/post.rb'
|
17
|
+
require_relative 'ayadn/skip.rb'
|
18
|
+
require_relative 'ayadn/status.rb'
|
19
|
+
require_relative 'ayadn/tools.rb'
|
20
|
+
require_relative 'ayadn/user-stream.rb'
|
21
|
+
require_relative 'ayadn/view-channels.rb'
|
22
|
+
require_relative 'ayadn/view-interactions.rb'
|
23
|
+
require_relative 'ayadn/view-object.rb'
|
24
|
+
require_relative 'ayadn/view.rb'
|
25
|
+
require_relative 'ayadn/app.rb'
|
data/lib/ayadn/api.rb
CHANGED
@@ -25,7 +25,7 @@ class AyaDN
|
|
25
25
|
|
26
26
|
def getGlobal(last_page_id)
|
27
27
|
@url = @endpoints.global
|
28
|
-
@url += @endpoints.
|
28
|
+
@url += @endpoints.base_params
|
29
29
|
@url += @endpoints.include_directed if $tools.config['timeline']['directed']
|
30
30
|
checkLastPageID(last_page_id)
|
31
31
|
getHash
|
@@ -92,7 +92,7 @@ class AyaDN
|
|
92
92
|
end
|
93
93
|
def getSinglePost(post_id)
|
94
94
|
@url = @endpoints.single_post(post_id)
|
95
|
-
@url += @endpoints.
|
95
|
+
@url += @endpoints.light_params
|
96
96
|
getHash
|
97
97
|
end
|
98
98
|
def getStarredPosts(username)
|
data/lib/ayadn/app.rb
ADDED
@@ -0,0 +1,367 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
puts "\n\nAYADN".red + " - " + "App.net command-line client\n".brown
|
5
|
+
|
6
|
+
$status = AyaDN::ClientStatus.new
|
7
|
+
$tools = AyaDN::Tools.new
|
8
|
+
$files = AyaDN::Files.new
|
9
|
+
$files.makedir($tools.ayadn_configuration[:db_path])
|
10
|
+
|
11
|
+
token = $files.auth_read
|
12
|
+
if token != nil
|
13
|
+
client = AyaDN.new(token)
|
14
|
+
client.configAPI
|
15
|
+
else
|
16
|
+
puts $status.errorNotAuthorized
|
17
|
+
AyaDN.new(nil).ayadnAuthorize(nil)
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
arg1, arg2, arg3, arg4 = ARGV[0], ARGV[1], ARGV[2], ARGV[3]
|
22
|
+
|
23
|
+
case arg1
|
24
|
+
|
25
|
+
when "scroll"
|
26
|
+
client.ayadnScroll(arg2, arg3)
|
27
|
+
|
28
|
+
when nil
|
29
|
+
client.ayadnUnified(nil)
|
30
|
+
|
31
|
+
when "unified", "uni"
|
32
|
+
client.ayadnUnified(arg2)
|
33
|
+
|
34
|
+
when "write", "w"
|
35
|
+
arg2 != nil ? client.ayadnSendPost(arg2, nil) : client.ayadn_compose_post
|
36
|
+
|
37
|
+
when "reply", "r"
|
38
|
+
if arg2 != nil
|
39
|
+
arg2.is_integer? ? client.ayadn_reply(arg2) : (puts $status.errorPostID(arg2))
|
40
|
+
else
|
41
|
+
puts $status.errorNoID
|
42
|
+
end
|
43
|
+
|
44
|
+
when "global", "g"
|
45
|
+
client.ayadnGlobal(arg2)
|
46
|
+
|
47
|
+
when "mentions", "m"
|
48
|
+
(arg2 =~ /^@/ || arg2 == "me") ? client.ayadnUserMentions(arg2, arg3) : (puts $status.errorUserID(arg2))
|
49
|
+
|
50
|
+
when "posts", "p"
|
51
|
+
(arg2 =~ /^@/ || arg2 == "me") ? client.ayadnUserPosts(arg2, arg3) : (puts $status.errorUserID(arg2))
|
52
|
+
|
53
|
+
when "trending", "conversations", "checkins", "photos"
|
54
|
+
client.ayadnExplore(arg1, arg2)
|
55
|
+
|
56
|
+
when "infos", "i", "info"
|
57
|
+
if arg2 =~ /^@/ || arg2 == "me"
|
58
|
+
client.ayadnUserInfos(arg2)
|
59
|
+
elsif arg2.is_integer?
|
60
|
+
client.ayadnPostInfos(arg2)
|
61
|
+
else
|
62
|
+
puts $status.errorInfos(arg2)
|
63
|
+
end
|
64
|
+
|
65
|
+
when "convo", "c", "thread"
|
66
|
+
arg2.is_integer? ? client.ayadnConversation(arg2) : (puts $status.errorPostID(arg2))
|
67
|
+
|
68
|
+
when "tag", "t", "hashtag"
|
69
|
+
theTag = arg2.dup
|
70
|
+
theTag[0] = "" if theTag =~ /^#/
|
71
|
+
client.ayadnHashtags(theTag)
|
72
|
+
|
73
|
+
when "delete"
|
74
|
+
if arg2.is_integer?
|
75
|
+
puts "\nAre you sure you want to delete post ".green + "#{arg2}? ".brown + "(n/y) ".green
|
76
|
+
input = STDIN.getch
|
77
|
+
(input == "y" || input == "Y") ? client.ayadnDeletePost(arg2) : (puts "\nCanceled.\n\n".red)
|
78
|
+
else
|
79
|
+
puts $status.errorPostID(arg2)
|
80
|
+
end
|
81
|
+
|
82
|
+
when "list"
|
83
|
+
case arg2
|
84
|
+
when "followings", "fwings"
|
85
|
+
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnShowList("followings", arg3) : (puts $status.errorSyntax)
|
86
|
+
when "followers", "fwers"
|
87
|
+
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnShowList("followers", arg3) : (puts $status.errorSyntax)
|
88
|
+
when "muted"
|
89
|
+
client.ayadnShowList("muted", "me")
|
90
|
+
when "blocked"
|
91
|
+
client.ayadnShowList("blocked", "me")
|
92
|
+
when "files"
|
93
|
+
client.ayadn_list_files(arg3)
|
94
|
+
when "options","config"
|
95
|
+
client.ayadn_show_options
|
96
|
+
when "channels", "ch"
|
97
|
+
client.get_loaded_channels
|
98
|
+
client.ayadn_get_channels
|
99
|
+
when "aliases", "alias", "channel-alias", "alias-channel"
|
100
|
+
client.ayadn_list_aliases
|
101
|
+
else
|
102
|
+
puts $status.errorSyntax
|
103
|
+
end
|
104
|
+
|
105
|
+
when "star"
|
106
|
+
arg2.is_integer? ? client.ayadnStarringPost("star", arg2) : (puts $status.errorPostID(arg2))
|
107
|
+
|
108
|
+
when "unstar"
|
109
|
+
arg2.is_integer? ? client.ayadnStarringPost("unstar", arg2) : (puts $status.errorPostID(arg2))
|
110
|
+
|
111
|
+
when "repost"
|
112
|
+
arg2.is_integer? ? client.ayadnReposting("repost", arg2) : (puts $status.errorPostID(arg2))
|
113
|
+
|
114
|
+
when "unrepost"
|
115
|
+
arg2.is_integer? ? client.ayadnReposting("unrepost", arg2) : (puts $status.errorPostID(arg2))
|
116
|
+
|
117
|
+
when "follow"
|
118
|
+
arg2 =~ /^@/ ? client.ayadnFollowing("follow", arg2) : (puts $status.errorUserID(arg2))
|
119
|
+
|
120
|
+
when "unfollow"
|
121
|
+
arg2 =~ /^@/ ? client.ayadnFollowing("unfollow", arg2) : (puts $status.errorUserID(arg2))
|
122
|
+
|
123
|
+
when "pm"
|
124
|
+
if arg2 =~ /^@/
|
125
|
+
if arg3 != nil
|
126
|
+
# ayadn pm @ericd "hello!"
|
127
|
+
client.ayadnSendMessage(arg2, arg3)
|
128
|
+
else
|
129
|
+
client.ayadnComposeMessage(arg2)
|
130
|
+
end
|
131
|
+
else
|
132
|
+
puts $status.errorSyntax
|
133
|
+
end
|
134
|
+
|
135
|
+
when "send"
|
136
|
+
if arg3 != nil
|
137
|
+
# ayadn send 12345 "hello, channel!"
|
138
|
+
client.ayadnSendMessageToChannel(arg2, arg3)
|
139
|
+
else
|
140
|
+
client.ayadnComposeMessageToChannel(arg2)
|
141
|
+
end
|
142
|
+
|
143
|
+
when "channels", "ch"
|
144
|
+
client.get_loaded_channels
|
145
|
+
client.ayadn_get_channels
|
146
|
+
|
147
|
+
when "messages", "msg"
|
148
|
+
# arg2 is integer -> display channel stream
|
149
|
+
# arg3 == nil = with pagination, arg3 == "all" = no pagination
|
150
|
+
client.ayadnGetMessages(arg2, arg3)
|
151
|
+
|
152
|
+
when "quote", "comment", "q"
|
153
|
+
if arg2.is_integer?
|
154
|
+
client.ayadn_quote(arg2)
|
155
|
+
else
|
156
|
+
puts $status.errorSyntax
|
157
|
+
end
|
158
|
+
|
159
|
+
when "nowplaying", "itunes", "np"
|
160
|
+
client.ayadn_nowplaying
|
161
|
+
|
162
|
+
when "search", "s"
|
163
|
+
arg2 != nil ? client.ayadnSearch(arg2) : (puts $status.errorSyntax)
|
164
|
+
|
165
|
+
when "starred"
|
166
|
+
if arg2 =~ /^@/ || arg2 == "me"
|
167
|
+
client.ayadnStarredPosts(arg2, arg3)
|
168
|
+
elsif arg2.is_integer?
|
169
|
+
client.ayadnWhoStarred(arg2)
|
170
|
+
else
|
171
|
+
puts $status.errorUserID(arg2)
|
172
|
+
end
|
173
|
+
|
174
|
+
when "reposted"
|
175
|
+
arg2.is_integer? ? client.ayadnWhoReposted(arg2) : (puts $status.errorPostID(arg2))
|
176
|
+
|
177
|
+
when "inter", "interactions", "events"
|
178
|
+
client.ayadnInteractions
|
179
|
+
|
180
|
+
when "save"
|
181
|
+
arg2.is_integer? ? client.ayadnSavePost(arg2) : (puts $status.errorPostID(arg2))
|
182
|
+
|
183
|
+
when "load"
|
184
|
+
arg2.is_integer? ? client.ayadnLoadPost(arg2) : (puts $status.errorPostID(arg2))
|
185
|
+
|
186
|
+
when "backup"
|
187
|
+
if arg2 == "followings"
|
188
|
+
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnSaveList("followings", arg3) : (puts $status.errorSyntax)
|
189
|
+
elsif arg2 == "followers"
|
190
|
+
(arg3 =~ /^@/ || arg3 == "me") ? client.ayadnSaveList("followers", arg3) : (puts $status.errorSyntax)
|
191
|
+
elsif arg2 == "muted"
|
192
|
+
client.ayadnSaveList("muted", "me")
|
193
|
+
end
|
194
|
+
|
195
|
+
when "help", "h"
|
196
|
+
puts $tools.helpScreen
|
197
|
+
|
198
|
+
when "commands", "usage"
|
199
|
+
puts $tools.list_of_commands
|
200
|
+
|
201
|
+
when "webhelp"
|
202
|
+
puts $tools.helpScreen
|
203
|
+
begin
|
204
|
+
if $tools.ayadn_configuration[:platform] =~ /darwin/
|
205
|
+
$tools.startBrowser("https://github.com/ericdke/ayadn#ayadn")
|
206
|
+
else
|
207
|
+
puts "\nCan't start a browser automatically. Please visit ".cyan + "https://github.com/ericdke/ayadn#ayadn".magenta
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
when "options"
|
212
|
+
client.ayadn_show_options
|
213
|
+
|
214
|
+
when "debug"
|
215
|
+
if arg2 == nil
|
216
|
+
client.ayadnDebugStream
|
217
|
+
elsif arg2 =~ /^@/
|
218
|
+
client.ayadnDebugUser(arg2)
|
219
|
+
elsif arg3.is_integer?
|
220
|
+
if arg2 == "post"
|
221
|
+
client.ayadnDebugPost(arg3)
|
222
|
+
elsif arg2 == "message"
|
223
|
+
# channel_id, message_id
|
224
|
+
client.ayadnDebugMessage(arg3, arg4)
|
225
|
+
elsif arg2 == "channel"
|
226
|
+
client.ayadnDebugChannel(arg3)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
when "skip-source", "skip-client"
|
231
|
+
case arg2
|
232
|
+
when "add"
|
233
|
+
client.ayadn_skip_add("sources", arg3)
|
234
|
+
when "remove"
|
235
|
+
client.ayadn_skip_remove("sources", arg3)
|
236
|
+
when "show"
|
237
|
+
client.ayadn_show_options
|
238
|
+
else
|
239
|
+
puts $status.errorSyntax
|
240
|
+
end
|
241
|
+
|
242
|
+
when "skip-tag", "skip-hashtag"
|
243
|
+
case arg2
|
244
|
+
when "add"
|
245
|
+
client.ayadn_skip_add("hashtags", arg3)
|
246
|
+
when "remove"
|
247
|
+
client.ayadn_skip_remove("hashtags", arg3)
|
248
|
+
when "show"
|
249
|
+
client.ayadn_show_options
|
250
|
+
else
|
251
|
+
puts $status.errorSyntax
|
252
|
+
end
|
253
|
+
|
254
|
+
when "skip-mention", "skip-name", "skip-username"
|
255
|
+
case arg2
|
256
|
+
when "add"
|
257
|
+
client.ayadn_skip_add("mentions", arg3)
|
258
|
+
when "remove"
|
259
|
+
client.ayadn_skip_remove("mentions", arg3)
|
260
|
+
when "show"
|
261
|
+
client.ayadn_show_options
|
262
|
+
else
|
263
|
+
puts $status.errorSyntax
|
264
|
+
end
|
265
|
+
|
266
|
+
when "mute"
|
267
|
+
arg2 =~ /^@/ ? client.ayadnMuting("mute", arg2) : (puts $status.errorUserID(arg2))
|
268
|
+
|
269
|
+
when "unmute"
|
270
|
+
arg2 =~ /^@/ ? client.ayadnMuting("unmute", arg2) : (puts $status.errorUserID(arg2))
|
271
|
+
|
272
|
+
when "block"
|
273
|
+
arg2 =~ /^@/ ? client.ayadnBlocking("block", arg2) : (puts $status.errorUserID(arg2))
|
274
|
+
|
275
|
+
when "unblock"
|
276
|
+
arg2 =~ /^@/ ? client.ayadnBlocking("unblock", arg2) : (puts $status.errorUserID(arg2))
|
277
|
+
|
278
|
+
when "reset"
|
279
|
+
if arg2 == "pagination"
|
280
|
+
client.ayadnReset(arg3, arg4)
|
281
|
+
elsif arg2 == nil
|
282
|
+
client.ayadnReset(nil, nil)
|
283
|
+
end
|
284
|
+
|
285
|
+
# when "deactivate"
|
286
|
+
# # deactivate a user channel
|
287
|
+
# client.ayadnDeactivateChannel(arg2)
|
288
|
+
|
289
|
+
when "random"
|
290
|
+
# just for fun, a quick & dirty hack :)
|
291
|
+
api = AyaDN::API.new(token)
|
292
|
+
puts "Fetching random posts, wait a second... (quit with CTRL+C)\n\n".green
|
293
|
+
$tools.config['counts']['global'] = 20
|
294
|
+
hash = api.getGlobal(2)
|
295
|
+
puts "\e[H\e[2J"
|
296
|
+
last_post = hash['data'][0]['id'].to_i
|
297
|
+
rnd_post_num = rand(last_post + 1)
|
298
|
+
hash = api.getSinglePost(rnd_post_num)
|
299
|
+
hash = hash['data']
|
300
|
+
puts AyaDN::View.new(nil).buildSimplePost(hash)
|
301
|
+
if hash['text'] == nil
|
302
|
+
puts "\n-- SKIPPED POST (NO TEXT) --\n\n"
|
303
|
+
sleep 0.2
|
304
|
+
end
|
305
|
+
loop do
|
306
|
+
begin
|
307
|
+
sleep 0.7
|
308
|
+
rnd_post_num = rand(last_post + 1)
|
309
|
+
hash = api.getSinglePost(rnd_post_num)
|
310
|
+
hash = hash['data']
|
311
|
+
if hash['text'] == nil
|
312
|
+
puts "\n-- SKIPPED POST (NO TEXT) --\n\n"
|
313
|
+
sleep 0.2
|
314
|
+
next
|
315
|
+
end
|
316
|
+
#jj hash['annotations'] if hash['annotations']
|
317
|
+
puts AyaDN::View.new(nil).buildSimplePost(hash)
|
318
|
+
rescue Exception => e
|
319
|
+
#puts e.inspect
|
320
|
+
abort($status.stopped)
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
when "delete-message"
|
325
|
+
client.ayadn_delete_message(arg2, arg3) #channel, message
|
326
|
+
|
327
|
+
when "download"
|
328
|
+
client.ayadn_download_files(arg2)
|
329
|
+
|
330
|
+
when "delete-file"
|
331
|
+
client.ayadn_delete_file(arg2)
|
332
|
+
|
333
|
+
when "upload"
|
334
|
+
client.ayadn_upload_files(arg2)
|
335
|
+
|
336
|
+
when "private", "public"
|
337
|
+
client.ayadn_attribute_file(arg1, arg2)
|
338
|
+
|
339
|
+
when "pin"
|
340
|
+
client.ayadnBookmark(ARGV)
|
341
|
+
|
342
|
+
when "alias-channel"
|
343
|
+
client.ayadn_alias_channel(arg2, arg3)
|
344
|
+
|
345
|
+
when "stream_global"
|
346
|
+
client.ayadn_userstream
|
347
|
+
|
348
|
+
when "does", "do", "is", "has"
|
349
|
+
client.ayadn_does(ARGV)
|
350
|
+
|
351
|
+
when "authorize", "login"
|
352
|
+
AyaDN.new(nil).ayadnAuthorize("reset")
|
353
|
+
|
354
|
+
when "install"
|
355
|
+
if arg2 == "config"
|
356
|
+
$tools.installConfig
|
357
|
+
else
|
358
|
+
puts $status.errorSyntax
|
359
|
+
end
|
360
|
+
|
361
|
+
else
|
362
|
+
# if not any known argument
|
363
|
+
puts $status.errorSyntax
|
364
|
+
puts "#{ARGV.join(" ")} ".brown + "is not a valid option.\n\n".red
|
365
|
+
puts $tools.helpScreen
|
366
|
+
|
367
|
+
end
|
data/lib/ayadn/client-http.rb
CHANGED
@@ -26,7 +26,7 @@ class AyaDN
|
|
26
26
|
puts "\nForbidden.\n\n".red
|
27
27
|
exit
|
28
28
|
when 404
|
29
|
-
puts "\nDoes not exist (or has been deleted)
|
29
|
+
puts "\nDoes not exist (or has been deleted) => \n\n#{code}\n\n".red
|
30
30
|
exit
|
31
31
|
when 429
|
32
32
|
puts "\nToo many requests.\n\n".red
|
@@ -54,17 +54,17 @@ class AyaDN
|
|
54
54
|
#print "\rConnecting to #{uri.host}#{uri.path}".cyan
|
55
55
|
body = ''
|
56
56
|
https.request(request) do |res|
|
57
|
-
fileSize = res['Content-Length'].to_i
|
58
|
-
bytesTransferred = 0
|
57
|
+
#fileSize = res['Content-Length'].to_i
|
58
|
+
#bytesTransferred = 0
|
59
59
|
res.read_body do |part|
|
60
|
-
bytesTransferred += part.length
|
61
|
-
rounded = bytesTransferred.percent_of(fileSize).round(2)
|
62
|
-
print "\rFetching data: ".cyan + "#{rounded} ".brown
|
60
|
+
#bytesTransferred += part.length
|
61
|
+
#rounded = bytesTransferred.percent_of(fileSize).round(2)
|
62
|
+
#print "\rFetching data: ".cyan + "#{rounded} ".brown
|
63
63
|
# print "\rDownloading response from App.net\t#{bytesTransferred.to_filesize}"
|
64
64
|
body << part
|
65
65
|
end
|
66
66
|
end
|
67
|
-
print "\r "
|
67
|
+
#print "\r "
|
68
68
|
#puts ""
|
69
69
|
check_http_error_code(body)
|
70
70
|
return body
|
data/lib/ayadn/config.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
counts: # number of elements retrieved by a stream on the first access, 200 max
|
3
|
-
global:
|
4
|
-
unified:
|
5
|
-
checkins:
|
6
|
-
explore:
|
7
|
-
mentions:
|
8
|
-
posts:
|
9
|
-
starred:
|
10
|
-
search:
|
3
|
+
global: 50
|
4
|
+
unified: 50
|
5
|
+
checkins: 50
|
6
|
+
explore: 50
|
7
|
+
mentions: 50
|
8
|
+
posts: 50
|
9
|
+
starred: 50
|
10
|
+
search: 50
|
11
11
|
timeline:
|
12
12
|
# if true, the timeline is displayed from old to recent
|
13
13
|
downside: true
|
@@ -17,7 +17,7 @@ timeline:
|
|
17
17
|
streamback: 30
|
18
18
|
countdown_1: 5
|
19
19
|
countdown_2: 15
|
20
|
-
show_client:
|
20
|
+
show_client: true
|
21
21
|
show_symbols: true
|
22
22
|
show_reposters: true
|
23
23
|
files:
|
data/lib/ayadn/get-api.rb
CHANGED
data/lib/ayadn/main.rb
CHANGED
data/lib/ayadn/tools.rb
CHANGED
@@ -49,9 +49,9 @@ class AyaDN
|
|
49
49
|
"streamback" => 30,
|
50
50
|
"countdown_1" => 5,
|
51
51
|
"countdown_2" => 15,
|
52
|
-
"show_client" =>
|
52
|
+
"show_client" => true,
|
53
53
|
"show_symbols" => true,
|
54
|
-
"show_reposters" =>
|
54
|
+
"show_reposters" => true
|
55
55
|
},
|
56
56
|
"files" => {
|
57
57
|
"ayadnfiles" => "/ayadn/data",
|
@@ -182,7 +182,7 @@ class AyaDN
|
|
182
182
|
puts "\nRedirected.\n\n".red
|
183
183
|
puts "#{meta.inspect}\n".red
|
184
184
|
when 404
|
185
|
-
puts "Does not exist (or has been deleted)
|
185
|
+
puts "Does not exist (or has been deleted) => #{meta['code']}\n".red
|
186
186
|
exit
|
187
187
|
else
|
188
188
|
abort("\nERROR: #{meta.to_s}\n".red)
|
data/lib/ayadn/view-object.rb
CHANGED
@@ -17,6 +17,7 @@ class AyaDN
|
|
17
17
|
user_handle: user_handle,
|
18
18
|
user_real_name: user_real_name,
|
19
19
|
text: coloredText(item),
|
20
|
+
source: item['source']['name'],
|
20
21
|
links: objectLinks(item),
|
21
22
|
annotations: annotations,
|
22
23
|
me_mentioned: me_mentioned,
|
@@ -134,7 +135,7 @@ class AyaDN
|
|
134
135
|
obj_view << ' '
|
135
136
|
obj_view << params[:created_day].cyan + ' ' + params[:created_hour].cyan
|
136
137
|
obj_view << ' '
|
137
|
-
obj_view << "[#{
|
138
|
+
obj_view << "[#{params[:source]}]".cyan if $tools.config['timeline']['show_client']
|
138
139
|
if params[:repost_of] && $tools.config['timeline']['show_reposters']
|
139
140
|
obj_view << " [x#{params[:num_reposts]}]".blue
|
140
141
|
end
|
@@ -144,6 +145,7 @@ class AyaDN
|
|
144
145
|
end
|
145
146
|
obj_view << "\n"
|
146
147
|
obj_view << params[:text]
|
148
|
+
obj_view << "\n" if params[:links]
|
147
149
|
obj_view << (params[:annotations] + "\n") if params[:annotations] != nil
|
148
150
|
obj_view << params[:links] + "\n"
|
149
151
|
obj_view
|
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: 0.6.
|
4
|
+
version: 0.6.4
|
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-02-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- lib/ayadn.rb
|
55
55
|
- lib/ayadn/adn_files.rb
|
56
56
|
- lib/ayadn/api.rb
|
57
|
+
- lib/ayadn/app.rb
|
57
58
|
- lib/ayadn/authorize.rb
|
58
59
|
- lib/ayadn/client-http.rb
|
59
60
|
- lib/ayadn/colors.rb
|