#1 2011-06-07 21:44:15

rudra
Member
Registered: 2010-12-21
Posts: 13

top 5 in LatexExport

Dear friends,
I am trying to alter the default exportLatex script. I have done all the way except a small part:
I want to include casts(actors in gcs) in latex file but since the actors list is too large, I want to include only first 5, say.
How can I do that?
I am less then novice in perl and hence, plz keep it simple.
Btw, attached is a screenshot of my pdf exported from gcs...if anyone is interested, I will upload it as a plugin.

Last edited by rudra (2011-06-07 21:48:18)


Attachments:
Attachment Icon Screenshot.png, Size: 148,158 bytes, Downloads: 441

Offline

 

#2 2011-06-10 04:02:59

rudra
Member
Registered: 2010-12-21
Posts: 13

Re: top 5 in LatexExport

ha ha ha...its a joke i assume!!

Offline

 

#3 2011-06-10 11:27:17

unclepetros
Member
Registered: 2010-04-11
Posts: 88

Re: top 5 in LatexExport

Hi rudra,
actors list, is a string or an array?
If it is a string, what is separator char?

Let me know.

Regards
UnclePetros

Offline

 

#4 2011-06-10 21:35:39

rudra
Member
Registered: 2010-12-21
Posts: 13

Re: top 5 in LatexExport

it is given in GCImdb plugin as:
                if ($self->{actor} && $self->{role})
                {
                    $self->{actor} =~ s/^\s+|\s+$//g;
                    $self->{actor} =~ s/\s{2,}/ /g;
                    push @{$self->{curInfo}->{actors}}, [$self->{actor}];
                    $self->{role} =~ s/^\s+|\s+$//g;
                    $self->{role} =~ s/\s{2,}/ /g;
                    push @{$self->{curInfo}->{actors}->[$self->{actorsCounter}]}, $self->{role};                               
                    $self->{actorsCounter}++;
                }
                $self->{actor} = "";
                $self->{role} = "";
            }

so my guess is its an array with upperlimit of actorsCounter is fixed somewhere.

Offline

 

#5 2011-06-11 12:35:12

unclepetros
Member
Registered: 2010-04-11
Posts: 88

Re: top 5 in LatexExport

Hi rudra,
ok, I've analyzed the code, as I didn't know the feature.
You have to work only on GCExportLatex.pm file, don't touch GCIMDB.pm plugin.

In the file GCExportLatex.pm you have to insert the row related to the cast in the getItem function:

you can add the following row to add just the first actor:

Code:

$result .= $self->getLocal('actors') . ": & $item->{actors}[0][0] \\\\" if $item->{actors}[0][0];

If you want to add also the name of the character the actor plays, you could do:

Code:

$result .= $self->getLocal('actors') . ": & $item->{actors}[0][0] $item->{actors}[0][0] " if $item->{actors}[0][0];
$result .= "$item->{actors}[0][1] \\\\" if $item->{actors}[0][1];

And repeat the same for the other actors.

You could also use a loop, but it is not easier than this.
I think this sould be enough for you.

Let me know in case of problems.

Obviously, consider that these changes may results in a wrong export if latex export feature is used by other collection types (It seems to me it is used only for films, but I'm not sure).

Regards
Pietro

Last edited by unclepetros (2011-06-11 12:40:21)

Offline

 

#6 2011-06-11 16:51:54

rudra
Member
Registered: 2010-12-21
Posts: 13

Re: top 5 in LatexExport

This part is giving error:

$ gcstar
*** unhandled exception in callback:
***   Can't use string ("") as an ARRAY ref while "strict refs" in use at /usr/local/bin/../lib/gcstar/GCExport/GCExportLatex.pm line 148.
***  ignoring at /usr/local/bin/gcstar line 328.

I am trying to find out the error by googling it....but cant get much(due to my knowledge in perl) here is the same error:
http://forums.devshed.com/perl-programm … 98875.html

so it will be helpful if you plz let me know how to proceed.

Offline

 

#7 2011-06-13 09:19:19

unclepetros
Member
Registered: 2010-04-11
Posts: 88

Re: top 5 in LatexExport

OK,
I don't know what's the problem.
On my environment it works fine.

Please could you attach on the forum your actual GCExptorLatex.pm file?

Regards
UnclePetros

Last edited by unclepetros (2011-06-13 09:20:29)

Offline

 

#8 2011-06-13 18:25:48

rudra
Member
Registered: 2010-12-21
Posts: 13

Re: top 5 in LatexExport

unclepetros wrote:

OK,
I don't know what's the problem.
On my environment it works fine.

Please could you attach on the forum your actual GCExptorLatex.pm file?

Regards
UnclePetros

Happily!!
See, I am not a perl expert! So, if your time allow you to check if everything is ok or not, plz do that.
Regards,


Attachments:
Attachment Icon GCExportLatex.pm, Size: 5,915 bytes, Downloads: 637

Offline

 

#9 2011-06-21 23:26:29

unclepetros
Member
Registered: 2010-04-11
Posts: 88

Re: top 5 in LatexExport

Sorry rudra,
can you post the GCExportLatex.pm file you use when you receive the error?

The file you post in the previous post is the original file, it doesn't contain any of the lines I've suggested you.

What the file at the moment of the error you report in the previous posts?

Anyway I've tried to add my lines to the file you post, and it works fine.

Regards
UnclePetros

Offline

 



Should you have a problem using GCstar, you can open a bug report or request some support on GCstar forums.