add help
This commit is contained in:
parent
00c666c628
commit
2e6ef10555
1 changed files with 14 additions and 6 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
require 'cgi'
|
||||||
|
|
||||||
class Radio
|
class Radio
|
||||||
include Cinch::Plugin
|
include Cinch::Plugin
|
||||||
|
|
||||||
|
@ -6,24 +8,30 @@ class Radio
|
||||||
match /radio help/, :method => :on_help
|
match /radio help/, :method => :on_help
|
||||||
match /radio info/, :method => :on_info
|
match /radio info/, :method => :on_info
|
||||||
match /radio next/, :method => :on_next
|
match /radio next/, :method => :on_next
|
||||||
|
|
||||||
def on_play(m, link)
|
def on_play(m, link)
|
||||||
if link =~ /http(s):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-]+)(&(amp;)?[\w\?=]*)?/
|
if link =~ /http(s):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-]+)(&(amp;)?[\w\?=]*)?/
|
||||||
File.open('/tmp/radio', 'w') do |f|
|
File.open('/tmp/radio', 'w') do |f|
|
||||||
f.puts(link)
|
f.puts(link)
|
||||||
f.flush
|
f.flush
|
||||||
end
|
end
|
||||||
open(link).read =~ /<title>(.*?) - YouTube<\/title>/
|
if open(link).read =~ /<title>(.*?) - YouTube<\/title>/
|
||||||
m.reply "New song \""+$1+"\""
|
m.reply "New song \""+CGI.unescapeHTML($1)+"\""
|
||||||
File.open('/tmp/notify-send', 'w') do |f|
|
File.open('/tmp/notify-send', 'w') do |f|
|
||||||
f.puts($1)
|
f.puts($1)
|
||||||
f.flush
|
f.flush
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_help(m)
|
def on_help(m)
|
||||||
m.reply 'curl "http://soyuz.labr.xyz:8080/" | play -q - 2>/dev/null'
|
m.reply 'curl "http://soyuz.labr.xyz:8080/" | play -q - 2>/dev/null'
|
||||||
|
m.reply 'comandi: '
|
||||||
|
m.reply ' info - ti dice la canzone che stai sentendo'
|
||||||
|
m.reply ' pialla - cancella la canzone che stai sentendo'
|
||||||
|
m.reply ' play <linkdiyoutube> - mette una canzone in playlist'
|
||||||
|
m.reply ' next - ti fa sentire un altra roba'
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_pialla(m)
|
def on_pialla(m)
|
||||||
|
|
Loading…
Reference in a new issue