Browse Source

commito roba non committata

encrypt 7 years ago
parent
commit
fa7dcaa753
1 changed files with 11 additions and 4 deletions
  1. 11 4
      plugins/radio.rb

+ 11 - 4
plugins/radio.rb

@@ -26,7 +26,8 @@ class Radio
   end
 
   def on_help(m)
-    m.reply 'curl "http://soyuz.labr.xyz:8080/" | play -q - 2>/dev/null'
+    m.reply 'curl ""http://utvghefxggihh5ts.onion" | play -q - 2>/dev/null'
+    m.reply 'http://soyuz.labr.xyz:8000 - qua sta l\'interfaccia webbosa - poi ritorna'
     m.reply 'comandi: '
     m.reply ' info - ti dice la canzone che stai sentendo'
     m.reply ' pialla - cancella la canzone che stai sentendo'
@@ -43,9 +44,15 @@ class Radio
   end
 
   def on_info(m)
-    title = `mpc | head -n 1 | cut -d '#' -f 2 | base64 -d`
-    title.gsub("\n","")
-    m.reply CGI.unescapeHTML(title)
+    info = `mpc`.split("\n")
+    return if info.empty? || info.count <3
+    title = Base64.decode64(info[0].split('#').last).chomp
+    songs,time = "0"
+    if info[1] =~  /.* #[0-9]+\/([0-9]+)\s(.*)/
+      songs = $1
+      time = $2.strip
+    end
+    m.reply CGI.unescapeHTML(title)+" ["+time+"] "+songs+" songs in playlist"
   end
 
   def on_next(m)