audio_addict 0.4.1 → 0.4.3

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.
@@ -6,21 +6,21 @@ module AudioAddict
6
6
  attr_reader :network
7
7
 
8
8
  NETWORKS = {
9
- di: "Digitally Imported",
10
- rockradio: "Rock Radio",
11
- radiotunes: "Radio Tunes",
12
- jazzradio: "Jazz Radio",
13
- classicalradio: "Classical Radio",
14
- zenradio: "Zen Radio",
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: "di.fm",
19
- rockradio: "rockradio.com",
20
- radiotunes: "radiotunes.com",
21
- jazzradio: "jazzradio.com",
22
- classicalradio: "classicalradio.com",
23
- zenradio: "zenradio.com",
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.keys.include? network.to_sym
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 == "zenradio" ? "zr%{channel_key}_aac" : "%{channel_key}"
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.keys.include? channel
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
- private
87
+ private
88
88
 
89
89
  def channels!
90
90
  response = cache.get "#{network}/channels" do
91
- api.get "channels"
91
+ api.get 'channels'
92
92
  end
93
93
 
94
94
  result = {}
95
95
  response.map do |channel|
96
- key = channel["key"]
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 { |key, channel| channel.name }.to_h
100
+ result.sort_by { |_key, channel| channel.name }.to_h
101
101
  end
102
102
  end
103
103
  end
@@ -6,19 +6,20 @@ module AudioAddict
6
6
  attr_reader :channel
7
7
 
8
8
  def initialize(channel, properties)
9
- @channel, @properties = channel, properties
9
+ @channel = channel
10
+ @properties = properties
10
11
  end
11
12
 
12
13
  def inspectable
13
- [:title, :artist, :id]
14
+ %i[title artist id]
14
15
  end
15
16
 
16
17
  def id
17
- properties["track_id"]
18
+ properties['track_id']
18
19
  end
19
20
 
20
21
  def title
21
- properties["title"].strip
22
+ properties['title'].strip
22
23
  end
23
24
 
24
25
  def search_string
@@ -1,3 +1,3 @@
1
1
  module AudioAddict
2
- VERSION = "0.4.1"
2
+ VERSION = '0.4.3'
3
3
  end
@@ -13,10 +13,12 @@ module AudioAddict
13
13
  [:query]
14
14
  end
15
15
 
16
- def get(count = 1)
17
- raise DependencyError, "This command requires youtube-dl" unless command_exist? 'youtube-dl'
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, "youtube-dl exited with an error" unless success
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 ||= %Q[youtube-dl --extract-audio --audio-format mp3 ytsearch%{count}:"%{query}"]
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 "requires"
2
- require "byebug" if ENV["BYEBUG"]
1
+ require 'requires'
2
+ require 'byebug' if ENV['BYEBUG']
3
3
  requires \
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"
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.1
4
+ version: 0.4.3
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: 2021-01-28 00:00:00.000000000 Z
11
+ date: 2022-11-28 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: '0.6'
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: '0.6'
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.4.0
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.2.3
154
+ rubygems_version: 3.3.26
154
155
  signing_key:
155
156
  specification_version: 4
156
157
  summary: AudioAddict Command Line