English > Development
make Custom Field names same as Directors (ctDirectors)
ferofrantisek:
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
Ivek23:
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;
ferofrantisek:
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?
Ivek23:
--- Quote from: ferofrantisek on September 11, 2014, 10:42:54 am ---Thank you very much for code, url is working.
--- End quote ---
Welcome.
--- Quote from: ferofrantisek on September 11, 2014, 10:42:54 am ---Field must be only memo.
--- End quote ---
Yes, the correct conclusion.
--- Quote from: ferofrantisek on September 11, 2014, 10:42:54 am ---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?
--- End quote ---
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?
--- End quote ---
ferofrantisek:
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;
Navigation
[0] Message Index
[#] Next page
Go to full version