Remote network usage
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# VideoDetect — Docker Compose environment variables
|
||||
# Copy this file to .env and fill in real values before running docker-compose up.
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Database
|
||||
# -----------------------------------------------------
|
||||
DB_ROOT_PASSWORD=videodetect
|
||||
DB_PASSWORD=videodetect
|
||||
DB_USER=videodetect
|
||||
DB_NAME=videodetect
|
||||
DB_HOST=10.0.1.7
|
||||
|
||||
API_HOST=https://10.0.1.7:3000
|
||||
|
||||
@@ -18,8 +18,6 @@ services:
|
||||
volumes:
|
||||
- nas_input:/data:ro
|
||||
- $PWD/scanner.pl:/app/scanner.pl:ro
|
||||
networks:
|
||||
- videodetect_videodetect-network
|
||||
|
||||
volumes:
|
||||
nas_input:
|
||||
@@ -27,8 +25,4 @@ volumes:
|
||||
driver_opts:
|
||||
type: nfs
|
||||
o: addr=10.0.0.2,ro,nfsvers=4,hard,intr
|
||||
device: ":/mnt/Bulk/Homes/ryan/Prawns"
|
||||
|
||||
networks:
|
||||
videodetect_videodetect-network:
|
||||
external: true
|
||||
device: ":/mnt/Bulk/Homes/ryan/Prawns"
|
||||
+6
-4
@@ -16,7 +16,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 @video_extensions = qw(mp4 mkv avi mov flv wmv mpg mpeg webm m4v);
|
||||
my %ignored_extensions;
|
||||
my @dir_queue = ('/data');
|
||||
|
||||
@@ -46,18 +46,19 @@ 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";
|
||||
for my $ext (sort { $ignored_extensions{$b} <=> $ignored_extensions{$a} } keys %ignored_extensions) {
|
||||
print "Ignored extension $ext: $ignored_extensions{$ext} times\n";
|
||||
}
|
||||
|
||||
sub process_file {
|
||||
my ($file_path) = @_;
|
||||
if (my ($ext)=$file_path =~ /^.+\.(\S+?)$/) {
|
||||
unless (grep { lc($ext) eq $_ } @video_extensions) {
|
||||
$ignored_extensions{lc($ext)} = 1;
|
||||
$ignored_extensions{lc($ext)}++;
|
||||
return; # Not a video file
|
||||
}
|
||||
}
|
||||
|
||||
print "$file_path\n";
|
||||
my $sth = $dbh->prepare("SELECT id,file_size FROM videos WHERE file_path=?");
|
||||
$sth->execute($file_path);
|
||||
if(my $row = $sth->fetchrow_hashref()) {
|
||||
@@ -71,6 +72,7 @@ sub process_file {
|
||||
}
|
||||
return; # Already exists and size matches
|
||||
}
|
||||
print "NEW:$file_path\n";
|
||||
|
||||
my $info = get_video_info($file_path);
|
||||
unless ($info) {
|
||||
|
||||
Reference in New Issue
Block a user