Remote network usage

This commit is contained in:
Ryan
2026-09-13 18:40:02 -04:00
parent dbbbaa2ea2
commit ad3deb3226
6 changed files with 36 additions and 19 deletions
+5
View File
@@ -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
+1 -6
View File
@@ -9,15 +9,13 @@ services:
container_name: videodetect-aiworker container_name: videodetect-aiworker
restart: "no" restart: "no"
environment: 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} - OLLAMA_URL=${OLLAMA_URL:-http://10.0.1.7:11434}
- SECONDS_PER_FRAME=${SECONDS_PER_FRAME:-30} - SECONDS_PER_FRAME=${SECONDS_PER_FRAME:-30}
- TASK_COUNT=${TASK_COUNT:-50} - TASK_COUNT=${TASK_COUNT:-50}
volumes: volumes:
- nas_input:/data:ro - nas_input:/data:ro
- ./run.pl:/app/run.pl:ro - ./run.pl:/app/run.pl:ro
networks:
- videodetect_videodetect-network
volumes: volumes:
nas_input: nas_input:
@@ -27,6 +25,3 @@ volumes:
o: addr=10.0.0.2,ro,nfsvers=4,hard,intr o: addr=10.0.0.2,ro,nfsvers=4,hard,intr
device: ":/mnt/Bulk/Homes/ryan/Prawns" device: ":/mnt/Bulk/Homes/ryan/Prawns"
networks:
videodetect_videodetect-network:
external: true
+9 -2
View File
@@ -26,6 +26,8 @@ for(my $i=0; $i<$task_count; $i++) {
my $path = $video->{'file_path'}; my $path = $video->{'file_path'};
my $result = CheckPath($path); my $result = CheckPath($path);
next unless $result;
my $response = PostResponse($task_id, $ref->{'assign_key'}, $result); my $response = PostResponse($task_id, $ref->{'assign_key'}, $result);
} }
@@ -69,14 +71,19 @@ sub CheckPath {
unlink($file); unlink($file);
} }
if($total == 0) {
warn "No images were processed for $path\n";
return undef;
}
my $percentage = ($yes*100)/$total; my $percentage = ($yes*100)/$total;
print "$yes of $total images gave yes - $percentage\n"; print "$yes of $total images gave yes - $percentage\n";
my $verdict = 0; my $verdict = 0;
if($percentage >= $sensitivity) { if($percentage >= $sensitivity) {
print "Probably a black dude, $percentage\n"; print "$path: Probably a black dude, $percentage\n";
$verdict = 1; $verdict = 1;
} else { } else {
print "Probably not, $percentage\n"; print "$path: Probably not, $percentage\n";
$verdict = 0; $verdict = 0;
} }
return { return {
+14
View File
@@ -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
-6
View File
@@ -18,8 +18,6 @@ services:
volumes: volumes:
- nas_input:/data:ro - nas_input:/data:ro
- $PWD/scanner.pl:/app/scanner.pl:ro - $PWD/scanner.pl:/app/scanner.pl:ro
networks:
- videodetect_videodetect-network
volumes: volumes:
nas_input: nas_input:
@@ -28,7 +26,3 @@ volumes:
type: nfs type: nfs
o: addr=10.0.0.2,ro,nfsvers=4,hard,intr o: addr=10.0.0.2,ro,nfsvers=4,hard,intr
device: ":/mnt/Bulk/Homes/ryan/Prawns" device: ":/mnt/Bulk/Homes/ryan/Prawns"
networks:
videodetect_videodetect-network:
external: true
+6 -4
View File
@@ -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 $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 %ignored_extensions;
my @dir_queue = ('/data'); 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 # 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"); my $sth_delete = $dbh->prepare("DELETE FROM videos WHERE last_scan_time < ? OR last_scan_time IS NULL");
$sth_delete->execute($now); $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 { sub process_file {
my ($file_path) = @_; my ($file_path) = @_;
if (my ($ext)=$file_path =~ /^.+\.(\S+?)$/) { if (my ($ext)=$file_path =~ /^.+\.(\S+?)$/) {
unless (grep { lc($ext) eq $_ } @video_extensions) { unless (grep { lc($ext) eq $_ } @video_extensions) {
$ignored_extensions{lc($ext)} = 1; $ignored_extensions{lc($ext)}++;
return; # Not a video file return; # Not a video file
} }
} }
print "$file_path\n";
my $sth = $dbh->prepare("SELECT id,file_size FROM videos WHERE file_path=?"); my $sth = $dbh->prepare("SELECT id,file_size FROM videos WHERE file_path=?");
$sth->execute($file_path); $sth->execute($file_path);
if(my $row = $sth->fetchrow_hashref()) { if(my $row = $sth->fetchrow_hashref()) {
@@ -71,6 +72,7 @@ sub process_file {
} }
return; # Already exists and size matches return; # Already exists and size matches
} }
print "NEW:$file_path\n";
my $info = get_video_info($file_path); my $info = get_video_info($file_path);
unless ($info) { unless ($info) {