first jenkins run

This commit is contained in:
2025-07-26 17:40:55 -07:00
parent a29ec39252
commit 7496df0174
8 changed files with 29 additions and 68 deletions

View File

@ -1,11 +0,0 @@
services:
photo_refresh:
container_name: photo_refresh
image: php:8.0-apache
ports:
- 8080:80
volumes:
- /opt/docker/photo_refresh/:/var/www/html/
network_mode: bridge
restart: always

View File

@ -1,17 +0,0 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Image Update</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<img id="refreshedImage" src="getImage.php" width="400" alt="Refreshed Image">
<script>
// Function to update the image every other second using AJAX
setInterval(function() {
$('#refreshedImage').attr('src', 'getImage.php?_=' + new Date().getTime()); // Adding timestamp to avoid caching
}, 2000);
</script>
</body>
</html>

View File

@ -1,22 +0,0 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
// Path to the directory where the images are stored
$imageDirectory = 'capture/';
// Get the list of image files in the directory
$imageFiles = glob($imageDirectory . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);
// If there are no image files, return a default image
if (empty($imageFiles)) {
$defaultImage = 'default.jpg'; // Provide path to your default image
header('Content-Type: image/jpeg'); // Adjust content type if default image type is different
readfile($defaultImage);
exit;
}
// Sort the image files by modification time, latest first
array_multisort(array_map('filemtime', $imageFiles), SORT_DESC, $imageFiles);
// Get the path to the latest image file
$latestImage = $imageFiles[0];
// Set header type
header('Content-Type: image/jpeg');
// Get the image
readfile($latestImage);
?>

View File

@ -11,9 +11,6 @@
### Top Cam Feed Kiosk ### Top Cam Feed Kiosk
### Bottom Service Control Panel ### Bottom Service Control Panel
# select display_name, city, state, postcode from addresses order by id desc limit 1;
# curl -s http://10.18.1.1:8184/wheres_gali?api_key=
- name: Carputer Early Tasks - name: Carputer Early Tasks
include_tasks: include_tasks:
- ustreamer.yaml - ustreamer.yaml

View File

@ -4,7 +4,9 @@
set_fact: set_fact:
- docker_source: "/opt/cosmos/photo_refresh" - docker_source: "/opt/cosmos/photo_refresh"
- name: photo_refresh - create docker folder
# Create docker Folder
- name: lldp - python - create api folder
file: file:
path: "{{ docker_source }}" path: "{{ docker_source }}"
state: directory state: directory
@ -21,7 +23,7 @@
name: photo_refresh # Name of the Docker image name: photo_refresh # Name of the Docker image
source: build source: build
build: build:
path: /opt/cosmos/photo_refresh # Path to the directory containing your Dockerfile path: "{{ docker_source }}" # Path to the directory containing your Dockerfile
state: present state: present
tag: latest tag: latest
@ -39,7 +41,7 @@
dest: "{{ docker_source }}docker-compose.yaml" dest: "{{ docker_source }}docker-compose.yaml"
mode: 0644 mode: 0644
- name: photo_refresh - Start container at 0.0.0.0:8080 - name: photo_refresh - Start container at 0.0.0.0:3000
shell: "docker-compose -f {{ docker_source }}/docker-compose.yaml up -d" shell: "docker-compose -f {{ docker_source }}/docker-compose.yaml up -d"
register: local_index_output register: local_index_output
- debug: | - debug: |

View File

@ -1,5 +1,12 @@
--- ---
# Create working Folder
- name: lldp - python - create api folder
file:
path: "{{ working_folder }}"
state: directory
mode: '0755'
- name: set template vars - name: set template vars
set_fact: set_fact:
# timelapse related scripts # timelapse related scripts
@ -23,9 +30,9 @@
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
loop: "{{ timelapse_script_templates }}" loop: "{{ timelapse_script_templates }}"
owner: root owner: timelapse
group: root group: timelapse
mode: 0644 mode: 0755
- name: template service file - name: template service file
template: template:
@ -41,6 +48,6 @@
daemon_reload: yes daemon_reload: yes
state: started state: started
enabled: yes enabled: yes
name: ustreamer name: timelapse
... ...

View File

@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
# create timelapse
# end the loop
rm $WORKING_DIR/run
sleep 5
# create timelapse
ffmpeg -r 30 -pattern_type glob -i "$WORKING_DIR/*.jpg" \ ffmpeg -r 30 -pattern_type glob -i "$WORKING_DIR/*.jpg" \
-vf "scale=1920x1080" -vcodec libx264 /$WORKING_DIR/00-timelapse.mp4 -vf "scale=1920x1080" -vcodec libx264 /$WORKING_DIR/00-timelapse.mp4

View File

@ -1,4 +1,11 @@
#!/bin/bash #!/bin/bash
# no need to do this math forever
input_width=1920
input_height=1080
output_width=1340
output_height=580
# Calculate the ratio for trimming the top part
trim_ratio=$(echo "scale=4; $output_height / $output_width * $input_width" | bc)
# this saves a snapshot of the camera every second or so depending on how long all the other crap takes # this saves a snapshot of the camera every second or so depending on how long all the other crap takes
# let's hope the vars make it otherwise imma need to parse a bollocksing file # let's hope the vars make it otherwise imma need to parse a bollocksing file
@ -26,12 +33,6 @@ do
# I have 1340x580. i think i will truncate the top # I have 1340x580. i think i will truncate the top
# Calculate the height to trim based on the aspect ratios of the input and output images # Calculate the height to trim based on the aspect ratios of the input and output images
if (( $i % 5 == 0 )); then if (( $i % 5 == 0 )); then
input_width=1920
input_height=1080
output_width=1340
output_height=580
# Calculate the ratio for trimming the top part
trim_ratio=$(echo "scale=4; $output_height / $output_width * $input_width" | bc)
NOW=$(date +%Y%m%d%H%M%S) NOW=$(date +%Y%m%d%H%M%S)
convert $WORKING_DIR/$FILENAME.jpg -gravity North -crop x$trim_ratio +repage -resize 1340x580 {{ working_folder }}/small_thumbs/$NOW.jpg convert $WORKING_DIR/$FILENAME.jpg -gravity North -crop x$trim_ratio +repage -resize 1340x580 {{ working_folder }}/small_thumbs/$NOW.jpg
fi fi