From 7496df01749e242a26c44df94c524358bfd92a7e Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 26 Jul 2025 17:40:55 -0700 Subject: [PATCH] first jenkins run --- files/docker-compose-php.yaml | 11 ----------- files/getImage.php | 17 ----------------- files/index.php | 22 ---------------------- tasks/main.yaml | 3 --- tasks/photo_refresh.yaml | 10 ++++++---- tasks/timelapse.yaml | 15 +++++++++++---- templates/create_timelapse.sh.j2 | 6 +++++- templates/record_snapshots.sh.j2 | 13 +++++++------ 8 files changed, 29 insertions(+), 68 deletions(-) delete mode 100644 files/docker-compose-php.yaml delete mode 100644 files/getImage.php delete mode 100644 files/index.php diff --git a/files/docker-compose-php.yaml b/files/docker-compose-php.yaml deleted file mode 100644 index ef52ffb..0000000 --- a/files/docker-compose-php.yaml +++ /dev/null @@ -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 diff --git a/files/getImage.php b/files/getImage.php deleted file mode 100644 index 8b88b9d..0000000 --- a/files/getImage.php +++ /dev/null @@ -1,17 +0,0 @@ - - - - -Dynamic Image Update - - - - Refreshed Image - - - \ No newline at end of file diff --git a/files/index.php b/files/index.php deleted file mode 100644 index 7ad2677..0000000 --- a/files/index.php +++ /dev/null @@ -1,22 +0,0 @@ - \ No newline at end of file diff --git a/tasks/main.yaml b/tasks/main.yaml index 8e0275a..e2eccde 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -11,9 +11,6 @@ ### Top Cam Feed Kiosk ### 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 include_tasks: - ustreamer.yaml diff --git a/tasks/photo_refresh.yaml b/tasks/photo_refresh.yaml index c57fa4f..b41b11c 100644 --- a/tasks/photo_refresh.yaml +++ b/tasks/photo_refresh.yaml @@ -4,11 +4,13 @@ set_fact: - docker_source: "/opt/cosmos/photo_refresh" -- name: photo_refresh - create docker folder + +# Create docker Folder +- name: lldp - python - create api folder file: path: "{{ docker_source }}" state: directory - mode: '0755' + mode: '0755' - name: photo_refresh - copy files for docker container copy: @@ -21,7 +23,7 @@ name: photo_refresh # Name of the Docker image source: 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 tag: latest @@ -39,7 +41,7 @@ dest: "{{ docker_source }}docker-compose.yaml" 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" register: local_index_output - debug: | diff --git a/tasks/timelapse.yaml b/tasks/timelapse.yaml index e6aefc2..0f7bd7f 100644 --- a/tasks/timelapse.yaml +++ b/tasks/timelapse.yaml @@ -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 set_fact: # timelapse related scripts @@ -23,9 +30,9 @@ src: "{{ item.src }}" dest: "{{ item.dest }}" loop: "{{ timelapse_script_templates }}" - owner: root - group: root - mode: 0644 + owner: timelapse + group: timelapse + mode: 0755 - name: template service file template: @@ -41,6 +48,6 @@ daemon_reload: yes state: started enabled: yes - name: ustreamer + name: timelapse ... \ No newline at end of file diff --git a/templates/create_timelapse.sh.j2 b/templates/create_timelapse.sh.j2 index 8edb1b0..2f7400c 100644 --- a/templates/create_timelapse.sh.j2 +++ b/templates/create_timelapse.sh.j2 @@ -1,6 +1,10 @@ #!/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" \ -vf "scale=1920x1080" -vcodec libx264 /$WORKING_DIR/00-timelapse.mp4 diff --git a/templates/record_snapshots.sh.j2 b/templates/record_snapshots.sh.j2 index 2513c55..9415cde 100644 --- a/templates/record_snapshots.sh.j2 +++ b/templates/record_snapshots.sh.j2 @@ -1,4 +1,11 @@ #!/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 # 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 # Calculate the height to trim based on the aspect ratios of the input and output images 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) convert $WORKING_DIR/$FILENAME.jpg -gravity North -crop x$trim_ratio +repage -resize 1340x580 {{ working_folder }}/small_thumbs/$NOW.jpg fi