soundly 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a6d8bf9107134324f78f29c81fc570d03e1a7d1d
4
+ data.tar.gz: 134e8433ca1fed1b86207e8bbd0e9405af65f823
5
+ SHA512:
6
+ metadata.gz: 0959dbdccc117c87b86d98dc6a2fafe211398211f9b1bf9bb8e2d3a3f6e938e55578f5b886d6800340e2f232f2fdb6673497df6b13b4d67a2a383c0fee649456
7
+ data.tar.gz: 585d2117e6f35015e505074df924845c37203349315460fffd48d0fc49ed71ccf96ddecfdacb74f38daabc7d31fd142dd578830f8741fb3a01132d9f0be1f30b
Binary file
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.14.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at <github email address>. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ # Specify your gem's dependencies in soundly.gemspec
3
+ gemspec
@@ -0,0 +1,33 @@
1
+ # Soundly
2
+
3
+ Soundly will offer two playlists generated through Spotify's API. The first playlist will be the 50 most played songs in the united states; the second playlist will be a user curated playlist. The user is me and the playlist is comprised of the songs I listen to most at any given moment.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'soundly'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install soundly
20
+
21
+ ## Usage
22
+
23
+ Pretty straight forward. This gem is just for funsies.
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/<github username>/soundly. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "soundly"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require "soundly"
4
+
5
+ Soundly::CLI.new.call
6
+
Binary file
@@ -0,0 +1,9 @@
1
+ #Environment
2
+ require_relative "./soundly/version.rb"
3
+ require_relative "./soundly/cli.rb"
4
+ require_relative "soundly/tracks.rb"
5
+
6
+ require 'pry'
7
+ require 'rspotify'
8
+ # require 'colorize'
9
+ # require 'colorized_string'
@@ -0,0 +1,135 @@
1
+ require 'rspotify'
2
+ require 'pry'
3
+ require_relative 'tracks'
4
+
5
+ class Soundly::CLI
6
+ def call
7
+ pills
8
+ greetings
9
+ menu
10
+ goodbye
11
+ end
12
+
13
+ def pills
14
+ @@pills = Soundly::Tracks.new
15
+ end
16
+
17
+ def greetings
18
+ string = printf %Q(Greetings human. Lend me your earholes, I will fill them with beautiful sounds👽); sleep 1
19
+ print "\n"
20
+ printf %Q(You have options: Blue pill, or Red pill.)
21
+ print "\n"
22
+ printf %Q(• The blue pill, allows you to sample a playlist shaped by your fellow homosapien's listening habits (top 50 currently trending songs on spotify).)
23
+ print "\n"
24
+ printf %Q(• Take the red pill, you get to sample an ever evolving playlist of sounds I fancy.)
25
+ end
26
+
27
+ def red_playlist
28
+ puts %Q(I like your style, hooman.)
29
+ puts %Q(Heres what I am currently listening to.)
30
+ @@pills.red_songs.each.with_index(1) {|object, index| puts "#{index}. #{object.name} by #{object.artists[0].name} \n"}
31
+ puts %Q(Type a song's listing number to learn more.)
32
+ puts %Q(Type "Menu" to head back to the main menu.)
33
+ end
34
+
35
+ def blue_playlist
36
+ puts %Q(:/ Okay, fine.)
37
+ puts "\n"
38
+ puts "Here's whats going on with music in your country, on planet E-Arth..."
39
+ @@pills.blue_songs.each.with_index(1) {|object, index| puts "#{index}. #{object.name} by #{object.artists[0].name} \n"}
40
+ # binding.pry
41
+ puts %Q(Type a song's listing number to learn more.)
42
+ puts %Q(Type "Menu" to head back to the main menu.)
43
+ end
44
+
45
+ def blue_pill
46
+ print "\n"
47
+ puts "Blue Pill: Main Menu"
48
+ sleep 1
49
+ blue_playlist
50
+
51
+ user_input = nil
52
+ while user_input != "menu"
53
+ user_input = gets.strip
54
+ if user_input == "menu"
55
+ menu
56
+ elsif (1..50).to_a.include?(user_input.to_i)
57
+ puts "Here are details on #{@@pills.blue_songs[user_input.to_i-1].name}"
58
+ song = @@pills.blue_songs[user_input.to_i-1]
59
+ puts "Song name: #{song.name}"
60
+ puts "Artist: #{song.artists[0].name}"
61
+ puts "Album: #{song.album.name}"
62
+ puts "Duration: #{song.duration_ms}"
63
+ puts "Popularity: #{song.popularity}"
64
+ puts "Preview_url: #{song.preview_url}" if song.preview_url != nil
65
+ print "\n"
66
+ else
67
+ puts %(You've lost me human. Try again.)
68
+ puts %(Select a number from the list to learn more about a song.)
69
+ print "\n"
70
+ puts %(Or you can type "Menu" to head back to main menu of course.)
71
+ print "\n"
72
+ end
73
+ end
74
+ end
75
+
76
+ def red_pill
77
+ print "\n"
78
+ puts "Red Pill: Main Menu"
79
+ red_playlist
80
+
81
+ user_input = nil
82
+ while user_input != "menu"
83
+ user_input = gets.strip
84
+ object = @@pills.red_songs.count.to_i
85
+ # binding.pry
86
+ if user_input == "menu"
87
+ menu
88
+ elsif (1..object).include?(user_input.to_i)
89
+ puts "Here are details on #{@@pills.red_songs[user_input.to_i-1].name}"
90
+ song = @@pills.red_songs[user_input.to_i-1]
91
+ puts "Song name: #{song.name}"
92
+ puts "Artist: #{song.artists[0].name}"
93
+ puts "Album: #{song.album.name}"
94
+ puts "Duration: #{song.duration_ms}"
95
+ puts "Popularity: #{song.popularity}"
96
+ puts "Preview_url: #{song.preview_url}" if song.preview_url != nil
97
+ print "\n"
98
+ else
99
+ puts %(You've lost me human. Try again.)
100
+ puts %(Select a number from the list to learn more about a song.)
101
+ print "\n"
102
+ puts %(Or you can type "Exit" to head back to main menu or course.)
103
+ print "\n"
104
+ end
105
+ end
106
+ end
107
+
108
+ def menu
109
+ user_input = nil
110
+ puts "Main Menu"
111
+ puts %Q(Type "Blue" for the Blue pill, and "Red" for the Red pill.)
112
+ puts %Q(Type "Exit" to part ways.)
113
+ print "\n"
114
+ puts %Q(Choose wisely, human...)
115
+
116
+ while user_input != "exit"
117
+ user_input = gets.strip.downcase
118
+ if user_input == "exit"
119
+ goodbye
120
+ elsif user_input == "blue"
121
+ blue_pill
122
+ elsif user_input == "red"
123
+ red_pill
124
+ else
125
+ puts "Come again?"
126
+ end
127
+ end
128
+ end
129
+
130
+ def goodbye
131
+ puts %Q(Goodbye human.)
132
+ puts %Q(See you soon.)
133
+ exit
134
+ end
135
+ end
@@ -0,0 +1,51 @@
1
+ require 'rspotify'
2
+ require 'pry'
3
+ require_relative 'cli'
4
+
5
+ class Soundly::Tracks
6
+ # attr_accessor :track_name, :artist, :album, :genre, :duration, :popularity, :position, :preview_url
7
+
8
+ @@blue_playlist = []
9
+ @@red_playlist = []
10
+
11
+
12
+ def initialize
13
+ blue_playlist
14
+ red_playlist
15
+ end
16
+
17
+ def blue_playlist
18
+ RSpotify.authenticate("b866a06729ba441d8819fe317fa0d8b3", "f00fcf04738f4f73a8e880923f767a13")
19
+ playlist = RSpotify::Playlist.find('spotifycharts', '37i9dQZEVXbLRQDuF5jeBp')
20
+ playlist.tracks.each do |song|
21
+ @@blue_playlist << song
22
+
23
+ #Soundly::Tracks.save_song(song)
24
+ end
25
+ end
26
+
27
+ def red_playlist
28
+ RSpotify.authenticate("b866a06729ba441d8819fe317fa0d8b3", "f00fcf04738f4f73a8e880923f767a13")
29
+ playlist = RSpotify::Playlist.find('dwyn.hrmn', '7BQJkBkL5muBFOc7ok76XO')
30
+ playlist.tracks.each do |song|
31
+ @@red_playlist << song
32
+ end
33
+ end
34
+
35
+ def blue_songs
36
+ @@blue_playlist
37
+ end
38
+
39
+ def red_songs
40
+ @@red_playlist
41
+ end
42
+
43
+ def self.all(playlist)
44
+ if playlist == blue
45
+ @@blue_playlist
46
+ else
47
+ @@red_playlist
48
+ end
49
+ end
50
+
51
+ end
@@ -0,0 +1,3 @@
1
+ module Soundly
2
+ VERSION = "0.1.2"
3
+ end
@@ -0,0 +1,10 @@
1
+ #Psuedo code for Soundly
2
+
3
+ 1. Greets user
4
+ 2. Give user choice between blue pill and red pill, or to exit the program completely.
5
+
6
+ 2A. Blue pill will take user to Spotify's top 50 trending songs in USA
7
+
8
+ 2B. Red pill will take user to my personal trending list on Spotify.
9
+
10
+ 3. Regardless of pill chosen, the program should end up in a loop that offers a list of songs available - followed by a prompt to ask the user if they would like detailed information on a specific song
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'soundly/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "soundly"
8
+ spec.version = Soundly::VERSION
9
+ spec.authors = ["<dwyn>"]
10
+ spec.email = ["<dwayne.harmon@gmail.com>"]
11
+
12
+ spec.summary = %q{This gem will play songs from a revolving playlist through the Spotify API}
13
+ spec.description = %q{Write a longer description or delete this line.}
14
+ spec.homepage = "https://github.com/dwyn/soundly"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.14"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "rspotify"
30
+ spec.add_development_dependency "spotify-client"
31
+ spec.add_development_dependency "omniauth-spotify"
32
+ spec.add_development_dependency "pry"
33
+ end
data/spec.md ADDED
@@ -0,0 +1,6 @@
1
+ # Specifications for the CLI Assessment
2
+
3
+ Specs:
4
+ - [x] Have a CLI for interfacing with the application
5
+ - [x] Pull data from an external source
6
+ - [x] Implement both list and detail views
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: soundly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - "<dwyn>"
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-06-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspotify
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: spotify-client
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: omniauth-spotify
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Write a longer description or delete this line.
112
+ email:
113
+ - "<dwayne.harmon@gmail.com>"
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".DS_Store"
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".travis.yml"
122
+ - CODE_OF_CONDUCT.md
123
+ - Gemfile
124
+ - README.md
125
+ - Rakefile
126
+ - bin/console
127
+ - bin/setup
128
+ - bin/soundly
129
+ - lib/.DS_Store
130
+ - lib/soundly.rb
131
+ - lib/soundly/cli.rb
132
+ - lib/soundly/tracks.rb
133
+ - lib/soundly/version.rb
134
+ - notes.md
135
+ - soundly.gemspec
136
+ - spec.md
137
+ homepage: https://github.com/dwyn/soundly
138
+ licenses: []
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.6.11
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: This gem will play songs from a revolving playlist through the Spotify API
160
+ test_files: []