audio_addict 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/radio +8 -12
- data/lib/audio_addict/api.rb +12 -11
- data/lib/audio_addict/cache.rb +2 -2
- data/lib/audio_addict/channel.rb +12 -9
- data/lib/audio_addict/cli.rb +12 -12
- data/lib/audio_addict/commands/api.rb +14 -13
- data/lib/audio_addict/commands/base.rb +3 -3
- data/lib/audio_addict/commands/channels.rb +23 -23
- data/lib/audio_addict/commands/config.rb +57 -57
- data/lib/audio_addict/commands/download.rb +20 -19
- data/lib/audio_addict/commands/history.rb +6 -6
- data/lib/audio_addict/commands/log.rb +37 -35
- data/lib/audio_addict/commands/login.rb +11 -11
- data/lib/audio_addict/commands/now.rb +5 -5
- data/lib/audio_addict/commands/playlist.rb +25 -24
- data/lib/audio_addict/commands/set.rb +24 -22
- data/lib/audio_addict/commands/vote.rb +32 -32
- data/lib/audio_addict/config.rb +7 -3
- data/lib/audio_addict/exceptions.rb +2 -2
- data/lib/audio_addict/extensions/file.rb +18 -14
- data/lib/audio_addict/inspectable.rb +2 -2
- data/lib/audio_addict/log.rb +2 -2
- data/lib/audio_addict/radio.rb +19 -19
- data/lib/audio_addict/track.rb +5 -4
- data/lib/audio_addict/version.rb +1 -1
- data/lib/audio_addict/youtube.rb +6 -4
- data/lib/audio_addict.rb +8 -8
- metadata +8 -7
data/lib/audio_addict/radio.rb
CHANGED
@@ -6,21 +6,21 @@ module AudioAddict
|
|
6
6
|
attr_reader :network
|
7
7
|
|
8
8
|
NETWORKS = {
|
9
|
-
di:
|
10
|
-
rockradio:
|
11
|
-
radiotunes:
|
12
|
-
jazzradio:
|
13
|
-
classicalradio:
|
14
|
-
zenradio:
|
9
|
+
di: 'Digitally Imported',
|
10
|
+
rockradio: 'Rock Radio',
|
11
|
+
radiotunes: 'Radio Tunes',
|
12
|
+
jazzradio: 'Jazz Radio',
|
13
|
+
classicalradio: 'Classical Radio',
|
14
|
+
zenradio: 'Zen Radio',
|
15
15
|
}
|
16
16
|
|
17
17
|
DOMAINS = {
|
18
|
-
di:
|
19
|
-
rockradio:
|
20
|
-
radiotunes:
|
21
|
-
jazzradio:
|
22
|
-
classicalradio:
|
23
|
-
zenradio:
|
18
|
+
di: 'di.fm',
|
19
|
+
rockradio: 'rockradio.com',
|
20
|
+
radiotunes: 'radiotunes.com',
|
21
|
+
jazzradio: 'jazzradio.com',
|
22
|
+
classicalradio: 'classicalradio.com',
|
23
|
+
zenradio: 'zenradio.com',
|
24
24
|
}
|
25
25
|
|
26
26
|
def self.networks(search = nil)
|
@@ -33,7 +33,7 @@ module AudioAddict
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.valid_network?(network)
|
36
|
-
NETWORKS.
|
36
|
+
NETWORKS.has_key?(network.to_sym)
|
37
37
|
end
|
38
38
|
|
39
39
|
def initialize(network)
|
@@ -53,7 +53,7 @@ module AudioAddict
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def url_template
|
56
|
-
channel_path = network ==
|
56
|
+
channel_path = network == 'zenradio' ? 'zr%{channel_key}_aac' : '%{channel_key}'
|
57
57
|
"http://prem2.#{domain}:80/#{channel_path}?%{listen_key}"
|
58
58
|
end
|
59
59
|
|
@@ -77,27 +77,27 @@ module AudioAddict
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def valid_channel?(channel)
|
80
|
-
channels.
|
80
|
+
channels.has_key?(channel)
|
81
81
|
end
|
82
82
|
|
83
83
|
def api
|
84
84
|
@api ||= API.new network
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
private
|
88
88
|
|
89
89
|
def channels!
|
90
90
|
response = cache.get "#{network}/channels" do
|
91
|
-
api.get
|
91
|
+
api.get 'channels'
|
92
92
|
end
|
93
93
|
|
94
94
|
result = {}
|
95
95
|
response.map do |channel|
|
96
|
-
key = channel[
|
96
|
+
key = channel['key']
|
97
97
|
candidate = Channel.new self, channel
|
98
98
|
result[key] = candidate if candidate.active?
|
99
99
|
end
|
100
|
-
result.sort_by { |
|
100
|
+
result.sort_by { |_key, channel| channel.name }.to_h
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
data/lib/audio_addict/track.rb
CHANGED
@@ -6,19 +6,20 @@ module AudioAddict
|
|
6
6
|
attr_reader :channel
|
7
7
|
|
8
8
|
def initialize(channel, properties)
|
9
|
-
@channel
|
9
|
+
@channel = channel
|
10
|
+
@properties = properties
|
10
11
|
end
|
11
12
|
|
12
13
|
def inspectable
|
13
|
-
[
|
14
|
+
%i[title artist id]
|
14
15
|
end
|
15
16
|
|
16
17
|
def id
|
17
|
-
properties[
|
18
|
+
properties['track_id']
|
18
19
|
end
|
19
20
|
|
20
21
|
def title
|
21
|
-
properties[
|
22
|
+
properties['title'].strip
|
22
23
|
end
|
23
24
|
|
24
25
|
def search_string
|
data/lib/audio_addict/version.rb
CHANGED
data/lib/audio_addict/youtube.rb
CHANGED
@@ -13,10 +13,12 @@ module AudioAddict
|
|
13
13
|
[:query]
|
14
14
|
end
|
15
15
|
|
16
|
-
def get(count =
|
17
|
-
|
16
|
+
def get(count = nil)
|
17
|
+
count ||= 1
|
18
|
+
raise DependencyError, 'This command requires youtube-dl' unless command_exist? 'youtube-dl'
|
19
|
+
|
18
20
|
success = execute command(count: count, query: query)
|
19
|
-
raise DependencyError,
|
21
|
+
raise DependencyError, 'youtube-dl exited with an error' unless success
|
20
22
|
end
|
21
23
|
|
22
24
|
def command(args)
|
@@ -35,7 +37,7 @@ module AudioAddict
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def command_template
|
38
|
-
@command_template ||= %
|
40
|
+
@command_template ||= %[youtube-dl --extract-audio --audio-format mp3 ytsearch%{count}:"%{query}"]
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
data/lib/audio_addict.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'requires'
|
2
|
+
require 'byebug' if ENV['BYEBUG']
|
3
3
|
requires \
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
'audio_addict/exceptions',
|
5
|
+
'audio_addict/cache',
|
6
|
+
'audio_addict/inspectable',
|
7
|
+
'audio_addict/auto_properties',
|
8
|
+
'audio_addict/commands/base',
|
9
|
+
'audio_addict'
|
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.4.
|
4
|
+
version: 0.4.2
|
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:
|
11
|
+
date: 2022-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.7.3
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.7.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: requires
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,7 +134,8 @@ files:
|
|
134
134
|
homepage: https://github.com/dannyben/audio_addict
|
135
135
|
licenses:
|
136
136
|
- MIT
|
137
|
-
metadata:
|
137
|
+
metadata:
|
138
|
+
rubygems_mfa_required: 'true'
|
138
139
|
post_install_message:
|
139
140
|
rdoc_options: []
|
140
141
|
require_paths:
|
@@ -143,14 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
144
|
requirements:
|
144
145
|
- - ">="
|
145
146
|
- !ruby/object:Gem::Version
|
146
|
-
version: 2.
|
147
|
+
version: 2.6.0
|
147
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
149
|
requirements:
|
149
150
|
- - ">="
|
150
151
|
- !ruby/object:Gem::Version
|
151
152
|
version: '0'
|
152
153
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
154
|
+
rubygems_version: 3.3.14
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
157
|
summary: AudioAddict Command Line
|