From 093f51ecd808e6e688ff7e130c035b792e7fa22d Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 18 Feb 2012 18:12:56 +0100 Subject: unicode, again --- videoadd.pl | 22 +++++++--------------- videodb-check.pl | 2 +- videomv.pl | 2 +- videorm.pl | 2 +- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/videoadd.pl b/videoadd.pl index 0b74f17..5c49b61 100755 --- a/videoadd.pl +++ b/videoadd.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -CS -w +#!/usr/bin/perl -w # This program is free software. It comes without any warranty, to the # extent permitted by applicable law. You can redistribute it and/or @@ -299,14 +299,6 @@ if ( defined ($imdb{crit}) and &runIMDB() ) { $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... @@ -329,11 +321,12 @@ foreach my $k (keys %options) { ################################################################################ # Run mplayer on the given file to get A/V codecs, etc. -if ( defined($file) and &runMplayer() ) { +if ( defined $file ) { $new{filename} = basename ($file); $new{filesize} = (stat $file)[7]; $new{filedate} = (stat $file)[9]; # Last modify time in seconds since epoch - +} +if ( defined($file) and &runMplayer() ) { my @cmd = ('mplayer', '-identify', '-ao', 'null', '-vo', 'null', '-frames', '0', $file); @@ -400,7 +393,7 @@ unless ( defined $ignoredb_flag ) { # Get the genre IDs my @genres; - if (&include('genres') and @{$new{genres}}) { + if (&include('genres') and defined ($new{genres}) and @{$new{genres}}) { my $sth_selgenre = $dbh->prepare( "SELECT id FROM $config{prefix}genres WHERE name = ?" ) or die "Error: " .$dbh->errstr; my $sth_insgenre = $dbh->prepare( "INSERT INTO $config{prefix}genres SET name = ?" ) @@ -475,7 +468,7 @@ unless ( defined $ignoredb_flag ) { } else { $ok = 0; - warn "Warning: Something weird happened during the INSERT. You should probably check the sanity of your collection.\n"; + warn "Warning: Something weird happened during the INSERT. You should probably sanity check your collection.\n"; } } @@ -695,8 +688,7 @@ sub runIMDB { sub runMplayer { # Returns 1 if there is need to run mplayer, 0 otherwise - foreach ( qw/filename filesize filedate - video_codec audio_codec video_width video_height + foreach ( qw/video_codec audio_codec video_width video_height runtime language custom1 custom2 custom3 custom4/) { return 1 if &include($_); diff --git a/videodb-check.pl b/videodb-check.pl index e2dde3d..14d58ed 100755 --- a/videodb-check.pl +++ b/videodb-check.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -CS -w +#!/usr/bin/perl -w # This program is free software. It comes without any warranty, to the # extent permitted by applicable law. You can redistribute it and/or diff --git a/videomv.pl b/videomv.pl index 1013b33..d7d4655 100755 --- a/videomv.pl +++ b/videomv.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl -CS -w +#!/usr/bin/perl -w # This program is free software. It comes without any warranty, to the # extent permitted by applicable law. You can redistribute it and/or diff --git a/videorm.pl b/videorm.pl index c612410..af33032 100755 --- a/videorm.pl +++ b/videorm.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl -CS -w +#!/usr/bin/perl -w # This program is free software. It comes without any warranty, to the # extent permitted by applicable law. You can redistribute it and/or -- cgit v1.2.3