billboard_hot_100_CLI 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 +4 -4
- data/lib/billboard_hot_100/command_line_interface.rb +84 -60
- data/lib/billboard_hot_100/version.rb +1 -1
- metadata +2 -4
- data/Gemfile.lock +0 -11
- data/billboard_hot_100_CLI-0.1.0.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af48475772c793ff5de2aab60f2636f022e84a6ed19cd496fce93470c4b4a75a
|
|
4
|
+
data.tar.gz: 5e5c8a207604f7a288c5656acd5e241615b020939e9ef7e05081b353644e27fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28f8dafa86532aae4aba103e2d720ec6f0a81d5f2049bc14449fa5b922e106f3041df5b1d1c65ed6a109967a53805f6b4f0ece23df98e7dbfe38986f58d986a8
|
|
7
|
+
data.tar.gz: 365649ae1175076083b943e08fc32d0717986f9dc41da11e0e86c0026f41935688851a8a5025d3df41beb9b94d4399b2cc1aab733c95ad714258b39725d5b49e
|
|
@@ -3,93 +3,117 @@ class BillboardHot100::CommandLineInteface
|
|
|
3
3
|
def run
|
|
4
4
|
BillboardHot100::Scraper.scrape_songs
|
|
5
5
|
welcome
|
|
6
|
-
list_ranges
|
|
7
|
-
more_info
|
|
8
|
-
goodbye
|
|
9
6
|
end
|
|
10
7
|
|
|
11
8
|
def welcome
|
|
12
9
|
puts "\nWelcome to the this weeks Billboard Hot 100!\n"
|
|
10
|
+
ranges
|
|
13
11
|
end
|
|
14
12
|
|
|
15
|
-
def
|
|
16
|
-
puts "\nPlease enter the rankings you wish to see...\n"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
def ranges
|
|
14
|
+
puts "\nPlease enter the rankings you wish to see...\n\n"
|
|
15
|
+
|
|
16
|
+
total = BillboardHot100::Song.all.size
|
|
17
|
+
increment = 10
|
|
18
|
+
ranges = total/increment
|
|
19
|
+
ranking = 1
|
|
20
|
+
ranges_s = ""
|
|
21
|
+
|
|
22
|
+
ranges.times do
|
|
23
|
+
ranges_s << "#{ranking}-#{ranking+increment-1}, "
|
|
24
|
+
ranking += increment
|
|
25
|
+
end
|
|
26
|
+
puts ranges_s[0...-2]
|
|
27
|
+
|
|
28
|
+
quantize_input(increment, total)
|
|
20
29
|
end
|
|
21
30
|
|
|
22
|
-
def
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
def quantize_input(increment, total)
|
|
32
|
+
input = gets.strip
|
|
33
|
+
case
|
|
34
|
+
when input.to_i.between?(1,total)
|
|
35
|
+
low_num = ((input.to_i-1)/increment).floor*increment
|
|
36
|
+
display_songs(increment, input, low_num)
|
|
37
|
+
when input.downcase == "exit"
|
|
38
|
+
exit
|
|
27
39
|
else
|
|
28
40
|
invalid_choice
|
|
41
|
+
ranges
|
|
29
42
|
end
|
|
30
43
|
end
|
|
31
44
|
|
|
32
|
-
def
|
|
33
|
-
low_num
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def display_ten_songs(low_num)
|
|
38
|
-
puts "\nDisplaying songs #{low_num+1} through #{low_num+10}\n\n"
|
|
39
|
-
BillboardHot100::Song.all[low_num,10].each do |song|
|
|
45
|
+
def display_songs(increment, input, low_num)
|
|
46
|
+
puts "\nDisplaying songs #{low_num+1} through #{low_num+increment}\n\n"
|
|
47
|
+
BillboardHot100::Song.all[low_num,increment].each do |song|
|
|
40
48
|
puts "#{song.rank}. #{song.title} by #{song.artist}"
|
|
41
49
|
end
|
|
50
|
+
|
|
51
|
+
more_info(increment, input, low_num)
|
|
42
52
|
end
|
|
43
53
|
|
|
44
|
-
def more_info
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
def more_info(increment, input, low_num)
|
|
55
|
+
puts "\nPlease enter the song you want more information on, or type LIST to select a new range of songs.\n"
|
|
56
|
+
input = gets.strip
|
|
57
|
+
|
|
58
|
+
case
|
|
59
|
+
when input.to_i.between?(low_num+1,low_num+increment)
|
|
60
|
+
song = BillboardHot100::Song.all[input.to_i-1]
|
|
61
|
+
display_song(song)
|
|
62
|
+
when input.downcase == "list"
|
|
63
|
+
ranges
|
|
64
|
+
when input.downcase == "exit"
|
|
65
|
+
exit
|
|
66
|
+
else
|
|
67
|
+
puts "\nPlease enter a number between #{low_num+1} and #{low_num+increment}, or type LIST to select a new range of songs.\n".colorize(:red)
|
|
68
|
+
display_songs(increment, input, low_num)
|
|
69
|
+
end
|
|
70
|
+
continue
|
|
71
|
+
end
|
|
51
72
|
|
|
52
|
-
|
|
73
|
+
def continue
|
|
74
|
+
puts "\nWould you like information on another song? Enter Y or N\n"
|
|
53
75
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
76
|
+
input = gets.strip.downcase
|
|
77
|
+
case input
|
|
78
|
+
when "y"
|
|
79
|
+
ranges
|
|
80
|
+
when "n", "exit"
|
|
81
|
+
exit
|
|
59
82
|
else
|
|
60
83
|
invalid_choice
|
|
61
|
-
|
|
84
|
+
continue
|
|
85
|
+
end
|
|
62
86
|
end
|
|
63
87
|
|
|
64
88
|
def display_song(song)
|
|
65
89
|
puts "\n#{song.rank}. #{song.title} by #{song.artist}"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def goodbye
|
|
86
|
-
puts "\nCheck back next week for the latest Billboard Hot 100!"
|
|
87
|
-
exit
|
|
90
|
+
|
|
91
|
+
if song.last_week.length > 0 && !song.last_week.include?("-")
|
|
92
|
+
puts "Last Week: #{song.last_week}"
|
|
93
|
+
else
|
|
94
|
+
puts "New To Chart!".colorize(:blue)
|
|
95
|
+
end
|
|
96
|
+
if song.peak_position.length > 0
|
|
97
|
+
puts "Peak Position: #{song.peak_position}"
|
|
98
|
+
end
|
|
99
|
+
if song.weeks_on_chart.length > 0
|
|
100
|
+
puts "Weeks On Chart: #{song.weeks_on_chart}"
|
|
101
|
+
end
|
|
102
|
+
if song.lyrics.length > 0
|
|
103
|
+
puts "Lyrics: #{song.lyrics}"
|
|
104
|
+
end
|
|
105
|
+
if song.award.length > 0
|
|
106
|
+
puts "Award: #{song.award}".colorize(:blue)
|
|
107
|
+
end
|
|
88
108
|
end
|
|
89
109
|
|
|
90
110
|
def invalid_choice
|
|
91
|
-
puts "\nInvalid Choice!"
|
|
92
|
-
|
|
111
|
+
puts "\nInvalid Choice, Please Try Again!".colorize(:red)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def exit
|
|
115
|
+
puts "\nCheck back next week for the latest Billboard Hot 100!"
|
|
116
|
+
exit!
|
|
93
117
|
end
|
|
94
118
|
|
|
95
|
-
end
|
|
119
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: billboard_hot_100_CLI
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Olson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-04-
|
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -90,10 +90,8 @@ extra_rdoc_files: []
|
|
|
90
90
|
files:
|
|
91
91
|
- CONTRIBUTING.md
|
|
92
92
|
- Gemfile
|
|
93
|
-
- Gemfile.lock
|
|
94
93
|
- LICENSE.md
|
|
95
94
|
- README.md
|
|
96
|
-
- billboard_hot_100_CLI-0.1.0.gem
|
|
97
95
|
- billboard_hot_100_CLI.gemspec
|
|
98
96
|
- bin/billboard_hot_100
|
|
99
97
|
- bin/console
|
data/Gemfile.lock
DELETED
|
Binary file
|