English > Scripts and Templates

AllRovi movie script

(1/26) > >>

Ivek23:

--- Quote from: Ivek23 on January 07, 2014, 11:56:04 am ---Notice:

AllRovi script does not work anymore.

--- End quote ---


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.

rick.ca:
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: ---TmpStr3 := TextBetween(HTML, '<span>by ', '</span>', True, curPos);
...
AddFieldValue(mfDescription, TmpStr2 + #13 + '—' + TmpStr3);

--- End code ---

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)

--- End quote ---

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


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

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: ---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));

--- End code ---

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


--- Code: ---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));

--- End code ---

...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: ---if GET_THEMES then
  AddFieldValue(mfCategory, HTMLValues(HTML,
'>Similarity</button>', '</div>',
'">', '</button>',
', ', EndPos));
--- End code ---

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]

minolotus:
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.
--- End quote ---

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.
--- End quote ---

+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.
--- End 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?

Ivek23:

--- 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...
--- End quote ---

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: ---TmpStr3 := TextBetween(HTML, '<span>by ', '</span>', True, curPos);
...
AddFieldValue(mfDescription, TmpStr2 + #13 + '—' + TmpStr3);

--- End code ---

--- End quote ---

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)

--- End quote ---

--- End quote ---

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


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


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

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: ---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));

--- End code ---

--- End quote ---

Works great one and another.


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


--- Code: ---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));

--- End code ---

--- End quote ---

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: ---//Released
 //modified by rick.ca 07/09/2011
  AddCustomFieldValueByName('Released', HTMLValues(HTML,
                             '<dt>released</dt>', '<dt>run time</dt>',
                 '<dd>', '</dd>',
                 ', ', EndPos));
--- End code ---

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

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

Basic code
--- Code: ---//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)); 
--- End code ---

I use this code

--- Code: ---//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)); 
--- End code ---

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


--- End code ---

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: ---if GET_THEMES then
  AddFieldValue(mfCategory, HTMLValues(HTML,
'>Similarity</button>', '</div>',
'">', '</button>',
', ', EndPos));
--- End code ---

--- End quote ---

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.


--- End quote ---

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:

--- Quote from: minolotus 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.
--- End quote ---

--- End quote ---

Thanks, minolotus

Navigation

[0] Message Index

[#] Next page

Go to full version