From 4f789ab2ba39f0b9a0b5f0ef735dcc6501924789 Mon Sep 17 00:00:00 2001 From: b2un0 Date: Fri, 28 Feb 2025 17:08:41 +0100 Subject: [PATCH] build know tonies markdown table for each language on --- .github/workflows/known_tonies.yaml | 26 +++++++++++++++++++++++ .github/workflows/validate.yaml | 1 + README.md | 17 ++++++++++----- build_known_tonies.sh | 32 +++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/known_tonies.yaml create mode 100755 build_known_tonies.sh diff --git a/.github/workflows/known_tonies.yaml b/.github/workflows/known_tonies.yaml new file mode 100644 index 0000000..8240695 --- /dev/null +++ b/.github/workflows/known_tonies.yaml @@ -0,0 +1,26 @@ +name: build known tonies for each language + +on: + push: + workflow_dispatch: + +jobs: + known_tonies: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: build known tonies + run: ./build_known_tonies.sh + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + file_pattern: '*/*.md' + commit_message: update language specific known tonies list diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 3ac7ac8..7100bcc 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -2,6 +2,7 @@ name: Validate NFC Files on: push: + workflow_dispatch: pull_request: types: [ opened, synchronize, reopened ] diff --git a/README.md b/README.md index f1e804b..494b616 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,20 @@ +# Toniebox NFC Files This repo contains `.nfc` files to be used with Flipper Zero. Just place them in your `nfc` folder, and then emulate them. Pull requests welcome! -**Usage Notes** +### Usage Notes -* Reading/emulating SLIX-L chips is a fairly new addition to the official Flipper Zero firmware. It disappeared for a few releases and came back as of `0.99.1` (with a different file format), so make sure you are on that version or newer. I'm not sure about unofficial firmwares and which versions support this yet. -* The Tonie Box downloads the audio data from servers, so it is possible that the data in this repo no longer works at some point. Keep that in mind if you are uploading your kid's cherished figures. +* Reading/emulating SLIX-L chips is a fairly new addition to the official Flipper Zero firmware. + It disappeared for a few releases and came back as of `0.99.1` (with a different file format), so make sure you are on that version or newer. + I'm not sure about unofficial firmwares and which versions support this yet. +* The Tonie Box downloads the audio data from servers, so it is possible that the data in this repo no longer works at some point. + Keep that in mind if you are uploading your kid's cherished figures. -**Pull Requests** +### Pull Requests -If you want to add new Tonies, it will help to run `validation.sh`. If it detects something wrong with any of the files, it will tell you, and you can fix it before submitting the PR. Otherwise it will output no message at all. I will also run this from time to time and clean up files as needed. \ No newline at end of file +If you want to add new Tonies, it will help to run `validation.sh`. +If it detects something wrong with any of the files, it will tell you, and you can fix it before submitting the PR. +Otherwise, it will output no message at all. +I will also run this from time to time and clean up files as needed. \ No newline at end of file diff --git a/build_known_tonies.sh b/build_known_tonies.sh new file mode 100755 index 0000000..8b8f460 --- /dev/null +++ b/build_known_tonies.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +echo "Building known tonies for each folder" + +while read -r LANG_DIR; do + NFC_FILES=() + while IFS= read -r -d '' NFC_FILE; do + NFC_FILES+=("${NFC_FILE}") + done < <(find "${LANG_DIR}" -type f -name "*.nfc" -print0 | sort -z) + + FOLDER=$(basename "${LANG_DIR}") + NFC_FILES_COUNT=${#NFC_FILES[@]} + + echo "${FOLDER} has ${NFC_FILES_COUNT}" + { + echo "# ${NFC_FILES_COUNT} ${FOLDER} NFC Files" + echo "" + echo "automatically generated, do not edit" + echo "" + echo "| Folder | Filename |" + echo "|--------|----------|" + } > "${LANG_DIR}/README.md" + + for FILE_PATH_ABS in "${NFC_FILES[@]}"; do + FILE_NAME=$(basename "$FILE_PATH_ABS") + FILE_PATH_REL=${FILE_PATH_ABS#"${LANG_DIR}/"} + FILE_PATH_REL_ENC=$(echo "$FILE_PATH_REL" | awk '{gsub(/ /, "%20"); print}') + FOLDER_NAME_REL=$(dirname "${FILE_PATH_REL}") + printf "| %s | [%s](%s) |\n" "${FOLDER_NAME_REL}" "${FILE_NAME}" "${FILE_PATH_REL_ENC}" >> "${LANG_DIR}/README.md" + done + +done < <(find "." -maxdepth 1 -type d ! -name ".*")