| View previous topic :: View next topic |
| Author |
Message |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Tue Mar 15, 2022 9:16 am Post subject: how to centralize the commands only in a room |
|
|
CrazyCat passed me this script to see who can help me I adapted a dj room to put the mute/unmute commands as it would be so that it would only pay attention in that room not in radichan too and the direct command does not work for me can someone help me thank you very much
| Code: | namespace eval radio {
variable streamurl "https://zenoplay.zenomedia.com/api/zenofm/nowplaying/ffvwrxpufzzuv"
variable radiochan "#yourchan"
variable radiodj "#yourchandj"
package require http
package require tls
variable cursong ""
bind pub - !direct ::radio::pub:getstream
bind pub -|n !mute ::radio::mute
bind pub -|n !unmute ::radio::unmute
proc mute {nick uhost handle chan text} {
unbind cron - "* * * * *" ::radio::getstream
putserv "privmsg $::radio::radiodj :4parado los anuncios.."
}
proc unmute {nick uhost handle chan text} {
bind cron - "* * * * *" ::radio::getstream
putserv "privmsg $::radio::radiodj :4Puesto en Automatico los anuncios.."
}
proc pub:getstream {nick uhost handle chan text} {
if {[::string tolower $chan] ne $::radio::radiochan } {
return
}
::radio::getstream 0 0 0 0 0
}
proc getstream {mi ho da mo wd} {
::http::register https 443 ::tls::socket
set tok [::http::geturl $::radio::streamurl]
set source [::radio::json2dict [::http::data $tok]]
::http::cleanup $tok
::http::unregister https
set title [dict get $source title]
set artist [dict get $source artist]
if {$::radio::cursong ne $title} {
set ::radio::cursong $title
set artist [encoding convertfrom utf-8 [string map {"&" "&"} $artist]]
set title [encoding convertfrom utf-8 [string map {"&" "&"} $title]]
putserv "PRIVMSG $::radio::radiochan :Ahora Suena : 3$title de 2$artist "
}
}
proc json2dict {JSONtext} {
string range [string trim [string trimleft [string map {\t {} \n {} \r {} , { } : { } \[ \{ \] \}} $JSONtext] {\uFEFF}]] 1 end-1
}
} |
_________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue Mar 15, 2022 10:21 am Post subject: Make !mute and !unmute commands channel specific. |
|
|
This should make the !mute and !unmute commands to function only in the radiodj "#yourchandj" channel.
| Code: | namespace eval radio {
variable streamurl "https://zenoplay.zenomedia.com/api/zenofm/nowplaying/ffvwrxpufzzuv"
variable radiochan "#yourchan"
variable radiodj "#yourchandj"
package require http
package require tls
variable cursong ""
bind pub - !direct ::radio::pub:getstream
bind pub -|n !mute ::radio::mute
bind pub -|n !unmute ::radio::unmute
proc mute {nick uhost handle chan text} {
if {![string equal -nocase $chan $::radio::radiodj]} { return 0 }
unbind cron - "* * * * *" ::radio::getstream
putserv "privmsg $::radio::radiodj :4parado los anuncios.."
}
proc unmute {nick uhost handle chan text} {
if {![string equal -nocase $chan $::radio::radiodj]} { return 0 }
bind cron - "* * * * *" ::radio::getstream
putserv "privmsg $::radio::radiodj :4Puesto en Automatico los anuncios.."
}
proc pub:getstream {nick uhost handle chan text} {
if {![string equal -nocase $chan $::radio::radiochan]} { return 0 }
::radio::getstream 0 0 0 0 0
}
proc getstream {mi ho da mo wd} {
::http::register https 443 ::tls::socket
set tok [::http::geturl $::radio::streamurl]
set source [::radio::json2dict [::http::data $tok]]
::http::cleanup $tok
::http::unregister https
set title [dict get $source title]
set artist [dict get $source artist]
if {$::radio::cursong ne $title} {
set ::radio::cursong $title
set artist [encoding convertfrom utf-8 [string map {"&" "&"} $artist]]
set title [encoding convertfrom utf-8 [string map {"&" "&"} $title]]
putserv "PRIVMSG $::radio::radiochan :Ahora Suena : 3$title de 2$artist "
}
}
proc json2dict {JSONtext} {
string range [string trim [string trimleft [string map {\t {} \n {} \r {} , { } : { } \[ \{ \] \}} $JSONtext] {\uFEFF}]] 1 end-1
}
} |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Tue Mar 15, 2022 1:03 pm; edited 1 time in total |
|
| Back to top |
|
 |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Tue Mar 15, 2022 10:47 am Post subject: |
|
|
thanks for reply SpiKe^^
I tried it and it doesn't work for me pass the commands !unmute
! mute in radiochan and the messages came out in radiodj as if it was connected & disconnected _________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue Mar 15, 2022 10:51 am Post subject: |
|
|
Now you have both of us very confused.
Please try to explain what you are after here... _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Tue Mar 15, 2022 12:56 pm Post subject: |
|
|
hello again, i wanted the !unmute & !mute commands to work only in the radiodj room with the solution you gave me they only work in the radiochan room and the !direct command doesn't work it doesn't do anything thanks very much _________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue Mar 15, 2022 1:06 pm Post subject: |
|
|
Slightly changed the above fix I posted.
You need to .restart the bot to remove all earlier binds! _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Tue Mar 15, 2022 1:27 pm Post subject: |
|
|
well it's true my mistake, I rebooted and the radiodj !unmute & !mute room commands worked but the other !direct command doesn't work in either room thanks again _________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue Mar 15, 2022 1:47 pm Post subject: |
|
|
I was just fixing the room specific public !unmute & !mute command deal.
(Post subject: how to centralize the commands only in a room)
If the script is unable to get data from the webpage that's a whole different deal.
Maybe CrazyCat can figure out why the script no longer works? _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Tue Mar 15, 2022 2:06 pm Post subject: |
|
|
the data is obtained from the web page because when you use !unmute and it enters in automatic mode when changing the song if it jumps in the room the song that is playing at that moment.
But when you use the !direct command it doesn't play anything.
I think I understand that it is for that very reason to say the song that is playing at that time or am I confused?
again thank you very much for helping and being there _________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue Mar 15, 2022 8:15 pm Post subject: |
|
|
Try this...
| Code: |
namespace eval radio {
variable streamurl "https://zenoplay.zenomedia.com/api/zenofm/nowplaying/ffvwrxpufzzuv"
variable radiochan "#yourchan"
variable radiodj "#yourchandj"
package require http
package require tls
variable cursong ""
bind pub - !direct ::radio::pub:getstream
bind pub -|n !mute ::radio::mute
bind pub -|n !unmute ::radio::unmute
proc mute {nick uhost handle chan text} {
if {![string equal -nocase $chan $::radio::radiodj]} { return 0 }
unbind cron - "* * * * *" ::radio::getstream
putserv "privmsg $::radio::radiodj :4parado los anuncios.."
}
proc unmute {nick uhost handle chan text} {
if {![string equal -nocase $chan $::radio::radiodj]} { return 0 }
bind cron - "* * * * *" ::radio::getstream
putserv "privmsg $::radio::radiodj :4Puesto en Automatico los anuncios.."
}
proc pub:getstream {nick uhost handle chan text} {
if {![string equal -nocase $chan $::radio::radiochan]} { return 0 }
::radio::getstream 0 0 0 0 "pub"
}
proc getstream {mi ho da mo wd} {
::http::register https 443 ::tls::socket
set tok [::http::geturl $::radio::streamurl]
set source [::radio::json2dict [::http::data $tok]]
::http::cleanup $tok
::http::unregister https
set title [dict get $source title]
set artist [dict get $source artist]
if {($wd eq "pub") || ($::radio::cursong ne $title)} {
set ::radio::cursong $title
set artist [encoding convertfrom utf-8 [string map {"&" "&"} $artist]]
set title [encoding convertfrom utf-8 [string map {"&" "&"} $title]]
putserv "PRIVMSG $::radio::radiochan :Ahora Suena : 3$title de 2$artist "
}
}
proc json2dict {JSONtext} {
string range [string trim [string trimleft [string map {\t {} \n {} \r {} , { } : { } \[ \{ \] \}} $JSONtext] {\uFEFF}]] 1 end-1
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Wed Mar 16, 2022 12:32 pm; edited 1 time in total |
|
| Back to top |
|
 |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Wed Mar 16, 2022 7:30 am Post subject: |
|
|
Thanks for answering but now I can't test it. The chatzona gentlemen just gave me G-lined: Deactivate your browser's vpn to eggdrop and I can't test it, thanks for the help, I'm waiting for the chatzona gentlemen to give me some solution I doubt it anyway thanks _________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Wed Mar 16, 2022 10:01 am Post subject: |
|
|
after solving the problem with chatzona probe
what you told me and it doesn't work for me I get this error by partyline
Tcl error [::radio::pub:getstream]: wrong # args: should be "::radio::getstream mi ho da mo wd" _________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Wed Mar 16, 2022 10:15 am Post subject: |
|
|
The following line is false:
| Code: | | ::radio::getstream 0 0 0 0 pub |
Must be:
| Code: | | ::radio::getstream 0 0 0 0 0 |
Or another numeric value.
And the proc must be changed to use the value and not "pub" _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
flink Halfop

Joined: 21 Feb 2021 Posts: 53 Location: Canarias
|
Posted: Wed Mar 16, 2022 11:04 am Post subject: |
|
|
good Crazy Cat thanks for contributing ideas I removed pub and it still doesn't work !direct
| Code: |
::radio::getstream 0 0 0 0 0 |
_________________ Mi ingles: no es el mejor, Manda el traductor...  |
|
| Back to top |
|
 |
|