English > Support

Metascore

(1/2) > >>

afrocuban:
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?

Ivek23:

--- Quote from: afrocuban 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?
--- End quote ---

Is this an additional score field or a custom Metascore field. Then I will see what can be done about this problem.

afrocuban:
Custom field, here:

--- Code: --- //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+'');
--- End code ---

Thank you in advance.

Ivek23:
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.

afrocuban:
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: ---(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~:
--- End code ---

So, it finds it properly, but doesn't parse it to base? Any clue now?

Navigation

[0] Message Index

[#] Next page

Go to full version