Remote network usage
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# VideoDetect — Docker Compose environment variables
|
||||
# Copy this file to .env and fill in real values before running docker-compose up.
|
||||
|
||||
API_HOST=https://10.0.1.7:3000
|
||||
|
||||
@@ -9,15 +9,13 @@ services:
|
||||
container_name: videodetect-aiworker
|
||||
restart: "no"
|
||||
environment:
|
||||
- API_BASE_URL=${API_BASE_URL:-http://videodetect-api:3000}
|
||||
- API_BASE_URL=${API_BASE_URL:-http://10.0.1.7:3000}
|
||||
- OLLAMA_URL=${OLLAMA_URL:-http://10.0.1.7:11434}
|
||||
- SECONDS_PER_FRAME=${SECONDS_PER_FRAME:-30}
|
||||
- TASK_COUNT=${TASK_COUNT:-50}
|
||||
volumes:
|
||||
- nas_input:/data:ro
|
||||
- ./run.pl:/app/run.pl:ro
|
||||
networks:
|
||||
- videodetect_videodetect-network
|
||||
|
||||
volumes:
|
||||
nas_input:
|
||||
@@ -27,6 +25,3 @@ volumes:
|
||||
o: addr=10.0.0.2,ro,nfsvers=4,hard,intr
|
||||
device: ":/mnt/Bulk/Homes/ryan/Prawns"
|
||||
|
||||
networks:
|
||||
videodetect_videodetect-network:
|
||||
external: true
|
||||
|
||||
+9
-2
@@ -25,6 +25,8 @@ for(my $i=0; $i<$task_count; $i++) {
|
||||
my $video_id = $video->{'id'};
|
||||
my $path = $video->{'file_path'};
|
||||
my $result = CheckPath($path);
|
||||
|
||||
next unless $result;
|
||||
|
||||
my $response = PostResponse($task_id, $ref->{'assign_key'}, $result);
|
||||
}
|
||||
@@ -69,14 +71,19 @@ sub CheckPath {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
if($total == 0) {
|
||||
warn "No images were processed for $path\n";
|
||||
return undef;
|
||||
}
|
||||
|
||||
my $percentage = ($yes*100)/$total;
|
||||
print "$yes of $total images gave yes - $percentage\n";
|
||||
my $verdict = 0;
|
||||
if($percentage >= $sensitivity) {
|
||||
print "Probably a black dude, $percentage\n";
|
||||
print "$path: Probably a black dude, $percentage\n";
|
||||
$verdict = 1;
|
||||
} else {
|
||||
print "Probably not, $percentage\n";
|
||||
print "$path: Probably not, $percentage\n";
|
||||
$verdict = 0;
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -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