Personal Video Database

English => Development => Scripts and Templates => Topic started by: nostra on June 24, 2008, 01:32:22 am

Title: AllMovie.com (movies)
Post by: nostra on June 24, 2008, 01:32:22 am
Attached:
-Current version of the script [0.1.0.3]
-Downloads main information + Poster, Review, Product Credits, High Historical Importance, High Artistic Quality

The problems with search results will be fixed in the program itself a bit later.



The current version of this script is included with the program installation, but is available separately in this scripts archive (http://www.videodb.info/bin/plugins/scripts.zip) (on the Download (http://www.videodb.info/forum_en/index.php?action=down) page).



[attachment deleted by admin]
Title: Re: AllMovie.com (movies)
Post by: rick.ca on July 19, 2008, 07:48:47 pm
I've noticed the rating returned by these scripts is often one less than it should be. It seems the problem is the rating is obtained from the "alternative name" of the star image, but (for reasons I can't fathom) this is incorrect. You could get the correct rating directly from the star image file name. That's st_rN.gif, where N = 1 to 9, representing 1 to 5 stars in 1/2 star increments. In other words, the rating = N + 1.
Title: Re: AllMovie.com (movies)
Post by: nostra on July 20, 2008, 11:31:52 am
Are you sure that the rating in the image file is more precise (or correct) than the rating retrieved currently? It seemed vice versa to me...
Title: Re: AllMovie.com (movies)
Post by: rick.ca on July 20, 2008, 06:15:02 pm
Here's a small sample:

American Beauty: 4.5 stars - <img src="/img/st_r8.gif" alt="4.5 Stars"> - correct
The Bank Job: 3.5 stars - <img src="/img/st_r6.gif" alt="3 Stars"> - incorrect
A Beautiful Mind: 4 stars - <img src="/img/st_r7.gif" alt="4 Stars"> - correct
Bend It Like Beckham: 3.5 stars - <img src="/img/st_r6.gif" alt="3 Stars"> - incorrect
Beyond Borders: 2 stars - <img src="/img/st_r3.gif" alt="1.5 Stars"> - incorrect
Big Fish: 3.5 stars - <img src="/img/st_r6.gif" alt="3 Stars"> - incorrect

In judging which is correct, I'm siding with the image because that is what is visible. Do you know what the "alt" version is used for? I can't be certain which is "more precise," although it was a sense some ratings in PVD were too low that attracted my attention.
Title: Re: AllMovie.com (movies)
Post by: nostra on March 11, 2009, 01:23:57 am
The script is updated according to the new design of the site. There still some problems thou, but it should be ok until I find time to finish the script.
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 11, 2009, 07:24:58 am
Thanks for the quick re-write. These may be the problems you know about, but I'll list here what I find anyway:

1. If there is no poster, the script throws up an error dialog with no error message in it. According to the movie I tested, they use the relative "<img src="/img/noimage200.png"..., rather than a complete url: Watchmen (http://www.allmovie.com/work/watchmen-353567)

[Edit:] Looking at this again, I wonder if 2, 3 and 4 are all the same issue—Genre and Director are not saved or saved in the wrong field if AKA data exists. If I turn AKA off in Overwrite fields, BTW, it still doesn't get Genre or Director if AKA exists. This seems consistent: Underground (http://www.allmovie.com/work/134794), Tin Drum (http://www.allmovie.com/work/the-tin-drum-50080)

2. Sometimes Genre is saved in AKA: Body of Lies (http://www.allmovie.com/work/body-of-lies-393933) I don't see any difference in the source between those that work and those that don't.

3. AKA and Themes (Categories) are not saved.

4. Sometimes Director is saved, sometimes not: Body of Lies (http://www.allmovie.com/work/body-of-lies-393933), Watchmen (http://www.allmovie.com/work/watchmen-353567) I don't see any difference in the source between those that work and those that don't.

5. Year, Actors, Country, Studio, MPAA, Tags, Description, Review and Duration seem to work correctly.

6. Got this error on Box office: Blade Runner (http://www.allmovie.com/work/blade-runner-5994)

conversion error from string "27,580,111/ 1992 Rerelease: $3,740,330"
Overflow occurred during data type conversion.
Error Code: 14
Title: Re: AllMovie.com (movies)
Post by: nostra on March 11, 2009, 08:54:41 pm
Could you post titles of the movies that produce each type of error?
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 11, 2009, 10:32:13 pm
Quote
Could you post titles of the movies that produce each type of error?

I've edited my original post.

Quote
There are still some problems when searching for movie titles with prefixes.

The search results I've seen are so consistently useless, it seems to go beyond prefixes. But allmovies searches (including those done directly on the website) have always been strange—so maybe this is one thing that hasn't changed.  ::)
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 12, 2009, 12:15:58 am
I've noticed the rating returned by these scripts is often one less than it should be. It seems the problem is the rating is obtained from the "alternative name" of the star image, but (for reasons I can't fathom) this is incorrect. You could get the correct rating directly from the star image file name. That's st_rN.gif, where N = 1 to 9, representing 1 to 5 stars in 1/2 star increments. In other words, the rating = N + 1.

Just for the record, I see this has been fixed. I probably noticed before, but never got around to updating my existing ratings. It seems, too, allmovies has fixed the data that caused the problem in the first place.
Title: Re: AllMovie.com (movies)
Post by: nostra on March 12, 2009, 12:44:12 am
OK, everything should be fixed now, except search results.
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 13, 2009, 03:12:03 am
I'm modifying the script to handle additional data elements for custom fields. That's coming along quite nicely, but I need a little help. As a measure of my profound coding-lameness, I'm unable to introduce a simple variable to add two data elements together.

I would like to combine MPAA (e.g., "R") and MPAA Reasons (e.g., "language and sexual references") into the same way it's expressed on IMDb (e.g., "Rated R for language and sexual references.")

So MPAA is retrieved with...
Code: [Select]
//MPAA
 EndPos := PosFrom('style="width: 86px;', HTML, EndPos); //if no countries found set EndPos to the right position
 curPos := PosFrom('">', HTML, EndPos) + 2;
 EndPos := PosFrom('</td>', HTML, curPos);
 AddFieldValue(mfMPAA, Copy(HTML, curPos, EndPos - curPos));

...and I'm adding MPAA reasons to a custom field with...
Code: [Select]
//MPAA Reasons
 AddCustomFieldValueByName('MPAA', HTMLValues(HTML,
              '<span>MPAA Reasons</span>', '</table>',
'<li>', '</li>',
', ', EndPos));

How can I modify this to combine the two and put the result into mfMPAA?

I realize this is a trivial thing—there are very few cases where the data won't already have come from IMDb—but I'll be able to use the same technique for other things.
Title: Re: AllMovie.com (movies)
Post by: nostra on March 13, 2009, 04:16:28 am
There is already a variable for tremporary data declared: TmpStr
You need to do following:

Code: [Select]
//MPAA
EndPos := PosFrom('style="width: 86px;', HTML, EndPos); //if no countries found set EndPos to the right position
curPos := PosFrom('">', HTML, EndPos) + 2;
EndPos := PosFrom('</td>', HTML, curPos);
TmpStr := Copy(HTML, curPos, EndPos - curPos);

and then

Code: [Select]
//MPAA Reasons
 AddCustomFieldValueByName('MPAA', TmpStr + ' ' + HTMLValues(HTML,
              '<span>MPAA Reasons</span>', '</table>',
'<li>', '</li>',
', ', EndPos));

I have added a space like this ' ', so that it looks better.

P.S. I have not tested this code
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 13, 2009, 10:12:42 am
Thanks! It turned out to be a little more complicated, but I figured it out...

I forgot to mention TmpStr is used between the two parts (in the Box Office section). Eventually, I figured out how to declare and use TmpStr2. Then, because I wanted it to be "Rated X for... .", it had to be conditional on a rating existing. So I'm using global variables and conditional statements—wow.  ::)

Is a date function available? I would like to be able to save the current date in a custom Date updated field.

Now that I'm running out of new things to add, I'm eyeing the Similar Works section (under Plot Synopsis). Is it possible to grab that list and add the movies to PVD's Connections (as a separate section, I suppose)—or is that beyond the scope of a script?

Quote
P.S. I have not tested this code

That's okay. You can test the script when it's finished. ;D
Title: Re: AllMovie.com (movies)
Post by: Two Wire on March 15, 2009, 05:31:35 pm
Quote
Attached:
-Current version of the script [0.1.0.3]
Quote

Where is this attachment?  No can find. Help.
 Thanks
Title: Re: AllMovie.com (movies)
Post by: tantrum829 on March 15, 2009, 05:42:08 pm
Ok I am a little lost. I downloaded the new script but it wont replace the old one. I drag and drop it to the same place where the old one is and i assume it should
ask me if I want to overwrite the old file but it doesnt. The icon is different. It has a .txt icon instead of the .pvd

How do i change it.

Thanks
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 15, 2009, 05:55:09 pm
The script is attached to the first message of this topic. It is named allmovie.psf. Copy it to your Scripts folder, overwriting the old one.
Title: Re: AllMovie.com (movies)
Post by: tantrum829 on March 15, 2009, 06:04:18 pm
That what I did but like I said it wont overwrite it it just copies it and sits next to the old script. The image the new script has a .txt icon

I have a screen capture but not sure how to attach to this post. i pressed the insert image icon but did not work.
Title: Re: AllMovie.com (movies)
Post by: tantrum829 on March 15, 2009, 06:12:29 pm
Okay. Here is a screen capture. Hope its readable.  http://img19.imageshack.us/img19/5209/screenshot003ajk.png

I got to go to work but I will be back on the forum later in case I dont reply back anytime soon.

Thanks.
Title: Re: AllMovie.com (movies)
Post by: Two Wire on March 15, 2009, 06:32:38 pm
Thanks Rick. I spent 45 minutes looking for that updated script. I looked several times through the first post,. as well as reading and re-reading the other post. I did not see it even after you told me where to look. I was about to ask for specific directions when a speck on my screen csught attention. That got me close enough to a light blue hyperlink, and whala, there it was. I have poor vision, but I live and learn.

Thanks, it works great. no more error code.








Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 16, 2009, 12:40:12 am
Quote
Here is a screen capture.

Uh-oh. I feel a Vista-tantrum coming.  :-X  It's no use...

What the heck is that?! Where are the file extensions? Surely you're not trusting icons to tell you the file type. Is there a file details mode that will actually reveal a little information about what you're looking at? What is the "Movies folder" (if that's what it is) and what are the files (if that's what they are) doing there? The normal installation directory for the program is C:\Program Files\Personal Video Database. Scripts must be in a subfolder of that directory named "Scripts." Is that what your screenshot is suppose to be of?

...tantrum <off>. Thank you for understanding. I can assure you that you can install PVD wherever you want, and, if a valid script with a PSF extension is placed in the \Scripts subfolder of that directory, it will be recognized by the program.
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 16, 2009, 01:14:24 am
Quote
I have poor vision, but I live and learn.

Are you aware of the "full page zoom" feature in the current versions of Firefox, Opera and IE? Using that, you can enlarge everything (i.e., images and graphics—like an attachment icon—as well as text). In Firefox, Ctrl++/Ctrl+- enlarge/reduce, or you can put icons on a toolbar to do so.
Title: Re: AllMovie.com (movies)
Post by: tantrum829 on March 16, 2009, 04:17:14 am
Okay. Sorry I will post a better screenshot but what if I uninstall, download and install again. Are the new scripts included in the latest version? Will I loose everything I have so far?  http://img4.imageshack.us/img4/9274/screenshot004l.png

I see there is a backup option. Will that work like it sounds? It took me forever to add all my movies.

To be honest I dont understand why its like that.  I installed the program and then moved the icon to a folder called movies and it was working just fine until the other day.




Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 16, 2009, 05:51:06 am
Re-installing won't help. In any case, no, the installation package does not include this updated script. You need to slow down and try to gain a better understanding of how your operating system works. If it took you "forever" to build your database, you should not be referring to backup as an "option." Sooner or later, your database will become corrupt, and you will not be able to fix it. If you don't have backup, all will be lost. But even backup won't help you if you don't even know where your data and backup files are stored. So...

Use Explorer's details view—so it actually provides some useful information about files and folders. Is the "Movies" folder your PVD installation directory, or is it something else? Do you see viddb.exe there? Navigate to Computer - Hard Drive - Program Files. Do you see a "Personal Video Database" folder there? If so, is viddb.exe there? Does the folder have "Plugins," "Scripts" and "Skins" sub-folders? Are your plugins, scripts and skins there, or only in your "Movies" folder? And—most importantly—where is your data file? Before you do anything else (using Explorer), you need to find that, and make a copy of it. Making a copy of your data file is actually easier, faster and more efficient way to create a backup than the backup feature in the program.
Title: Re: AllMovie.com (movies)
Post by: tantrum829 on March 16, 2009, 06:16:32 am
First of all I appreciate your patience. Okay I dont find it in program files to be honest this is how I remember it. I downloaded the program to my desktop and I changed the name of folder to Movies and the I changed the folder icon. When I click on the folder I get this   http://img27.imageshack.us/img27/3729/screenshot005x.png

Here it is in detailed view    http://img27.imageshack.us/img27/2827/screenshot006e.png

I then Run Viddb.exe and it runs.

It sounds like I didnt do it right the first time. so any help is appreciated.
Title: Re: AllMovie.com (movies)
Post by: tantrum829 on March 16, 2009, 06:34:14 am
I was able to get it to work. I opened the old file in notepad deleted everything and copy pasted the text on the new script on the old and now its working fine.

Im not sure that was the right way to do it but it seems to have worked. thanks for all the help.
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 16, 2009, 09:32:44 am
I can assure you that you can install PVD wherever you want, and, if a valid script with a PSF extension is placed in the \Scripts subfolder of that directory, it will be recognized by the program.

QED. Although running it from the desktop is a rather extreme demonstration.  ;)

I don't know why you had a problem over-writing the old script with the new one. If you had used Explorer in detail view, however, you could have easily seen which was which (perhaps Windows changed the extension, so it wouldn't have to overwrite the existing file). Then it would have been a simple matter to delete the old file, and rename the new one. The point of my earlier rant was, in a misguided attempt to make things "easier," Vista obscures straightforward information you need to know and understand in order to maintain your system properly.
Title: Re: AllMovie.com (movies)
Post by: tantrum829 on March 17, 2009, 06:51:01 am
Basically that was the issue. No matter how many times I downloaded it or where I saved it the script would always show up as a .txt file and not overwriting the old one since they where different ext. Maybe it was a vista thing but I am just relieved that its working now.

Thanks for the help.

Title: Re: AllMovie.com (movies)
Post by: HeadHancho on March 18, 2009, 09:42:31 pm
This new script was downloaded and used to overwrite the previous one... it does remove the error message but sadly it has a very low success rate (50:50 at best) of identifying the film from the titles I have.  Has anyone else experienced this?  Often, I'm getting a list of possible titles but nothing close to what I am looking for.
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 18, 2009, 11:48:50 pm
Yes, that why nostra said "The problems with search results will be fixed in the program itself a bit later." I don't know why, but it's obviously not something that can be addressed in the script itself.
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 18, 2009, 11:54:57 pm
And now back to my questions... ;)
Is a date function available? I would like to be able to save the current date in a custom Date updated field.

Now that I'm running out of new things to add, I'm eyeing the Similar Works section (under Plot Synopsis). Is it possible to grab that list and add the movies to PVD's Connections (as a separate section, I suppose)—or is that beyond the scope of a script?
Title: Re: AllMovie.com (movies)
Post by: nostra on March 19, 2009, 12:25:28 am
It is possible to fill any field with a script.

The "last modified" field will be available in 0.9.9.5
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 19, 2009, 02:17:03 am
Quote
It is possible to fill any field with a script.

I need to be more careful with that word, "possible." Consider it my contribution to your "Things to think about doing when I have nothing better to think about doing" TODO list. ;)

Quote
The "last modified" field will be available in 0.9.9.5

Great! I assume that will be a field the program will update whenever a plugin or script adds any information to the record.

Should I still want to get the current date in a script, however, is a date function available?
Title: Re: AllMovie.com (movies)
Post by: nostra on March 19, 2009, 02:36:06 am
Quote
Great! I assume that will be a field the program will update whenever a plugin or script adds any information to the record.

This field will be updated each time a plugin or user updates one of the fields.

Quote
Should I still want to get the current date in a script, however, is a date function available?

Sure. (I need to find some time and post detailed instructions for scripting, templates and skins)
Here are the Date/time functions:

Code: [Select]
function CurrentDateTime : Extended;

function DateToStr(Value : Extended) : WideString;

function TimeToStr(Value : Extended) : WideString;

function EncDate(Year, Month, Day : Word): Extended;

function EncTime(Hour, Min, Sec : Word): Extended;

procedure DecdTime(const Time: Extended; var Hour, Min, Sec: Word);

procedure DecdDate(const Date: Extended; var Year, Month, Day: Word);

function StrToDateW(const S: WideString): Extended;

function StrToTimeW(const S: WideString): Extended;
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 19, 2009, 07:12:00 am
Quote
Sure. (I need to find some time and post detailed instructions for scripting, templates and skins)
Here are the Date/time functions:

Thanks! I've "fixed" my script. My date Updated field will be somewhat redundant with Last modified, but it might be useful to have a separate date for when the AllMovie+ script was last run.

Detailed instructions would be nice, but when you spoon-feed me like this, my head is less likely to explode. :D
Title: Re: AllMovie.com (movies)
Post by: darichman on March 21, 2009, 02:49:32 am
Okay I have a few days off now, so I'm revisiting my movie metadata (yay!)

First of all, thanks for updating the allmovie script, nostra. I'll see how I go...
Title: Re: AllMovie.com (movies)
Post by: Roland6543 on March 22, 2009, 02:33:16 am
Well, I'm with Two Wire.... I cant see the link for the script anywhere ??? Not even any faint colored hyperlink.

Of course (and hopefully) someone will point out the error of my ways and I'll feel like a humiliated noob.

Title: Re: AllMovie.com (movies)
Post by: darichman on March 22, 2009, 03:18:57 am
It's in the first post of this thread.

http://www.videodb.info/forum_en/index.php?topic=895.msg2074#msg2074 (http://www.videodb.info/forum_en/index.php?topic=895.msg2074#msg2074)

:)
Title: Re: AllMovie.com (movies)
Post by: Roland6543 on March 22, 2009, 04:06:52 am
LOL!!! I swear it wasnt there before, but is now. :o

I think the link only appears once you register. In other words:
We search the forums.
We find a thread which seems to solve our problem.
We spend a frustrated 1/2 hr trying to find the "missing link".
We try to post a question, but cant until we register - which we proceed to do.
Soon therafter some friendly person tells us that its in the first post of the thread (exactly where we couldnt find it in the first place)
We rush off and check the thread again..... and..... Now that we have registered the link miraculously appears.
We feel like a humiliated noob!!!

And it works!!!!   Hahaha   :) Gotta love it.

Thanks for the help everyone. Great software.
Title: Re: AllMovie.com (movies)
Post by: rick.ca on March 22, 2009, 04:44:13 am
Quote
We feel like a humiliated noob!!!

Well, don't. You solved a mystery for me. Next time I post something, maybe I'll explain, "Here a great script, but you can't have it, or even see it, until you log in!" ;D
Title: Re: AllMovie.com (movies)
Post by: blue334 on April 04, 2009, 11:22:21 am
It seems this script isn't working at the moment (yes I have the latest version).
I doesn't retrieve correct titles for any movie starting with a common word. I'm also getting a lot of division by zero errors on the ratings.

Title: Re: AllMovie.com (movies)
Post by: rick.ca on April 04, 2009, 11:36:47 am
There's a known issue in the program causing the problem with search results. Hopefully, this will be resolved in 0.9.9.5—due out shortly. I don't believe I've seen any division by zero errors. Do you see any pattern?
Title: Re: AllMovie.com (movies)
Post by: blue334 on April 04, 2009, 08:47:02 pm
I can't see any pattern, and maybe it doesn't even have to do with ratings. I was guessing as much because the rating field is not updated for those entries which show this error.
(http://img21.imageshack.us/img21/4879/20090404213634.png)
Title: Re: AllMovie.com (movies)
Post by: nostra on April 04, 2009, 09:25:48 pm
Post a couple of movie titles that produce the error.
Title: Re: AllMovie.com (movies)
Post by: blue334 on April 04, 2009, 09:28:14 pm
Found it I think, the error is related to web address formatting:

Example:
http://allmovie.com/work/black-widow-123424 - error
http://www.allmovie.com/work/black-widow-123424 - no error

But addresses without www are ok if the MPAA field is not enabled, seems the script requires www only for that particular field
Title: Re: AllMovie.com (movies)
Post by: Reset on April 04, 2009, 10:08:29 pm
In an attachment there is a script which works both with www, and without www.

[attachment deleted by admin]
Title: Re: AllMovie.com (movies)
Post by: rick.ca on April 05, 2009, 03:09:58 am
In an attachment there is a script which works both with www, and without www.

Nostra, the version attached to your first message should probably be replaced with this version. (Pending a better way to keep track of these things. :-\ )
Title: Re: AllMovie.com (movies)
Post by: rick.ca on May 30, 2009, 02:33:16 am
I'm still confused (perhaps because I use my own modified version (http://www.videodb.info/forum_en/index.php?topic=1232.0) of the script now). Where should users get the current version of the "official" script (now 0.1.0.4) if they need it separately from the installation package? It appears http://www.videodb.info/bin/plugins/scripts.zip is not up-to-date.
Title: Re: AllMovie.com (movies)
Post by: nostra on May 30, 2009, 02:40:57 am
I'm still confused (perhaps because I use my own modified version (http://www.videodb.info/forum_en/index.php?topic=1232.0) of the script now). Where should users get the current version of the "official" script (now 0.1.0.4) if they need it separately from the installation package? It appears http://www.videodb.info/bin/plugins/scripts.zip is not up-to-date.

Oh, right. I'll update the archive. Thx for reminding me.
Title: Re: AllMovie.com (movies)
Post by: nostra on May 30, 2009, 02:43:09 am
Done