English > Scripts and Templates

AllMovie+ script: Including data for custom fields

<< < (2/10) > >>

darichman:
Thanks, that was really helpful... I agree that it's nice to know where the data came from. Up until now, I've been using IMDb for all standard fields, with AMG fields all belonging to custom fields with a "AMG " prefix. It's hard to get the best of both worlds... custom fields don't work too well with "People" fields...

A template to decide which order fields are displayed in would work really well, for both standard and custom fields I think...

rick.ca:

--- Quote ---A few little niggly bits I've noticed so far...
--- End quote ---

Thanks! My routine of downloading from two sources is concealing some bugs.


--- Quote ---1. Box Office doesn't format correctly in the standard field. Works fine as a "short text" custom entry
--- End quote ---

Yes, I started with a custom field, but then decided I would prefer to use the standard. So I reverted to nostra's code. A simple dollar figure seems to work. But "$106,260,000/ Top grossing film of 1979" becomes "1,062,600,009" (!) Obviously the standard field is numeric. So I added the "+ 1" in the following:


--- Code: --- //Box office
 curPos := PosFrom('<span>Box office</span>', HTML, EndPos);
 if curPos > 0 then begin
  curPos := PosFrom('<li>', HTML, curPos) + 5;
  EndPos := PosFrom('</li>', HTML, curPos);
  TmpStr := Copy(HTML, curPos, EndPos - curPos);
  curPos := Pos('/', TmpStr);
  if curPos > 0 then
   Delete(TmpStr, curPos, Length(TmpStr) - curPos + 1);     <-----
  curPos := Pos(':', TmpStr);
  if curPos > 0 then
   Delete(TmpStr, curPos, Length(TmpStr) - curPos + 1);     <-----
  AddFieldValueXML('money', TmpStr);
 end;
--- End code ---

I don't really understand the code (imagine a monkey banging on the keyboard :-[ ), so I'm not sure if that's an appropriate modification, although it seems to work for ones I can find. Allmovies doesn't seem to have much box office data—which is why I decided against an additional custom field. :-\


--- Quote ---2. Your MPAA + Reason formatting works okay, but if there is no reason listed, you get an output of "Rated M for ." etc
--- End quote ---

Yes, just being lazy here. I only use this a backup to IMDb, which normally have exactly the same data (that's where the "Rated X for ..." format comes from). I couldn't be bothered fixing it for the rare case where IMDb would not have the data, and allmovie would have the rating but not the reason. Still, just fixing it would be easier than making excuses...


--- Code: --- //MPAA Reasons
 TmpStr1 := HTMLValues(HTML, '<span>MPAA Reasons</span>', '</table>', '<li>', '</li>', ', ', EndPos);
 if (TmpStr1 = '') AND (TmpStr2 <> '') then
 AddFieldValue(mfMPAA, 'Rated ' + TmpStr2);
 if (TmpStr1 <> '') AND (TmpStr2 <> '') then
 AddFieldValue(mfMPAA, 'Rated ' + TmpStr2 + ' ' + TmpStr1 + '.');
--- End code ---

...well, maybe not. I think that does it, but I'm not sure. :-\


--- Quote ---3. I added support for the "Region" field in AMG.
--- End quote ---

I think that the one that only occurred in 2% of my movies—so I deleted it. There are a number of such obscure items. The site design is very annoying. Tags like that are usually linked to a page with a definition of the term and/or a list of movies with the tag value, but there's no other way to access those pages. In other words, I have to know of a movie tagged with a region before I can find out anything about that tag. To enumerate a few examples...

854: From Play
855: From Poem By
856: From Poem
857: From Screenplay By
858: From Screenplay
860: From Story
861: Lampoons "Name" (?)
862: Location
862: Movie Budget
862: Recognizable Quote...

Sorry—thought I might find "Region" or something interesting if I kept going. I think they're on drugs, or just want to piss-off script writers. ;)

If only we had the entire list of tags and they appeared on the page in tag number order (they don't), that would be a more reliable way to reference these items, and perhaps aggregate some of them into something useful. For example, the "From" ones could be combined into one field populated with "From book ____",  "From play ____", etc. )I combined Book and Story, but I couldn't find the rest.)


--- Quote ---4. I seem to get a rating of 10 for every movie... must have a closer look.
--- End quote ---

Their rating tend to be generous, but that's not right. I don't know why this may cause you a problem, but note the script is using a custom field, rather than the usual (i.e., as in nostra's version) Other rating field.


--- Quote ---I'm not sure if it was you or Nostra who added the Reviews and Production Credits functionality, but that's awesome
--- End quote ---

That would be nostra. I'm hoping you'll study his technique and use it to grab the "Similar Works" entries from the Overview page and save them as Connections. While it wouldn't be quite as useful, it would nevertheless be super-awesome! Besides, there's nothing left to grab, so this one's yours. ;D

darichman:
Oh wow, I've never seen some of those fields up there! haha

Yeah, I'd like that extra info too... I wonder how it would be best presented though - maybe in a note/memo field. I'll have a look - but my approach so far has been similar to yours... look at the existing script and trying to adapt it without breaking it. I've broken it a few dozen times now :)

rick.ca:

--- Quote ---I'd like that extra info too...
--- End quote ---

I figured analyzing the tag URLs would be a good way to figure out what information is there and how it's organized. See attached bookmarks file (remove the .TXT and open in browser and/or import bookmarks). I gave up after 1,555 (tag numbers up to 2,200). Still no sign of Region.  ::)

Note many of the URLs have no information other than the name of the tag. Others have a brief description, definition or instruction. Many are to lists of movies with the tag—so the link to those can be useful. You know, when you just have to have direct link to movies made in Albania... ;)

[attachment deleted by admin]

rick.ca:

--- Quote from: Reset on April 04, 2009, 10:08:29 pm ---In an attachment there is a script which works both with www, and without www.

--- End quote ---

Applied same fix to this script (attached to first message above).

Thanks, Reset.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version