ayadn 1.1.0 → 1.1.1
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/lib/ayadn/action.rb +14 -7
- data/lib/ayadn/authorize.rb +1 -1
- data/lib/ayadn/databases.rb +17 -7
- data/lib/ayadn/settings.rb +1 -1
- data/lib/ayadn/status.rb +5 -5
- data/lib/ayadn/switch.rb +2 -2
- data/lib/ayadn/version.rb +1 -1
- data/lib/ayadn.rb +6 -5
- 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: aff30a9bc5c1bb18519f3dab1152c3b19f7b5005
|
|
4
|
+
data.tar.gz: 580767690f9388fcbaf26e223ca2ac76474a1ff7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a41e1953abbe7b5968bb86ebeb69e0c8d1f7d2a3ae00a0cb571ec4c0c519adedfd830bf946a17c2064fd7fe9b006ecb6e1528ec3319c1be276d7f291b8a0e4d7
|
|
7
|
+
data.tar.gz: a18acf5eeb4fcc57a0243baa4874f98f8ad458e96c57e8c17d63d07d19cc0d53e182988bab1bb9d199b3cc630f4bdcecbce261e51da4411fca615d9af9f46550
|
data/CHANGELOG.md
CHANGED
data/lib/ayadn/action.rb
CHANGED
|
@@ -379,8 +379,11 @@ module Ayadn
|
|
|
379
379
|
begin
|
|
380
380
|
missing_post_id unless post_id.is_integer?
|
|
381
381
|
puts Status.unstarring(post_id)
|
|
382
|
-
|
|
383
|
-
|
|
382
|
+
resp = @api.get_details(post_id)
|
|
383
|
+
id = get_original_id(post_id, resp)
|
|
384
|
+
resp = @api.get_details(id)
|
|
385
|
+
if resp['data']['you_starred']
|
|
386
|
+
check_has_been_unstarred(id, @api.unstar(id))
|
|
384
387
|
else
|
|
385
388
|
puts Status.not_your_starred
|
|
386
389
|
end
|
|
@@ -395,8 +398,10 @@ module Ayadn
|
|
|
395
398
|
begin
|
|
396
399
|
missing_post_id unless post_id.is_integer?
|
|
397
400
|
puts Status.starring(post_id)
|
|
398
|
-
|
|
399
|
-
|
|
401
|
+
resp = @api.get_details(post_id)
|
|
402
|
+
check_if_already_starred(resp)
|
|
403
|
+
id = get_original_id(post_id, resp)
|
|
404
|
+
check_has_been_starred(id, @api.star(id))
|
|
400
405
|
rescue => e
|
|
401
406
|
Errors.global_error("action/star", post_id, e)
|
|
402
407
|
ensure
|
|
@@ -837,7 +842,6 @@ module Ayadn
|
|
|
837
842
|
abort(Status.empty_fields) if el.length == 0
|
|
838
843
|
end
|
|
839
844
|
@view.clear_screen
|
|
840
|
-
#text_to_post = "#nowplaying '#{itunes.track}' from '#{itunes.album}' by #{itunes.artist}"
|
|
841
845
|
text_to_post = "#nowplaying\nTitle: ‘#{itunes.track}’\nArtist: #{itunes.artist}\nfrom ‘#{itunes.album}’"
|
|
842
846
|
puts Status.writing
|
|
843
847
|
show_nowplaying(text_to_post)
|
|
@@ -852,8 +856,6 @@ module Ayadn
|
|
|
852
856
|
rescue => e
|
|
853
857
|
puts Status.wtf
|
|
854
858
|
Errors.global_error("action/nowplaying", itunes, e)
|
|
855
|
-
# ensure
|
|
856
|
-
# Databases.close_all
|
|
857
859
|
end
|
|
858
860
|
end
|
|
859
861
|
|
|
@@ -1179,6 +1181,11 @@ module Ayadn
|
|
|
1179
1181
|
|
|
1180
1182
|
def get_track_infos
|
|
1181
1183
|
track = `osascript -e 'tell application "iTunes"' -e 'set trackName to name of current track' -e 'return trackName' -e 'end tell'`
|
|
1184
|
+
if track.empty?
|
|
1185
|
+
puts "\nCanceled: unable to get info from iTunes.\n".color(:red)
|
|
1186
|
+
Errors.warn "Nowplaying canceled: unable to get info from iTunes."
|
|
1187
|
+
exit
|
|
1188
|
+
end
|
|
1182
1189
|
album = `osascript -e 'tell application "iTunes"' -e 'set trackAlbum to album of current track' -e 'return trackAlbum' -e 'end tell'`
|
|
1183
1190
|
artist = `osascript -e 'tell application "iTunes"' -e 'set trackArtist to artist of current track' -e 'return trackArtist' -e 'end tell'`
|
|
1184
1191
|
maker = Struct.new(:artist, :album, :track)
|
data/lib/ayadn/authorize.rb
CHANGED
|
@@ -28,7 +28,7 @@ module Ayadn
|
|
|
28
28
|
puts "Saving user token...\n".color(:green)
|
|
29
29
|
create_token_file(user)
|
|
30
30
|
puts "Creating user account for #{user.handle}...\n".color(:green)
|
|
31
|
-
accounts_db =
|
|
31
|
+
accounts_db = Databases.init("#{user.home_path}/accounts.db")
|
|
32
32
|
create_account(user, accounts_db)
|
|
33
33
|
end
|
|
34
34
|
|
data/lib/ayadn/databases.rb
CHANGED
|
@@ -8,11 +8,11 @@ module Ayadn
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def self.open_databases
|
|
11
|
-
@users =
|
|
12
|
-
@index =
|
|
13
|
-
@pagination =
|
|
14
|
-
@aliases =
|
|
15
|
-
@blacklist =
|
|
11
|
+
@users = self.init "#{Settings.config[:paths][:db]}/users.db"
|
|
12
|
+
@index = self.init "#{Settings.config[:paths][:pagination]}/index.db"
|
|
13
|
+
@pagination = self.init "#{Settings.config[:paths][:pagination]}/pagination.db"
|
|
14
|
+
@aliases = self.init "#{Settings.config[:paths][:db]}/aliases.db"
|
|
15
|
+
@blacklist = self.init "#{Settings.config[:paths][:db]}/blacklist.db"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def self.close_all
|
|
@@ -24,6 +24,16 @@ module Ayadn
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def self.init(path)
|
|
28
|
+
winPlatforms = ['mswin', 'mingw', 'mingw_18', 'mingw_19', 'mingw_20', 'mingw32']
|
|
29
|
+
case RbConfig::CONFIG['host_os']
|
|
30
|
+
when *winPlatforms
|
|
31
|
+
abort("\nSorry, Ayadn doesn't work on Windows.\n\n".color(:red))
|
|
32
|
+
else
|
|
33
|
+
Daybreak::DB.new "#{path}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
27
37
|
def self.add_mention_to_blacklist(target)
|
|
28
38
|
@blacklist[target.downcase] = :mention
|
|
29
39
|
end
|
|
@@ -37,7 +47,7 @@ module Ayadn
|
|
|
37
47
|
@blacklist.delete(target.downcase)
|
|
38
48
|
end
|
|
39
49
|
def self.import_blacklist(blacklist)
|
|
40
|
-
new_list =
|
|
50
|
+
new_list = self.init blacklist
|
|
41
51
|
new_list.each {|name,type| @blacklist[name] = type}
|
|
42
52
|
new_list.close
|
|
43
53
|
end
|
|
@@ -68,7 +78,7 @@ module Ayadn
|
|
|
68
78
|
end
|
|
69
79
|
|
|
70
80
|
def self.import_aliases(aliases)
|
|
71
|
-
new_aliases =
|
|
81
|
+
new_aliases = self.init aliases
|
|
72
82
|
new_aliases.each {|al,id| @aliases[al] = id}
|
|
73
83
|
new_aliases.close
|
|
74
84
|
end
|
data/lib/ayadn/settings.rb
CHANGED
data/lib/ayadn/status.rb
CHANGED
|
@@ -83,22 +83,22 @@ module Ayadn
|
|
|
83
83
|
"Could not block user #{username} (doesn't exist, or is already blocked)\n".color(:red)
|
|
84
84
|
end
|
|
85
85
|
def self.deleted(post_id)
|
|
86
|
-
"
|
|
86
|
+
"Post #{post_id} has been deleted.\n".color(:green)
|
|
87
87
|
end
|
|
88
88
|
def self.deleted_m(message_id)
|
|
89
89
|
"\nMessage #{message_id} has been deleted.\n".color(:green)
|
|
90
90
|
end
|
|
91
91
|
def self.starred(post_id)
|
|
92
|
-
"
|
|
92
|
+
"Post #{post_id} has been starred.\n".color(:green)
|
|
93
93
|
end
|
|
94
94
|
def self.unreposted(post_id)
|
|
95
|
-
"
|
|
95
|
+
"Post #{post_id} has been unreposted.\n".color(:green)
|
|
96
96
|
end
|
|
97
97
|
def self.reposted(post_id)
|
|
98
|
-
"
|
|
98
|
+
"Post #{post_id} has been reposted.\n".color(:green)
|
|
99
99
|
end
|
|
100
100
|
def self.unstarred(post_id)
|
|
101
|
-
"
|
|
101
|
+
"Post #{post_id} has been unstarred.\n".color(:green)
|
|
102
102
|
end
|
|
103
103
|
def self.unfollowed(username)
|
|
104
104
|
"\nUser #{username} has been unfollowed.\n".color(:green)
|
data/lib/ayadn/switch.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Ayadn
|
|
|
4
4
|
def list
|
|
5
5
|
home_path = Dir.home + "/ayadn"
|
|
6
6
|
if File.exist?("#{home_path}/accounts.db")
|
|
7
|
-
accounts_db =
|
|
7
|
+
accounts_db = Databases.init("#{home_path}/accounts.db")
|
|
8
8
|
active = accounts_db['ACTIVE']
|
|
9
9
|
begin
|
|
10
10
|
puts "\nCurrently authorized accounts:\n".color(:cyan)
|
|
@@ -33,7 +33,7 @@ module Ayadn
|
|
|
33
33
|
username = Workers.remove_arobase_if_present(user.first)
|
|
34
34
|
home_path = Dir.home + "/ayadn"
|
|
35
35
|
if File.exist?("#{home_path}/accounts.db")
|
|
36
|
-
accounts_db =
|
|
36
|
+
accounts_db = Databases.init("#{home_path}/accounts.db")
|
|
37
37
|
active = accounts_db['ACTIVE']
|
|
38
38
|
if username == accounts_db[active][:username]
|
|
39
39
|
puts "\nYou're already authorized with username '#{accounts_db[active][:handle]}'.\n".color(:red)
|
data/lib/ayadn/version.rb
CHANGED
data/lib/ayadn.rb
CHANGED
|
@@ -3,10 +3,11 @@ require_relative 'ayadn/version'
|
|
|
3
3
|
|
|
4
4
|
%w{rest_client json thor rainbow/ext/string terminal-table yaml logger daybreak fileutils io/console}.each { |r| require "#{r}" }
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
winPlatforms = ['mswin', 'mingw', 'mingw_18', 'mingw_19', 'mingw_20', 'mingw32']
|
|
7
|
+
case Gem::Platform.local.os
|
|
8
|
+
when *winPlatforms
|
|
9
|
+
require 'win32console'
|
|
10
|
+
require 'pstore'
|
|
11
|
+
end
|
|
11
12
|
|
|
12
13
|
require_relative 'ayadn/app'
|
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.1.
|
|
4
|
+
version: 1.1.1
|
|
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-
|
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|