Author Topic: make Custom Field names same as Directors (ctDirectors)  (Read 3103 times)

0 Members and 1 Guest are viewing this topic.

Offline ferofrantisek

  • Member
  • *
  • Posts: 21
    • View Profile
make Custom Field names same as Directors (ctDirectors)
« on: September 08, 2014, 11:45:08 am »
Hi.
I would like ask if someone could help. Sorry for my bad English. I am doing script for anime database http://anidb.net.  I would like make Field names same as Directors (ctDirectors) but with names Original Work:, Story Composition:, Series Composition: with url reference and with switch to people. (so I can group movies by Original Work and show movies with original work = …) I make this but link to URL is not working as in Director: and I am getting stuck.  Original Work is type multiselect list in Custom Field. Output is in the field Original Work:
<link url="http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=147">Tomino Yoshiyuki
<link url="http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=1352">Yatate Hajime
script:
//Original Work:  ~ source for example: http://anidb.net/perl-bin/animedb.pl?show=anime&aid=6517
curPos := Pos('">Original Work:</a', HTML);
LogMessage('17 Original Work: ');
 if curPos > 0 then begin
  EndPos := curPos;
  TmpStr := '';
  curPos := PosFrom('creatorid=', HTML, curPos);
  curPos1 := PosFrom('</tr>', HTML, EndPos)
  LogMessage('17.1                      zistujem ci zacina cyklus');
 while (curPos < curPos1) and (curPos > EndPos) do begin               
 URL :=  'http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=' + TextBetween(HTML, 'creatorid=', '">', false, curPos);
  LogMessage('17.2 Original Work:  url '+URL);
          TransName := TextBetween(HTML,  '">', '</a>', false, curPos);
               LogMessage('17.3                       zadavam meno '+TransName);
 curPos := PosFrom('creatorid=', HTML, curPos);
 if TmpStr <> '' then
              TmpStr := TmpStr + #13;
if URL <> '' then
              TmpStr := TmpStr + '<link url="' + URL + '">';
TmpStr := TmpStr + TransName;
 AddCustomFieldValueByName('Original Work:', TmpStr);
   end;
  end;
 Thank you very much. Fero

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: make Custom Field names same as Directors (ctDirectors)
« Reply #1 on: September 09, 2014, 06:01:59 pm »
Welcome, ferofrantisek.

Of course, does not work because it is missing this piece of code
if URL <> '' then
          TmpStr := TmpStr + '</link>';


or this one piece of code
TmpStr := TmpStr + TransName + '</link>';

Now try this, as shown below, it will probably work.

//Original Work:  ~ source for example: http://anidb.net/perl-bin/animedb.pl?show=anime&aid=6517
curPos := Pos('">Original Work:</a', HTML);
LogMessage('17 Original Work: ');
 if curPos > 0 then begin
  EndPos := curPos;
  TmpStr := '';
  curPos := PosFrom('creatorid=', HTML, curPos);
  curPos1 := PosFrom('</tr>', HTML, EndPos)
  LogMessage('17.1                      zistujem ci zacina cyklus');
 while (curPos < curPos1) and (curPos > EndPos) do begin               
 URL :=  'http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=' + TextBetween(HTML, 'creatorid=', '">', false, curPos);
  LogMessage('17.2 Original Work:  url '+URL);
          TransName := TextBetween(HTML,  '">', '</a>', false, curPos);
               LogMessage('17.3                       zadavam meno '+TransName);
 curPos := PosFrom('creatorid=', HTML, curPos);
 if TmpStr <> '' then
              TmpStr := TmpStr + #13;
if URL <> '' then
              TmpStr := TmpStr + '<link url="' + URL + '">';
TmpStr := TmpStr + TransName;
if URL <> '' then
          TmpStr := TmpStr + '</link>';
 AddCustomFieldValueByName('Original Work:', TmpStr);
   end;
  end;

or such variant

//Original Work:  ~ source for example: http://anidb.net/perl-bin/animedb.pl?show=anime&aid=6517
curPos := Pos('">Original Work:</a', HTML);
LogMessage('17 Original Work: ');
 if curPos > 0 then begin
  EndPos := curPos;
  TmpStr := '';
  curPos := PosFrom('creatorid=', HTML, curPos);
  curPos1 := PosFrom('</tr>', HTML, EndPos)
  LogMessage('17.1                      zistujem ci zacina cyklus');
 while (curPos < curPos1) and (curPos > EndPos) do begin               
 URL :=  'http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=' + TextBetween(HTML, 'creatorid=', '">', false, curPos);
  LogMessage('17.2 Original Work:  url '+URL);
          TransName := TextBetween(HTML,  '">', '</a>', false, curPos);
               LogMessage('17.3                       zadavam meno '+TransName);

 if TmpStr <> '' then
              TmpStr := TmpStr + #13;
if URL <> '' then
              TmpStr := TmpStr + '<link url="' + URL + '">';
TmpStr := TmpStr + TransName;
if URL <> '' then
          TmpStr := TmpStr + '</link>';
 AddCustomFieldValueByName('Original Work:', TmpStr);

 curPos := PosFrom('creatorid=', HTML, curPos);
   end;
  end;
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline ferofrantisek

  • Member
  • *
  • Posts: 21
    • View Profile
Re: make Custom Field names same as Directors (ctDirectors)
« Reply #2 on: September 11, 2014, 10:42:54 am »
Thank you very much for code, url is working. Field must be only memo. How do i do that in the PDV that I could show movies with Original Work or  group movies by Original Work same as the Director and Actors?

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: make Custom Field names same as Directors (ctDirectors)
« Reply #3 on: September 11, 2014, 01:23:55 pm »
Thank you very much for code, url is working.

Welcome.

Field must be only memo.

Yes, the correct conclusion.

How do i do that in the PDV that I could show movies with Original Work or  group movies by Original Work same as the Director and Actors?

Yes, it is possible as follows:

This piece of code
AddCustomFieldValueByName('Original Work by:', TransName);

to add in this code

//Original Work:  ~ source for example: http://anidb.net/perl-bin/animedb.pl?show=anime&aid=6517
curPos := Pos('">Original Work:</a', HTML);
LogMessage('17 Original Work: ');
 if curPos > 0 then begin
  EndPos := curPos;
  TmpStr := '';
  curPos := PosFrom('creatorid=', HTML, curPos);
  curPos1 := PosFrom('</tr>', HTML, EndPos)
  LogMessage('17.1                      zistujem ci zacina cyklus');
 while (curPos < curPos1) and (curPos > EndPos) do begin               
 URL :=  'http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=' + TextBetween(HTML, 'creatorid=', '">', false, curPos);
  LogMessage('17.2 Original Work:  url '+URL);
          TransName := TextBetween(HTML,  '">', '</a>', false, curPos);
               LogMessage('17.3                       zadavam meno '+TransName);
 curPos := PosFrom('creatorid=', HTML, curPos);
 if TmpStr <> '' then
              TmpStr := TmpStr + #13;
if URL <> '' then
              TmpStr := TmpStr + '<link url="' + URL + '">';
TmpStr := TmpStr + TransName;
if URL <> '' then
          TmpStr := TmpStr + '</link>';
 AddCustomFieldValueByName('Original Work:', TmpStr);
AddCustomFieldValueByName('Original Work by:', TransName);
   end;
  end;

Custom field name:
Original Work by:

Custom field
Custom field can not be memo, but it can be Select list or Multiselect list
.
Then will be made ​​to
Quote
... show movies with Original Work or  group movies by Original Work same as the Director and Actors?
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline ferofrantisek

  • Member
  • *
  • Posts: 21
    • View Profile
Re: make Custom Field names same as Directors (ctDirectors)
« Reply #4 on: September 17, 2014, 11:28:42 am »
Thank you very much but maybe i didn’t understand accurate or write correct, because when I push right button on mouse on fields of Director or Actors there are options  / Show movies only with Actors =  … or  Group movies by Actors /. Fields Director or Actors also have url reference.  So I would like if it possible to do with CustomField  for example 'Original Work:’

When I add code AddCustomFieldValueByName('Original Work by:', TransName);  i create new field 'Original Work by:' but these information already are saved in 'Original Work:’

I tested that CustomField must be only memo because this can hide url reference and after that url working.

This code i use for actors and working.


//Seiyu ~ctActors~

curPos := Pos('<h4>main cast</h4>', HTML);
LogMessage('21 zistujem ci su Actors');
 if curPos > 0 then begin
 curPos := PosFrom('creatorid=', HTML, curPos);
EndPos  := curPos;
curPos1 := PosFrom('">show more</a></td>', HTML, curPos)
LogMessage('21.1 zadávam Actors');
while (curPos < curPos1) do begin

  URL :=  'http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=' + TextBetween(HTML, 'creatorid=', '">', false, curPos);
  LogMessage('20.2      zadavam url Actors '+URL);
 
     TransName := TextBetween(HTML,  '">', '</a>', false, curPos);

    LogMessage('20.3      zadavam meno Actors '+TransName);
    curPos := PosFrom('charid=', HTML, curPos);
    URLr :=  'http://anidb.net/perl-bin/animedb.pl?show=character&charid=' + TextBetween(HTML, 'charid=', '">', false, curPos);
    LogMessage('20.4      zadavam url role '+URLr)
   
    Role := TextBetween(HTML,  '">', '</a>', false, curPos);
       LogMessage('20.3      zadavam meno role '+Role);
          
 curPos := PosFrom('creatorid=', HTML, curPos);

  AddMoviePerson('', TransName, Role, URL, ctActors);
  end;


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: make Custom Field names same as Directors (ctDirectors)
« Reply #5 on: September 22, 2014, 07:11:42 am »
I tested that CustomField must be only memo because this can hide url reference and after that url working.

This code i use for actors and working.


//Seiyu ~ctActors~

curPos := Pos('<h4>main cast</h4>', HTML);
LogMessage('21 zistujem ci su Actors');
 if curPos > 0 then begin
 curPos := PosFrom('creatorid=', HTML, curPos);
EndPos  := curPos;
curPos1 := PosFrom('">show more</a></td>', HTML, curPos)
LogMessage('21.1 zadávam Actors');
while (curPos < curPos1) do begin

  URL :=  'http://anidb.net/perl-bin/animedb.pl?show=creator&creatorid=' + TextBetween(HTML, 'creatorid=', '">', false, curPos);
  LogMessage('20.2      zadavam url Actors '+URL);
 
     TransName := TextBetween(HTML,  '">', '</a>', false, curPos);

    LogMessage('20.3      zadavam meno Actors '+TransName);
    curPos := PosFrom('charid=', HTML, curPos);
    URLr :=  'http://anidb.net/perl-bin/animedb.pl?show=character&charid=' + TextBetween(HTML, 'charid=', '">', false, curPos);
    LogMessage('20.4      zadavam url role '+URLr)
   
    Role := TextBetween(HTML,  '">', '</a>', false, curPos);
       LogMessage('20.3      zadavam meno role '+Role);
          
 curPos := PosFrom('creatorid=', HTML, curPos);

  AddMoviePerson('', TransName, Role, URL, ctActors);
  end;

Yes, since you information about Actors transferred to normal Actors field the same also for Directors, Writers, Composers and Producers information. Otherwise, if such information is transferred to the memo custom fields. Here, it is necessary already in the script write such a code, that the url link already been added to record the information in the memo custom Fields. Then the url will really work.

Nostra could tell something more about this topic, but unfortunately it has long been absent.

Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


 

anything