audio_addict 0.4.4 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/radio +4 -4
- data/lib/audio_addict/commands/channels.rb +4 -4
- data/lib/audio_addict/commands/config.rb +13 -13
- data/lib/audio_addict/commands/download.rb +4 -4
- data/lib/audio_addict/commands/history.rb +2 -2
- data/lib/audio_addict/commands/log.rb +4 -4
- data/lib/audio_addict/commands/login.rb +3 -3
- data/lib/audio_addict/commands/now.rb +5 -5
- data/lib/audio_addict/commands/playlist.rb +5 -5
- data/lib/audio_addict/commands/set.rb +3 -3
- data/lib/audio_addict/commands/vote.rb +1 -1
- data/lib/audio_addict/version.rb +1 -1
- metadata +17 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d324a3657ae9b16cc367a39bbbdf23be19880471dc199fd1762dc163c63b36
|
4
|
+
data.tar.gz: eb20e965b292d3802fcc1d8c0b0c9416dc23bc1b24b91fc88c58a0835bb33029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b9d46c654ce1096e59f40261577dd6b86500a410e7e894aaf03d1f1358bc8aaf5bc8ddff327864897efb4226c5eab9195ec1a666a78dd52aa4b56cfb48128da
|
7
|
+
data.tar.gz: e85d2e9509c20a181163a6b8d444754d6836e1900504f9a862c9fde04fc6cedf4edf9dc8ccd6708039d30fb6f8945f2616b85139862fa56f8ca38da3bde124d8
|
data/bin/radio
CHANGED
@@ -11,20 +11,20 @@ rescue Interrupt, AudioAddict::Interrupt, TTY::Reader::InputInterrupt
|
|
11
11
|
say "\nGoodbye"
|
12
12
|
exit 1
|
13
13
|
rescue AudioAddict::ConfigError => e
|
14
|
-
say '
|
14
|
+
say 'ru`ERROR: Missing Configuration Values`'
|
15
15
|
say "#{e.message}:"
|
16
16
|
e.missing_keys.each do |key|
|
17
|
-
say "-
|
17
|
+
say "- b`#{key}`"
|
18
18
|
end
|
19
19
|
say ''
|
20
|
-
say 'Run
|
20
|
+
say 'Run m`radio config guide` for more information'
|
21
21
|
exit 1
|
22
22
|
rescue => e
|
23
23
|
if ENV['DEBUG']
|
24
24
|
puts e.backtrace.reverse
|
25
25
|
say ''
|
26
26
|
end
|
27
|
-
say "
|
27
|
+
say "ru`ERROR: #{e.class}`"
|
28
28
|
say e.message
|
29
29
|
exit 1
|
30
30
|
end
|
@@ -20,7 +20,7 @@ module AudioAddict
|
|
20
20
|
def run
|
21
21
|
needs :network
|
22
22
|
|
23
|
-
say "
|
23
|
+
say "gu`#{radio.name}`\n"
|
24
24
|
|
25
25
|
search = args['SEARCH']
|
26
26
|
|
@@ -39,7 +39,7 @@ module AudioAddict
|
|
39
39
|
def show_verbose(channels)
|
40
40
|
channels.each do |channel|
|
41
41
|
say ''
|
42
|
-
say "
|
42
|
+
say "g`#{channel.name.ljust 22} `# #{channel.key}"
|
43
43
|
say ''
|
44
44
|
say word_wrap channel.description.to_s
|
45
45
|
say ''
|
@@ -50,7 +50,7 @@ module AudioAddict
|
|
50
50
|
|
51
51
|
say 'Similar Channels:'
|
52
52
|
similar.each do |key, similar_channel|
|
53
|
-
say "-
|
53
|
+
say "- b`#{similar_channel.name.ljust 20}` # #{key}"
|
54
54
|
end
|
55
55
|
say ''
|
56
56
|
end
|
@@ -58,7 +58,7 @@ module AudioAddict
|
|
58
58
|
|
59
59
|
def show_compact(channels)
|
60
60
|
channels.each do |channel|
|
61
|
-
say "
|
61
|
+
say "b`#{channel.key.rjust 25}` g`#{channel.name.strip}`"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -36,7 +36,7 @@ module AudioAddict
|
|
36
36
|
def get_command
|
37
37
|
key = args['KEY'].to_sym
|
38
38
|
value = Config.properties[key]
|
39
|
-
say value ? "
|
39
|
+
say value ? "g`#{value}`" : 'r`<Unset>`'
|
40
40
|
end
|
41
41
|
|
42
42
|
def set_command
|
@@ -44,22 +44,22 @@ module AudioAddict
|
|
44
44
|
value = args['VALUE']
|
45
45
|
Config.properties[key] = value
|
46
46
|
Config.save
|
47
|
-
say "
|
47
|
+
say "g`#{key}=#{value}`"
|
48
48
|
end
|
49
49
|
|
50
50
|
def del_command
|
51
51
|
key = args['KEY'].to_sym
|
52
52
|
Config.delete key
|
53
53
|
Config.save
|
54
|
-
say '
|
54
|
+
say 'g`Deleted`'
|
55
55
|
end
|
56
56
|
|
57
57
|
def show_command
|
58
|
-
say "
|
58
|
+
say "mu`# #{Config.path}`"
|
59
59
|
if File.exist? Config.path
|
60
60
|
puts File.read Config.path
|
61
61
|
else
|
62
|
-
say '
|
62
|
+
say 'r`File Not Found`'
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -70,7 +70,7 @@ module AudioAddict
|
|
70
70
|
|
71
71
|
def guide_command
|
72
72
|
key_guide.each do |key, value|
|
73
|
-
say "
|
73
|
+
say "g`#{key}`"
|
74
74
|
say word_wrap " #{value}"
|
75
75
|
say ''
|
76
76
|
end
|
@@ -88,12 +88,12 @@ module AudioAddict
|
|
88
88
|
|
89
89
|
def verify_and_show_keys(keys, critical: false)
|
90
90
|
problems = 0
|
91
|
-
prefix = critical ? '
|
91
|
+
prefix = critical ? 'r`Error `' : 'y`Warning`'
|
92
92
|
|
93
93
|
keys.each do |key, command|
|
94
94
|
unless Config.has_key? key
|
95
95
|
problems += 1
|
96
|
-
say "#{prefix} : Key
|
96
|
+
say "#{prefix} : Key g`#{key}` is not set. Fix with m`radio #{command}`."
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -102,11 +102,11 @@ module AudioAddict
|
|
102
102
|
|
103
103
|
def key_guide
|
104
104
|
{
|
105
|
-
email: "Last email used for logging in.\nUsually set with
|
106
|
-
session_key: "Used for authentication.\nUsually set with
|
107
|
-
listen_key: "Used for generating playlists.\nUsually set with
|
108
|
-
network: "Specify the AudioAddict network you are currently listening to.\nUsually set with
|
109
|
-
channel: "Specify the AudioAddict channel you are currently listening to.\nUsually set with
|
105
|
+
email: "Last email used for logging in.\nUsually set with m`radio login`.",
|
106
|
+
session_key: "Used for authentication.\nUsually set with m`radio login`.",
|
107
|
+
listen_key: "Used for generating playlists.\nUsually set with m`radio login`.",
|
108
|
+
network: "Specify the AudioAddict network you are currently listening to.\nUsually set with m`radio set`.",
|
109
|
+
channel: "Specify the AudioAddict channel you are currently listening to.\nUsually set with m`radio set`.",
|
110
110
|
like_log: "Specify the path to store all your positive votes.\nIf this is not set, votes will only be sent to AudioAddict and not logged locally.",
|
111
111
|
cache_dir: "Specify the path to store API response cache.\nDefault: ~/.audio_addict/cache",
|
112
112
|
cache_life: "Specify the cache life period.\nDefault: 6h.",
|
@@ -30,12 +30,12 @@ module AudioAddict
|
|
30
30
|
def current_command
|
31
31
|
needs :network, :channel
|
32
32
|
|
33
|
-
say '
|
33
|
+
say 'b`Downloading` : ... '
|
34
34
|
|
35
35
|
track = current_channel.current_track
|
36
36
|
query = track.search_string
|
37
37
|
|
38
|
-
|
38
|
+
say "b`Downloading` : g`#{query}`", replace: true
|
39
39
|
|
40
40
|
Youtube.new(query).get count
|
41
41
|
end
|
@@ -48,7 +48,7 @@ module AudioAddict
|
|
48
48
|
data.each do |line|
|
49
49
|
_network, _channel, artist, song = line.split(' :: ')
|
50
50
|
query = "#{artist}, #{song}"
|
51
|
-
say "\
|
51
|
+
say "\nb`Downloading` : g`#{query}`"
|
52
52
|
Youtube.new(query).get count
|
53
53
|
end
|
54
54
|
end
|
@@ -56,7 +56,7 @@ module AudioAddict
|
|
56
56
|
def search_command
|
57
57
|
query = args['QUERY']
|
58
58
|
|
59
|
-
say "\
|
59
|
+
say "\nb`Downloading` : g`#{query}`"
|
60
60
|
Youtube.new(query).get count
|
61
61
|
end
|
62
62
|
|
@@ -10,10 +10,10 @@ module AudioAddict
|
|
10
10
|
|
11
11
|
def run
|
12
12
|
needs :network, :channel
|
13
|
-
say "
|
13
|
+
say "gu`#{radio.name} > #{current_channel.name}`"
|
14
14
|
say ''
|
15
15
|
tracks.each do |track|
|
16
|
-
say "
|
16
|
+
say "g` #{track.artist.rjust max_artist_len}` : b`#{track.title}`"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -45,7 +45,7 @@ module AudioAddict
|
|
45
45
|
def sort_command
|
46
46
|
needs :like_log
|
47
47
|
log.sort
|
48
|
-
say '
|
48
|
+
say 'g`Sorted`'
|
49
49
|
end
|
50
50
|
|
51
51
|
def browse_command
|
@@ -59,7 +59,7 @@ module AudioAddict
|
|
59
59
|
per_page: page_size
|
60
60
|
|
61
61
|
say 'Songs:'
|
62
|
-
tree[network][channel][artist].each { |song| say "-
|
62
|
+
tree[network][channel][artist].each { |song| say "- g`#{song}`" }
|
63
63
|
say ''
|
64
64
|
|
65
65
|
browse_command if prompt.yes?('Again?')
|
@@ -71,7 +71,7 @@ module AudioAddict
|
|
71
71
|
|
72
72
|
if filename
|
73
73
|
File.write filename, yaml
|
74
|
-
say "
|
74
|
+
say "g`Saved #{filename}`"
|
75
75
|
else
|
76
76
|
puts yaml
|
77
77
|
end
|
@@ -84,7 +84,7 @@ module AudioAddict
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def page_size
|
87
|
-
@page_size ||=
|
87
|
+
@page_size ||= terminal_height - 4
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -12,7 +12,7 @@ module AudioAddict
|
|
12
12
|
proceed = true
|
13
13
|
|
14
14
|
if radio.api.logged_in?
|
15
|
-
say "
|
15
|
+
say "y`You are already logged in as` yu`#{Config.email}`"
|
16
16
|
proceed = prompt.yes? 'Login again?'
|
17
17
|
end
|
18
18
|
|
@@ -28,9 +28,9 @@ module AudioAddict
|
|
28
28
|
if user && pass
|
29
29
|
say 'Logging in... '
|
30
30
|
radio.api.login user, pass
|
31
|
-
|
31
|
+
say 'g`Saved`', replace: true
|
32
32
|
else
|
33
|
-
say '
|
33
|
+
say 'r`Cancelled`'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -11,13 +11,13 @@ module AudioAddict
|
|
11
11
|
def run
|
12
12
|
needs :network, :channel
|
13
13
|
|
14
|
-
say "
|
15
|
-
say "
|
16
|
-
say '
|
14
|
+
say "b` Network `: g`#{radio.name}` # #{radio.network}"
|
15
|
+
say "b` Channel `: g`#{current_channel.name}` # #{current_channel.key}"
|
16
|
+
say 'b` Track `: ... '
|
17
17
|
|
18
18
|
track = current_channel.current_track
|
19
|
-
|
20
|
-
say "
|
19
|
+
say "b` Track `: g`#{track.title.strip}`", replace: true
|
20
|
+
say "b` By `: g`#{track.artist.strip}`"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -26,7 +26,7 @@ module AudioAddict
|
|
26
26
|
name = args['NAME']
|
27
27
|
outfile = "#{name}.yml"
|
28
28
|
|
29
|
-
say "
|
29
|
+
say "r`Warningr`: g`#{outfile}` already exists!" if File.exist? outfile
|
30
30
|
proceed = prompt.yes? "Create #{outfile}?"
|
31
31
|
return unless proceed
|
32
32
|
|
@@ -46,11 +46,11 @@ module AudioAddict
|
|
46
46
|
outfile = "#{name}.pls"
|
47
47
|
|
48
48
|
if File.exist? infile
|
49
|
-
say "
|
49
|
+
say "r`Warning`: g`#{outfile}` already exists!" if File.exist? outfile
|
50
50
|
proceed = prompt.yes? "Create #{outfile}?"
|
51
51
|
generate_playlist infile, outfile if proceed
|
52
52
|
else
|
53
|
-
say "
|
53
|
+
say "r`Cannot find #{infile}`"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -68,7 +68,7 @@ module AudioAddict
|
|
68
68
|
data[:channels] = channels
|
69
69
|
|
70
70
|
File.write outfile, data.to_yaml
|
71
|
-
say "Saved
|
71
|
+
say "Saved g`#{outfile}`"
|
72
72
|
end
|
73
73
|
|
74
74
|
def generate_playlist(infile, outfile)
|
@@ -92,7 +92,7 @@ module AudioAddict
|
|
92
92
|
output = "#{output.join("\n")}\n"
|
93
93
|
|
94
94
|
File.write outfile, output
|
95
|
-
say "Saved
|
95
|
+
say "Saved g`#{outfile}`"
|
96
96
|
end
|
97
97
|
|
98
98
|
def template_params(channel_key)
|
@@ -59,7 +59,7 @@ module AudioAddict
|
|
59
59
|
elsif radio.search(channel).any?
|
60
60
|
channel_menu channel
|
61
61
|
else
|
62
|
-
say "
|
62
|
+
say "r`Invalid channel: #{radio.name} > #{channel}`"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -100,13 +100,13 @@ module AudioAddict
|
|
100
100
|
def save_channel(channel, echo: true)
|
101
101
|
Config.channel = channel
|
102
102
|
Config.save
|
103
|
-
say "Channel :
|
103
|
+
say "Channel : g`#{radio.name} > #{current_channel.name}` # #{channel}" if echo
|
104
104
|
end
|
105
105
|
|
106
106
|
def save_network(network, echo: true)
|
107
107
|
Config.network = network
|
108
108
|
Config.save
|
109
|
-
say "Network :
|
109
|
+
say "Network : g`#{radio.name}` # #{network}" if echo
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
data/lib/audio_addict/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audio_addict
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
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: 2023-01-
|
11
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.1
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: '2'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.8.1
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: '2'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: httparty
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +50,28 @@ dependencies:
|
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.3
|
53
|
+
version: '0.3'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.3
|
60
|
+
version: '0.3'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: mister_bin
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.7
|
67
|
+
version: '0.7'
|
62
68
|
type: :runtime
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.7
|
74
|
+
version: '0.7'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: requires
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
157
|
- !ruby/object:Gem::Version
|
152
158
|
version: '0'
|
153
159
|
requirements: []
|
154
|
-
rubygems_version: 3.4.
|
160
|
+
rubygems_version: 3.4.5
|
155
161
|
signing_key:
|
156
162
|
specification_version: 4
|
157
163
|
summary: AudioAddict Command Line
|