diff options
author | Guilhem Moulin <guilhem.moulin@ens-lyon.org> | 2012-02-18 03:35:47 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@ens-lyon.org> | 2012-02-18 03:35:47 +0100 |
commit | fdf9307f5140393938ed27a1079792b748cad4e5 (patch) | |
tree | 030cef7525c0f2d278940fc2d968e31f6e5168a1 | |
parent | 2ba8f6a1439488050b3c98d454f974b2705865be (diff) |
unicode bugfix, cont
-rwxr-xr-x | videoadd.pl | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/videoadd.pl b/videoadd.pl index ce68ef3..c5278a5 100755 --- a/videoadd.pl +++ b/videoadd.pl @@ -245,13 +245,20 @@ if (defined $imdb{crit}) { $new{year} = $movie->year(); $new{imgurl} = $movie->cover(); $new{director} = join ', ', map {$_->{name}} @{$movie->directors()}; - $new{actors} = join "\n", map {$_->{name}. '::' .$_->{role}. '::imdb:' .$_->{id}} - @{$movie->full_cast()}; + $new{actors} = join "\n", map {&mkcast($_)} @{$movie->full_cast()}; $new{country} = join ', ', @{$movie->country()}; - $new{plot} = $movie->full_plot(); + $new{plot} = $movie->storyline(); # TODO; plot vs. full_plot vs. storyline? $new{genres} = $movie->genres(); $new{rating} = $movie->rating(); # Ignoring #votes and awards $new{istv} = 1 if $movie->kind() =~ /tv/; + + # Convert the retrieved data to UTF-8 + map { utf8::encode($new{$_}) + if exists ($new{$_}) and defined ($new{$_}) and $new{$_} ne "" + and not utf8::is_utf8($new{$_}) } + qw/title subtitle language diskid comment disklabel imgurl director + actors country filename plot/; + map { utf8::encode($_) unless utf8::is_utf8($_) } @{$new{genres}}; } elsif (defined $file) { # Fill in at least the title, based on the file name... @@ -317,14 +324,7 @@ if ( defined($file) ) { # The "Subtitles" field is not hard-coded: insert it in the "custom" field instead $new{customs}->{subtitles} = lc join (', ', @slang); } - -# Convert everything to UTF-8 -map { utf8::encode($new{$_}) if exists $new{$_} and not utf8::is_utf8($new{$_}) } - qw/title subtitle language diskid comment disklabel imgurl director - actors country filename plot/; -map { utf8::encode($_) unless utf8::is_utf8($_) } (values %{$new{customs}}); -map { utf8::encode($_) unless utf8::is_utf8($_) } @{$new{genres}}; - + ################################################################################ # Insertion into the database @@ -512,3 +512,8 @@ sub code2lang { return $lang if defined $lang; return $code; } + +sub mkcast { + no warnings 'uninitialized'; + return $_->{name}. '::' .$_->{role}. '::imdb:' .$_->{id}; +} |