From 0151969e6bd81ddedd6032c3c1c886e8b7e58517 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 18 Feb 2012 00:20:20 +0100 Subject: proper mediatype --- videoadd.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/videoadd.pl b/videoadd.pl index 5aa0f03..94debac 100755 --- a/videoadd.pl +++ b/videoadd.pl @@ -333,13 +333,19 @@ unless ( defined $ignoredb_flag ) { } delete $new{customs}; + # Get the (first found) mediatype for files on the hard disk + my $mediatype = $dbh->selectrow_arrayref( "SELECT id FROM $config{prefix}mediatypes + WHERE name = ?", undef, 'HDD' ) + or die "Can't select: $!\n"; + my $INSERT = "INSERT INTO $config{prefix}videodata - SET mediatype = 14, - created = NOW()"; + SET created = NOW()"; if (defined $new{filedate}) { $INSERT .= ", filedate = FROM_UNIXTIME($new{filedate})"; delete $new{filedate}; } + $INSERT .= ", mediatype = $mediatype->[0]" + if defined ($mediatype) and defined ($mediatype->[0]); while (my ($k,$v) = each %new) { $INSERT .= ", " .$k. " = " .$dbh->quote ($v) if defined $v; -- cgit v1.2.3