spotify_rec 1.1 → 1.6
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 +4 -4
- data/bin/spotify_rec +33 -26
- data/lib/error.rb +10 -0
- data/lib/login.rb +154 -117
- data/lib/menu.rb +116 -67
- data/lib/my_list.rb +162 -137
- data/lib/playlist.rb +103 -67
- data/lib/rec.rb +54 -44
- data/lib/spec/rec_spec.rb +24 -0
- data/lib/spec/user_spec.rb +34 -0
- data/lib/tutorial.rb +56 -0
- data/lib/user.rb +93 -69
- data/public/users.json +1 -13
- metadata +64 -5
- data/lib/run.rb +0 -47
data/lib/run.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'rspotify'
|
2
|
-
require 'optparse'
|
3
|
-
require 'json'
|
4
|
-
require 'tty-prompt'
|
5
|
-
require 'terminal-table'
|
6
|
-
require 'colorize'
|
7
|
-
require_relative 'user'
|
8
|
-
require_relative 'playlist'
|
9
|
-
require_relative 'login'
|
10
|
-
require_relative 'rec'
|
11
|
-
require_relative 'menu'
|
12
|
-
require_relative 'my_list'
|
13
|
-
include Login
|
14
|
-
|
15
|
-
RSpotify.authenticate("712ff89a218a4e6dbe1f169e06f949b9", "e9e0517f405b4a01a1be8823126459b7")
|
16
|
-
$prompt = TTY::Prompt.new
|
17
|
-
|
18
|
-
VERSION = 1.0
|
19
|
-
|
20
|
-
ARGV << '--run' if ARGV.empty?
|
21
|
-
|
22
|
-
options = {}
|
23
|
-
parser = OptionParser.new do |opts|
|
24
|
-
opts.banner = "Welcome to Spotify Recommendations! Usage: spotifyrec [options]".colorize(:light_green)
|
25
|
-
|
26
|
-
opts.on("-v", "--version", "Display the version") do
|
27
|
-
puts "Spotify Recommendations version #{VERSION}".colorize(:light_green)
|
28
|
-
end
|
29
|
-
|
30
|
-
opts.on("-h", "--help", "Display the help message") do
|
31
|
-
puts opts
|
32
|
-
exit
|
33
|
-
end
|
34
|
-
|
35
|
-
opts.on("-qGENRE", "--quick=GENRE", "Generate a quick recommendation with the chosen genre") do |genre|
|
36
|
-
recommendations = RSpotify::Recommendations.generate(limit: 5, seed_genres: [genre])
|
37
|
-
cleaned_recs = recommendations.tracks.map { |t| "#{t.name} by #{t.artists[0].name}" }
|
38
|
-
puts "》 RECOMMENDATIONS 《".colorize(:light_green)
|
39
|
-
cleaned_recs.each { |track| puts track }
|
40
|
-
end
|
41
|
-
|
42
|
-
opts.on("-r", "--run", "Run the application") do
|
43
|
-
Login::login
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
parser.parse!
|