the_little_streamer 0.4.5 → 0.5.0
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 +5 -5
- data/lib/the_little_streamer/html.rb +17 -8
- data/lib/the_little_streamer/player.rb +2 -5
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 00baf48d663ad7871febe31a46a942007a5eb3bc4c8e84dd94ed5c98d0b849fc
|
4
|
+
data.tar.gz: ae7758504a37d8142f001d6ccd6cce225a66a185afb7b55b5785e38c007b0d23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4f511005bdbe85b98ae85d936c9894e4c0804f9c742cd78278af3495994b9d9699a33424ae89797a58e6adaa5dacb559090b184529a55a7832ee02b77f1544a
|
7
|
+
data.tar.gz: ede209515d4f3c8c0cdb7f7d73b57403e0bd50aa404fa19378fdb20254d7b7efd53b29c6290597216d512d0633f2c96142660f93e24ea346910ed3724a13b597
|
@@ -87,9 +87,10 @@ module TLS::HTML
|
|
87
87
|
|
88
88
|
#Create a link
|
89
89
|
def link root, path, text = path, params = {}
|
90
|
-
full_path = root.split('/').map! {|r|
|
91
|
-
params = params.map { |k, v| "#{k}=#{v}" }.join "&"
|
92
|
-
|
90
|
+
full_path = root.split('/').map! {|r| ue r }.join('/') << "/" << ue(path)
|
91
|
+
params = params.map { |k, v| "#{ue(k)}=#{ue(v)}" }.join "&"
|
92
|
+
|
93
|
+
"<a href=\"#{full_path}?#{params}\">#{e text}</a>"
|
93
94
|
end
|
94
95
|
|
95
96
|
#Some navigation
|
@@ -104,7 +105,7 @@ module TLS::HTML
|
|
104
105
|
#Audio tag
|
105
106
|
def audio path
|
106
107
|
<<-HTML
|
107
|
-
<audio id=
|
108
|
+
<audio id="player" onEnded="javascript:play_next()" src="#{("/" << ue(path))}" autobuffer controls autoplay >
|
108
109
|
You need the power of HTML5!
|
109
110
|
</audio>
|
110
111
|
<script type="text/javascript">
|
@@ -118,7 +119,7 @@ module TLS::HTML
|
|
118
119
|
list = []
|
119
120
|
|
120
121
|
songs.each_with_index do |song, i|
|
121
|
-
list << "<li><a href=\"javascript:play_index(#{i})\">#{song.artist} - #{song.title}</a></li>"
|
122
|
+
list << "<li><a href=\"javascript:play_index(#{i})\">#{e song.artist} - #{e song.title}</a></li>"
|
122
123
|
end
|
123
124
|
|
124
125
|
<<-HTML
|
@@ -177,18 +178,18 @@ module TLS::HTML
|
|
177
178
|
{ artist: #{link("/artist", song.artist, song.artist).inspect},
|
178
179
|
album: #{link("/artist/#{song.artist}/album/", song.album, song.album).inspect},
|
179
180
|
title: #{song.title.inspect},
|
180
|
-
path: #{(
|
181
|
+
path: #{("/" << ue(song.path)).inspect} }
|
181
182
|
JAVASCRIPT
|
182
183
|
end
|
183
184
|
|
184
185
|
#HTML for song information header
|
185
186
|
def song_info song
|
186
|
-
"<span id='title'>#{song.title}</span> by <span id='artist'>#{link "/artist/", song.artist}</span><br/><span id='album'>#{link "/artist/#{song.artist}/album", song.album}</span>"
|
187
|
+
"<span id='title'>#{e song.title}</span> by <span id='artist'>#{link "/artist/", song.artist}</span><br/><span id='album'>#{link "/artist/#{song.artist}/album", song.album}</span>"
|
187
188
|
end
|
188
189
|
|
189
190
|
#Back/forward links
|
190
191
|
def prev_and_next
|
191
|
-
@prev_and_next ||=
|
192
|
+
@prev_and_next ||= '<a href="javascript:play_next(true)">Prev</a> <a href="javascript:play_next()">Next</a>'
|
192
193
|
@prev_and_next
|
193
194
|
end
|
194
195
|
|
@@ -205,4 +206,12 @@ module TLS::HTML
|
|
205
206
|
</div>
|
206
207
|
HTML
|
207
208
|
end
|
209
|
+
|
210
|
+
def e str
|
211
|
+
CGI.escapeHTML str.to_s
|
212
|
+
end
|
213
|
+
|
214
|
+
def ue str
|
215
|
+
URI.escape str.to_s
|
216
|
+
end
|
208
217
|
end
|
@@ -92,16 +92,13 @@ class TLS::Player
|
|
92
92
|
if @music.has? artist
|
93
93
|
path = "/artist/#{artist}/album/"
|
94
94
|
|
95
|
-
|
96
|
-
x = page <<-HTML
|
95
|
+
page <<-HTML
|
97
96
|
#{title(artist)}
|
98
97
|
#{@music.album_names_by(artist).map { |a| link path, a }.join("<br/>")}
|
99
98
|
<br/><br/>
|
100
99
|
#{link("/artist/#{artist}/", "play", "Play All")} -
|
101
100
|
#{link("/artist/#{artist}/", "play", "Randomly", :order => :random)}
|
102
|
-
|
103
|
-
puts "down"
|
104
|
-
x
|
101
|
+
HTML
|
105
102
|
else
|
106
103
|
artist_not_found artist
|
107
104
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_little_streamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -55,7 +55,8 @@ files:
|
|
55
55
|
- lib/the_little_streamer/player.rb
|
56
56
|
- lib/the_little_streamer/song.rb
|
57
57
|
homepage: http://github.com/presidentbeef/the_little_streamer
|
58
|
-
licenses:
|
58
|
+
licenses:
|
59
|
+
- MIT
|
59
60
|
metadata: {}
|
60
61
|
post_install_message:
|
61
62
|
rdoc_options: []
|
@@ -73,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
74
|
version: '0'
|
74
75
|
requirements: []
|
75
76
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.7.3
|
77
78
|
signing_key:
|
78
79
|
specification_version: 4
|
79
80
|
summary: Simple Sinatra application for streaming music.
|