Author Topic: Script: TheMovieDB [ES] (Easy API Script)  (Read 58756 times)

0 Members and 2 Guests are viewing this topic.

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #20 on: September 21, 2014, 07:17:58 pm »
CHANGE LOG (21/09/2014):
            v 0.1.7.1   VVV: Adjust WEB_SPECIFIC to new API.
(Edito: New version down)
« Last Edit: December 06, 2014, 07:07:27 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #21 on: September 22, 2014, 06:44:47 pm »
Thanks, script works fine, but find a small cosmetic bug in Actors:

Info in Actors field
Quote
John Wayne ... s Col John Marlowe
William Holden ... s Major 'Hank' Kendall
Constance Towers ... s Miss Hannah Hunter
Judson Pratt ... s Sgt Major Kirby
and part of code
Code: [Select]
              Delete(Role,1,Length('                        as '));             //WEB_SPECIFIC
After correcting this part of the code
Code: [Select]
              Delete(Role,1,Length('                         as '));             //WEB_SPECIFICand the info in Actors field such without cosmetic defects
Quote
John Wayne ... Col John Marlowe
William Holden ... Major 'Hank' Kendall
Constance Towers ... Miss Hannah Hunter
Judson Pratt ... Sgt Major Kirby

The correction in this part of the code:
function GetPVDMoviePersonListValue
Code: [Select]
//===============================
const
// Web delimiters. Null '' value it's not valid. WEB_SPECIFIC
    WebCreditURLBegin = '<a href="';               //String which opens the Web Result URL text. WEB_SPECIFIC
    WebCreditURLEnd = '" itemprop="url">';         //String which closes the Web Result URL text. WEB_SPECIFIC
    WebCreditPhotoURLBegin = '<img src="';         //For Actors: String which opens the Web Result Photo URL text. WEB_SPECIFIC
    WebCreditPhotoURLEnd = '" width=';             //For Actors: String which closes the Web Result Photo URL text. WEB_SPECIFIC
    WebCreditNameBegin = '<span itemprop="name">'; //String which opens the Web Result Name text. WEB_SPECIFIC
    WebCreditNameEnd = '</span>';              //String which closes the Web Result Name text. WEB_SPECIFIC
    WebCreditRoleBegin = '</a>';                    //For Actors: String which opens the Web Result Role text. WEB_SPECIFIC
    WebCreditRoleEnd = '</span>';                //For Actors: String which closes the Web Result Role text. WEB_SPECIFIC
function GetPVDMoviePersonListValue(HTML:String ;Pos:Integer;PVDCreditType:Integer;WebCreditText:String;WebCreditOpen:String;WebFieldBegin:String; WebFieldEnd:String):Integer;
  var
    curPos,endPos,endPosList :Integer;
    Name,Role,URL:String;

  begin
    LogMessage('procedure GetPVDMoviePersonListValue');
    //PVDCreditType - Personal Video Database credit type
    //WebCreditText - Name of Web Credit. Only for Debuging option.
    //WebCreditOpen - String which opens the Web Credit data.

    curPos:=PosFrom(WebCreditOpen,HTML,Pos)+Length(WebCreditOpen);
    endPosList:=PosFrom(WebFieldEnd,HTML,curPos);
    curPos:=PosFrom(WebFieldBegin,HTML,curPos)+Length(WebFieldBegin);
    while curPos < endPosList do begin
      LogMessage('Parsing search Person results in '+IntToStr(curPos)+' ...');
      //Get URL + Name
      URL:='';
      Name:='';
      Role:='';
      curPos:=PosFrom(WebCreditURLBegin,HTML,curPos)
      if (0<curPos) and (curPos<endPosList) then begin
          if GET_ACTORS_INFO_URL then begin
              curPos:=curPos+Length(WebCreditURLBegin);
              endPos:=PosFrom(WebCreditURLEnd,HTML,curPos);
              URL:=BASE_URL+Copy(HTML,curPos,endPos - curPos);
          end else if PVDCreditType=ctActors then begin                 //For Actors changed a Photo URL. WEB_SPECIFIC
              curPos:=PosFrom(WebCreditPhotoURLBegin,HTML,curPos)
              curPos:=curPos+Length(WebCreditPhotoURLBegin);
              endPos:=PosFrom(WebCreditPhotoURLEnd,HTML,curPos);
              URL:=Copy(HTML,curPos,endPos - curPos);
              URL:=StringReplace(URL,'w45','original',True,True,False);         //WEB_SPECIFIC
          end;
          LogMessage('      Parse Results Person URL:'+URL+'||'+IntToStr(PVDCreditType));
          curPos:=PosFrom(WebCreditNameBegin,HTML,curPos)+Length(WebCreditNameBegin);
          endPos:=PosFrom(WebCreditNameEnd,HTML,curPos);
          Name:=RemoveTags(Copy(HTML,curPos,endPos - curPos),False);
          LogMessage('      Parse Results Person Name:'+Name+'||'+IntToStr(PVDCreditType));
          curPos:=endPos+Length(WebCreditNameEnd);
          if (PVDCreditType=ctActors) then begin
              curPos:=PosFrom(WebCreditRoleBegin,HTML,curPos);               //For Actors gets Role
              curPos:=curPos+Length(WebCreditRoleBegin);
              endPos:=PosFrom(WebCreditRoleEnd,HTML,curPos);
              Role:=Copy(HTML,curPos,endPos - curPos);
              Role:=RemoveTags(Role,False);                                     //WEB_SPECIFIC
              Delete(Role,1,Length('                         as '));             //WEB_SPECIFIC
              Role:=Copy(Role,1,Length(Role)-Length('                      ')); //WEB_SPECIFIC
              LogMessage('      Parse Results Actors Role:'+Role+'||'+IntToStr(PVDCreditType));
              curPos:=endPos+Length(WebCreditRoleEnd);
          end;
          AddMoviePerson(Name,'',Role,URL,PVDCreditType);
      end else begin
          curPos:=endPosList;
      end;
    end;
    Result:=endPosList+Length(WebFieldEnd); //Last position of the list.
  end;
//===============================
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #22 on: December 06, 2014, 06:48:53 pm »
CHANGE LOG (06/12/2014):
            v 0.1.7.2   VVV: Adjust WEB_SPECIFIC to new Cast API. Ivek23 improvements
Attached the new versión
(Edito: New version down)
« Last Edit: December 21, 2014, 09:44:16 am by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #23 on: December 07, 2014, 12:56:26 pm »
Thanks, script works fine.

If the script open this option,
Code: [Select]
LANG_STR      = '?language=es'; but in this movie Little House on the Prairie (1974) find a cosmetic bug in Overview (Description):

Info in Description field
Quote
l><html lang="es"><head>  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  <title>Little House on the Prairie (1974) — The Movie Database</title>  <meta http-equiv="X-UA-Compatible" content="IE=edge" />  <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/6efb98679ac650d00fb834856373621f/stylesheets/kendo-2013.3.1119/kendo.common.min.css" media="screen" rel="stylesheet" type="text/css">  <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/77d719565ba5d76901b3a86b66fb059c/stylesheets/kendo-2013.3.1119/kendo.uniform.min.css" media="screen" rel="stylesheet" type="text/css">  <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/7fd603bea3ca164c7d1bd6e15acd6738/stylesheets/kendo.tmdb-override.css" media="screen" rel="stylesheet" type="text/css">  <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/271e6e828f0b748bb88847a73fccdc18/stylesheets/screen.css" media="screen" rel="stylesheet" type="text/css">  <link href="http://d3a8mw37cqal2z.cloudfront.net/assets/e1e3a96883a7615a6db24c6d0e3078c8/stylesheets/common_new.css" media="screen" rel="stylesheet" type="text/css">  <link rel="apple-touch-icon-precomposed" sizes="57x57" href="http://d3a8mw37cqal2z.cloudfront.net/assets/6d26011c3446214a7a865214a8bd58eb/images/icons/apple-touch-icon-57x57.png">    <link rel="apple-touch-icon-precomposed" sizes="60x60" href="http://d3a8mw37cqal2z.cloudfront.net/assets/90ff34e1460a1bc18e49b293b3dc07d2/images/icons/apple-touch-icon-60x60.png">    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://d3a8mw37cqal2z.cloudfront.net/assets/1195932a092f33eac3082e855d83eb8e/images/icons/apple-touch-icon-72x72.png">    <link rel="apple-touch-icon-precomposed" sizes="76x76" href="http://d3a8mw37cqal2z.cloudfront.net/assets/5ead36dc56b6e4b3a7621e7581b106fd/images/icons/apple-touch-icon-76x76.png">    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://d3a8mw37cqal2z.cloudfront.net/assets/120461b6f34e23e689d313036f33c2c0/images/icons/apple-touch-icon-114x114.png">    <link rel="apple-touch-icon-precomposed" sizes="120x120" href="http://d3a8mw37cqal2z.cloudfront.net/assets/88fa3f9f8b03ad1f0cfc6fb99a8ab370/images/icons/apple-touch-icon-120x120.png">    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://d3a8mw37cqal2z.cloudfront.net/assets/1946cd97a5e4433294397d654c3bc1c6/images/icons/apple-touch-icon-144x144.png">    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="http://d3a8mw37cqal2z.cloudfront.net/assets/99390dc2b4ae2fec3244f748685b471f/images/icons/apple-touch-icon-152x152.png">    <link rel="apple-touch-icon-precomposed" sizes="180x180" href="http://d3a8mw37cqal2z.cloudfront.net/assets/d400682e22f0e9b495267602a5eed761/images/icons/apple-touch-icon-180x180.png">    <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/b986ddc8926c02722708d06c001032a4/images/icons/favicon-16x16.png" sizes="16x16">    <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/654d36c26057026531e1a3eafc4c900c/images/icons/favicon-32x32.png" sizes="32x32">    <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/81c45b25939d2fbd6acc7a67eb31dca9/images/icons/favicon-96x96.png" sizes="96x96">    <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/106d4ebe075848cf21d73763aad08b5a/images/icons/favicon-160x160.png" sizes="160x160">    <link rel="icon" type="image/png" href="http://d3a8mw37cqal2z.cloudfront.net/assets/510b44c7a8e6b8119d1c5f7d105de612/images/icons/favicon-192x192.png" sizes="192x192">    <link rel="canonical" href="http://www.themoviedb.org/movie/39014-little-house-on-the-prairie">  <meta property="og:title" content="Little House on the Prairie" /><meta property="og:type" content="movie" /><meta property="og:url" content="https://www.themoviedb.org/movie/39014-little-house-on-the-prairie" /><meta property="og:image" content="https://image.tmdb.org/t/p/w500/eOMMPpVGpSaRz409vJRuYORmF8X.jpg" /><meta property="og:site_name" content="The Movie Database" /><meta property="fb:app_id" content="141280979243998" />  <meta name="twitter:card" content="summary" /><meta name="twitter:site" content="@themoviedb" /><meta name="twitter:title" content="Little House on the Prairie" /><meta name="twitter:description" content="Get more information about Little House on the Prairie on TMDb." /><meta name="twitter:image" content="https://image.tmdb.org/t/p/w500/eOMMPpVGpSaRz409vJRuYORmF8X.jpg" /><meta name="twitter:image:width" content="500" /><meta name="twitter:image:height" content="750" /><meta name="twitter:url" content="https://www.themoviedb.org/movie/39014-little-house-on-the-prairie" />  <meta name="description" content="The Movie Database (TMDb) is a popular, user editable database for movies and TV shows.">    <meta name="keywords" content="Movies, TV Shows, Reviews, API, Actors, Actresses, Photos, User Ratings, Synopsis, Trailers, Teasers, Credits, Cast">  <meta name="viewport" content="width=device-width, user-scalable=yes">  <!--[if IE]>    <link rel="stylesheet" type="text/css" href="http://d3a8mw37cqal2z.cloudfront.net/assets/e3432461116162e6b9c7aafcffd0f36a/stylesheets/ie_screen.css"></link>  <![endif]-->  <script src="http://d3a8mw37cqal2z.cloudfront.net/assets/a170a53120550c0f705a2c1a4c1275f2/javascripts/jquery-1.9.1.min.js" type="text/javascript"></script>  <script type="text/javascript" charset="utf-8">      var language = "es";      var locale = "si";      var image_url = "http://d3a8mw37cqal2z.cloudfront.net/images/";      var cdn_url = "http://image.tmdb.org/";      var cdn_path = "t/p/";      var keyDown = {};  </script></head><body>  <div id="container">   <div id="navbg"> </div>   <div id="subnavbg" class="movie"> </div>   <div id="header" class="movie">    <a href="/?language=es" alt="TMDb - The Movie Database"><img id="logo" src="http://d3a8mw37cqal2z.cloudfront.net/assets/8d0e15fe2a8e8abf7b14876f9a4f8158/images/tmdb-logo.png" alt="TMDb - The Movie Database" width="260" height="54" /></a>    <div id="meta">  <ul>            <li class="addNew movie"><a href="/movie/new?language=es">Add New Movie</a></li>            <li class="login"><a href="https://www.themoviedb.org/login">Account Login</a></li>  </ul>  <p>    <a href="https://www.themoviedb.org/talk">Forums</a>    <a href="https://www.themoviedb.org/contribute">Contribute</a>    <a href="https://www.themoviedb.org/apps">Apps</a>    <a href="https://www.themoviedb.org/documentation/api">API</a>    <a href="https://www.themoviedb.org/documentation/editing">Help</a>    <a href="https://www.themoviedb.org/account/signup">Sign Up</a>
and part of code
Code: [Select]
  //Get ~description~
    PVDField:='description';                               //For easy programation
    WebFieldText:='      Description:';                    //Only for Debuging
    WebFieldOpen:='<h3>Overview</h3>';
    WebFieldBegin:='"description">';                       //WEB_SPECIFIC
    WebFieldEnd:='</p>';                                   //WEB_SPECIFIC
    curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);

After correcting this part of the code
Code: [Select]
  //Get ~description~
    PVDField:='description';                               //For easy programation
    WebFieldText:='      Description:';                    //Only for Debuging
    WebFieldOpen:='<h3>Overview</h3>';
    WebFieldBegin:='"description">';                       //WEB_SPECIFIC
    WebFieldEnd:='</p>';                                   //WEB_SPECIFIC
    if (0<endPos) and (0<PosFrom('" itemprop="description">',HTML,endPos)) then begin
    curPos:=GetPVDFieldOneValue(HTML,curPos,PVDField,WebFieldText,WebFieldOpen,WebFieldBegin,WebFieldEnd);
    end;
and the info in Description field such without cosmetic defects, the field is now empty, but only for this movie: Little House on the Prairie (1974)


If the script open this option
Code: [Select]
LANG_STR      = '?language=en'; there these problems, which are described above in this movie Little House on the Prairie (1974), I have not found, everything is working properly.


I was tested several variants, but this is the only function properly. Try it, you might find a better solution.
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: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #24 on: December 11, 2014, 07:30:37 am »
Change url address:

from the previous
http://www.themoviedb.org/

to this new url address
 https://www.themoviedb.org/

Script does not work anymore.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #25 on: December 11, 2014, 09:36:42 pm »
Yes  :'( :'(
It seems like PVdB script GET funtion does not recogniced the "https://" prefix.

If I use:
    SEARCH_STR    = 'http://www.themoviedb.org/search/movie?query=%s'
Log Window shows:
    (11/12/2014 21:12:35) Searching movie information for: Little House on the Prairie
    (11/12/2014 21:12:35) GET: http://www.themoviedb.org/search/movie?query=Little+House+on+the+Prairie
    (11/12/2014 21:12:36) Redirected to: https://www.themoviedb.org/search/movie?query=Little+House+on+the+Prairie
    (11/12/2014 21:12:36) IOHandler value is not valid

If I use:
    SEARCH_STR    = 'https://www.themoviedb.org/search/movie?query=%s'
Log Window shows:
    (11/12/2014 21:17:40) Searching movie information for: Little House on the Prairie
    (11/12/2014 21:17:40) GET: http://https://www.themoviedb.org/search/movie?query=Little+House+on+the+Prairie
    (11/12/2014 21:17:43) Socket Error # 11001 Host not found.

I could use the api search:
    http://api.themoviedb.org/3/search/movie?query=%s&api_key=0a4782bd3877917501a2d45e1198f809'
but it's more difficult ( Not Easy Script ;) ).

I will continue working but it is a shame not to correct the problem of the GET function. Any idea?

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
« Last Edit: December 12, 2014, 06:48:43 pm by Ivek23 »
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: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #27 on: December 13, 2014, 01:00:49 pm »
I could use the api search:
    http://api.themoviedb.org/3/search/movie?query=%s&api_key=0a4782bd3877917501a2d45e1198f809'
but it's more difficult ( Not Easy Script ;) ).

I will continue working but it is a shame not to correct the problem of the GET function. Any idea?

Mavbe this api search:
 http://api.themoviedb.org/3/search/movie?query=%s&language=en&include_adult=true&api_key=0a4782bd3877917501a2d45e1198f809

Downloading from:
http://api.themoviedb.org/3/movie/'+MovieID+'&append_to_response=alternative_titles,credits,keywords,images&language=en&api_key=0a4782bd3877917501a2d45e1198f809

I've done a lot of tests, but I did not find any solutions.

Yes  :'( :'(
It seems like PVdB script GET funtion does not recogniced the "https://" prefix

Unfortunately, it is true, as has already been mentioned above and there is no solution for this problem.

As shown in the present example TheMovieDB when the page is
start url address "http://" into "https://" and now the script for this page yet find search results just by using the api-key, the transfer of information from TheMovieDB web pages it does not work anymore.

I think that in the future more and more web pages start url title changed to "https://" and the script and maybe even plugins will no longer work,
because it does not use the api-key options, as is the case TheMovieDB web page.

BTW:
TheMovieDB plugin still works for now, since it uses the api-key.

Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD



Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #29 on: December 14, 2014, 11:52:10 pm »
Completely redone  :) :D :).
It has a Rondabout in GetBaseURL for "cheat" GET PVdB funtion (the fail "https") and this allows using the standard link "http://www.themoviedb.org/movie/".
In addition, the structure of the script is linear, use the record movie_id (imdb or themoviedb) and get much more information.

CHANGE LOG (14/12/2014):
            V 0.2.0.0   VVV: Adjust new API based scrip (not Web search based).
                       (PVdB "GET" scripts funtions doesn't work with 'https' URL).
(Edito: New version down)

Quote
I think that in the future more and more web pages start url title changed to "https://" and the script and maybe even plugins will no longer work,
because it does not use the api-key options, as is the case TheMovieDB web page.
I also afraid that :'(. As many pages do not have (or do not publish) their api_keys I tried to make a script that "would read" pages but now we know that can not work with "https". ;D PVdB new version? ;D Please ....
« Last Edit: December 21, 2014, 09:44:49 am by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #30 on: December 15, 2014, 08:02:43 am »
Very good job, works great, but miss the release date, because it missing in the transfer of information.

It may help this one piece of code to release date:

Code: [Select]
procedure ParseMovie(MovieURL : String; HTML : String);
var
curPos, curPos1, endPos : Integer;
Date, Released, Wpage, Wpage1, TmpStr, TmpStr0, TmpStr1, TmpStr2, TmpStr3 : String;
  DateParts: TWideArray;
begin

//Date ~Updated~ (choose simple or verbose version)
Date := DateToStr(CurrentDateTime);
if Date <> '' then
  begin
    ExplodeString(Date, DateParts, '-');
Date := DateParts[2] +'.'+ DateParts[1] +'.'+ DateParts[0];

Date := StringReplace(Date, '01.', '1.', True, True, False);
Date := StringReplace(Date, '02.', '2.', True, True, False);
Date := StringReplace(Date, '03.', '3.', True, True, False);
Date := StringReplace(Date, '04.', '4.', True, True, False);
Date := StringReplace(Date, '05.', '5.', True, True, False);
Date := StringReplace(Date, '06.', '6.', True, True, False);
Date := StringReplace(Date, '07.', '7.', True, True, False);
Date := StringReplace(Date, '08.', '8.', True, True, False);
Date := StringReplace(Date, '09.', '9.', True, True, False);

AddCustomFieldValueByName('TheMovieDB Updated', Date);  // Simple
// AddCustomFieldValueByName('TheMovieDB Updated', DateToStr(CurrentDateTime));  // Simple
// AddCustomFieldValueByName('TheMovieDB Updated', DateToStr(CurrentDateTime) + ' at ' + TimeToStr(CurrentDateTime));  // Verbose
//  AddCustomFieldValueByName('TheMovieDB Updated', DateToStr(CurrentDateTime) + + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + SCRIPT_NAME + ' ' + SCRIPT_VERSION); // Annoying
//AddCustomFieldValueByName('TheMovieDB Updated1', Date + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + SCRIPT_NAME + ' ' + SCRIPT_VERSION); // Annoying
AddCustomFieldValueByName('TheMovieDB Updated1', Date + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + RATING_NAME + ' ' + SCRIPT_VERSION); // Annoying
  end else
    LogMessage('date not found');

//~Released~
curPos := PosFrom('"release_date":"', HTML, EndPos);
 if curPos > 0 then begin
  curPos := PosFrom('"release_date":"', HTML, EndPos);
endPos := PosFrom('","revenue"', HTML, curPos);
 Released :=  TextBetween(HTML, '"release_date":"', '","revenue"', True, curPos);
    //Released := StringReplace(Released, '01', '1', True, True, False);
//Released := StringReplace(Released, '02', '2', True, True, False);
//Released := StringReplace(Released, '03', '3', True, True, False);
//Released := StringReplace(Released, '04', '4', True, True, False);
//Released := StringReplace(Released, '05', '5', True, True, False);
//Released := StringReplace(Released, '06', '6', True, True, False);
//Released := StringReplace(Released, '07', '7', True, True, False);
//Released := StringReplace(Released, '08', '8', True, True, False);
//Released := StringReplace(Released, '09', '9', True, True, False);
  if Released <> '' then
  begin
    ExplodeString(Released, DateParts, '-');
    Released := DateParts[2] +'.'+ DateParts[1] +'.'+ DateParts[0];
    LogMessage('rdate: '+ Released);
AddFieldValueXML('rdate', Released);
AddCustomFieldValueByName('Release info', Released);
  end else
    LogMessage('rdate not found');
  end;

end;

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: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #31 on: December 15, 2014, 12:05:23 pm »
If you change this
Code: [Select]
  //LANG_API_STR         = '&language=es';                                  //WEB_SPECIFIC
  LANG_API_STR       = '&language=en';                                  //WEB_SPECIFIC
  //LANG_API_STR       = '&language=fr';                                  //WEB_SPECIFIC
and with that part of the code
Code: [Select]
      //Get ~url~
      curPos:=Pos('"homepage":"","id":',HTML)+Length('"homepage":"","id":');    //WEB_SPECIFIC
      endPos:=PosFrom(',',HTML,curPos);                                         //WEB_SPECIFIC
      ItemValue:=Copy(HTML,curPos,endPos - curPos);                                 
      if (0=Pos('null',ItemValue)) then begin                                   //WEB_SPECIFIC. But it's impossible not 'homepage'.
         ItemValue:=StringReplace(ItemValue,'"','',True,True,False);
         ItemValue:=BASE_URL_TRUE+Copy(HTML,curPos,endPos - curPos);
         AddFieldValueXML('url',ItemValue);
         LogMessage('      Get result url:'+ItemValue+'||');
      end;
occur under certain movie to wrong url address
Code: [Select]
http://www.themoviedb.org/movie/ckdrop_path":"/17zArExB7ztm6fjUXZwQWgGMC9f.jpg"
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #32 on: December 21, 2014, 09:49:14 am »
CHANGE LOG (21/12/2014):
            V 0.2.0.1   VVV: Adjust search list Posters width.
                                    Add a comprobation translated LANG_API_STR overview (Description) (User Option TRASLATED_OVERVIEW)
                                    Add the first ~rdate~ Release Date (Ivek23 proposition)
Attached the new versión

(If some movie fails, please send me the title, the bad information and the search language. Thank you.)
(Edito: New version down)
« Last Edit: December 25, 2014, 12:12:04 pm by VVV_Easy_Programing »

Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #33 on: December 25, 2014, 12:14:34 pm »
CHANGE LOG (25/12/2014):
            V 0.2.0.2   VVV: Fixed bug (search URL) with movies with stored IMDB URL.
                                    Fixed bug with URL get (Ivek23 detected)
Attached the new versión.

Merry Christmas!

(Edito: New version down)
« Last Edit: December 27, 2014, 08:08:46 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #34 on: December 25, 2014, 04:58:42 pm »
CHANGE LOG (25/12/2014):
            V 0.2.0.2   VVV: Fixed bug (search URL) with movies with stored IMDB URL.
                                    Fixed bug with URL get (Ivek23 detected)
Attached the new versión.

Thanks.

Merry Christmas!

Same to you.
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: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #35 on: December 26, 2014, 07:23:35 pm »
(If some movie fails, please send me the title, the bad information and the search language. Thank you.)

Yes, I found bugs in Search Results:

Code: [Select]
LANG_STR      = '?language=es';
in this movie World Trade Center find a cosmetic bug in Search Results:

Problematic is the following piece of code,
Code: [Select]
            curPos:=PosFrom('"poster_path":"',HTML,endPos)+Length('"poster_path":"');               //WEB_SPECIFIC
            endPos:=PosFrom('"',HTML,curPos);                                                       //WEB_SPECIFIC
            PreviewURL:='http://image.tmdb.org/t/p/w92'+Copy(HTML,curPos,endPos-curPos);            //WEB_SPECIFIC. w92,w185,w300,w342,original.
            LogMessage('      Parse Results PreviewURL:'+PreviewURL+'||');
when displaying search results, only three addresses are correct, the fourth, which link does not work, and the fifth title of the copies of the first and second title in search results.

After correcting this part of the code
Code: [Select]
function ParsePage(HTML:String;URL:AnsiString):Cardinal;
    var
      curPos,endPos,NumbResult:Integer;
      Title,OriTitle,Year,MovieURL,PreviewURL1,PreviewURL,ItemValue,ItemList,Name,Role,PersonURL:String;     
    begin
.
.
.
            LogMessage('      Parse Results Year:'+Year+'||');
            curPos:=PosFrom('"poster_path":',HTML,endPos)+Length('"poster_path":');               //WEB_SPECIFIC
            endPos:=PosFrom('"popularity"',HTML,curPos);                                                       //WEB_SPECIFIC
            PreviewURL1:='http://image.tmdb.org/t/p/w92'+Copy(HTML,curPos,endPos-curPos);            //WEB_SPECIFIC. w45,w92,w185,w300,w342,original.
            PreviewURL1 := StringReplace(PreviewURL1, '"', '', True, True, False);
PreviewURL1 := StringReplace(PreviewURL1, 'null', '', True, True, False);
            PreviewURL:=PreviewURL1;            //WEB_SPECIFIC. w45,w92,w185,w300,w342,original.
            LogMessage('      Parse Results PreviewURL:'+PreviewURL+'||');           
.
.
.
but now the search results with the correct movie titles.

In this movie Blade find a cosmetic bug in Search Results:

Search results the appear with larger the number of movie titles,then occurs several times the same set of movie titles, actually a four times.

Code: [Select]
//Not Implemented get information of "popularity" "vote_count" "keywords" "images"
"keywords" also means "tags" and the normal Tags field in PVD
Code: [Select]
AddFieldValueXML('tags',ItemValue);
"vote_count"  it can be custom TheMoviedb Votes field in PVD.

It may help this one piece of code:
Code: [Select]
//~Votes~
 curPos := PosFrom('"vote_count":', HTML, EndPos);
 if curPos > 0 then begin
  curPos := PosFrom('"vote_count":', HTML, EndPos);
endPos := PosFrom(',"alternative_titles"', HTML, curPos);
    TmpStr1 :=  TextBetween(HTML, '"vote_count":', ',"alternative_titles"', True, curPos);
 if TmpStr1 = '0' then
TmpStr1 := '';
   AddCustomFieldValueByName('TheMoviedb Votes', TmpStr1);
 if TmpStr1 = '' then
TmpStr1 := 'vote unknown';
 end;
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #36 on: December 27, 2014, 08:11:05 pm »
CHANGE LOG (27/12/2014):
            V 0.2.0.3   VVV: Fixed bug with movie list search URL when the poster is 'null' (Ivek23 detected)
                                    Add the "keywords" as "tags" (Ivek23 proposition)
                                    Add (needs Custom Field ~TheMoviedb_Votes~) "vote_count" (Ivek23 proposition)
Attached the new versión.

(Thanks Ivek23)

(Edito: New version down)
« Last Edit: January 08, 2016, 03:09:09 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #37 on: December 28, 2015, 05:00:29 pm »
The script does not work anymore (search results).
« Last Edit: January 03, 2016, 06:20:37 pm by Ivek23 »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline VVV_Easy_Programing

  • Older Power User
  • *****
  • Posts: 199
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #38 on: January 08, 2016, 03:07:57 pm »
CHANGE LOG (08/01/2016):
            V 0.2.0.5   VVV: Fixed bug with the "total_results" detection (before it was the last information now "total_pages" is the last).
                             Adjust to the new order of received informations for "Parsing search Movies"
                             Eliminate "2014" from name.

Attached the new versión.

(Thanks again Ivek23)

(Edito: New version down)
« Last Edit: June 12, 2017, 09:51:16 pm by VVV_Easy_Programing »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2713
    • View Profile
Re: Script: TheMovieDB [ES] 2014 (Easy Script)
« Reply #39 on: January 08, 2016, 07:10:50 pm »
(Thanks again Ivek23)

Thank you for the new version.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD