atx_live_music 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/atx_live_music-0.1.2.gem +0 -0
- data/atx_live_music.gemspec +1 -1
- data/bin/atx-live-music +1 -1
- data/lib/atx_live_music.rb +3 -1
- data/lib/atx_live_music/cli.rb +32 -21
- data/lib/atx_live_music/dates.rb +39 -0
- data/lib/atx_live_music/scraper.rb +11 -0
- data/lib/atx_live_music/shows.rb +19 -64
- data/lib/atx_live_music/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86dc90076e613c2c4a5b72184113ee68c977959b
|
4
|
+
data.tar.gz: d65bfe2008b6678c8e22c8687bd342f2f8126537
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89aaa0649ec995990ed1a96ea7dcff1456d9746d60394fa5eae10ff70f76fb0eb12a387ec9de7efc4320925c5c2aa04aa1638359b0d168a4fd37f82d7ca0b8bf
|
7
|
+
data.tar.gz: e5e46dadaf552814c814ee5d1b8424ce0c6907ca48bf8ddc5d980b03e3264e5c6f5ceafccf6de3cae2bbc30d745444ed861431a38d5313cd2bf8b17db180b904
|
Binary file
|
data/atx_live_music.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = AtxLiveMusic::VERSION
|
9
9
|
spec.authors = ["wedesignstudios"]
|
10
10
|
spec.email = ["deelden@gmail.com"]
|
11
|
-
spec.date = '2016-06-
|
11
|
+
spec.date = '2016-06-12'
|
12
12
|
spec.summary = "Live Music in Austin, Texas"
|
13
13
|
spec.description = "Displays live music listings in Austin, Texas."
|
14
14
|
spec.homepage = "https://github.com/wedesignstudios/atx-live-music"
|
data/bin/atx-live-music
CHANGED
data/lib/atx_live_music.rb
CHANGED
@@ -3,4 +3,6 @@ require "nokogiri"
|
|
3
3
|
|
4
4
|
require_relative "./atx_live_music/version"
|
5
5
|
require_relative "./atx_live_music/cli"
|
6
|
-
require_relative "./atx_live_music/shows"
|
6
|
+
require_relative "./atx_live_music/shows"
|
7
|
+
require_relative "./atx_live_music/scraper"
|
8
|
+
require_relative "./atx_live_music/dates"
|
data/lib/atx_live_music/cli.rb
CHANGED
@@ -1,52 +1,59 @@
|
|
1
1
|
class AtxLiveMusic::CLI
|
2
2
|
|
3
3
|
def call
|
4
|
-
puts "Please wait while the roadies load in the shows...\n"
|
5
|
-
|
4
|
+
puts "Please wait while the roadies load in the shows...\n"
|
5
|
+
get_latest_shows
|
6
6
|
list_dates
|
7
7
|
cta
|
8
8
|
end
|
9
9
|
|
10
|
+
def get_latest_shows
|
11
|
+
AtxLiveMusic::Dates.get_seven_days
|
12
|
+
|
13
|
+
AtxLiveMusic::Dates.all.each do |date|
|
14
|
+
AtxLiveMusic::Shows.create_shows(date)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
10
18
|
def list_dates
|
11
|
-
puts "\n***** ATX Live Music *****\n\n"
|
12
|
-
|
13
|
-
|
19
|
+
puts "\n***** ATX Live Music *****\n\n"
|
20
|
+
|
21
|
+
AtxLiveMusic::Dates.all.each_with_index do |date, index|
|
22
|
+
index == 0 ? (puts "#{index+1}. Today") : (puts "#{index+1}. #{date.string_date}")
|
14
23
|
end
|
15
24
|
end
|
16
25
|
|
17
26
|
def cta
|
18
|
-
puts "\nSelect the date you want to rock on: [1 - 7 or 'exit']\n\n"
|
27
|
+
puts "\nSelect the date you want to rock on: [1 - 7 or 'exit']\n\n"
|
19
28
|
input = gets.strip
|
29
|
+
input_num = input.to_i
|
20
30
|
|
21
|
-
if
|
22
|
-
|
23
|
-
|
24
|
-
display_listings(AtxLiveMusic::Shows.all[i-1].listings)
|
31
|
+
if input_num > 0 && input_num <= AtxLiveMusic::Dates.all.count
|
32
|
+
input_num == 1 ? (puts "\nToday\n#{divider}") : (puts "\n#{AtxLiveMusic::Dates.all[input_num-1].string_date}\n#{divider}")
|
33
|
+
display_shows_on_given_date(AtxLiveMusic::Dates.all[input_num-1])
|
25
34
|
another_date?
|
26
35
|
elsif input == "exit"
|
27
36
|
exit
|
28
|
-
|
37
|
+
elsif input_num == 0 || input_num > AtxLiveMusic::Dates.all.count
|
29
38
|
puts "Which date did you want?"
|
30
39
|
cta
|
31
40
|
end
|
32
|
-
|
33
|
-
end
|
34
41
|
|
35
|
-
def display_listings(listings_arr)
|
36
|
-
listings_arr.each do |listing|
|
37
|
-
listing.each do |key, value|
|
38
|
-
key.to_s == "location" ? (puts "#{key.upcase}: #{value} \n\n") : (puts "#{key.upcase}: #{value}")
|
39
|
-
end
|
40
|
-
end
|
41
42
|
end
|
42
43
|
|
43
|
-
def
|
44
|
-
|
44
|
+
def display_shows_on_given_date(date)
|
45
|
+
date.shows.each do |show|
|
46
|
+
puts "SHOW: #{show.performance}"
|
47
|
+
puts "VENUE: #{show.venue}"
|
48
|
+
puts "LOCATION: #{show.location}\n\n"
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
def another_date?
|
48
53
|
puts "\nWant to check out another date's listings? [Y or N]"
|
54
|
+
|
49
55
|
input = gets.strip.upcase
|
56
|
+
|
50
57
|
case input
|
51
58
|
when "Y"
|
52
59
|
list_dates
|
@@ -59,6 +66,10 @@ class AtxLiveMusic::CLI
|
|
59
66
|
end
|
60
67
|
end
|
61
68
|
|
69
|
+
def divider
|
70
|
+
"=========================="
|
71
|
+
end
|
72
|
+
|
62
73
|
def exit
|
63
74
|
puts "\nEnjoy the music! And remember...Keep Austin Weird."
|
64
75
|
puts "**************************************************\n\n"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class AtxLiveMusic::Dates
|
2
|
+
|
3
|
+
attr_accessor :num_date, :string_date, :shows
|
4
|
+
|
5
|
+
@@all = []
|
6
|
+
@@seven_days = []
|
7
|
+
|
8
|
+
def initialize(day)
|
9
|
+
@num_date = day.strftime("%Y-%m-%d")
|
10
|
+
@string_date = day.strftime("%B %-e")
|
11
|
+
@shows = []
|
12
|
+
@@all << self
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.all
|
16
|
+
@@all
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.seven_days
|
20
|
+
@@seven_days
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.get_seven_days
|
24
|
+
@@seven_days << Time::now
|
25
|
+
|
26
|
+
i = 0
|
27
|
+
while i < 6
|
28
|
+
day = @@seven_days.last + 86400
|
29
|
+
@@seven_days << day
|
30
|
+
i += 1
|
31
|
+
end
|
32
|
+
self.create_days
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.create_days
|
36
|
+
self.seven_days.each {|day| self.new(day)}
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/lib/atx_live_music/shows.rb
CHANGED
@@ -1,77 +1,32 @@
|
|
1
1
|
class AtxLiveMusic::Shows
|
2
2
|
|
3
|
-
attr_accessor :
|
4
|
-
attr_reader :date
|
3
|
+
attr_accessor :date, :performance, :venue, :location
|
5
4
|
|
6
|
-
|
7
|
-
@@all = []
|
8
|
-
|
9
|
-
def initialize(date="")
|
5
|
+
def initialize(date, performance, venue, location)
|
10
6
|
@date = date
|
11
|
-
@
|
12
|
-
|
7
|
+
@performance = performance
|
8
|
+
@location = location
|
9
|
+
@venue = venue
|
10
|
+
date.shows << self
|
13
11
|
end
|
14
12
|
|
15
|
-
def self.
|
16
|
-
|
17
|
-
|
13
|
+
def self.create_shows(date)
|
14
|
+
page = Scraper.new(date.num_date)
|
15
|
+
arr = page.doc.css("#AllListings")
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
i = 0
|
22
|
-
@days << Time::now
|
23
|
-
while i < 6
|
24
|
-
day = @days.last + 86400
|
25
|
-
@days << day
|
26
|
-
i += 1
|
27
|
-
end
|
28
|
-
@days
|
29
|
-
end
|
17
|
+
arr.each do |listing|
|
18
|
+
i = 0
|
30
19
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
20
|
+
while i < listing.css("h2").count
|
21
|
+
performance = listing.css("h2 a")[i].text
|
22
|
+
venue = listing.css("h3 a")[i].text
|
23
|
+
location = listing.css("h3 span")[i].text
|
36
24
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
num_days
|
41
|
-
end
|
25
|
+
AtxLiveMusic::Shows.new(date, performance, venue, location)
|
26
|
+
i += 1
|
27
|
+
end
|
42
28
|
|
43
|
-
def self.create_shows
|
44
|
-
AtxLiveMusic::Shows.num_days.each do |day|
|
45
|
-
shows = AtxLiveMusic::Shows.new(day)
|
46
|
-
shows.create_listings
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def create_listings
|
51
|
-
|
52
|
-
arr = self.doc.css("#AllListings")
|
53
|
-
arr.each do |listing|
|
54
|
-
i = 0
|
55
|
-
while i < listing.css("h2").count
|
56
|
-
event = {}
|
57
|
-
event[:show] = listing.css("h2 a")[i].text
|
58
|
-
event[:venue] = listing.css("h3 a")[i].text
|
59
|
-
event[:location] = listing.css("h3 span")[i].text
|
60
|
-
@listings << event
|
61
|
-
i += 1
|
62
|
-
end
|
63
|
-
|
64
29
|
end
|
65
30
|
end
|
66
31
|
|
67
|
-
|
68
|
-
@doc = Nokogiri::HTML(open(URL+self.date))
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atx_live_music
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wedesignstudios
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,12 +82,15 @@ files:
|
|
82
82
|
- Rakefile
|
83
83
|
- atx_live_music-0.1.0.gem
|
84
84
|
- atx_live_music-0.1.1.gem
|
85
|
+
- atx_live_music-0.1.2.gem
|
85
86
|
- atx_live_music.gemspec
|
86
87
|
- bin/atx-live-music
|
87
88
|
- bin/console
|
88
89
|
- bin/setup
|
89
90
|
- lib/atx_live_music.rb
|
90
91
|
- lib/atx_live_music/cli.rb
|
92
|
+
- lib/atx_live_music/dates.rb
|
93
|
+
- lib/atx_live_music/scraper.rb
|
91
94
|
- lib/atx_live_music/shows.rb
|
92
95
|
- lib/atx_live_music/version.rb
|
93
96
|
homepage: https://github.com/wedesignstudios/atx-live-music
|