Skip to content

Commit

Permalink
Merge pull request #22 from jeremiah-k/process-release-notes
Browse files Browse the repository at this point in the history
Process release notes
  • Loading branch information
jeremiah-k authored Dec 24, 2024
2 parents 369643d + 8930f1e commit 5058338
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 29 deletions.
14 changes: 7 additions & 7 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ cli:
plugins:
sources:
- id: trunk
ref: v1.6.5
ref: v1.6.6
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- node@18.12.1
- node@18.20.5
- [email protected]
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected].327
- [email protected].344
- git-diff-check
- [email protected]
- [email protected]
- [email protected].1
- [email protected].1
- [email protected].1
- [email protected].2
- [email protected].2
- [email protected].4
- [email protected]
- trufflehog@3.84.2
- trufflehog@3.88.0
- [email protected]
actions:
enabled:
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Fetchtastic is a utility for downloading and managing the latest Meshtastic Andr
## Table of Contents

- [Installation](#installation)
- [Termux Installation (Android)](#termux-installation-android)
- [Linux/Mac Installation](#linuxmac-installation)
- [Termux Installation (Android)](#termux-installation-android)
- [Usage](#usage)
- [Setup Process](#setup-process)
- [Command List](#command-list)
Expand All @@ -17,6 +17,26 @@ Fetchtastic is a utility for downloading and managing the latest Meshtastic Andr

## Installation

### Linux/Mac Installation

Fetchtastic can also be installed on Linux or macOS systems.

#### Install with pipx (Recommended)

It's recommended to use `pipx` to install Fetchtastic in an isolated environment. (If you prefer, you can use `pip` too.)

1. **Install pipx**:

Follow the installation instructions for your platform on the [pipx documentation page](https://pypa.github.io/pipx/installation/).

Restart your terminal after installing pipx.

2. **Install Fetchtastic with pipx**:

```bash
pipx install fetchtastic
```

### Termux Installation (Android)

Fetchtastic can be installed on your Android device using Termux.
Expand All @@ -42,26 +62,6 @@ pkg install python python-pip openssl -y
pip install fetchtastic
```

### Linux/Mac Installation

Fetchtastic can also be installed on Linux or macOS systems.

#### Install with pipx (Recommended)

It's recommended to use `pipx` to install Fetchtastic in an isolated environment. (If you prefer, you can use `pip` too.)

1. **Install pipx**:

Follow the installation instructions for your platform on the [pipx documentation page](https://pypa.github.io/pipx/installation/).

Restart your terminal after installing pipx.

2. **Install Fetchtastic with pipx**:

```bash
pipx install fetchtastic
```

## Usage

### Setup Process
Expand Down
20 changes: 20 additions & 0 deletions app/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ def cleanup_old_versions(directory, releases_to_keep):
os.rmdir(version_path)
log_message(f"Removed directory: {version_path}")

# Function to strip out non-printable characters and emojis
def strip_unwanted_chars(text):
"""
Strips out non-printable characters and emojis from a string.
"""
# Regex for printable characters (including some extended ASCII)
printable_regex = re.compile(r"[^\x00-\x7F]+")
return printable_regex.sub("", text)

# Function to check for missing releases and download them if necessary
def check_and_download(
releases,
Expand Down Expand Up @@ -247,11 +256,22 @@ def check_and_download(
for release in releases_to_download:
release_tag = release["tag_name"]
release_dir = os.path.join(download_dir, release_tag)
release_notes_file = os.path.join(
release_dir, f"release_notes-{release_tag}.md"
)

# Create release directory if it doesn't exist
if not os.path.exists(release_dir):
os.makedirs(release_dir, exist_ok=True)

# Download release notes if missing
if not os.path.exists(release_notes_file) and release.get("body"):
log_message(f"Downloading release notes for version {release_tag}.")
release_notes_content = strip_unwanted_chars(release["body"])
with open(release_notes_file, "w", encoding="utf-8") as notes_file:
notes_file.write(release_notes_content)
log_message(f"Saved release notes to {release_notes_file}")

assets_to_download = []
for asset in release["assets"]:
file_name = asset["name"]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = fetchtastic
version = 0.2.4
version = 0.2.5
author = Jeremiah K
author_email = [email protected]
description = Meshtastic Firmware and APK Downloader
Expand Down

0 comments on commit 5058338

Please sign in to comment.