hey guys i have a script to keep a database of tv shows
and which genres they have. but im having some problems
i am a novice mirc scripter to i have no clue how to make it look cleaner i would really appreciate if someone could clean up my code.
also the $read function doesnt seem to work
so if a tv shows episode is defined and written to tvlog.txt
and it catches it again then it will notice me again instead of disregarding it heres the code :

Code:
ON 1: TEXT:*:# {
  if ($nick isin %TESTNICK) {
    set %catchnick $nick
    set %catchmsg $strip($1-)
    set %source TEST

    set %TEST.tvshow1 trigger1
    set %TEST.tvshow2 trigger2
    set %TEST.tvshow3 trigger3

    ;[New TV]
    if ($eval(% $+ %source $+ .tvshow1,2) isin %catchmsg) && ($eval(% $+ %source $+ .tvshow2,2) isin %catchmsg) {
      if ($eval(% $+ %source $+ .tvshow3,2) isin %catchmsg) { 
        if ($read($shortfn($mircdirTXT\Dupes\tvlog.txt),w,$getstring(%catchmsg)) == $null) {
          if (XviD isin $getstring(%catchmsg)) || (divx isin $getstring(%catchmsg)) {
            set %tvshow $getstring(%catchmsg)
            if ($read($shortfn($mircdirTXT\TVCheck\us.scripted.txt),w,$allcut(%tvshow))) || ($us.scripted.hash.match(%tvshow)) {
              if (HDTV isin %tvshow) || (HD.XviD isin %tvshow) {
                if (HR. isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.HR.HDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
                elseif (720p isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.720p.HDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
                else { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.HDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
              }             
              elseif (PDTV isin %tvshow) { 
                if (HR. isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.HR.PDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
                else { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.PDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ <  }
              }
              elseif (DSR isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.DSR.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
              elseif (DVDRip isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.DVDRiP.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
              else { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Scripted.Non.Digital.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
            }
            if ($read($shortfn($mircdirTXT\TVCheck\us.reality.txt),w,$allcut(%tvshow))) || ($us.reality.hash.match(%tvshow)) {
              if (HDTV isin %tvshow) || (HD.XviD isin %tvshow) {
                if (HR. isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.HR.HDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
                elseif (720p isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.720p.HDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
                else { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.HDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
              }             
              elseif (PDTV isin %tvshow) { 
                if (HR. isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.HR.PDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
                else { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.PDTV.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
              }
              elseif (DSR isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.DSR.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
              elseif (DVDRip isin %tvshow) { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.DVDRiP.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
              else { /write $shortfn($mircdirTXT\Dupes\dupelog.txt) %tvshow | /write $shortfn($mircdirTXT\Dupes\tvlog.txt) %tvshow | /echoall $me >>> New°>> US.Reality.Non.Digital.XviD->> %tvshow First Sighted on >> $+ %source $+ < }
            }
          }
        }
      }
    }

    unset %catchnick
    unset %catchmsg
  }
  else {
    halt
  }
}



functions used:

Code:
alias getstring return $regml(getstring,$regex(getstring,$1-,/([^\s\/]+?([._])(?:\S+?\2)+\S+?-[^\/\s]+)/))
alias echoall { scid -a _echoall $1- }
alias _echoall { var %i = 1 | while (%i <= $window(*,0)) { var %w = $window(*,%i) | if (%w == status window) { echo 9 -bflrst $1- } | elseif (@* !iswm %w) { echo 9 -bflrt %w $1- } | inc %i } }
alias maycut return $regex($1-,/\.(?:S\d+E\d+|\d+x\d+)\.|\.\d\d(\d\d)?\.\d\d\.\d\d\./)
alias allcut {
  var %a = $fixstr($1-)
  if ($maycut(%a)) { var %tmp = $regsub(%a,/\.S\d+E\d+\..+|\.\d\d(\d\d)?\.\d\d\.\d\d\.\S+/,,%a) | return %a }
  return $1-
}
alias scut {
  var %a = $fixstr($1-)
  if ($maycut(%a)) { var %tmp = $regsub(%a,/(?<=\.S\d\d).+/,,%a)) | return %a }
  return $1-
}
alias ecut {
  var %a = $fixstr($1-)
  if ($maycut(%a)) { var %tmp = $regsub(%a,/(?<=\.S\d\dE\d\d).+/,,%a)) | return %a }
  return $1-
}
alias fixstr {
  if ($regex(fixstr,$1,/(.+?)(\d+?)x(\d\d.+)/)) {
    return $replace($+($regml(fixstr,1),S,$base($regml(fixstr,2),10,10,2),E,$regml(fixstr,3)),_,.) 
  }
  if ($regex(fixstr,$1,/_\d\d(\d\d)?_\d\d_\d\d_/)) return $replace($1,_,.)
  return $1
}



hope someone has some time to look through it

/bwuser

Last edited by bwuser; 12/07/08 03:17 PM.