egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lindex help
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Mon Jun 30, 2014 6:01 am    Post subject: Reply with quote

Here's a small correction : added a debug advert when regexp didn't matches.
Code:
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:
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.
_________________
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
View user's profile Send private message Visit poster's website
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Tue Jul 01, 2014 12:44 pm    Post subject: Reply with quote

the bind is this
Code:
bind pub - iD3 rls:id3
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Jul 02, 2014 6:42 am    Post subject: Reply with quote

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).
_________________
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
View user's profile Send private message Visit poster's website
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Thu Jul 03, 2014 12:15 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Jul 03, 2014 1:06 pm    Post subject: Reply with quote

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:
set pattern {([^>]+)? > ([^>]+)? from ([0-9]+)? at ([0-9]+)? Hz}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Tue Jul 08, 2014 1:23 pm    Post subject: Reply with quote

Many thanks to all that helped me sort the code out it now works fine
Back to top
View user's profile Send private message
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Thu Aug 06, 2015 11:31 am    Post subject: Reply with quote

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:
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:
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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber