This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon Jun 30, 2014 6:01 am
Here's a small correction : added a debug advert when regexp didn't matches.
Code: Select all
proc rls:id3 {nick host hand chan arg} {
global chann_ sitebot_ ftp_
if { $chan == $chann_(spam) && $nick == $sitebot_(nick) } {
set pattern {iD3 > ([^>]+)? > ([^>]+)? from ([0-9]+)? at ([0-9]+)? Hz}
if { [regexp $pattern $arg match rlsname genre year sampling] } {
if {[string trim $genre] == ""} { set genre "-" }
if {[string trim $year] == ""} { set year "-" }
if {[string trim $sampling] == ""} { set sampling "-" }
if { $rlsname == "" } {
putquick "PRIVMSG $chann_(echo) :\0034 Error!! Release Name Empty\003"
return 0
}
} else {
putserv "PRIVMSG $chann_(echo) :$arg didn't match"
return 0
}
putquick "PRIVMSG $chann_(echo) :!addid3c $rlsname $genre $year $sampling"
}
}
I noticed something strange in your code:
Code: Select all
putquick "PRIVMSG $chann_(echo) :!addid3c $rlsname $genre $year $sampling"
Is !addid3c the bind for the rls:id3 proc ? If it is, the "command line" is not what is expected in the regexp.
If you really want help, I think you have to give us your complete code and not just bits of it.
COBRa
Halfop
Posts: 49 Joined: Fri Jan 04, 2013 8:23 am
Post
by COBRa » Tue Jul 01, 2014 12:44 pm
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Jul 02, 2014 6:42 am
Ok, so the "!addid3c" command has no relation with this part of the script.
Can you give me an example of non-matching command ? (paste the complete irc log without any modification).
COBRa
Halfop
Posts: 49 Joined: Fri Jan 04, 2013 8:23 am
Post
by COBRa » Thu Jul 03, 2014 12:15 pm
The !addid3c is announced in a specific channel and another bot which is linked adds the info into a database so yes its part of this code
so when the line !addid3c some_release some_genre etc hits the channel another bot picks up the !addid3c line and enter it into the database
the error im getting is this
Deine_Freunde-Heile_Welt-DE-2014-CARDiNALS > Pop from 2014 at 44100 Hz didn't match
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Thu Jul 03, 2014 1:06 pm
Sorry for the late answer.
Since you are using the "pub" binding, "id3" is considered the command, and thus removed from the text-argument ($arg). Thus, the regular expression needs to be adjusted accordingly:
Code: Select all
set pattern {([^>]+)? > ([^>]+)? from ([0-9]+)? at ([0-9]+)? Hz}
NML_375
COBRa
Halfop
Posts: 49 Joined: Fri Jan 04, 2013 8:23 am
Post
by COBRa » Tue Jul 08, 2014 1:23 pm
Many thanks to all that helped me sort the code out it now works fine
COBRa
Halfop
Posts: 49 Joined: Fri Jan 04, 2013 8:23 am
Post
by COBRa » Thu Aug 06, 2015 11:31 am
Hi using similar code to the previous post in trying to capture this line via the regex method and wondered if you guys could assist me plz i think its the regex line thts wrong anyhow heres my first draught
Code: Select all
proc rls:spec {nick host hand chan arg} {
global chann_ sitebot_ ftp_
if { $chan == $chann_(spam) && $nick == $sitebot_(nick) } {
set pattern {([^>]+)? > Codec: ([^>]+)? FPS: ([^fps][0-9]+)? Res:([0-9]+)? AR: ([0-9]+)? > Audio: ([^>]+)? BitRate: ([^kbps][0-9]+)? Freq: ([^KHz][0-9]+)? Channels: ([^ch][0-9]+)?}
if { [regexp $pattern $arg match rlsname videocodec fps ar audiocodec audiobitrate audiofreq channels] } {
if {[string trim $videocodec] == ""} { set videocodec "-" }
if {[string trim $fps] == ""} { set fps "-" }
if {[string trim $ar] == ""} { set ar "-" }
if {[string trim $audiocodec] == ""} { set audiocodec "-" }
if {[string trim $audiobitrate] == ""} { set audiobitrate "-" }
if {[string trim $audiofreq] == ""} { set audiofreq "-" }
if {[string trim $channels] == ""} { set channels "-" }
if { $rlsname == "" } {
putquick "PRIVMSG $chann_(add) :\0034 Error!! Release Name Empty\003"
return 0
}
} else {
putserv "PRIVMSG $chann_(add) :$arg didn't match"
return 0
}
putquick "PRIVMSG $chann_(add) :!addvideoinfo $rlsname $videocodec $fps $ar $audiocodec $audiobitrate $audiofreq $channels"
putquick "PRIVMSG $chann_(add) :\[\0035SAMPLE-SPEC\003\] $rlsname"
}
}
and this is the line im trying to capture
Code: Select all
SPEC > At.Midnight.2015.08.05.HDTV.x264-TASTETV > Codec: AVC FPS: 29.970fps Res: 720x404 AR: 16:9 > Audio: AAC BitRate: 124Kbps Freq: 48.0KHz Channels: 2ch