funny-lvtho 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c75e4e258c3b4526ecde83092a5e06a868ba6057
4
- data.tar.gz: b96c6066de376181fd65fb895b9a161d73df3e61
3
+ metadata.gz: 2e63eae417fcf3b51707f6e4c6463d9028aac5d5
4
+ data.tar.gz: 3e102d82a6641cbce90fc1e5759ed87a6aa93cbe
5
5
  SHA512:
6
- metadata.gz: 47d24e4df9edeb1464e78658c5a260a51ec4a79229190abb801c68f4a4ff1f9c9e52f8fff5d40aff5428773ecf37ea72648012b8bdc6d333f71d29199398839f
7
- data.tar.gz: cc6bf2d68d3944ddfc8c5366a951dc551a70ad8f9c2d82cd0ebba22e474f4dde2f7fc50f225de2e9ec14842d28a1240a26ad47103bccbfc4ad0036471529be1f
6
+ metadata.gz: c423a0c2eac81b1f342bfc53e36d91a02bc0cb8b0b1d71b2d0b753efa5998e7fe42fb916b4c78646bdd15981ea6b483f4db43b4c9c1c7b7293ed68fed04afa52
7
+ data.tar.gz: f3454b6c16c8668c8f418e6e3a1dedf50988c5fa43790cc4c46d5b67b698fec1d4247161bfa064aaf755e52db78c8d81ed28687bc37edc4649292424a5b606db
@@ -6,59 +6,61 @@ require 'colorize'
6
6
 
7
7
  module Funny
8
8
  module Lvtho
9
- while true
10
- puts ""
11
- puts "What do you want ? ".blue.on_white
12
- puts "1. Listen to musics".blue.on_white
13
- puts "2. Watching fimls ".blue.on_white
14
- puts "3. Play games ".blue.on_white
15
- puts "Please select : "
16
- choose = gets.chomp.to_i
17
- case choose
18
- when 1
19
- html = open('https://lvtho-server.herokuapp.com/musics')
20
- doc = Nokogiri::HTML(html.read)
21
- doc.encoding = 'utf-8'
22
- musics = doc.css("body .list-musics").to_a
23
- puts "List musics for you"
24
- musics.each_with_index do |music, index_music|
25
- item = music.text.split("\n")
26
- item.each_with_index do |a, index_item|
27
- if index_item == 1
28
- puts "#{index_music+1}. #{a.split.join(' ')}".blue.on_white
29
- print " #{index_music+1}.1 Open music".green
30
- print " #{index_music+1}.2 Lyrics".yellow
31
- puts " #{index_music+1}.3 Download"
32
- puts ""
9
+ def run
10
+ while true
11
+ puts ""
12
+ puts "What do you want ? ".blue.on_white
13
+ puts "1. Listen to musics".blue.on_white
14
+ puts "2. Watching fimls ".blue.on_white
15
+ puts "3. Play games ".blue.on_white
16
+ puts "Please select : "
17
+ choose = gets.chomp.to_i
18
+ case choose
19
+ when 1
20
+ html = open('https://lvtho-server.herokuapp.com/musics')
21
+ doc = Nokogiri::HTML(html.read)
22
+ doc.encoding = 'utf-8'
23
+ musics = doc.css("body .list-musics").to_a
24
+ puts "List musics for you"
25
+ musics.each_with_index do |music, index_music|
26
+ item = music.text.split("\n")
27
+ item.each_with_index do |a, index_item|
28
+ if index_item == 1
29
+ puts "#{index_music+1}. #{a.split.join(' ')}".blue.on_white
30
+ print " #{index_music+1}.1 Open music".green
31
+ print " #{index_music+1}.2 Lyrics".yellow
32
+ puts " #{index_music+1}.3 Download"
33
+ puts ""
34
+ end
33
35
  end
34
- end
35
- if (index_music+1) == musics.length
36
- begin
37
- puts "Please select: "
38
- selected = gets.chomp
39
- result_select = selected.split(".")
40
- raise "Please select x.1 -> x.3" unless (1..3).include?(result_select[1].to_i)
41
- case result_select[1].to_i
42
- when 1
43
- music_selected = musics[result_select[0].to_i-1].text.split("\n")[2].split.join(' ')
44
- system("xdg-open", music_selected)
45
- when 2
46
- puts musics[result_select[0].to_i-1].text.split("\n")[3].split.join(' ').white.on_blue
47
- when 3
36
+ if (index_music+1) == musics.length
37
+ begin
38
+ puts "Please select: "
39
+ selected = gets.chomp
40
+ result_select = selected.split(".")
41
+ raise "Please select x.1 -> x.3" unless (1..3).include?(result_select[1].to_i)
42
+ case result_select[1].to_i
43
+ when 1
44
+ music_selected = musics[result_select[0].to_i-1].text.split("\n")[2].split.join(' ')
45
+ system("xdg-open", music_selected)
46
+ when 2
47
+ puts musics[result_select[0].to_i-1].text.split("\n")[3].split.join(' ').white.on_blue
48
+ when 3
49
+ end
50
+ rescue Exception => e
51
+ puts e.message
48
52
  end
49
- rescue Exception => e
50
- puts e.message
51
53
  end
52
54
  end
53
- end
54
55
 
55
- when 2
56
+ when 2
56
57
 
57
- when 3
58
+ when 3
58
59
 
59
- else
60
- puts "Please select 1 to 3"
61
- return
60
+ else
61
+ puts "Please select 1 to 3"
62
+ return
63
+ end
62
64
  end
63
65
  end
64
66
  end
@@ -1,5 +1,5 @@
1
1
  module Funny
2
2
  module Lvtho
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funny-lvtho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - lvtho