audio_addict 0.1.1 → 0.1.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: 1344d6300842af6ee581d4ea2b5695c9f741ea0a839993dfae73d218280d0b88
4
- data.tar.gz: facf7ab27a2e123012fa721e1eb4f36ed90e9fd6d0f184950b9ea6a6a2d37b39
3
+ metadata.gz: 20084805bf5d4e9fa5409b4354364be364e005e8c5db251d4bc84dfa68f04436
4
+ data.tar.gz: 8011bab35c939ffd10c183b56e62d169259add2f6c7c042a4e60b29b9e1fa1ca
5
5
  SHA512:
6
- metadata.gz: e95982e148ee53bba66319321918cc89ce3b17f0f1d8865677ba660a3e3bdb0dcf0ec503feea3baa4aef6434be5368b0f88293ecd43ece461ec570c082effa78
7
- data.tar.gz: e9e0219a73b6e51390fd8c22a98195add6596e5d7b7bd81fd93f889aa9cc40b2c1f5b87a4ed95e081386152abfed1f9bae4d933a2da8d9097b3a4fb690b72b18
6
+ metadata.gz: d28c3632e64e82c2154c70366c6664c90f1cb9a9e84b3ef6082efcf0629cde1ab3003ee6985a048d2d21c5d699bf7a87ba15119e5ff4d8ec18a581d7e9dad7bc
7
+ data.tar.gz: f53f5dfeaabed9bb8d099809bae886f2b7b5cca0eb838e401f235257407cc9e8f7d386eab99d30577699b91f8110a7eda34126f059e3ea9b3a9d434fe0e8d775
data/README.md CHANGED
@@ -14,12 +14,17 @@ radio network.
14
14
 
15
15
  ---
16
16
 
17
+ Demo
18
+ --------------------------------------------------
19
+
20
+ ![Demo](https://raw.githubusercontent.com/DannyBen/audio_addict/master/demo/demo.gif)
21
+
17
22
 
18
23
  Install
19
24
  --------------------------------------------------
20
25
 
21
- Please note that in order to use this gem you need to have a premium account
22
- at one of the AudioAddict networks.
26
+ Please note that in order to use this gem you need to have an AUdioAddict
27
+ account (free or premium) at one of the AudioAddict networks.
23
28
 
24
29
  ```
25
30
  $ gem install audio_addict
@@ -40,7 +45,7 @@ Features
40
45
  - View currently playing track
41
46
  - Vote on the currently playing track
42
47
  - Save a log of a all your liked tracks
43
- - Generate playlists
48
+ - Generate playlists (requires a premium account)
44
49
 
45
50
 
46
51
  Usage
@@ -17,6 +17,8 @@ module AudioAddict
17
17
  session = session(username, password)
18
18
  Config.session_key = session['key']
19
19
  Config.listen_key = session['member']['listen_key']
20
+ Config.email = session['member']['email']
21
+ Config.premium = session['member']['user_type'] == 'premium'
20
22
  Config.save
21
23
  end
22
24
 
@@ -42,10 +44,8 @@ module AudioAddict
42
44
 
43
45
  def session(username, password)
44
46
  params = { member_session: { username: username, password: password } }
45
- cache.get "/#{network}/member_sessions" do
46
- basic_auth
47
- response http.post "/#{network}/member_sessions", body: params
48
- end
47
+ basic_auth
48
+ response http.post "/#{network}/member_sessions", body: params
49
49
  end
50
50
 
51
51
  def session_key
@@ -18,6 +18,10 @@ module AudioAddict
18
18
  end
19
19
  end
20
20
 
21
+ def require_premium_account
22
+ raise PremiumAccount, "This operation requires a premium account" unless Config.premium
23
+ end
24
+
21
25
  def radio
22
26
  @radio ||= Radio.new current_network
23
27
  end
@@ -76,6 +76,7 @@ module AudioAddict
76
76
 
77
77
  def key_guide
78
78
  {
79
+ email: "Last email used for logging in.\nUsually set with !txtpur!radio login!txtrst!.",
79
80
  session_key: "Used for authentication.\nUsually set with !txtpur!radio login!txtrst!.",
80
81
  listen_key: "Used for generating playlists.\nUsually set with !txtpur!radio login!txtrst!.",
81
82
  network: "Specify the AudioAddict network you are currently listening to.\nUsually set with !txtpur!radio set!txtrst!.",
@@ -12,7 +12,7 @@ module AudioAddict
12
12
  proceed = true
13
13
 
14
14
  if radio.api.logged_in?
15
- say "!txtylw!You are already logged in"
15
+ say "!txtylw!You are already logged in as !undylw!#{Config.email}"
16
16
  proceed = prompt.yes? "Login again?"
17
17
  end
18
18
 
@@ -22,7 +22,7 @@ module AudioAddict
22
22
  private
23
23
 
24
24
  def login_prompt
25
- user = prompt.ask "Username :"
25
+ user = prompt.ask "Username :", default: Config.email
26
26
  pass = prompt.mask "Password :"
27
27
 
28
28
  if user and pass
@@ -18,6 +18,8 @@ module AudioAddict
18
18
  def init_command(args)
19
19
  needs :network, :channel, :listen_key
20
20
 
21
+ require_premium_account
22
+
21
23
  name = args['NAME']
22
24
  outfile = "#{name}.yml"
23
25
 
@@ -33,6 +35,8 @@ module AudioAddict
33
35
  def generate_command(args)
34
36
  needs :network, :channel, :listen_key
35
37
 
38
+ require_premium_account
39
+
36
40
  name = args['NAME']
37
41
 
38
42
  infile = "#{name}.yml"
@@ -13,6 +13,9 @@ module AudioAddict
13
13
  path: {
14
14
  name: "Config Path", value: Config.path },
15
15
 
16
+ email: {
17
+ name: "Email", command: 'login' },
18
+
16
19
  session_key: {
17
20
  name: "Session Key", command: 'login', secret: true },
18
21
 
@@ -4,6 +4,7 @@ module AudioAddict
4
4
  class Interrupt < Error; end
5
5
  class ArgumentError < Error; end
6
6
  class ConfigError < Error; end
7
+ class PremiumAccount < Error; end
7
8
 
8
9
  class APIError < Error
9
10
  attr_reader :response
@@ -1,3 +1,3 @@
1
1
  module AudioAddict
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audio_addict
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit