Author Topic: AllRovi movie script  (Read 122098 times)

0 Members and 4 Guests are viewing this topic.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
AllRovi movie script
« on: July 09, 2011, 04:49:32 pm »
Notice:

AllRovi script does not work anymore.




Now for all former AllMovie fans here is new AllRovi script, based on AllMovie script and with the help of other scripts, especially the new Italian script. The script gets most of the movie information currently available at the new AllRovi site, including:

  • Basic info; Title, Year, Director, Genre, Run time, Release, etc.
  • Poster (not good quality, but sufficient for a thumbnail)
  • Rovi rating
  • Synopsis
  • Review
  • Sub-Genres and Themes
  • MPAA rating and Flags

...and adds some special features:

  • Full Cast and Crew listings with links to Rovi bios.
  • Support for separate Attributes, Themes and Moods, even though Rovi now lumps all these together in Characteristics.
  • Mood links to old AllMovie mood pages (description of the mood and a list of "major works") found in the Web Archive.
  • Links to Rovi's Genre and Sub-Genre pages (with description, significant works and 'most visited' films).



This script has now been released and is available via the program's auto-update system. Run Help > Check for updates and choose AllRovi from the list. Post any comments or questions to the Support forum.
« Last Edit: February 08, 2014, 03:35:55 pm by Ivek23 »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllRovi (movies)
« Reply #1 on: July 10, 2011, 06:17:02 am »
Well done, Ivek! We're almost back in business (if Rovi will ever replace the data that's still missing ::) ). Some comments...

For Description (aka Synopsis), I prefer the author's name at the end. So I changed it to...

Code: [Select]
TmpStr3 := TextBetween(HTML, '<span>by ', '</span>', True, curPos);
...
AddFieldValue(mfDescription, TmpStr2 + #13 + '—' + TmpStr3);

The HTMLValues function is not being used properly in many places...

Quote from: Scripting Manual
function HTMLValues(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String;

Gathers all values from a given text into a string using ValDelim as delimiter. The function searches for ABegin first starting from Pos, from this point it gathers values between ItemBegin and ItemEnd until AEnd is found. The last position is returned in Pos variable.

Parameters:
HTML    text to process
ABegin    substring where the values start (header)
ItemBegin    substring that precedes each single value
ItemEnd    substring that follow each single value
ValDelim    delimiter to use in a resulting string
[in] Pos    from which position in text should the search start (will contain the position of AEnd after execution)

Each item in the list has to begin/end with ItemBegin/ItemEnd. Characteristics, for example, works better with...

Code: [Select]
AddCustomFieldValueByName('Characteristics', HTMLValues(HTML,
                                '<h3>characteristics</h3>', '<div class="promo-frame">',
        '>- ', '</div>', 
        ', ', EndPos));

BTW, Characteristics is rather useless as it is (a mix of other data elements), so I put it in a memo field. That way, the data is easier to see, and cut & paste to other fields (i.e., Attributes, Keywords, Moods) if I so choose.

A more obvious and common use for this function would seem to be the List Item (<li> / </li>)...

Code: [Select]
AddCustomFieldValueByName('Flags', HTMLValues(HTML,
                             '<dt>flags</dt>', '</dd>',
     '<li>', '</li>',
     ', ', EndPos)); 

AddFieldValue(mfGenre, HTMLValues(HTML,
                             '<dt>genres</dt>', '</dd>',
     '<li>', '</li>',
     ', ', EndPos));

AddCustomFieldValueByName('Types', HTMLValues(HTML,
                             '<dt>sub-genres</dt>', '</dd>',
     '<li>', '</li>',
     ', ', EndPos));

And these I'm not so sure of...

Code: [Select]
AddCustomFieldValueByName('Released',HTMLValues(HTML,
                             '<dt>release date</dt>', '<dt>run time</dt>',
     '<li>', '</li>',
     '; ', EndPos));

 AddCustomFieldValueByName('Original duration', HTMLValues(HTML,
                             '<dt>run time</dt>', '<dt>produced by</dt>',
     '<dd>', ' min',
     ', ', EndPos)); 

AddFieldValue(mfStudio, HTMLValues(HTML,
                             '<dt>produced by</dt>', '<dt>AMG ID</dt>',
     '<dd>', '</dd>',
     ', ', EndPos));

...They'll fail if the fields don't appear in exactly that order. I'll have to test more to see if this is reliable. :-\

I removed "min." from Run time because my Original duration field is an integer field.

I almost missed Themes, but there it is hiding in plain site in the "explore related movies by" buttons. The code for that...

Code: [Select]
if GET_THEMES then
  AddFieldValue(mfCategory, HTMLValues(HTML,
'>Similarity</button>', '</div>',
'">', '</button>',
', ', EndPos));

We're still missing...

  • Rovi rating: This is an annoying one. I can almost see it being done by replacing "star full" with "2" and "star half" with "1", adding those up and saving the result, but there must be an easier way.

  • Review: I couldn't figure out how to do this, simply because I don't know how to go to another page (i.e., in this case, MoveURL + '/review'). It must be simple, but I'm stumped.

  • Cast & Crew: I don't know what you or others might want. I get my people data from IMDb and don't want Rovi data messing that up. So my preference is that the names are captured as Rovi links along with the Role, and the whole thing be saved together in a memo field. That provides a convenient secondary source of credits, along with links to additional people information at the Rovi site.

I assume these things are beyond your capabilities as well. Hopefully nostra will have mercy and give us a hand. ;)

[attachment deleted by admin]

Offline minolotus

  • User
  • ***
  • Posts: 69
    • View Profile
Re: AllRovi (movies)
« Reply #2 on: July 10, 2011, 12:24:16 pm »
Ivec23 and rick.ca, thank you very much for your excellent work.

Quote
I almost missed Themes, but there it is hiding in plain site in the "explore related movies by" buttons.

I am wondering how the incredible Zac and his gang will handle this in the future. If you take a look at a movie added in the good old days (=before the allrovi launch), the themes are not included in the characteristics (e.g. http://www.allrovi.com/movies/movie/casablanca-v8482). But this seems to be different for movies added recently (e.g. http://www.allrovi.com/movies/movie/horrible-bosses-v517760).  Supposed that they will keep this system, the question arises if a script could compare both fields Themes and Characteristics and remove the matching items from the Characteristics field? IMHO this would reduce the chaos in the Characteristics field.

[Update]: I have just discovered that the items in Chararcteristics and Themes are not allways fully identical (e.g. http://www.allrovi.com/movies/movie/tabloid-v526607: ). So, this would not work very proper and hence I don't think that it is worth to spend time and adjust the scipt as proposed above. >:(

Quote
Cast & Crew: I don't know what you or others might want. I get my people data from IMDb and don't want Rovi data messing that up. So my preference is that the names are captured as Rovi links along with the Role, and the whole thing be saved together in a memo field. That provides a convenient secondary source of credits, along with links to additional people information at the Rovi site.

+1 Good idea.

Quote
Review: I couldn't figure out how to do this, simply because I don't know how to go to another page (i.e., in this case, MoveURL + '/review'). It must be simple, but I'm stumped.

Possible Low-tech solution: If this could not be done within a script, maybe it is possible to build a second script for the reviews only and put both scripts together with a batch file?
« Last Edit: July 10, 2011, 08:02:58 pm by minolotus »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi (movies)
« Reply #3 on: July 10, 2011, 02:47:39 pm »
Quote
Well done, Ivek! We're almost back in business (if Rovi will ever replace the data that's still missing Roll Eyes ). Some comments...

Thank Rick.ca to praise therefore, users for help and comments

Quote
For Description (aka Synopsis), I prefer the author's name at the end. So I changed it to...

Code: [Select]
TmpStr3 := TextBetween(HTML, '<span>by ', '</span>', True, curPos);
...
AddFieldValue(mfDescription, TmpStr2 + #13 + '—' + TmpStr3);

Each to his taste and liking.

Quote
The HTMLValues function is not being used properly in many places...

Quote from: Scripting Manual
function HTMLValues(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String;

Gathers all values from a given text into a string using ValDelim as delimiter. The function searches for ABegin first starting from Pos, from this point it gathers values between ItemBegin and ItemEnd until AEnd is found. The last position is returned in Pos variable.

Parameters:
HTML    text to process
ABegin    substring where the values start (header)
ItemBegin    substring that precedes each single value
ItemEnd    substring that follow each single value
ValDelim    delimiter to use in a resulting string
[in] Pos    from which position in text should the search start (will contain the position of AEnd after execution)

I do not understand everything, but I translated much of this does not help.

Quote
Characteristics, for example, works better with...

Code: [Select]
AddCustomFieldValueByName('Characteristics', HTMLValues(HTML,
                                '<h3>characteristics</h3>', '<div class="promo-frame">',
        '>- ', '</div>', 
        ', ', EndPos));

BTW, Characteristics is rather useless as it is (a mix of other data elements), so I put it in a memo field. That way, the data is easier to see, and cut & paste to other fields (i.e., Attributes, Keywords, Moods) if I so choose.

A more obvious and common use for this function would seem to be the List Item (<li> / </li>)...

Code: [Select]
AddCustomFieldValueByName('Flags', HTMLValues(HTML,
                             '<dt>flags</dt>', '</dd>',
     '<li>', '</li>',
     ', ', EndPos)); 

AddFieldValue(mfGenre, HTMLValues(HTML,
                             '<dt>genres</dt>', '</dd>',
     '<li>', '</li>',
     ', ', EndPos));

AddCustomFieldValueByName('Types', HTMLValues(HTML,
                             '<dt>sub-genres</dt>', '</dd>',
     '<li>', '</li>',
     ', ', EndPos));

Works great one and another.

Quote
And these I'm not so sure of...

Code: [Select]
AddCustomFieldValueByName('Released',HTMLValues(HTML,
                             '<dt>release date</dt>', '<dt>run time</dt>',
     '<li>', '</li>',
     '; ', EndPos));

 AddCustomFieldValueByName('Original duration', HTMLValues(HTML,
                             '<dt>run time</dt>', '<dt>produced by</dt>',
     '<dd>', ' min',
     ', ', EndPos)); 

AddFieldValue(mfStudio, HTMLValues(HTML,
                             '<dt>produced by</dt>', '<dt>AMG ID</dt>',
     '<dd>', '</dd>',
     ', ', EndPos));

It works great too, but here are two things:

1. ) Released
Released under mostly older movies where you will find only Film Release Year - code
Code: [Select]
//Released
 //modified by rick.ca 07/09/2011
  AddCustomFieldValueByName('Released', HTMLValues(HTML,
                             '<dt>released</dt>', '<dt>run time</dt>',
                 '<dd>', '</dd>',
                 ', ', EndPos));

2. ) Release Date
Release date below are mostly recent films where you can find all:
Month, day and year for Release Film - code
 
Code: [Select]
//Release date
 //modified by rick.ca 07/09/2011
  AddCustomFieldValueByName('Released',HTMLValues(HTML,
                             '<dt>release date</dt>', '<dt>run time</dt>',
                 '<li>', '</li>',
                 '; ', EndPos));

3. ) Produced by
Here is the case, then Optional user, but also Produced by 

Basic code
Code: [Select]
//Produced by 
 //modified by Ivek23 and rick.ca 07/09/2011
  AddFieldValue(mfStudio,  HTMLValues(HTML,
                             '<dt>produced by</dt>', '<dt>AMG ID</dt>',
                 '<dd>', '</dd>',
                 ', ', EndPos)); 

I use this code
Code: [Select]
//Produced by 
 //modified by Ivek23 and rick.ca 07/09/2011
  AddCustomFieldValueByName('Studio', HTMLValues(HTML,
                             '<dt>produced by</dt>', '<dt>released by</dt>',
                 '<dd>', '</dd>',
                 ', ', EndPos)); 

Since there are also Released by - my code
 
Code: [Select]
//Released by 
 //modified by Ivek23 07/10/2011
  AddCustomFieldValueByName('Released by',  HTMLValues(HTML,
                             '<dt>released by</dt>', '<dt>AMG ID</dt>',
                 '<dd>', '</dd>',
                 ', ', EndPos)); 


are usually different studios and distributors, which are produced and released.

Quote
I almost missed Themes, but there it is hiding in plain site in the "explore related movies by" buttons. The code for that...

Code: [Select]
if GET_THEMES then
  AddFieldValue(mfCategory, HTMLValues(HTML,
'>Similarity</button>', '</div>',
'">', '</button>',
', ', EndPos));

Thank you for Themes.

Quote
  • Review: I couldn't figure out how to do this, simply because I don't know how to go to another page (i.e., in this case, MoveURL + '/review'). It must be simple, but I'm stumped.


We'll see if we can do something in this for the Review.

Notice:
Adding in the first post new AllRovi Script Version 0.1.0.2
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi (movies)
« Reply #4 on: July 10, 2011, 02:50:41 pm »
Ivec23 and rick.ca, thank you very much for your excellent work.

Quote
I almost missed Themes, but there it is hiding in plain site in the "explore related movies by" buttons.

Thanks, minolotus
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi (movies)
« Reply #5 on: July 10, 2011, 04:02:22 pm »
Quote
  • Review: I couldn't figure out how to do this, simply because I don't know how to go to another page (i.e., in this case, MoveURL + '/review'). It must be simple, but I'm stumped.

Quote
We'll see if we can do something in this for the Review.

Here are the codes for the Review which must be:


Code: [Select]
function RemoveTagsEx(AText : String) : String;
var
 B, E : Integer;
begin
 Result := AText;

 B := PosFrom('<', Result, 1);
 E := PosFrom('>', Result, B);

 while (B > 0) AND (B < E) do begin
  Delete(Result, B, E - B + 1);

  B := Pos('<', Result);
  E := Pos('>', Result);
 end;
end;

procedure ParseReview(HTML : String);
var
 curPos, EndPos : Integer;
 TmpStr, TmpStr1, TmpStr2, TmpStr3, TmpStr4, TmpStr5 : String;
 begin
 curPos := Pos('<div class="tab-title">', HTML);
 if curPos < 1 then
  Exit;
 
 LogMessage('Pasrsing review...'); 

//Review
 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>', '</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);
 AddCustomFieldValueByName('Review', TmpStr5 + '   ' + TmpStr4 + #13 + TmpStr4 + '   ' + TmpStr3 + #13 + TmpStr2);

end;


procedure ParseMovie(MovieURL : String; HTML : String);
Code: [Select]
//Get URL
 EndPos := Pos('" class="title">', HTML);
 if EndPos > 0 then begin
  curPos := PrevPos('<div class="details"><a href="', HTML, EndPos);
  AddFieldValue(mfURL, Copy(HTML, curPos + 21, EndPos - curPos - 21));
 end else
  AddFieldValue(mfURL, MovieURL);
   AddCustomFieldValueByName('Url', '<link url="' + MovieURL + '">' + MovieURL + '</link>');

//Get Review URL
 if GET_REVIEW then begin
  EndPos := Pos('"><span>review</span>', HTML);
  if EndPos > 0 then begin
   curPos := PrevPos('href="/movies', HTML, EndPos);
   ExtraLinks[smReview] := BASE_URL + Copy(HTML, curPos + 6, EndPos - curPos - 6);
  end; 
 end;

Code: [Select]
if Pos('Search Results for', HTML) > 0 then begin
  ParseSearchResults(HTML);
  Result := prList;
  Exit;
 end else
 if Pos('- Cast, Reviews, Summary, and Awards - AllRovi</title>', HTML) > 0 then
  ParseMovie(URL, HTML)
else
 if Pos('- Review - AllRovi</title>', HTML) > 0 then
  ParseReview(HTML);

Notice:
Adding in the first post new AllRovi Script Version 0.1.0.3
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi (movies)
« Reply #6 on: July 10, 2011, 10:08:19 pm »
Quote
  • Cast & Crew: I don't know what you or others might want. I get my people data from IMDb and don't want Rovi data messing that up. So my preference is that the names are captured as Rovi links along with the Role, and the whole thing be saved together in a memo field. That provides a convenient secondary source of credits, along with links to additional people information at the Rovi site.

I managed to find a solution and the code for Cast & Crew, but will wait for tomorrow, this is further tested and know for sure that it worked, so please wait for maybe a day or two.

Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllRovi (movies)
« Reply #7 on: July 11, 2011, 02:14:28 am »
Thanks very much for your work on this, Ivek. I'm happy I've my Reviews back. :D

I wasn't expecting you to incorporate all my changes, having assumed we would need to maintain our separate versions. I now see that should not be necessary. Where you've used a custom field for something I don't use, I can just ignore it. Where you've used a standard field I get from elsewhere, I can turn it off in my Overwrite fields settings. The only real conflicts are where we treat the actual data differently (e.g., Description). In the attached version, I've added a RICK_CA := True option and then separated my modifications using if RICK_CA then... So unless you plan to do something very unusual, I'm confident we can share the same script. We can use the same technique to add options other users might want.

Having said that, it's still a PITA when we're both making changes at the same time—as we are today. I'm hoping you won't mind once again incorporating my changes. Or if you prefer, I'll merge the two after you've finished with your Cast & Crew addition. That should be easy if that's all you've changed since version 3.

My changes, not including minor editing:

  • Alternate formatting for Description and Review.

  • Minor changes to Title and Year and their use in LogMessages; removed unnecessary LogMessages.

  • Optional Run time destined for numeric field (removes " min.").

  • Changed Produced by so it will work if there's a Released by or not.

  • Changed Themes so it's added to mfCategory if the GET_THEMES option is set, and always added to the a custom field named "Category" (not to be confused with the standard field of the same name).

[attachment deleted by admin]
« Last Edit: July 11, 2011, 03:50:23 am by rick.ca »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllRovi (movies)
« Reply #8 on: July 11, 2011, 02:45:49 am »
Ivec23 and rick.ca, thank you very much for your excellent work.

You're welcome. Thanks to Ivek's perseverance, we're making good progress.

Quote
...So, this would not work very proper and hence I don't think that it is worth to spend time and adjust the scipt as proposed above.

Yes, it's almost impossible to figure out what they're doing with "Characteristics," which, of course, is a big part of the problem. Not only does it not work as a "mashup," they're not doing whatever they're doing with any discernible consistency. Attached is my effort to figure it out. I can see some patterns, but my conclusion is there is very good reason why it's useless. More disturbingly, it appears they may be dropping some data elements (Moods and Keywords) entirely. If that's the case, I have little hope any of this data will be restored to it's previous form. :(

Quote
Possible Low-tech solution: If this could not be done within a script, maybe it is possible to build a second script for the reviews only and put both scripts together with a batch file?

Low-tech is a well-used tool in my kit, but it seems Ivek has figured it out. Even when I look at what he did, I don't understand why it works. :-[

[attachment deleted by admin]

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #9 on: July 11, 2011, 07:04:08 am »
For Cast & Crew

Copy the below procedure ParseReview



Code: [Select]
//Parse Cast
//Modified 09/24/2010 to save entire Cast tab to custom memo field, as well as individual actors.
procedure ParseCast(HTML : String);
var
 curPos, EndPos : Integer;
 TmpStr, TmpStr1 : String;
 Name, Role, URL : String;
begin
 curPos := Pos('<div class="description-box">', HTML);
 if curPos < 1 then
  Exit;
 
 TmpStr := ''; 
             
 EndPos := curPos;
 curPos := PosFrom('http://www.allrovi.com/name/', HTML, curPos);
 while (curPos > 0) AND (curPos < PosFrom('</table>', HTML, EndPos)) do begin
  EndPos := PosFrom('">', HTML, curPos);
   
  URL := Copy(HTML, curPos, EndPos - curPos);
   
  curPos := EndPos + 2;
  EndPos := PosFrom('</a>', HTML, curPos);
   
  Name := Copy(HTML, curPos, EndPos - curPos);
 
  curPos := PosFrom('>', HTML, EndPos);
  if curPos > 0 then begin
   curPos := curPos + 2;
   EndPos := PosFrom('</td>', HTML, curPos);

   Role := Trim(Copy(HTML, curPos +4, EndPos - curPos -4));
  end else begin
   Role := ''; 
   curPos := EndPos;
  end;
   
  AddMoviePerson(Name, '', '', URL, ctActors);
 
  if TmpStr <> '' then
   TmpStr := TmpStr + #13; 
  if URL <> '' then
   TmpStr := TmpStr + '<link url="' + URL + '">';
  TmpStr := TmpStr + Name;
  if Role <> '' then
   TmpStr := TmpStr + ' - ' + Role;

  if URL <> '' then
   TmpStr := TmpStr + '</link>';

  if curPos > 0 then
   curPos := PosFrom('http://www.allrovi.com/name/', HTML, curPos)
  else
   Exit; 
 end;

AddCustomFieldValueByName('Cast', TmpStr); // If you do not exist then the change to:
 AddCustomFieldValueByName('Actors', TmpStr);

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

 TmpStr := '';
 
 EndPos := curPos;
 curPos := PosFrom('http://www.allrovi.com/name/', HTML, curPos);
 while (curPos > 0) AND (curPos < PosFrom('</dl>', HTML, EndPos)) do begin
  EndPos := PosFrom('">', HTML, curPos);
   
  URL := 'http://www.allrovi.com/name/' + Copy(HTML, curPos, EndPos - curPos);
   
  curPos := EndPos + 2;
  EndPos := PosFrom('</a>', HTML, curPos);
   
  Name := Copy(HTML, curPos, EndPos - curPos);
 
  curPos := PosFrom('>', HTML, EndPos);
  if curPos > 0 then begin
   curPos := curPos + 2;
   EndPos := PosFrom('</dd>', HTML, curPos);
 
   Role := Trim(Copy(HTML, curPos +4, EndPos - curPos -4));
  end else begin
   Role := ''; 
   curPos := EndPos;
  end;
       
  AddMoviePerson(Name, '', Role, URL, ctProducers);

  if TmpStr <> '' then
   TmpStr := TmpStr + #13; 
  if URL <> '' then
   TmpStr := TmpStr + '<link url="' + URL + '">';
  TmpStr := TmpStr + Name;
  if Role <> '' then
   TmpStr := TmpStr + ' - ' + Role;
  if URL <> '' then
   TmpStr := TmpStr + '</link>';

  if curPos > 0 then
   curPos := PosFrom('http://www.allrovi.com/name/', HTML, curPos)
  else
   Exit; 
 end;

 AddCustomFieldValueByName('Production', TmpStr);
end;

Notice:
Code: [Select]
AddMoviePerson(Name, '', Role, URL, ctProducers);This is only a test there to see how information is transferred


Code: [Select]
[s]GET_CAST = True;[/s]
Code: [Select]
//Get Cast URL
[s]if GET_CAST then begin[/s]
   EndPos := Pos('"><span>cast & crew</span></a>', HTML);
  if EndPos > 0 then begin
   curPos := PrevPos('href="/movies', HTML, EndPos);
   ExtraLinks[smCast] := BASE_URL + Copy(HTML, curPos + 6, EndPos - curPos - 6);
  end;
 [s]end; [/s]

Notice:
Strikethrough may be necessary


Code: [Select]
ParseReview(HTML)
 else
 if Pos('- Cast and Crew - AllRovi</title>', HTML) > 0 then
  ParseCast(HTML):

This is now testing that might find a solution to the Role there because I leave this <td> and this <dd>, but I can not find solution how to remove this.


Notice:
If, however, it might be something, here are the necessary code:

Code: [Select]
procedure ParseCredits(HTML : String);
var
 curPos, EndPos : Integer;
 TmpStr, TmpStr1 : String;
 Name, Role, URL : String;
begin
 curPos := Pos('<div class="profession-box">', HTML);
 if curPos < 1 then
  Exit;

 TmpStr := '';
 
 EndPos := curPos;
 curPos := PosFrom('http://www.allrovi.com/name/', HTML, curPos);
 while (curPos > 0) AND (curPos < PosFrom('</dl>', HTML, EndPos)) do begin
  EndPos := PosFrom('">', HTML, curPos);
   
  URL := 'http://www.allrovi.com/name/' + Copy(HTML, curPos, EndPos - curPos);
   
  curPos := EndPos + 2;
  EndPos := PosFrom('</a>', HTML, curPos);
   
  Name := Copy(HTML, curPos, EndPos - curPos);
 
  curPos := PosFrom('>', HTML, EndPos);
  if curPos > 0 then begin
   curPos := curPos + 2;
   EndPos := PosFrom('</dd>', HTML, curPos);
 
   Role := Trim(Copy(HTML, curPos, EndPos - curPos));
  end else begin
   Role := ''; 
   curPos := EndPos;
  end;
       
  AddMoviePerson(Name, '', Role, URL, ctProducers);

  if TmpStr <> '' then
   TmpStr := TmpStr + #13; 
  if URL <> '' then
   TmpStr := TmpStr + '<link url="' + URL + '">';
  TmpStr := TmpStr + Name;
  if Role <> '' then
   TmpStr := TmpStr + ' - ' + Role;
  if URL <> '' then
   TmpStr := TmpStr + '</link>';

  if curPos > 0 then
   curPos := PosFrom('http://www.allrovi.com/name/', HTML, curPos)
  else
   Exit; 
 end;
 
 AddCustomFieldValueByName('Production', TmpStr);
end;

Code: [Select]
//Get Review URL
 if GET_REVIEW then begin
  EndPos := Pos('"><span>review</span>', HTML);
  if EndPos > 0 then begin
   curPos := PrevPos('href="/movies', HTML, EndPos);
   ExtraLinks[smReview] := BASE_URL + Copy(HTML, curPos + 6, EndPos - curPos - 6);
  end; 
 end;

//Get Cast URL
if GET_CAST then begin
   EndPos := Pos('"><span>cast & crew</span></a>', HTML);
  if EndPos > 0 then begin
   curPos := PrevPos('href="/movies', HTML, EndPos);
   ExtraLinks[smCast] := BASE_URL + Copy(HTML, curPos + 6, EndPos - curPos - 6);
  end;
 end;

Code: [Select]
ParseReview(HTML)
 else
 if Pos('- Cast and Crew - AllRovi</title>', HTML) > 0 then
  ParseCast(HTML)
 else
 if Pos('- Cast and Crew - AllRovi</title>', HTML) > 0 then
  ParseCredits(HTML);

Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #10 on: July 11, 2011, 03:13:32 pm »
Quote
This is now testing that might find a solution to the Role there because I leave this <td> and this <dd>, but I can not find solution how to remove this.

Maybe someone succeeds or help would be welcomed by Nostra.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #11 on: July 11, 2011, 07:31:49 pm »
Quote
Thanks very much for your work on this, Ivek. I'm happy I've my Reviews back.
Rick.ca also thank you for the help that the script works better.

Quote
I wasn't expecting you to incorporate all my changes, having assumed we would need to maintain our separate versions. I now see that should not be necessary. Where you've used a custom field for something I don't use, I can just ignore it. Where you've used a standard field I get from elsewhere, I can turn it off in my Overwrite fields settings. The only real conflicts are where we treat the actual data differently (e.g., Description). In the attached version, I've added a RICK_CA := True option and then separated my modifications using if RICK_CA then...

I hope you don 't mind if I added your changes and update the script, but in a good and useful purpose to do better functioning script as well as any other potential users, so I have a proposal to attach your name as a co-author of the script.  Given options
Quote
RICK_CA := True option and then separated my modifications using if RICK_CA then...
this is a very good idea

Quote
So unless you plan to do something very unusual, I'm confident we can share the same script. We can use the same technique to add options other users might want.
Also true

Quote
Having said that, it's still a PITA when we're both making changes at the same time—as we are today. I'm hoping you won't mind once again incorporating my changes. Or if you prefer, I'll merge the two after you've finished with your Cast & Crew addition. That should be easy if that's all you've changed since version 3.

I have nothing against it, even it would be to merge both versions into a single script version to this version would then also be added as an official in the Download section, that would not upset the other two different AllRovi script version, AllMovie script is (would be well placed in the archive or the end of the Download section in the part where there are also other tools, in particular, that at times when he needs it, as I have now, when I worked AllRovi Script ) are not removed because it would certainly come in handy when someone at work was like a new script, I hope you agree with this interpretation.

BTW:
With your permission, these added as a co-author of the script.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #12 on: July 11, 2011, 08:09:59 pm »
Rick.ca in Review I made a small change
instead of TmpStr3
Code: [Select]
if RICK_CA then
AddCustomFieldValueByName('Review', TmpStr2 + #13 + '—' + TmpStr3)
 else
AddCustomFieldValueByName('Review',  '  ~~  ' + TmpStr4 + '  ~~  ' + #13 + TmpStr2 + #13 + ' -  ' +   );

is TmpStr5
Code: [Select]
if RICK_CA then
AddCustomFieldValueByName('Review', TmpStr2 + #13 + '—' + TmpStr3)
 else
AddCustomFieldValueByName('Review',  '  ~~  ' + TmpStr4 + '  ~~  ' + #13 + TmpStr2 + #13 + ' -  ' + TmpStr5 );

at the end Review write the correct information Who is (the word by) the author of Review text.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllRovi movie script
« Reply #13 on: July 11, 2011, 08:50:47 pm »
I have nothing against it, even it would be to merge both versions into a single script version to this version would then also be added as an official in the Download section...

I think it would be better if the Download section had only one script per data source, and included only scripts and data sources that currently work. That's what most users expect to find there. Old, prior version and defunct scripts are still or can be available as attachments to topics like this one—where their current status and purpose can be explained. It would be okay if they were in a separate "Retired Scripts" section, but I doubt nostra would want to maintain such a thing. And users interested in those scripts would still need to find the topic that explains them.

Quote
With your permission, these added as a co-author of the script.

Yes. I look forward to your latest version. I've haven't attempted to add your latest changes (addition of Cast & Crew) to my own. I'd rather just review what you've done and suggest changes to that.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #14 on: July 11, 2011, 09:56:34 pm »
Yes. I look forward to your latest version. I've haven't attempted to add your latest changes (addition of Cast & Crew) to my own. I'd rather just review what you've done and suggest changes to that.

Yes

Cast & Crew  I did what was in my power, the result is visible when the data transfer info.

Notice:
Adding in the first post new AllRovi Script Version 0.1.0.4
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllRovi movie script
« Reply #15 on: July 12, 2011, 02:06:18 am »
Quote
Adding in the first post new AllRovi Script Version 0.1.0.4

I believe I've fixed the issues at hand. The changes are documented in the attached script. Please review and modify as you see fit, and post the result as version 5.

I'm pleased so far—see attached screen shot.

Suggested TODO List:

  • Add Rovi Rating to custom field and optionally to [orating]. Beg nostra for help?
  • Add Awards and Releases to custom fields using same technique as Cast & Crew.
  • OMG, is there nothing else? :o
  • Wait for Rovi to add the missing AllMovie data. ::)

[attachment deleted by admin]

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #16 on: July 12, 2011, 05:11:40 am »
Characteristics

Sorry Rick.ca , there still is a custom field called Characteristics, but last night because I added a quick change that I can be uploaded, I missed this detail, a custom field called 'Similar Works' I only have to test, because My primary skin I have not managed to add a custom field called Characteristics.
The next version this Details corrected.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllRovi movie script
« Reply #17 on: July 12, 2011, 07:03:53 am »
Quote
Sorry Rick.ca...

Funny, I did exactly the same thing yesterday, but took it a step further... I tested something "temporarily" using one of my custom fields, then forgot to change it back. When I was sure it was okay, I uploaded the script, and then ran it on about 100 of my movies. It worked perfectly—overwriting the data in my custom field. ::)

I wonder if anyone is going to be willing to test this for us... ;D

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #18 on: July 12, 2011, 07:40:58 am »
Quote
Sorry Rick.ca...

Funny, I did exactly the same thing yesterday, but took it a step further... I tested something "temporarily" using one of my custom fields, then forgot to change it back. When I was sure it was okay, I uploaded the script, and then ran it on about 100 of my movies. It worked perfectly—overwriting the data in my custom field. ::)

I wonder if anyone is going to be willing to test this for us... ;D

Happens now, the rating here,
Code: [Select]
//Rating
 //Temporary Multiselect list custom field AllRovi rating
  AddCustomFieldValueByName('AllRovi rating', HTMLValues(HTML,
                             '<dt>rovi rating</dt>',  '</dd>',
                 '<li class="star', '"></li>',
                 ', ', EndPos));


//MPAA Rating

but I will not be added in the first post until further add to the script
Awards and Releases.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllRovi movie script
« Reply #19 on: July 12, 2011, 10:17:22 am »
I have nothing against it, even it would be to merge both versions into a single script version to this version would then also be added as an official in the Download section, that would not upset the other two different AllRovi script version, AllMovie script is (would be well placed in the archive or the end of the Download section in the part where there are also other tools, in particular, that at times when he needs it, as I have now, when I worked AllRovi Script ) are not removed because it would certainly come in handy when someone at work was like a new script, I hope you agree with this interpretation.

In this AllMovie script in AllMovie Disappeared, Allrovi.com appeared! topic, but I forgot, it is almost identical to the original script for AllMovie Nostra, only what is changed here original url.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


 

anything