About the Cover Art problem:
QUOTE (stevehero)
In the beatport script concerning the cover art. I want it to gotoline 8 where the 500px images are mostly always stored therefore I want to findinline "
width="500" height="500"" and if it cant find it I want it to jump to line 7 where the 60px image of the release will always be. I've checked a lot of various release API's and they ALL hold these values with line 8 being either a 500px of the release or a different sized .jpg of the label but always line 7 is the 60px version of the release. Thats why I want it to default to line 7 if findinline 8 fails.
I have a feeling where I'm goin wrong is the ifnot line? But I'm not sure.
My attempt.
COVERURL
outputto "coverurl"
gotoline 8
findinline "width="500" height="500"" 1 1
ifnot "<image url="
gotoline 7
endif
findinline "url=\""
sayuntil "\" "
I'm still not 100% sure what the "1 1" after findinline does. I read the link you gave me but still not getting it.
Yes, ifnot is part of the problem. And you also deleted the unspace command. And you replaced findline with findinline. And you didn't escape the qutoationmarks. All these things lead to different results.
findline "text" 1 1
Finds the first next line which contains "text". If "text" can't be found in any of the next lines, the parser stops at the last line. Without the second 1 in the command, the script would stop and show if text can't be found.
After a findline command, the parser is always at the first character of a line.
findinline "text" 1 1
Finds the first next occurence of "text" in the line. If "text" can't be found in the line, the parser stops at the end of the line. Without the second 1 in the command, the script would stop and show if text can't be found.
After a findinline "text" command, the parser is at the first character which follows after "text" in the line.
unspace
This removes leading and trailing spaces of lines. And it sets the parser back to the first character of the line.
You can check the position of the parser after every line in the debug file. It is show line at "Line and position:" by this symbol: ^
This was all essential in my fix:
findline "width="500" height="500"" 1 1
unspace
ifnot "<image url="
The first line here looked for a line with
width="500" height="500" in it.
If width="500" height="500" can't be found, the parser stops at the last line. Unspace doesn't change anything. And the ifnot command has a positive result (positive = the last line does not start with "<image url=" so the ifnot condition is positive, the lines until endif are executed).
If width="500" height="500" can be found, the parser stops at this line. Unspace removes the leading spaces. And the ifnot command has a negative result (negative = the line does start with "<image url=" so the ifnot condition is negative, the lines until endif are ignored).
The only thing I wonder: I don't know if my fix as I presented it in the forum worked at all. I forgot to escpape the parenthesis. The first line must be written as wollowing:
findline "width=</b>"500</b>" height=</b>"500</b>"" 1 1
So, for what you want to do now:
outputto "coverurl"
gotoline 8
findinline "width="500" height="500"" 1 1
movechar -24
ifnot "width="500" height="500""
gotoline 7
else
gotochar 1
endif
findinline "url=""
sayuntil "" "
After findinline "width="500" height="500"" 1 1 this script goes back 24 characters (the exact length of "width="500" height="500", this time without escaping the quotationmarks) and checks with ifnot, if the seached text has (not) be found. If it has not been found, it moves to line 7, if found it moves to the first character of the line (because otherwise, the following findinline "url="" would find nothing).
By the way:
ifnot "width=\"500\" height=\"500\""
gotoline 7
else
gotochar 1
endif
is exactly the same as:
if "width=\"500\" height=\"500\""
gotochar 1
else
gotoline 7
endif