audio_addict 0.4.1 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b9ee1765ac530791d434e0ae9166dcbbd6c78af0331e6744b798b042a4855cc
4
- data.tar.gz: 36572839fec8085f9cdd3e55c0bf092319dac42f707c404097123454fd3f8a59
3
+ metadata.gz: 1bfa79e76c8667fc213082f955d753693b2f81f1857e82ac610d6b8db960ffb4
4
+ data.tar.gz: eb1b970c1eee32668eea5deee9c9b9d9658801451399fb55734870d0a995a5ed
5
5
  SHA512:
6
- metadata.gz: 44e14f1f07236555a67735e407c6aa9ae2849fb7db87b67168f9c1ddb233ee8007cfcd0e77c7462fe26df2a92c2cc4e780513e7a2ab4f522e9aa28f9d3886370
7
- data.tar.gz: c5ae90ef4ae1304a684f92679e62f66e8adaf75e65a94410b4259cbefec4aba7983e829dde112f2192564c9ce5fd242eeb0ee1fccb0185dd634e4f14e8a2398d
6
+ metadata.gz: 3fa5acfa2d77638568b0fa54ccd2e69a88e535fe30d2b8a35ba090b40a1aaae4ee68a1e3bf82eef38cbf751b4e2000dfec0b782a89634eb310bd65653354c003
7
+ data.tar.gz: 5547a8ab8c783357bb801bcc222b7f65dfadad970b4ded6bf623723651ad5e7c6b18379e624ace46af55d71f9460e8b74f6d973a5f57b811674f01d1a92e73ef
data/bin/radio CHANGED
@@ -7,28 +7,24 @@ router = AudioAddict::CLI.router
7
7
 
8
8
  begin
9
9
  exit router.run ARGV
10
-
11
10
  rescue Interrupt, AudioAddict::Interrupt, TTY::Reader::InputInterrupt
12
11
  say "\nGoodbye"
13
- exit 1
14
-
12
+ exit 1
15
13
  rescue AudioAddict::ConfigError => e
16
- say "!undred!ERROR: Missing Configuration Values"
14
+ say '!undred!ERROR: Missing Configuration Values'
17
15
  say "#{e.message}:"
18
16
  e.missing_keys.each do |key|
19
17
  say "- !txtblu!#{key}"
20
18
  end
21
- say ""
22
- say "Run !txtpur!radio config guide!txtrst! for more information"
23
- exit 1
24
-
19
+ say ''
20
+ say 'Run !txtpur!radio config guide!txtrst! for more information'
21
+ exit 1
25
22
  rescue => e
26
23
  if ENV['DEBUG']
27
- puts e.backtrace.reverse
28
- say ""
24
+ puts e.backtrace.reverse
25
+ say ''
29
26
  end
30
27
  say "!undred!ERROR: #{e.class}"
31
28
  say e.message
32
29
  exit 1
33
-
34
- end
30
+ end
@@ -1,11 +1,11 @@
1
- require "httparty"
1
+ require 'httparty'
2
2
 
3
3
  module AudioAddict
4
4
  class API
5
5
  include HTTParty
6
6
  include Cache
7
7
 
8
- base_uri "https://api.audioaddict.com/v1"
8
+ base_uri 'https://api.audioaddict.com/v1'
9
9
  debug_output $stderr if ENV['AUDIO_ADDICT_DEBUG']
10
10
 
11
11
  attr_accessor :network
@@ -16,10 +16,10 @@ module AudioAddict
16
16
 
17
17
  def login(username, password)
18
18
  session = session(username, password)
19
- Config.session_key = session["key"]
20
- Config.listen_key = session["member"]["listen_key"]
21
- Config.email = session["member"]["email"]
22
- Config.premium = session["member"]["user_type"] == "premium"
19
+ Config.session_key = session['key']
20
+ Config.listen_key = session['member']['listen_key']
21
+ Config.email = session['member']['email']
22
+ Config.premium = session['member']['user_type'] == 'premium'
23
23
  Config.save
24
24
  end
25
25
 
@@ -40,13 +40,13 @@ module AudioAddict
40
40
  end
41
41
 
42
42
  def basic_auth
43
- http.basic_auth "streams", "diradio"
43
+ http.basic_auth 'streams', 'diradio'
44
44
  end
45
45
 
46
46
  def session(username, password)
47
47
  params = { member_session: { username: username, password: password } }
48
48
  basic_auth
49
- response http.post "/#{network || "di"}/member_sessions", body: params
49
+ response http.post "/#{network || 'di'}/member_sessions", body: params
50
50
  end
51
51
 
52
52
  def session_key
@@ -57,10 +57,11 @@ module AudioAddict
57
57
  Config.listen_key
58
58
  end
59
59
 
60
- private
60
+ private
61
61
 
62
62
  def response(httparty_response)
63
- raise APIError.new httparty_response unless httparty_response.success?
63
+ raise APIError, httparty_response unless httparty_response.success?
64
+
64
65
  JSON.parse httparty_response.body
65
66
  end
66
67
 
@@ -69,7 +70,7 @@ module AudioAddict
69
70
  end
70
71
 
71
72
  def headers
72
- { "X-Session-Key" => session_key }
73
+ { 'X-Session-Key' => session_key }
73
74
  end
74
75
  end
75
76
  end
@@ -1,4 +1,4 @@
1
- require "lightly"
1
+ require 'lightly'
2
2
 
3
3
  module AudioAddict
4
4
  module Cache
@@ -11,7 +11,7 @@ module AudioAddict
11
11
  end
12
12
 
13
13
  def cache_life!
14
- Config.cache_life || "6h"
14
+ Config.cache_life || '6h'
15
15
  end
16
16
 
17
17
  def cache_dir
@@ -7,19 +7,21 @@ module AudioAddict
7
7
  attr_reader :radio
8
8
 
9
9
  def initialize(radio, properties)
10
- @radio, @properties = radio, properties
10
+ @radio = radio
11
+ @properties = properties
11
12
  end
12
13
 
13
14
  def inspectable
14
- [:key, :name, :id]
15
+ %i[key name id]
15
16
  end
16
17
 
17
18
  def active?
18
19
  # Seems like each network has a different way of marking inactive channels.
19
20
  # This is where we normalize it
20
- return false if !properties["asset_id"]
21
- return false if name[0] == "X" and key[0] != "x"
22
- return true
21
+ return false unless properties['asset_id']
22
+ return false if (name[0] == 'X') && (key[0] != 'x')
23
+
24
+ true
23
25
  end
24
26
 
25
27
  def track_history
@@ -36,9 +38,10 @@ module AudioAddict
36
38
  end
37
39
 
38
40
  def similar_channels
39
- similar = properties["similar_channels"]
41
+ similar = properties['similar_channels']
40
42
  return [] unless similar
41
- ids = similar.map { |s| s["similar_channel_id"] }
43
+
44
+ ids = similar.map { |s| s['similar_channel_id'] }
42
45
  radio.search_by_id ids
43
46
  end
44
47
 
@@ -52,10 +55,10 @@ module AudioAddict
52
55
  radio.api.post "#{endpoint}/#{direction}"
53
56
  end
54
57
 
55
- log_like track if direction == :up and Config.like_log
58
+ log_like track if (direction == :up) && Config.like_log
56
59
  end
57
60
 
58
- private
61
+ private
59
62
 
60
63
  def log_like(track = nil)
61
64
  track ||= current_track
@@ -2,19 +2,19 @@ module AudioAddict
2
2
  class CLI
3
3
  def self.router
4
4
  router = MisterBin::Runner.new version: VERSION,
5
- header: "AudioAddict Radio Utilities"
5
+ header: 'AudioAddict Radio Utilities'
6
6
 
7
- router.route "login", to: Commands::LoginCmd
8
- router.route "set", to: Commands::SetCmd
9
- router.route "channels", to: Commands::ChannelsCmd
10
- router.route "now", to: Commands::NowCmd
11
- router.route "history", to: Commands::HistoryCmd
12
- router.route "vote", to: Commands::VoteCmd
13
- router.route "playlist", to: Commands::PlaylistCmd
14
- router.route "config", to: Commands::ConfigCmd
15
- router.route "log", to: Commands::LogCmd
16
- router.route "download", to: Commands::DownloadCmd
17
- router.route "api", to: Commands::APICmd
7
+ router.route 'login', to: Commands::LoginCmd
8
+ router.route 'set', to: Commands::SetCmd
9
+ router.route 'channels', to: Commands::ChannelsCmd
10
+ router.route 'now', to: Commands::NowCmd
11
+ router.route 'history', to: Commands::HistoryCmd
12
+ router.route 'vote', to: Commands::VoteCmd
13
+ router.route 'playlist', to: Commands::PlaylistCmd
14
+ router.route 'config', to: Commands::ConfigCmd
15
+ router.route 'log', to: Commands::LogCmd
16
+ router.route 'download', to: Commands::DownloadCmd
17
+ router.route 'api', to: Commands::APICmd
18
18
 
19
19
  router
20
20
  end
@@ -1,18 +1,18 @@
1
1
  module AudioAddict
2
2
  module Commands
3
3
  class APICmd < Base
4
- summary "Make direct calls to the AudioAddict API"
4
+ summary 'Make direct calls to the AudioAddict API'
5
5
 
6
- help "This command sends a request to the provided API endpoint. The currently configured network is automatically prepended to the endpoint path, and the output is converted to YAML format."
6
+ help 'This command sends a request to the provided API endpoint. The currently configured network is automatically prepended to the endpoint path, and the output is converted to YAML format.'
7
7
 
8
- usage "radio api [get|post|delete] ENDPOINT"
9
- usage "radio api --help"
8
+ usage 'radio api [get|post|delete] ENDPOINT'
9
+ usage 'radio api --help'
10
10
 
11
- param "ENDPOINT", "API endpoint path"
11
+ param 'ENDPOINT', 'API endpoint path'
12
12
 
13
- example "radio api channels"
14
- example "radio api get track_history/channel/1"
15
- example "radio api post tracks/1/vote/2/up"
13
+ example 'radio api channels'
14
+ example 'radio api get track_history/channel/1'
15
+ example 'radio api post tracks/1/vote/2/up'
16
16
 
17
17
  def run
18
18
  needs :network
@@ -20,16 +20,17 @@ module AudioAddict
20
20
  puts response.to_yaml
21
21
  end
22
22
 
23
- private
23
+ private
24
24
 
25
25
  def api_method
26
- return :post if args["post"]
27
- return :delete if args["delete"]
28
- return :get
26
+ return :post if args['post']
27
+ return :delete if args['delete']
28
+
29
+ :get
29
30
  end
30
31
 
31
32
  def endpoint
32
- args["ENDPOINT"]
33
+ args['ENDPOINT']
33
34
  end
34
35
 
35
36
  def api
@@ -1,6 +1,6 @@
1
- require "mister_bin"
2
- require "colsole"
3
- require "tty/prompt"
1
+ require 'mister_bin'
2
+ require 'colsole'
3
+ require 'tty/prompt'
4
4
 
5
5
  module AudioAddict
6
6
  module Commands
@@ -1,58 +1,58 @@
1
1
  module AudioAddict
2
2
  module Commands
3
3
  class ChannelsCmd < Base
4
- summary "Show list of channels"
4
+ summary 'Show list of channels'
5
5
 
6
- help "This command lets you list and search for channels in the currently active radio network."
6
+ help 'This command lets you list and search for channels in the currently active radio network.'
7
7
 
8
- usage "radio channels [SEARCH --info]"
9
- usage "radio channels --help"
8
+ usage 'radio channels [SEARCH --info]'
9
+ usage 'radio channels --help'
10
10
 
11
- option "-i --info", "Show results with additional info, such as channel description and related channels"
11
+ option '-i --info', 'Show results with additional info, such as channel description and related channels'
12
12
 
13
- param "SEARCH", "Channel name or a partial name to search for"
13
+ param 'SEARCH', 'Channel name or a partial name to search for'
14
14
 
15
- example "radio channels"
16
- example "radio channels --info"
17
- example "radio channels metal"
18
- example "radio channels metal -i"
15
+ example 'radio channels'
16
+ example 'radio channels --info'
17
+ example 'radio channels metal'
18
+ example 'radio channels metal -i'
19
19
 
20
20
  def run
21
21
  needs :network
22
22
 
23
23
  say "!undgrn!#{radio.name}\n"
24
24
 
25
- search = args["SEARCH"]
25
+ search = args['SEARCH']
26
26
 
27
27
  channels = search ? radio.search(search) : radio.channels
28
28
 
29
29
  channels = channels.values
30
- if args["--info"]
30
+ if args['--info']
31
31
  show_verbose channels
32
32
  else
33
33
  show_compact channels
34
34
  end
35
35
  end
36
36
 
37
- private
37
+ private
38
38
 
39
39
  def show_verbose(channels)
40
40
  channels.each do |channel|
41
- say ""
41
+ say ''
42
42
  say "!txtgrn!#{channel.name.ljust 22} !txtrst!# #{channel.key}"
43
- say ""
44
- say word_wrap "#{channel.description}"
45
- say ""
43
+ say ''
44
+ say word_wrap channel.description.to_s
45
+ say ''
46
46
 
47
47
  similar = channel.similar_channels
48
48
 
49
- if similar.any?
50
- say "Similar Channels:"
51
- similar.each do |key, similar|
52
- say "- !txtblu!#{similar.name.ljust 20}!txtrst! # #{key}"
53
- end
54
- say ""
49
+ next unless similar.any?
50
+
51
+ say 'Similar Channels:'
52
+ similar.each do |key, similar_channel|
53
+ say "- !txtblu!#{similar_channel.name.ljust 20}!txtrst! # #{key}"
55
54
  end
55
+ say ''
56
56
  end
57
57
  end
58
58
 
@@ -1,57 +1,57 @@
1
1
  module AudioAddict
2
2
  module Commands
3
3
  class ConfigCmd < Base
4
- summary "Manage local configuration"
5
-
6
- help "This command provides low level access to your local configuration file."
7
-
8
- usage "radio config set KEY VALUE"
9
- usage "radio config get KEY"
10
- usage "radio config del KEY"
11
- usage "radio config show"
12
- usage "radio config edit"
13
- usage "radio config check"
14
- usage "radio config guide"
15
- usage "radio config --help"
16
-
17
- param "KEY", "Config key"
18
- param "VALUE", "Config value"
19
-
20
- option "-s --show", "Show the contents of the config file"
21
- option "-e --edit", "Open the config file for editing"
22
-
23
- command "get", "Show the value of this config key"
24
- command "set", "Set the value of this config key"
25
- command "del", "Delete the value of this config key"
26
- command "show", "Show the entire config file contents"
27
- command "edit", "Open the config file for editing"
28
- command "guide", "Show a list of supported config keys and their purpose"
29
- command "check", "Verify and report problems with the config file"
30
-
31
- example "radio config edit"
32
- example "radio config set like_log ~/like.log"
33
- example "radio config del session_key"
34
- example "radio config get listen_key"
4
+ summary 'Manage local configuration'
5
+
6
+ help 'This command provides low level access to your local configuration file.'
7
+
8
+ usage 'radio config set KEY VALUE'
9
+ usage 'radio config get KEY'
10
+ usage 'radio config del KEY'
11
+ usage 'radio config show'
12
+ usage 'radio config edit'
13
+ usage 'radio config check'
14
+ usage 'radio config guide'
15
+ usage 'radio config --help'
16
+
17
+ param 'KEY', 'Config key'
18
+ param 'VALUE', 'Config value'
19
+
20
+ option '-s --show', 'Show the contents of the config file'
21
+ option '-e --edit', 'Open the config file for editing'
22
+
23
+ command 'get', 'Show the value of this config key'
24
+ command 'set', 'Set the value of this config key'
25
+ command 'del', 'Delete the value of this config key'
26
+ command 'show', 'Show the entire config file contents'
27
+ command 'edit', 'Open the config file for editing'
28
+ command 'guide', 'Show a list of supported config keys and their purpose'
29
+ command 'check', 'Verify and report problems with the config file'
30
+
31
+ example 'radio config edit'
32
+ example 'radio config set like_log ~/like.log'
33
+ example 'radio config del session_key'
34
+ example 'radio config get listen_key'
35
35
 
36
36
  def get_command
37
- key = args["KEY"].to_sym
37
+ key = args['KEY'].to_sym
38
38
  value = Config.properties[key]
39
- say value ? "!txtgrn!#{value}" : "!txtred!<Unset>"
39
+ say value ? "!txtgrn!#{value}" : '!txtred!<Unset>'
40
40
  end
41
41
 
42
42
  def set_command
43
- key = args["KEY"].to_sym
44
- value = args["VALUE"]
43
+ key = args['KEY'].to_sym
44
+ value = args['VALUE']
45
45
  Config.properties[key] = value
46
46
  Config.save
47
47
  say "!txtgrn!#{key}=#{value}"
48
48
  end
49
49
 
50
50
  def del_command
51
- key = args["KEY"].to_sym
51
+ key = args['KEY'].to_sym
52
52
  Config.delete key
53
53
  Config.save
54
- say "!txtgrn!Deleted"
54
+ say '!txtgrn!Deleted'
55
55
  end
56
56
 
57
57
  def show_command
@@ -59,12 +59,12 @@ module AudioAddict
59
59
  if File.exist? Config.path
60
60
  puts File.read Config.path
61
61
  else
62
- say "!txtred!File Not Found"
62
+ say '!txtred!File Not Found'
63
63
  end
64
64
  end
65
65
 
66
66
  def edit_command
67
- editor = ENV["EDITOR"] || "vi"
67
+ editor = ENV['EDITOR'] || 'vi'
68
68
  system "#{editor} #{Config.path}"
69
69
  end
70
70
 
@@ -72,7 +72,7 @@ module AudioAddict
72
72
  key_guide.each do |key, value|
73
73
  say "!txtgrn!#{key}"
74
74
  say word_wrap " #{value}"
75
- say ""
75
+ say ''
76
76
  end
77
77
  end
78
78
 
@@ -81,17 +81,17 @@ module AudioAddict
81
81
  warnings = verify_and_show_keys optional_keys
82
82
 
83
83
  say "Done. #{errors} errors, #{warnings} warnings."
84
- errors > 0 ? 1 : 0
84
+ errors.positive? ? 1 : 0
85
85
  end
86
86
 
87
- private
87
+ private
88
88
 
89
89
  def verify_and_show_keys(keys, critical: false)
90
90
  problems = 0
91
- prefix = critical ? "!txtred!Error !txtrst!" : "!txtylw!Warning!txtrst!"
91
+ prefix = critical ? '!txtred!Error !txtrst!' : '!txtylw!Warning!txtrst!'
92
92
 
93
93
  keys.each do |key, command|
94
- if !Config.has_key? key
94
+ unless Config.has_key? key
95
95
  problems += 1
96
96
  say "#{prefix} : Key !txtgrn!#{key}!txtrst! is not set. Fix with !txtpur!radio #{command}!txtrst!."
97
97
  end
@@ -102,30 +102,30 @@ module AudioAddict
102
102
 
103
103
  def key_guide
104
104
  {
105
- email: "Last email used for logging in.\nUsually set with !txtpur!radio login!txtrst!.",
105
+ email: "Last email used for logging in.\nUsually set with !txtpur!radio login!txtrst!.",
106
106
  session_key: "Used for authentication.\nUsually set with !txtpur!radio login!txtrst!.",
107
- listen_key: "Used for generating playlists.\nUsually set with !txtpur!radio login!txtrst!.",
108
- network: "Specify the AudioAddict network you are currently listening to.\nUsually set with !txtpur!radio set!txtrst!.",
109
- channel: "Specify the AudioAddict channel you are currently listening to.\nUsually set with !txtpur!radio set!txtrst!.",
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
- cache_dir: "Specify the path to store API response cache.\nDefault: ~/.audio_addict/cache",
112
- cache_life: "Specify the cache life period.\nDefault: 6h.",
107
+ listen_key: "Used for generating playlists.\nUsually set with !txtpur!radio login!txtrst!.",
108
+ network: "Specify the AudioAddict network you are currently listening to.\nUsually set with !txtpur!radio set!txtrst!.",
109
+ channel: "Specify the AudioAddict channel you are currently listening to.\nUsually set with !txtpur!radio set!txtrst!.",
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
+ cache_dir: "Specify the path to store API response cache.\nDefault: ~/.audio_addict/cache",
112
+ cache_life: "Specify the cache life period.\nDefault: 6h.",
113
113
  }
114
114
  end
115
115
 
116
116
  def required_keys
117
117
  {
118
- email: "login",
119
- session_key: "login",
120
- listen_key: "login",
121
- network: "set",
122
- channel: "set",
118
+ email: 'login',
119
+ session_key: 'login',
120
+ listen_key: 'login',
121
+ network: 'set',
122
+ channel: 'set',
123
123
  }
124
124
  end
125
125
 
126
126
  def optional_keys
127
127
  {
128
- like_log: "config set like_log PATH",
128
+ like_log: 'config set like_log PATH',
129
129
  }
130
130
  end
131
131
  end
@@ -1,35 +1,36 @@
1
1
  module AudioAddict
2
2
  module Commands
3
3
  class DownloadCmd < Base
4
- summary "Download songs from YouTube"
4
+ summary 'Download songs from YouTube'
5
5
 
6
- help "This command uses youtube-dl to download the currently playing song, or songs from your like-log."
6
+ help 'This command uses youtube-dl to download the currently playing song, or songs from your like-log.'
7
7
 
8
- usage "radio download current [--count N]"
9
- usage "radio download log [--lines N --count N]"
10
- usage "radio download search QUERY [--count N]"
11
- usage "radio download --help"
8
+ usage 'radio download current [--count N]'
9
+ usage 'radio download log [--lines N --count N]'
10
+ usage 'radio download search QUERY [--count N]'
11
+ usage 'radio download --help'
12
12
 
13
- option "-l --lines N", "Number of log lines to download [default: 1]"
14
- option "-c --count N", "Number of YouTube search results to download\nDefaults to the value of the AUDIO_ADDICT_DOWNLOAD_COUNT environment variable, or 1"
13
+ option '-l --lines N', 'Number of log lines to download [default: 1]'
14
+ option '-c --count N',
15
+ "Number of YouTube search results to download\nDefaults to the value of the AUDIO_ADDICT_DOWNLOAD_COUNT environment variable, or 1"
15
16
 
16
- param "QUERY", "YouTube search query"
17
+ param 'QUERY', 'YouTube search query'
17
18
 
18
- command "current", "Download the currently playing song"
19
- command "log", "Download the last N songs from the like-log"
20
- command "search", "Download any song matching the Youtube search query"
19
+ command 'current', 'Download the currently playing song'
20
+ command 'log', 'Download the last N songs from the like-log'
21
+ command 'search', 'Download any song matching the Youtube search query'
21
22
 
22
- environment "AUDIO_ADDICT_DOWNLOAD_COUNT", "Set the default download count (--count)"
23
+ environment 'AUDIO_ADDICT_DOWNLOAD_COUNT', 'Set the default download count (--count)'
23
24
 
24
- example "radio download current"
25
- example "radio download current --count 3"
26
- example "radio download log --lines 2 --count 3"
25
+ example 'radio download current'
26
+ example 'radio download current --count 3'
27
+ example 'radio download log --lines 2 --count 3'
27
28
  example "radio download search 'Brimstone, Bright Shadow' -c2"
28
29
 
29
30
  def current_command
30
31
  needs :network, :channel
31
32
 
32
- say "!txtblu!Downloading !txtrst!: ... "
33
+ say '!txtblu!Downloading !txtrst!: ... '
33
34
 
34
35
  track = current_channel.current_track
35
36
  query = track.search_string
@@ -43,9 +44,9 @@ module AudioAddict
43
44
  needs :like_log
44
45
  lines = args['--lines']&.to_i
45
46
 
46
- data = log.data[-lines..-1]
47
+ data = log.data[-lines..]
47
48
  data.each do |line|
48
- network, channel, artist, song = line.split(" :: ")
49
+ _network, _channel, artist, song = line.split(' :: ')
49
50
  query = "#{artist}, #{song}"
50
51
  say "\n!txtblu!Downloading !txtgrn!: #{query}"
51
52
  Youtube.new(query).get count
@@ -1,23 +1,23 @@
1
1
  module AudioAddict
2
2
  module Commands
3
3
  class HistoryCmd < Base
4
- summary "Show track history for the current channel"
4
+ summary 'Show track history for the current channel'
5
5
 
6
- help "This command shows the last few tracks that were playing on the currently active channel in reverse order (top track is the most recent)."
6
+ help 'This command shows the last few tracks that were playing on the currently active channel in reverse order (top track is the most recent).'
7
7
 
8
- usage "radio history"
9
- usage "radio history --help"
8
+ usage 'radio history'
9
+ usage 'radio history --help'
10
10
 
11
11
  def run
12
12
  needs :network, :channel
13
13
  say "!undgrn!#{radio.name} > #{current_channel.name}"
14
- say ""
14
+ say ''
15
15
  tracks.each do |track|
16
16
  say "!txtgrn! #{track.artist.rjust max_artist_len}!txtrst! : !txtblu!#{track.title}"
17
17
  end
18
18
  end
19
19
 
20
- private
20
+ private
21
21
 
22
22
  def tracks
23
23
  @tracks ||= current_channel.track_history