English > Support

AllRovi movie script

<< < (4/10) > >>

Ivek23:

--- Quote from: RazorHall on August 06, 2011, 10:07:56 pm ---I'm seeing a few movies that aren't getting the Characteristics info, such as Phantom Love.

--- End quote ---

Same cases a major part in Bounty Huntress 2 (2002).
Synopsis will be postponed until the end ParseMovie As mentioned here, follows attempts:

this code

--- Code: ---//'Synopsis' saved to ~mfDescription~

curPos := PosFrom('<span>', HTML, curPos);
endPos := PosFrom('</span>', HTML, curPos);
TmpStr5 := TextBetween(HTML, '<span>', '</span>', True, curPos);

curPos := PosFrom('<span>by', HTML, curPos);
endPos := PosFrom('</span>', HTML, curPos);
TmpStr3 := TextBetween(HTML, '<span>by ', '</span>', True, curPos)

curPos := PosFrom('<strong>', HTML, curPos);
endPos := PosFrom('</strong>', HTML, curPos);
TmpStr4 := TextBetween(HTML, '<strong>', '</strong>', True, curPos);

curPos := PosFrom('<p>', HTML, curPos);
endPos := PosFrom('</p>', HTML, curPos);
TmpStr := Copy(HTML, curPos, endPos - curPos);
TmpStr1 := StringReplace(TmpStr, ' -- ', '—', True, True, False);
TmpStr2 := StringReplace(TmpStr1, ' --- ', '—', True, True, False);
TmpStr := StringReplace(TmpStr2, '--', '—', True, True, False);
TmpStr1 := StringReplace(TmpStr, #13#13#13#13, #13#10#13#10, True, True, False);
TmpStr2 := RemoveTagsEx(TmpStr1);

if (TmpStr4 = 'synopsis') AND (Pos('©', TmpStr2) = 0) then
AddFieldValue(mfDescription, TmpStr2 + #13 + '—' + TmpStr3)
else
if (TmpStr4 <> 'synopsis') OR (Pos('©', TmpStr2) = 1) then
LogMessage(' Synopsis: Not available');


--- End code ---
Copy here as shown in the attached code

--- Code: ---//~AMG ID~

TmpStr := HTMLValues(HTML,
'<dt>AMG ID</dt>', '</dd>',
'<pre>', '</pre>',
', ', endPos);
AddCustomFieldValueByName('AMG ID', TmpStr);


//'Synopsis' saved to ~mfDescription~

curPos := PosFrom('<span>', HTML, curPos);
endPos := PosFrom('</span>', HTML, curPos);
TmpStr5 := TextBetween(HTML, '<span>', '</span>', True, curPos);

curPos := PosFrom('<span>by', HTML, curPos);
endPos := PosFrom('</span>', HTML, curPos);
TmpStr3 := TextBetween(HTML, '<span>by ', '</span>', True, curPos)

curPos := PosFrom('<strong>', HTML, curPos);
endPos := PosFrom('</strong>', HTML, curPos);
TmpStr4 := TextBetween(HTML, '<strong>', '</strong>', True, curPos);

curPos := PosFrom('<p>', HTML, curPos);
endPos := PosFrom('</p>', HTML, curPos);
TmpStr := Copy(HTML, curPos, endPos - curPos);
TmpStr1 := StringReplace(TmpStr, ' -- ', '—', True, True, False);
TmpStr2 := StringReplace(TmpStr1, ' --- ', '—', True, True, False);
TmpStr := StringReplace(TmpStr2, '--', '—', True, True, False);
TmpStr1 := StringReplace(TmpStr, #13#13#13#13, #13#10#13#10, True, True, False);
TmpStr2 := RemoveTagsEx(TmpStr1);

if (TmpStr4 = 'synopsis') AND (Pos('©', TmpStr2) = 0) then
AddFieldValue(mfDescription, TmpStr2 + #13 + '—' + TmpStr3)
else
if (TmpStr4 <> 'synopsis') OR (Pos('©', TmpStr2) = 1) then
LogMessage(' Synopsis: Not available');

end;


procedure ParseSearchResults(HTML : String);

--- End code ---

and this for me this works perfectly, how it works for you now.

rick.ca:

--- Quote ---and this for me this works perfectly, how it works for you now.
--- End quote ---

Thanks, Ivek. Yes, that seems to work fine. It would be nice to understand why, but that's okay. :-\

I'll upload version 1.1 now. The change is referenced to your message above, so there's no need to post a script or explanation anywhere else.

Ivek23:

--- Quote ---I'll upload version 1.1 now. The change is referenced to your message above, so there's no need to post a script or explanation anywhere else.
--- End quote ---
OK, I understand.

deazo:

 Hi Ivek23 and Rick, I already thanked you for this but hey thank you again!
 
 I have a slight problem. For some reason, Allrovi script does not gather the rating anymore. I have not changed anything to the preferences, the "additional rating" box is checked. I wonder if there was a change in the last version that caused this?

Ivek23:
When updating data with AllRovi script for the movie Dakota (1945), I could not find this title in the results table, where several movie with the same title and a different year.
The problem is procedure ParseSearchResults in this part of code:

--- Code: ---
...

//if there are more movies with the same or similar title...

curPos := Pos('<div class="results">', HTML);
if curPos < 1 then
Exit;

curPos := PosFrom('<a href="http://www.allrovi.com/movies/', HTML, curPos);
while curPos > 0 do begin
endPos := PosFrom('">', HTML, curPos);
URL := Copy(HTML, curPos + 31, endPos - curPos - 31);
URL := BASE_URL + URL;

curPos := PosFrom('">', HTML, curPos);
endPos := PosFrom('</a>', HTML, curPos);
Title := Copy(HTML, curPos + 2, endPos - curPos - 2);

curPos := PosFrom('<td class="year">', HTML, curPos);
endPos := PosFrom('</td>', HTML, curPos);
Year := Trim(Copy(HTML, curPos + 17, endPos - curPos - 17));

AddSearchResult(Title, '', Year, URL, '');
curPos := PosFrom('" href="/movies/', HTML, curPos);
end;

end;

function NextMode(curMode : Integer) : Integer;


--- End code ---

When I am this one snippet of code  curPos := PosFrom('" href="/movies/', HTML, curPos); replaced by tiny fraction of the code curPos := PosFrom('<a href="http://www.allrovi.com/movies/', HTML, curPos);, now in the results table also previously found above the movie title.

Now this piece of code looks like this:

--- Code: ---
...

//if there are more movies with the same or similar title...

curPos := Pos('<div class="results">', HTML);
if curPos < 1 then
Exit;

curPos := PosFrom('<a href="http://www.allrovi.com/movies/', HTML, curPos);
while curPos > 0 do begin
endPos := PosFrom('">', HTML, curPos);
URL := Copy(HTML, curPos + 31, endPos - curPos - 31);
URL := BASE_URL + URL;

curPos := PosFrom('">', HTML, curPos);
endPos := PosFrom('</a>', HTML, curPos);
Title := Copy(HTML, curPos + 2, endPos - curPos - 2);

curPos := PosFrom('<td class="year">', HTML, curPos);
endPos := PosFrom('</td>', HTML, curPos);
Year := Trim(Copy(HTML, curPos + 17, endPos - curPos - 17));

AddSearchResult(Title, '', Year, URL, '');
curPos := PosFrom('<a href="http://www.allrovi.com/movies/', HTML, curPos);
end;

end;

function NextMode(curMode : Integer) : Integer;


--- End code ---

As well as images attached as evidence of how the before and after correcting codes.




[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version