From 77e18943b62bc14ea3c0dd9ce4a62511c976c041 Mon Sep 17 00:00:00 2001 From: RFK Date: Sun, 27 Aug 2023 11:28:23 +0200 Subject: [PATCH] Translate to English --- .github/workflows/docker-publish.yml | 6 +-- .github/workflows/translate-readme.yml | 21 +++++++++ PrusaLinkGetSnaps.py | 9 ++-- README.md | 64 +++++++++++--------------- 4 files changed, 54 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/translate-readme.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6172eb4..bcb96c8 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -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 / IMAGE_NAME: ${{ github.repository }} @@ -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 diff --git a/.github/workflows/translate-readme.yml b/.github/workflows/translate-readme.yml new file mode 100644 index 0000000..67e43e2 --- /dev/null +++ b/.github/workflows/translate-readme.yml @@ -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 diff --git a/PrusaLinkGetSnaps.py b/PrusaLinkGetSnaps.py index 3e9cea2..f465e21 100644 --- a/PrusaLinkGetSnaps.py +++ b/PrusaLinkGetSnaps.py @@ -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}" @@ -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 @@ -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: @@ -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: diff --git a/README.md b/README.md index 425129e..939da21 100644 --- a/README.md +++ b/README.md @@ -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' @@ -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 -```