Batch Script to replace only actor field based on URL!?!?

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
Mikefox

Batch Script to replace only actor field based on URL!?!?

Post by Mikefox »

My DVD list is complete (920) but I wan't to replace the actor field with only 10 actors without the caracter they play.

Can somebody make a Batch Script that replaces the existing actor fields based on an URL search for all movies.

Because I have all the URL's from IMDB so it should be faster to get them from the page without a movie search.


I hope somebody can create this!

THX in advance :grinking:
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

No need to fetch that on IMDB since you only want to remove parts of existing info ;)
What does the actor field currently look like ?
Mikefox

Post by Mikefox »

antp wrote:No need to fetch that on IMDB since you only want to remove parts of existing info ;)
What does the actor field currently look like ?
At this moment the actor fields looks like this:
Tommy Lee Jones (as Col. Hayes 'Hodge' Hodges), Samuel L. Jackson (as Col. Terry L. Childers), Guy Pearce (as Maj. Mark Biggs), Ben Kingsley (as Ambassador Mourain), Bruce Greenwood (I) (as National Security Advisor Bill Sokal), Anne Archer (as Mrs. Mourain), Blair Underwood (as Capt. Lee), Philip Baker Hall (as Gen. H. Lawrence Hodges), Dale Dye (as Gen. Perry), Amidou (as Dr. Ahmar), Mark Feuerstein (as Tom Chandler), Richard McGonagle (as Judge Col. E. Warner), Baoan Coleman (as Col. Binh Le Cao), Nicky Katt (as Hayes Hodges III), Ryan Hurst (as Cpl. Hustings)

THX for the quick respond antp :grinking: (bedankt!)
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

this should work, but make a backup of your catalog before :D :

Code: Select all

program NewScript;
var
  s: string;
  ParCount, ParPos: Integer;
  ActCount: Integer;
  p: Integer;
begin
  ParCount := 0;
  ParPos := 0;
  s := GetField(fieldActors);
  p := 1;
  while p <= Length(s) do
  begin
    if StrGet(s, p) = '(' then
    begin
      if ParCount = 0 then
        ParPos := p;
      ParCount := ParCount + 1;
    end
    else
    if StrGet(s, p) = ')' then
    begin
      ParCount := ParCount - 1;
      if ParCount < 1 then
      begin
        ParCount := 0;
        Delete(s, ParPos - 1, p - ParPos + 2);
        p := ParPos - 1;
      end;
    end;
    p := p + 1;
  end;
  ActCount := 0;
  p := 1;
  while p <= Length(s) do
  begin
    if StrGet(s, p) = ',' then
    begin
      ActCount := ActCount + 1;
      if ActCount = 10 then
        Delete(s, p, Length(s));
    end;
    p := p + 1;
  end;
  SetField(fieldActors, s);
end.
Mikefox

Post by Mikefox »

Works brilliantly!!

THX ANTP!!! :grinking:
Post Reply