Skip to content

Commit

Permalink
Translate to English
Browse files Browse the repository at this point in the history
  • Loading branch information
RFKDOT committed Aug 27, 2023
1 parent 9a50984 commit 77e1894
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 46 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ name: Build and Publish Docker Image
on:
push:
branches: ['main']
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: ['main']
workflow_dispatch:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
Expand All @@ -27,8 +25,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/translate-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Translate README

on:
push:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
# ISO Langusge Codes: https://cloud.google.com/translate/docs/languages
- name: Adding README - Spanish
uses: dephraiim/translate-readme@main
with:
LANG: es
9 changes: 4 additions & 5 deletions PrusaLinkGetSnaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def this_time():
return now.strftime("%d/%m/%Y %H:%M:%S")

def format_time(seconds):
"""Format time in seconds to HH:MM:SS"""
hours, remainder = divmod(seconds, 3600)
minutes, seconds = divmod(remainder, 60)
return f"{hours:02}:{minutes:02}:{seconds:02}"
Expand All @@ -33,12 +32,12 @@ def download_snapshot():
job_response = requests.get(f"http://{IP_ADDRESS}/api/v1/job", headers=HEADERS)
job_response.raise_for_status()
except Exception as e:
print(f"{this_time()} Parece que en este momento la impresora está apagada", flush=True)
print(f"{this_time()} Printer is off !?!?", flush=True)
sleep_time = 600
return

if job_response.status_code != 200:
print(f"{this_time()} Parece que en este momento no se está imprimiendo nada", flush=True)
print(f"{this_time()} Printer is stand-by !?!?", flush=True)
sleep_time = 120
return

Expand All @@ -60,7 +59,7 @@ def download_snapshot():
snap_response.raise_for_status()

if previous_snapshot == snap_response.content:
if DEBUG==True: print(f"{this_time()} Misma captura, esperamos {sleep_time} segundos", flush=True)
if DEBUG==True: print(f"{this_time()} Same image, waiting {sleep_time} seconds", flush=True)
return

else:
Expand All @@ -73,7 +72,7 @@ def download_snapshot():
with open(os.path.join(os.getcwd(), file_name), "wb") as file:
file.write(snap_response.content)

print(f"{this_time()} Captura obtenida y almacenada en {file_name}", flush=True)
print(f"{this_time()} Image saved => {file_name}", flush=True)
sleep_time = SLEEP_TIME

while True:
Expand Down
64 changes: 27 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,47 @@

[![Build and Publish Docker Image](https://github.com/RFKDOT/PrusaLinkSnapsToVideo/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/RFKDOT/PrusaLinkSnapsToVideo/actions/workflows/docker-publish.yml)

Descarga las capturas (SnapShots) dee las fotos realizadas por PrusaLink mediante su API, en formato PNG.
Y a partir de esas capturas, genera un video MP4.
Download the SnapShots of the photos taken by PrusaLink through its API, in PNG format.
And from these snapshots, it generates an MP4 video.

## Instalación manual
## Manual Installation

- Clonar proyecto
- Clone project

```
git clone git@github.com:RFKDOT/PrusaLinkSnapsToVideo.git
```

- Instalar dependencias
- Install dependencies

```
pip3 install opencv-python requests python-dotenv
```

## Configuración
### Configuration

- Copia el fichero .env.example a .env
- Editalo e incluye la IP local de tu RaspBerry donde tengas instalado PrusaLink, por defecto 'prusalink.local'
- Tambien incluye tu Clave API, la puedes encontrar o generar en la sección de Ajustes de tu PrusaLink
- Copy the file .env.example to .env
- Edit it and include the local IP of your RaspBerry where you have PrusaLink installed, by default 'prusalink.local'.
- Also include your API Key, you can find it or generate it in the Settings section of your PrusaLink.

## Instalación Docker Compose
### Use PrusaLinkGetSnaps.py

- Downloads the generated snapshots according to the camera configuration to PrusaLink.
- Keeps running permanently

```
python3 PrusaLinkGetSnaps.py
```

### Use MakeVideoFromSnaps.py

- Generate an MP4 video by assembling the SnapsShots of a given project, in order.

```
python3 MakeVideoFromSnaps.py
```

## Docker Compose installation

```
version: '3.9'
Expand All @@ -44,30 +61,3 @@ services:
working_dir: /app
restart: always
```

## Ejecución y uso

### PrusaLinkGetSnaps.py

- Descarga los snapshots generados según la configuración de la cámara en PrusaLink
- Se mantiene en ejecución permanente

```
python3 PrusaLinkGetSnaps.py
```

### MakeVideoFromSnaps.py

- Genera un video MP4 montando en él los SnapsShots de un determinado proyecto, en orden.

```
python3 MakeVideoFromSnaps.py
```

# Devel

```
docker system prune -a
docker build -t plstv .
docker run -it plstv
```

0 comments on commit 77e1894

Please sign in to comment.