|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
I'm using a trade script to transfer files between 2 FTP servers. Part of it is as follows: if (720p.HDTV.x264-MOMENTUM isin $2) && (provide isin $5) { var %section = TV var %rl = $2 var %sourcename = site1 var %sourcedir = /tv-x264/ var %curryname = site2 var %currydir = /tv-x264/
Now, the problem is that on site1 the %rl = $2 is picking up a release including the 'TV+' part as the irc string is as follows: TV+The.First.48.S12E10.720p.HDTV.x264-MOMENTUMSo when the release name is picked up, it looks for the complete string, not just the actual release name: The.First.48.S12E10.720p.HDTV.x264-MOMENTUMHow do I tell the script to ignore the 'TV+' part in the var %rl = $2 variable?
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Thanks ProoN,
Do I just replace
var %rl = $2
with
$replace(%rl,TV+,$null)?
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
if (720p.HDTV.x264-MOMENTUM isin $2) && (provide isin $5) { var %section = TV var %rl = $replace($2,TV+,$null) var %sourcename = site1 var %sourcedir = /tv-x264/ var %curryname = site2 var %currydir = /tv-x264/
Apologies. Try that.
Last edited by ProoN; 13/04/12 05:13 AM.
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Thanks! Now to wait and see if it works Grrr .. it's actually TV+/ So I guess var %rl = $replace($2,TV+/,$null) is correct?
Last edited by sandygws; 13/04/12 05:18 AM.
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
You could try that, although I personally try to avoid using slashes or commas within an identifier. I've found that it sometimes makes things sketchy. I, instead, generally use the $chr equivalent, ie if (720p.HDTV.x264-MOMENTUM isin $2) && (provide isin $5) { var %section = TV var %rl = $replace($2,TV+ $+ $chr(47),$null) var %sourcename = site1 var %sourcedir = /tv-x264/ var %curryname = site2 var %currydir = /tv-x264/
See if that works.
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Even better, thanks. Also, taking these releases as an example: The.First.48.S12E10.720p.HDTV.x264-MOMENTUM The.First.48.S12.Update.Special.05.HDTV.x264-MOMENTUMHow do I ignore the '720p' release if I'm using if (HDTV.x264-MOMENTUM isin $2) && (provide isin $5) { and only trade HDTV.x264-MOMENTUM?
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
Are you implying there are two results you're trying to get the script to distinguish between? while (*720p* !iswm %rl) { ... }
where within the brackets, { and } are where you'd execute the command, of course Damn, constantly editing this. Trying to make it more generic rather than specific to those single titles
Last edited by ProoN; 13/04/12 06:00 AM.
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Yes, the two examples are both HDTV, but one is standard HDTV, the other 720p HDTV. HDTV.x264-MOMENTUM isin $2 The problem is that the above will match 720p.HDTV.x264-MOMENTUM and HDTV.x264-MOMENTUMSo how I would tell the script to ignore the 720p bit where necessary?
|
|
|
|
Joined: Jan 2004
Posts: 1,358
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,358 |
... && (720p !isin %text)
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Thanks Loki (720p.HDTV.x264-MOMENTUM isin $2) && (720p !isin %text) { Would trade The.First.48.S12.Update.Special.05.HDTV.x264-MOMENTUMbut skip The.First.48.S12E10.720p.HDTV.x264-MOMENTUM... right?
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
if (*The.First.48.S12*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) { var %section = TV var %rl = $replace($2,TV+ $+ $chr(47),$null) var %sourcename = site1 var %sourcedir = /tv-x264/ var %curryname = site2 var %currydir = /tv-x264/
Last edited by ProoN; 13/04/12 11:09 PM.
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Nice and tidy ProoN, thanks
To confirm: that will NOT trade 720p, right?
ie line 3 ignores the 720p part?
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
(*720p* !iswm $2) is what ignores the 720p part. That little bit checks to see if "720p" ISN'T in the $2, and if it isn't, continues on with the code.
Line 3 replaces the TV+/ with "$null" (or .. nothing, essentially) and sets THAT result to %rl. Could have easily just used $remove, but eh, there are many ways to accomplish the same thing. Hopefully that works, though
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Very nice indeed. Just waiting to see if it works! One question though: which version is correct: if (*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) or if (*720p.HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2)
Last edited by sandygws; 13/04/12 11:36 PM.
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
Well, if you want it to check for only the HDTV.x264-MOMENTUM part, it'd be if (*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) { var %section = TV var %rl = $replace($2,TV+ $+ $chr(47),$null) var %sourcename = site1 var %sourcedir = /tv-x264/ var %curryname = site2 var %currydir = /tv-x264/ But if you wanted it to check for both HDTV.x264-MOMENTUM and the The.First.48.S12 parts, it'd be if (*The.First.48.S12*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) { var %section = TV var %rl = $replace($2,TV+ $+ $chr(47),$null) var %sourcename = site1 var %sourcedir = /tv-x264/ var %curryname = site2 var %currydir = /tv-x264/ Neither of those will do anything if 720p is anywhere within the titles, which is what you're wanting.. I think. hah
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
Well, if you want it to check for only the HDTV.x264-MOMENTUM part, it'd be Yes, I only want it to trade HDTV.x264-MOMENTUM - and skip the 720p versions. Neither of those will do anything if 720p is anywhere within the titles 720p is in the titles .. that's why I want to skip it. So the above will skip any release with 720p in the title, right?
Last edited by sandygws; 13/04/12 11:52 PM.
|
|
|
|
Joined: Nov 2004
Posts: 21
Ameglian cow
|
Ameglian cow
Joined: Nov 2004
Posts: 21 |
First one should ultimately be what you're wanting.. I think(?). But they both ignore anything with "720p" in it, yes
Last edited by ProoN; 14/04/12 12:00 AM.
|
|
|
|
Joined: May 2011
Posts: 53
Babel fish
|
OP
Babel fish
Joined: May 2011
Posts: 53 |
I have a further question ProoN: if (*HDTV.x264-MOMENTUM* iswm $2) && (*720p* !iswm $2) && (provide isin $5) { How do I change that to match HDTV.x264-MOMENTUM anywhere in the irc announce string .. not just in 'position' $2 ?
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
How do I change that to match HDTV.x264-MOMENTUM anywhere in the irc announce string .. not just in 'position' $2 ? You can indicate the token range like so: if (*HDTV.x264-MOMENTUM* iswm $2-5) $2-5 means $2, $3, $4, and $5, respectively.
|
|
|
|
|