Author Topic: Metascore  (Read 6182 times)

0 Members and 1 Guest are viewing this topic.

Offline afrocuban

  • Moderator
  • *****
  • Posts: 537
    • View Profile
Metascore
« on: January 04, 2024, 03:36:56 pm »
Hello Ivek. In a new _2b script. metascore import field doesn't work. But, more importantly, when updating older PVD movie entries where I had metascore imported from the times it worked, now when I update with _2b script, the field is overwritten with empty/zero value. How to prevent this please?

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2746
    • View Profile
Re: Metascore
« Reply #1 on: January 04, 2024, 08:51:54 pm »
Hello Ivek. In a new _2b script. metascore import field doesn't work. But, more importantly, when updating older PVD movie entries where I had metascore imported from the times it worked, now when I update with _2b script, the field is overwritten with empty/zero value. How to prevent this please?

Is this an additional score field or a custom Metascore field. Then I will see what can be done about this problem.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline afrocuban

  • Moderator
  • *****
  • Posts: 537
    • View Profile
Re: Metascore
« Reply #2 on: January 04, 2024, 11:01:56 pm »
Custom field, here:
Code: [Select]
//Get ~Metascore~   
    EndPos:=Pos('</span></span><span class="label"><span class="metacritic-score-label">Metascore</span></span></span></a></li></ul>',HTML);
    if EndPos>0 then begin   
      curPos:=PrevPos('">',HTML,EndPos)+Length('">');
        EndPos:=PosFrom('</span></span><span class="label"><span class="metacritic-score-label">Metascore</span></span></span></a></li></ul>',HTML,curPos)+2;   
        //ItemValue:=RemoveTags(Copy(HTML,curPos,endPos-curPos),false);
      ItemValue:=Copy(HTML,curPos,endPos-curPos);
      LogMessage('      Get result Metascore 0:'+ItemValue+'||');   
        ItemValue:=StringReplace(ItemValue,'0</',',0',True,False,True);
        ItemValue:=StringReplace(ItemValue,'1</',',1',True,False,True);
        ItemValue:=StringReplace(ItemValue,'2</',',2',True,False,True);
        ItemValue:=StringReplace(ItemValue,'3</',',3',True,False,True);
        ItemValue:=StringReplace(ItemValue,'4</',',4',True,False,True);
        ItemValue:=StringReplace(ItemValue,'5</',',5',True,False,True);
        ItemValue:=StringReplace(ItemValue,'6</',',6',True,False,True);
        ItemValue:=StringReplace(ItemValue,'7</',',7',True,False,True);
        ItemValue:=StringReplace(ItemValue,'8</',',8',True,False,True);
        ItemValue:=StringReplace(ItemValue,'9</',',9',True,False,True);
        //curPos:=Pos('var ue_t0=ue_t0',ItemValue);                               //WEB_SPECIFIC.
        //If 0<curPos then ItemValue:=Copy(ItemValue,0,curPos-1);   
        if ItemValue <> '' then AddCustomFieldValueByName('Metascore',FloatToStr((StrToFloat(ItemValue) * 1)));
        if ItemValue <> '' then LogMessage('      Get result Metascore (CF~Metascore~):'+ItemValue+'||');     
    End;
   //(*     
      LogMessage(#13+'');

Thank you in advance.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2746
    • View Profile
Re: Metascore
« Reply #3 on: January 05, 2024, 07:26:15 pm »
It doesn't delete anything on my old entries. Even otherwise, metascore import works without problems. In this case, unfortunately, I cannot help you solve the problem (obviously something is wrong or there is an error on your side). The code for importing metascore information has no error.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline afrocuban

  • Moderator
  • *****
  • Posts: 537
    • View Profile
Re: Metascore
« Reply #4 on: January 06, 2024, 12:23:31 am »
Thanks! This is what is weird.

For example movie
https://www.imdb.com/title/tt5827916/

For this movie, metascore is 7.8 (that is 78)

When run in debug mode this is what I found in a log file for metascore part:


Code: [Select]
(1/6/2024 12:14:13 AM)       Get result Tv Mode01:
2019, PG-13, 2h 54m||


(1/6/2024 12:14:13 AM)       Get result Metascore 0:78</||
(1/6/2024 12:14:13 AM)       Get result Metascore (CF~Metascore~):7,8||
(1/6/2024 12:14:13 AM)


(1/6/2024 12:14:13 AM)


(1/6/2024 12:14:13 AM)       AVOIDED ALWAYS1: Get result "Plot_summary" as ~comment~:

So, it finds it properly, but doesn't parse it to base? Any clue now?
« Last Edit: January 06, 2024, 12:27:11 am by afrocuban »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2746
    • View Profile
Re: Metascore
« Reply #5 on: January 06, 2024, 08:39:13 am »
In the PVD settings, in the Miscellaneous section, set (check this box) Allow editing rating in view mode. Then you will be able to edit the Metascore field or all rating fields in the database in view mode. Thus, it is not necessary to open and edit a certain movie entry in the database every time and then save it.

Once you have this set up, simply set the Mtascore rating to zero and then update the movie entry again to see if it will now add the metascore rating to that field.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline afrocuban

  • Moderator
  • *****
  • Posts: 537
    • View Profile
Re: Metascore
« Reply #6 on: January 09, 2024, 01:27:21 am »
Thank you Ivek, but that didn't help, unfortunately. It was already checked. Re-did everything but no luck. A great mystery...

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2746
    • View Profile
Re: Metascore
« Reply #7 on: January 09, 2024, 01:09:53 pm »
Maybe the IMDB_[EN][HTTPS]_TEST_Metascore script will just solve the problems.

IMDB_[EN][HTTPS]_TEST_Metascore script is attached.

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


Offline afrocuban

  • Moderator
  • *****
  • Posts: 537
    • View Profile
Re: Metascore
« Reply #8 on: January 09, 2024, 07:41:39 pm »
Wow! How great you noticed it was about Regional format of Windows, that is decimal! Splendid, thanks! It works flawlessly. I have changed original script, so you don't need to upload it.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2746
    • View Profile
Re: Metascore
« Reply #9 on: January 09, 2024, 09:07:37 pm »
Wow! How great you noticed it was about Regional format of Windows, that is decimal! Splendid, thanks! It works flawlessly. I have changed original script, so you don't need to upload it.

Great. It's good to hear that the problem is now solved.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD