audio_addict 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/lib/audio_addict/cli.rb +0 -1
- data/lib/audio_addict/commands/config.rb +41 -1
- data/lib/audio_addict/version.rb +1 -1
- metadata +2 -3
- data/lib/audio_addict/commands/status.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ad91c71a927305071c18db1bdca77e994e9df887794df051752d2d863c4e72c
|
4
|
+
data.tar.gz: b64a1c8438cd097e650460faa7ace3bfacab518bdbaef017e9fe9e7b28814a63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ba6881ddb58bc40a416526623a65af9a4f43692792eab3a348663cdb0f83c1c62b84973ba37693ecee34998e6e2086bda1abacb21718b16ffd6ad30954f0378
|
7
|
+
data.tar.gz: 7575d416bbc7b61229f58b58e46bc475f77de3bde4348a82fde03e21791b2c35e16575ba968ac28bd1a34eef537c3d4117c5f1dbdd38f4a0de0d11915d3b82f4
|
data/README.md
CHANGED
data/lib/audio_addict/cli.rb
CHANGED
@@ -5,7 +5,6 @@ module AudioAddict
|
|
5
5
|
header: "AudioAddict Radio Utilities"
|
6
6
|
|
7
7
|
router.route 'login', to: Commands::LoginCmd
|
8
|
-
router.route 'status', to: Commands::StatusCmd
|
9
8
|
router.route 'set', to: Commands::SetCmd
|
10
9
|
router.route 'channels', to: Commands::ChannelsCmd
|
11
10
|
router.route 'now', to: Commands::NowCmd
|
@@ -10,6 +10,7 @@ module AudioAddict
|
|
10
10
|
usage "radio config del KEY"
|
11
11
|
usage "radio config show"
|
12
12
|
usage "radio config edit"
|
13
|
+
usage "radio config check"
|
13
14
|
usage "radio config guide"
|
14
15
|
usage "radio config --help"
|
15
16
|
|
@@ -25,6 +26,7 @@ module AudioAddict
|
|
25
26
|
command "show", "Show the entire config file contents"
|
26
27
|
command "edit", "Open the config file for editing"
|
27
28
|
command "guide", "Show a list of supported config keys and their purpose"
|
29
|
+
command "check", "Verify and report problems with the config file"
|
28
30
|
|
29
31
|
example "radio config edit"
|
30
32
|
example "radio config set like_log ~/like.log"
|
@@ -74,8 +76,30 @@ module AudioAddict
|
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
79
|
+
def check_command
|
80
|
+
errors = verify_and_show_keys required_keys, critical: true
|
81
|
+
warnings = verify_and_show_keys optional_keys
|
82
|
+
|
83
|
+
say "Done. #{errors} errors, #{warnings} warnings."
|
84
|
+
errors > 0 ? 1 : 0
|
85
|
+
end
|
86
|
+
|
77
87
|
private
|
78
88
|
|
89
|
+
def verify_and_show_keys(keys, critical: false)
|
90
|
+
problems = 0
|
91
|
+
prefix = critical ? "!txtred!Error !txtrst!" : "!txtylw!Warning!txtrst!"
|
92
|
+
|
93
|
+
keys.each do |key, command|
|
94
|
+
if !Config.has_key? key
|
95
|
+
problems += 1
|
96
|
+
say "#{prefix} : Key !txtgrn!#{key}!txtrst! is not set. Fix with !txtpur!radio #{command}!txtrst!."
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
problems
|
101
|
+
end
|
102
|
+
|
79
103
|
def key_guide
|
80
104
|
{
|
81
105
|
email: "Last email used for logging in.\nUsually set with !txtpur!radio login!txtrst!.",
|
@@ -88,7 +112,23 @@ module AudioAddict
|
|
88
112
|
cache_life: "Specify the cache life period.\nDefault: 6h.",
|
89
113
|
}
|
90
114
|
end
|
91
|
-
|
115
|
+
|
116
|
+
def required_keys
|
117
|
+
{
|
118
|
+
email: 'login',
|
119
|
+
session_key: 'login',
|
120
|
+
listen_key: 'login',
|
121
|
+
network: 'set',
|
122
|
+
channel: 'set',
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
def optional_keys
|
127
|
+
{
|
128
|
+
like_log: 'config like_log PATH',
|
129
|
+
}
|
130
|
+
end
|
131
|
+
|
92
132
|
end
|
93
133
|
end
|
94
134
|
end
|
data/lib/audio_addict/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audio_addict
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -120,7 +120,6 @@ files:
|
|
120
120
|
- lib/audio_addict/commands/now.rb
|
121
121
|
- lib/audio_addict/commands/playlist.rb
|
122
122
|
- lib/audio_addict/commands/set.rb
|
123
|
-
- lib/audio_addict/commands/status.rb
|
124
123
|
- lib/audio_addict/commands/vote.rb
|
125
124
|
- lib/audio_addict/config.rb
|
126
125
|
- lib/audio_addict/exceptions.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
module AudioAddict
|
2
|
-
module Commands
|
3
|
-
class StatusCmd < Base
|
4
|
-
summary "Show configuration status"
|
5
|
-
|
6
|
-
help "This command shows high level status based on your configuration file."
|
7
|
-
|
8
|
-
usage "radio status [--unsafe]"
|
9
|
-
usage "radio status --help"
|
10
|
-
|
11
|
-
option "-u --unsafe", "Show the full session and listen keys"
|
12
|
-
|
13
|
-
def keys
|
14
|
-
{
|
15
|
-
path: {
|
16
|
-
name: "Config Path", value: Config.path },
|
17
|
-
|
18
|
-
email: {
|
19
|
-
name: "Email", command: 'login' },
|
20
|
-
|
21
|
-
session_key: {
|
22
|
-
name: "Session Key", command: 'login', secret: true },
|
23
|
-
|
24
|
-
listen_key: {
|
25
|
-
name: "Listen Key", command: 'login', secret: true },
|
26
|
-
|
27
|
-
network: {
|
28
|
-
name: "Network", command: 'set' },
|
29
|
-
|
30
|
-
channel: {
|
31
|
-
name: "Channel", command: 'set' },
|
32
|
-
|
33
|
-
like_log: {
|
34
|
-
name: "Like Log", command: 'config like_log PATH' },
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
def run
|
39
|
-
keys.each do |key, info|
|
40
|
-
value = info[:value] || Config.properties[key]
|
41
|
-
|
42
|
-
if value and !args['--unsafe'] and info[:secret]
|
43
|
-
value = "***#{value[-4, 4]}"
|
44
|
-
end
|
45
|
-
|
46
|
-
if value
|
47
|
-
display_value = "!txtgrn!#{value}!txtrst!"
|
48
|
-
else
|
49
|
-
display_value = "!txtred!<Unset>!txtrst!"
|
50
|
-
if info[:command]
|
51
|
-
display_value = "#{display_value} - set with !txtpur!radio #{info[:command]}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
say "!txtblu!#{info[:name].rjust 14}!txtrst! : #{display_value}"
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|