English > Scripts and Templates

AllMovie.com_new movie script

<< < (20/22) > >>

afrocuban:
Hello Ivek23,

Is there a way NOT to import year as a part of Title, just Title?

Thank you in advance.

Ivek23:

--- Quote from: afrocuban on October 16, 2015, 04:13:00 pm ---Hello Ivek23,

Is there a way NOT to import year as a part of Title, just Title?

Thank you in advance.
--- End quote ---

Why?
That's already in the script is done so that the Title-free year in the normal field as well as in the "Title" custom field.


--- Code: --- //~mfTitle~ or ~Title~

 curPos := Pos('<title>', HTML) + Length('<title>');
 if Pos(') - ', HTML) > 0 then
endPos := PosFrom(') - ', HTML, curPos)-6
 else
endPos := PosFrom(' -  | ', HTML, curPos);
TmpStr1 := Copy(HTML, curPos, endPos - curPos);
AddFieldValue(mfTitle, TmpStr1);
AddFieldValue(mfOrigTitle, TmpStr1);
Title := Copy(HTML, curPos, endPos - curPos);
Title1 := Copy(HTML, curPos, endPos - curPos);

 if Pos(') - ', HTML) > 0 then
endPos := PosFrom(') - ', HTML, curPos)+1
 else
endPos := PosFrom(' -  | ', HTML, curPos);
TmpStr1 := Copy(HTML, curPos, endPos - curPos);
AddCustomFieldValueByName('Title', TmpStr1);
--- End code ---

The year has also done the same way as Title.


--- Code: --- // ~mfYear~ or ~Year~
 
 curPos := Pos('<span class="release-year">', HTML) + Length('<span class="release-year">');
 if Pos('</span>        </h2>', HTML) > 0 then
endPos := PosFrom('</span>        </h2>', HTML, curPos);
TmpStr2 := Copy(HTML, curPos, endPos - curPos);

  if TmpStr2 = '0' then
TmpStr2 := '';
TmpStr2 := StringReplace(TmpStr2, '(', '', True, True, True);
TmpStr2 := StringReplace(TmpStr2, ')', '', True, True, True);
AddFieldValue(mfYear, TmpStr2);
AddCustomFieldValueByName('Year', TmpStr2);

  if TmpStr2 = '' then
TmpStr2 := 'year unknown';
 LogMessage(' Parsing: ' + TmpStr1 + '(' + TmpStr2 + ')');
--- End code ---

If this is not what we would like, then please give an example to make it easier to explain and help.

afrocuban:
Thanks for fast reply, Ivek.

I don't want to import year as a part of title because I import year in a separate field,  but mostly because it's not the part of real title.

I use Custom field "Title" to import title from AllMovie.com (which is mostly in English, and I need it), and Standard field "Title" to import localized title from Imdb (Serbian, as you can see on the screenshot), and standard origtitle to import original title from Imdb.

I wouldn't like to import year to a Custom field "Title" from AllMovie.com.

Thank you in advance.

Ivek23:
Try like this:

AddCustomFieldValueByName('Title', TmpStr1 + '(' + TmpStr2 + ')');

This is how it should be in the script:

--- Code: --- //~mfTitle~ or ~Title~

 curPos := Pos('<title>', HTML) + Length('<title>');
 if Pos(') - ', HTML) > 0 then
endPos := PosFrom(') - ', HTML, curPos)-6
 else
endPos := PosFrom(' -  | ', HTML, curPos);
TmpStr1 := Copy(HTML, curPos, endPos - curPos);
AddFieldValue(mfTitle, TmpStr1);
AddFieldValue(mfOrigTitle, TmpStr1);
Title := Copy(HTML, curPos, endPos - curPos);
Title1 := Copy(HTML, curPos, endPos - curPos);

 if Pos(') - ', HTML) > 0 then
endPos := PosFrom(') - ', HTML, curPos)+1
 else
endPos := PosFrom(' -  | ', HTML, curPos);
TmpStr1 := Copy(HTML, curPos, endPos - curPos);
//AddCustomFieldValueByName('Title', TmpStr1);
.
.
.
 // ~mfYear~ or ~Year~
 
 curPos := Pos('<span class="release-year">', HTML) + Length('<span class="release-year">');
 if Pos('</span>        </h2>', HTML) > 0 then
endPos := PosFrom('</span>        </h2>', HTML, curPos);
TmpStr2 := Copy(HTML, curPos, endPos - curPos);

  if TmpStr2 = '0' then
TmpStr2 := '';
TmpStr2 := StringReplace(TmpStr2, '(', '', True, True, True);
TmpStr2 := StringReplace(TmpStr2, ')', '', True, True, True);
AddFieldValue(mfYear, TmpStr2);
// AddCustomFieldValueByName('Year', TmpStr2);

  if TmpStr2 = '' then
TmpStr2 := 'year unknown';
 LogMessage(' Parsing: ' + TmpStr1 + '(' + TmpStr2 + ')');

AddCustomFieldValueByName('Title', TmpStr1 + '(' + TmpStr2 + ')');
--- End code ---

I did not tested, but it should work.

afrocuban:
Thanks, Ivek,

But now I get year two times, and I want without year at all, like in the second screenshot.

Thank you!


--- Quote ---That's already in the script is done so that the Title-free year in the normal field as well as in the "Title" custom field.
--- End quote ---

It isn't in my case. When I import Title it imports title with year?!

In custom field "Title" it should be only "A Bittersweet Life", and not "A Bittersweet Life (2005)"

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Reply

Go to full version