Author Topic: AllMovie+ script: Including data for custom fields  (Read 54043 times)

0 Members and 7 Guests are viewing this topic.

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #20 on: April 13, 2010, 09:21:05 pm »
I don't know. For other data in the left bar, the script takes advantage of the fact the target data is hyperlinked. That one is not, so a different technique is required. I'm sure it's not difficult for someone who understands how to do it, but that's not me.

Why do you need it? It's included in the URL.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #21 on: April 14, 2010, 05:27:55 am »
But I have found this in the url,whipping post so I left it for others.
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: AllMovie+ script: Including data for custom fields
« Reply #22 on: April 14, 2010, 10:19:56 am »
rick.ca
I have a question:

May I with your permission to publish the script AllMovie +modified,
I have organized my liking.

Works great for me.
« Last Edit: April 14, 2010, 10:22:32 am 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: AllMovie+ script: Including data for custom fields
« Reply #23 on: April 14, 2010, 10:34:51 am »
Sure, but please post it in a new topic and give it a different name (maybe "IvexAllmovie" ;) ). We don't want it confused with my version or nostra's original.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #24 on: April 14, 2010, 01:05:53 pm »
OK,Thanks.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline deazo

  • Older Power User
  • *****
  • Posts: 283
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #25 on: June 29, 2010, 05:01:17 pm »
 Hi Rick,

 I am using your script to scrape the review from allmovie and I would also like to have the 'tones' added to my movies.
 My problem is that I would like to keep my tags and add a similar 'Tones' field.
 If I use the modification provided by Ivek23 I get the tones, but not as clickable items. I really would like to have them as clickable items (like tags are). Would you know how?
 Thanks in advance.

NOTE: I have also just noticed that when using your script the rating is not captured, and when using the original one, it is. My overwrite options are the same for the two scripts.
 
D
« Last Edit: June 29, 2010, 05:21:35 pm by deazo »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #26 on: June 29, 2010, 05:40:09 pm »
Quote
I really would like to have them as clickable items (like tags are).

That's a characteristic unique to standard list fields. More generally, only standard fields can be used in a Simple search—which is what the link invokes.

I find Allmove Tones make much better use of this feature than IMDb Keywords. There are far too many keywords for a search of any one of them to be meaningful.

Offline deazo

  • Older Power User
  • *****
  • Posts: 283
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #27 on: June 29, 2010, 06:41:40 pm »

 You're right, there are too many tags.
 Still if I want to watch a movie say on Palestine, the "palestine" tag will be there, while the tone will not.
 Is there a list of Allmovie tones somewhere?
 I guess it's up to me to choose what I prefer to use, thanks for the info.

 In terms of rating, I have noticed that If I want to add the Allmovie rating with your script I will have to add a custom field called "Allmovie rating". I would like to still use the original script way which is changing "additional rating" into "allmovie rating".
 Could you tell me what I need to change?

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #28 on: June 29, 2010, 07:08:12 pm »
Is there a list of Allmovie tones somewhere?

I don't recall where/how I got it, but...

Code: [Select]
Affectionate
Angry
Atmospheric
Austere
Autumnal
Biting
Bittersweet
Bleak
Bright
Campy
Cathartic
Cerebral
Chilly
Claustrophobic
Compassionate
Confrontational
Creepy
Cynical
Deadpan
Decadent
Deliberate
Disturbing
Downbeat
Drab
Dreamlike
Earnest
Earthy
Easygoing
Eerie
Elegant
Elegiac
Enigmatic
Fanciful
Flashy
Forceful
Frantic
Gentle
Gloomy
Goofy
Goth
Grim
Gritty
Gruesome
Hallucinatory
Harsh
Heartwarming
Humorous
Intimate
Ironic
Irreverent
Lavish
Light
Literate
Lurid
Lyrical
Macabre
Madcap
Matter-of-Fact
Meditative
Melancholy
Menacing
Merry
Moody
Nocturnal
Nostalgic
Ominous
Paranoid
Passionate
Poignant
Quirky
Racy
Raunchy
Reflective
Rousing
Satirical
Sensual
Sentimental
Sexual
Sexy
Silly
Slick
Somber
Springlike
Stirring
Stylish
Stylized
Summery
Sweeping
Sweet
Talky
Tearjerking
Tense
Understated
Upbeat
Visceral
Warm
Whimsical
Wintry
Wistful
Witty
Wry

Quote
Could you tell me what I need to change?

Not off-hand, but I'm sure you could figure it out by comparing the two scripts.

You may want to consider leaving it as is. Should you ever want to get a second rating using a plugin (rather than a script), using orating is the only option.

Offline deazo

  • Older Power User
  • *****
  • Posts: 283
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #29 on: June 29, 2010, 07:42:05 pm »

 Yes but so far I have already added the Allmovie ratings with the other script (original one) so if I add it with your script I will double the info.
 I have tried to paste the rating part of the original script into yours to no success.*
 Anyway I will just run the original before running yours.
 Thanks for the list of tones (and all your support) by the way.

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #30 on: June 29, 2010, 10:10:55 pm »
Quote
I have tried to paste the rating part of the original script into yours to no success.

I don't know why not. It looks like the essential difference is just using...

AddFieldValue(mfRating, FloatToStr(StrToFloat(Copy(HTML, curPos, EndPos - curPos)) * 2));

instead of...

AddCustomFieldValueByName('AllMovie rating', FloatToStr(StrToFloat(Copy(HTML, curPos, EndPos - curPos)) * 2));

If you start the program with the -debug switch, the log will show any script errors.

Offline deazo

  • Older Power User
  • *****
  • Posts: 283
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #31 on: June 30, 2010, 11:02:27 am »

 This works great thank you  :D

Offline Hyomil

  • User
  • ***
  • Posts: 96
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #32 on: July 14, 2010, 12:39:46 am »
I've started importing the Allmovie reviews into a custom memo field, but there are no paragraph breaks like there are with the user reviews for the IMDb plugin.  I checked 2 reviews

http://www.allmovie.com/work/twilight-420151/review
http://www.allmovie.com/work/obsessed-433716/review

and both have multiple paragraphs on the website but are one long paragraph when imported into the memo field.  Any idea why this could be happening?

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #33 on: July 14, 2010, 03:10:46 am »
I don't know. It's always been that way, and I'm sure the original script is the same.

According to the Scripting Manual, the doLineBreaks parameter of the TextBetween function is to be "set to true if you want the <br> tag to be replaced with carriage return character." It is, but it doesn't seem to work. I don't understand these things, but I wonder if it's because this is XHTML and only the closing form of the tag—<br />—is used. In any case, the tags are not being converted, and the result of the function is to "return the resulting substring without tags"—so they just get stripped.

I would need nostra to fix the function, or suggest a workaround. I suppose it could be handled using different functions, but I'm unable figure it out. :'(

Offline Hyomil

  • User
  • ***
  • Posts: 96
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #34 on: July 14, 2010, 03:52:48 am »
Hmm, since the IMDb plugin is a DLL and not a script, I presume there's no way to examine it to see how nostra did it for the IMDb user reviews.  Have you noticed if any of the other Movie Information scripts are able to do the conversion successfully?

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #35 on: July 14, 2010, 04:16:47 am »
No and no. Hopefully, nostra can help.

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: AllMovie+ script: Including data for custom fields
« Reply #36 on: July 19, 2010, 07:18:10 pm »
You can use the StringReplace function to replace any type of Line Break tags and characters in proper ones (#13#10)
Gentlemen, you can’t fight in here! This is the War Room!

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #37 on: July 19, 2010, 08:30:24 pm »
You under estimate the degree of my helplessness. :-[

I thought of that, but I can't figure out how to get the string without using TextBetween. If I do, the tags are stripped, and there's nothing to replace. :-\

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: AllMovie+ script: Including data for custom fields
« Reply #38 on: July 19, 2010, 10:01:19 pm »
Alright then:
1. Find the position of starting tag using the PosFrom or Pos function and save it to a variable
2. Find the position of ending tag using the PosFrom or Pos function and save it to another variable
3. Use the Copy function to retrieve the text between starting tag and ending tag
4. Use StringReplace function to remove unneeded substrings or replace substrings
Gentlemen, you can’t fight in here! This is the War Room!

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie+ script: Including data for custom fields
« Reply #39 on: July 20, 2010, 12:46:18 am »
I'm still not getting anywhere. Following is my attempt to do as you suggest...

Code: [Select]
procedure ParseReview(HTML : String);
var
 curPos, endPos : Integer;
 TmpStr, TmpStr1, TmpStr2 : String;
begin
 curPos := Pos('<div id="results-table">', HTML);
 endPos := curPos
 if curPos < 1 then
  Exit;
   
 //Review
 curPos := PosFrom('<td colspan="2">', HTML, curPos);
 endPos := PosFrom('</p></td>', 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, '<br />', #13#10, True, True, False);
 TmpStr2 := RemoveTags(TmpStr1, True);
 AddCustomFieldValueByName('Review', TmpStr2);
end;

The  TmpStr1 := StringReplace(TmpStr, '<br />', #13#10, True, True, False); line does nothing. It seems the Copy function removes the <br /> tags, so there's nothing to replace. And even if there were something to replace, the #13#10 doesn't seem to be recognized by the function.

The result of the Copy function is a set of four CRLF between paragraphs. This, of course, results in three blank lines instead of one, as desired.