summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-02-18 00:20:20 +0100
committerGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-02-18 00:20:20 +0100
commit0151969e6bd81ddedd6032c3c1c886e8b7e58517 (patch)
tree89b22a4400204b00c6921aad5182abe8938adf93
parent92a1750b60381d03f1c1909f236055cfe7fdb0b1 (diff)
proper mediatype
-rwxr-xr-xvideoadd.pl10
1 files 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;