AI Scanning
This commit is contained in:
+3
-1
@@ -17,6 +17,7 @@ $SIG{INT} = sub { die "Interrupted\n"; };
|
||||
my $dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass);
|
||||
|
||||
my @video_extensions = qw(mp4 mkv avi mov flv wmv mpg mpeg webm);
|
||||
my %ignored_extensions;
|
||||
my @dir_queue = ('/data');
|
||||
|
||||
|
||||
@@ -45,12 +46,13 @@ while(my $dir = shift @dir_queue) {
|
||||
# Any entry where last_scan_time < $now is considered deleted or moved, so we can mark them as such
|
||||
my $sth_delete = $dbh->prepare("DELETE FROM videos WHERE last_scan_time < ? OR last_scan_time IS NULL");
|
||||
$sth_delete->execute($now);
|
||||
print "Ignored extensions: " . join(", ", keys %ignored_extensions) . "\n";
|
||||
|
||||
sub process_file {
|
||||
my ($file_path) = @_;
|
||||
# Determine if the file is a video based on mime info or extension. For simplicity, let's check the extension.
|
||||
if (my ($ext)=$file_path =~ /^.+\.(\S+?)$/) {
|
||||
unless (grep { lc($ext) eq $_ } @video_extensions) {
|
||||
$ignored_extensions{lc($ext)} = 1;
|
||||
return; # Not a video file
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user