summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;