summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xvideoadd.pl27
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};
+}