ayadn 2.0.10 → 2.0.11
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 +5 -0
- data/doc/11-blacklist.md +12 -2
- data/lib/ayadn.rb +1 -1
- data/lib/ayadn/blacklist.rb +10 -2
- data/lib/ayadn/descriptions.rb +10 -2
- data/lib/ayadn/nowplaying.rb +7 -1
- data/lib/ayadn/version.rb +1 -1
- data/lib/ayadn/workers.rb +16 -1
- data/spec/mock/ayadn.sqlite +0 -0
- data/spec/unit/blacklistworkers_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8855a888a4df8b8a2ce5faaec1b09a9e52a4eb0
|
4
|
+
data.tar.gz: 4fda3a6a7938cae52d79f8754d0d64aa0e528fd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f80c1b862b0ffc912501739b8e5ec9ea1f13d3bd59cbc984999549d192133dac899f6a047a137d2187a94728d84303212bc400ff328ddfd364f3c7eef2a86353
|
7
|
+
data.tar.gz: 0b541f61aa144fcca671072e8d1d0ed729eb7a82013dfdbb0adae7ca1c274e070744f9ba894d48a8a27e993a73c973d2f2bb9ccda9f7f0dbf4eb41935f0dcf06
|
data/CHANGELOG.md
CHANGED
data/doc/11-blacklist.md
CHANGED
@@ -16,13 +16,15 @@ Blacklist a user and, well, never see this user again.
|
|
16
16
|
|
17
17
|
Blacklist a mention and you won't even see posts by other users mentioning the user you blacklisted!
|
18
18
|
|
19
|
+
You can even blacklist a single keyword if you *really* don't want to see something.
|
20
|
+
|
19
21
|
*Since Ayadn 2.0, adding and removing to/from the blacklist takes immediately effect and is shared with other Ayadn instances launched by the same user.*
|
20
22
|
|
21
23
|
## ADD
|
22
24
|
|
23
25
|
Adds an item to your blacklist.
|
24
26
|
|
25
|
-
Available items: client, hashtag, user, mention.
|
27
|
+
Available items: client, hashtag, user, mention, word.
|
26
28
|
|
27
29
|
`ayadn blacklist add mention @shmuck`
|
28
30
|
|
@@ -42,11 +44,15 @@ Add a hashtag:
|
|
42
44
|
|
43
45
|
`ayadn -K add hashtag twitter`
|
44
46
|
|
47
|
+
Add a keyword:
|
48
|
+
|
49
|
+
`ayadn -K add word poo`
|
50
|
+
|
45
51
|
## REMOVE
|
46
52
|
|
47
53
|
Removes an item from your blacklist.
|
48
54
|
|
49
|
-
Available items: client, hashtag, user, mention.
|
55
|
+
Available items: client, hashtag, user, mention, word.
|
50
56
|
|
51
57
|
`ayadn blacklist remove mention @shmuck`
|
52
58
|
|
@@ -66,6 +72,10 @@ Remove a hashtag:
|
|
66
72
|
|
67
73
|
`ayadn -K remove hashtag twitter`
|
68
74
|
|
75
|
+
Remove a keyword:
|
76
|
+
|
77
|
+
`ayadn -K remove word poo`
|
78
|
+
|
69
79
|
## LIST
|
70
80
|
|
71
81
|
List all items in your blacklist.
|
data/lib/ayadn.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
begin
|
4
4
|
require_relative 'ayadn/version'
|
5
|
-
%w{rest_client json thor rainbow/ext/string terminal-table yaml logger fileutils io/console unicode_utils
|
5
|
+
%w{rest_client json thor rainbow/ext/string terminal-table yaml logger fileutils io/console unicode_utils readline amalgalite fast_cache}.each { |r| require "#{r}" }
|
6
6
|
Rainbow.enabled = true
|
7
7
|
require_relative 'ayadn/app'
|
8
8
|
rescue LoadError => e
|
data/lib/ayadn/blacklist.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Ayadn
|
3
3
|
class Blacklist < Thor
|
4
|
-
desc "add TYPE TARGET", "Adds a mention, hashtag, client or
|
4
|
+
desc "add TYPE TARGET", "Adds a mention, hashtag, client, username or keyword to your blacklist"
|
5
5
|
map "create" => :add
|
6
6
|
long_desc Descriptions.blacklist_add
|
7
7
|
def add(*args)
|
@@ -13,7 +13,7 @@ module Ayadn
|
|
13
13
|
Status.new.done
|
14
14
|
end
|
15
15
|
|
16
|
-
desc "remove TYPE TARGET", "Removes a mention, hashtag, client or
|
16
|
+
desc "remove TYPE TARGET", "Removes a mention, hashtag, client, username or keyword from your blacklist"
|
17
17
|
map "delete" => :remove
|
18
18
|
long_desc Descriptions.blacklist_remove
|
19
19
|
def remove(*args)
|
@@ -101,6 +101,10 @@ module Ayadn
|
|
101
101
|
when 'hashtag', 'tag'
|
102
102
|
Databases.add_to_blacklist('hashtag', args)
|
103
103
|
Logs.rec.info "Added '#{args}' to blacklist of hashtags."
|
104
|
+
when 'word', 'keyword'
|
105
|
+
args = args.map { |w| w.gsub(/[~:-;,?!\'&`^=+<>*%()\/"“”’°£$€.…]/, "") }
|
106
|
+
Databases.add_to_blacklist('word', args)
|
107
|
+
Logs.rec.info "Added '#{args}' to blacklist of words."
|
104
108
|
else
|
105
109
|
Status.new.wrong_arguments
|
106
110
|
end
|
@@ -124,6 +128,10 @@ module Ayadn
|
|
124
128
|
when 'hashtag', 'tag'
|
125
129
|
Databases.remove_from_blacklist('hashtag', args)
|
126
130
|
Logs.rec.info "Removed '#{type}:#{args}' from blacklist."
|
131
|
+
when 'word', 'keyword'
|
132
|
+
args = args.map { |w| w.gsub(/[~:-;,?!\'&`^=+<>*%()\/"“”’°£$€.…]/, "") }
|
133
|
+
Databases.remove_from_blacklist('word', args)
|
134
|
+
Logs.rec.info "Removed '#{type}:#{args}' from blacklist."
|
127
135
|
else
|
128
136
|
Status.new.wrong_arguments
|
129
137
|
end
|
data/lib/ayadn/descriptions.rb
CHANGED
@@ -1680,17 +1680,21 @@ module Ayadn
|
|
1680
1680
|
|
1681
1681
|
`ayadn -K add client 'Spammy Unknown Client'`
|
1682
1682
|
|
1683
|
+
`ayadn -K add word poo`
|
1684
|
+
|
1683
1685
|
`ayadn -K remove mention @shmuck`
|
1684
1686
|
|
1685
1687
|
`ayadn -K remove hashtag sports`
|
1686
1688
|
|
1687
1689
|
`ayadn -K remove client IFTTT`
|
1690
|
+
|
1691
|
+
`ayadn -K remove word poo`
|
1688
1692
|
\n\n
|
1689
1693
|
USAGE
|
1690
1694
|
end
|
1691
1695
|
def self.blacklist_add
|
1692
1696
|
<<-USAGE
|
1693
|
-
Adds a mention, hashtag or
|
1697
|
+
Adds a mention, hashtag, client or keyword to your blacklist.
|
1694
1698
|
|
1695
1699
|
You don't have to respect the case as all data is recorded downcase.
|
1696
1700
|
|
@@ -1705,12 +1709,14 @@ module Ayadn
|
|
1705
1709
|
`ayadn -K add client IFTTT`
|
1706
1710
|
|
1707
1711
|
`ayadn -K add client 'Spammy Unknown Client'`
|
1712
|
+
|
1713
|
+
`ayadn -K add word poo`
|
1708
1714
|
\n\n
|
1709
1715
|
USAGE
|
1710
1716
|
end
|
1711
1717
|
def self.blacklist_remove
|
1712
1718
|
<<-USAGE
|
1713
|
-
Removes a mention, hashtag or
|
1719
|
+
Removes a mention, hashtag, client or keyword from your blacklist.
|
1714
1720
|
|
1715
1721
|
You don't have to respect the case as all data is recorded downcase.
|
1716
1722
|
|
@@ -1723,6 +1729,8 @@ module Ayadn
|
|
1723
1729
|
`ayadn -K remove hashtag sports`
|
1724
1730
|
|
1725
1731
|
`ayadn -K remove client IFTTT`
|
1732
|
+
|
1733
|
+
`ayadn -K remove word poo`
|
1726
1734
|
\n\n
|
1727
1735
|
USAGE
|
1728
1736
|
end
|
data/lib/ayadn/nowplaying.rb
CHANGED
@@ -239,7 +239,10 @@ module Ayadn
|
|
239
239
|
def get_itunes_store url, artist, track
|
240
240
|
results = JSON.load(CNX.download(URI.escape(url)))['results']
|
241
241
|
|
242
|
-
#
|
242
|
+
#
|
243
|
+
# require 'pp'; pp results; exit
|
244
|
+
#
|
245
|
+
|
243
246
|
unless results.nil?
|
244
247
|
|
245
248
|
if results.empty?
|
@@ -255,7 +258,10 @@ module Ayadn
|
|
255
258
|
next if e['artistName'].nil?
|
256
259
|
candidates << e if e['artistName'].downcase == artist.downcase
|
257
260
|
end
|
261
|
+
|
262
|
+
#
|
258
263
|
# require "pp";pp candidates; exit
|
264
|
+
#
|
259
265
|
|
260
266
|
candidate = if candidates.empty?
|
261
267
|
results[0]
|
data/lib/ayadn/version.rb
CHANGED
data/lib/ayadn/workers.rb
CHANGED
@@ -213,7 +213,20 @@ module Ayadn
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
next if @skip
|
216
|
-
|
216
|
+
unless Settings.global[:force] == true
|
217
|
+
if Settings.options[:blacklist][:active] == true
|
218
|
+
post['text'].split(" ").each do |word|
|
219
|
+
target_word = word.gsub(/[~:-;,?!\'&`^=+<>*%()\/"“”’°£$€.…]/, "")
|
220
|
+
if Databases.is_in_blacklist?('word', target_word.downcase)
|
221
|
+
Debug.skipped({word: target_word})
|
222
|
+
@skip = true
|
223
|
+
break
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
next if @skip
|
229
|
+
|
217
230
|
# create custom objects from ADN response
|
218
231
|
if niceranks[post['user']['id'].to_i]
|
219
232
|
rank = niceranks[post['user']['id'].to_i][:rank]
|
@@ -536,6 +549,8 @@ module Ayadn
|
|
536
549
|
word_chars.each do |ch|
|
537
550
|
if UnicodeUtils.general_category(ch) == :Other_Symbol
|
538
551
|
sanitized << "#{ch} "
|
552
|
+
elsif UnicodeUtils.char_name(ch).nil?
|
553
|
+
next
|
539
554
|
else
|
540
555
|
sanitized << ch
|
541
556
|
end
|
data/spec/mock/ayadn.sqlite
CHANGED
Binary file
|
@@ -65,6 +65,11 @@ describe Ayadn::BlacklistWorkers do
|
|
65
65
|
k.add(['mentions', 'yolo'])
|
66
66
|
expect(Ayadn::Databases.is_in_blacklist?('mention', 'yolo')).to eq true
|
67
67
|
end
|
68
|
+
it "adds a word to the blacklist" do
|
69
|
+
k = Ayadn::BlacklistWorkers.new
|
70
|
+
k.add(['word', 'Instagram'])
|
71
|
+
expect(Ayadn::Databases.is_in_blacklist?('word', 'instagram')).to eq true
|
72
|
+
end
|
68
73
|
end
|
69
74
|
|
70
75
|
describe "remove" do
|
@@ -104,6 +109,15 @@ describe Ayadn::BlacklistWorkers do
|
|
104
109
|
k.remove(['account', 'mrTest'])
|
105
110
|
expect(Ayadn::Databases.is_in_blacklist?('user', 'mrtest')).to eq false
|
106
111
|
end
|
112
|
+
it "removes a word from the blacklist" do
|
113
|
+
k = Ayadn::BlacklistWorkers.new
|
114
|
+
k.add(['word', 'Instagram'])
|
115
|
+
expect(Ayadn::Databases.is_in_blacklist?('word', 'instagram')).to eq true
|
116
|
+
|
117
|
+
k = Ayadn::BlacklistWorkers.new
|
118
|
+
k.remove(['word', 'Instagram'])
|
119
|
+
expect(Ayadn::Databases.is_in_blacklist?('word', 'instagram')).to eq false
|
120
|
+
end
|
107
121
|
end
|
108
122
|
|
109
123
|
after do
|
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: 2.0.
|
4
|
+
version: 2.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|