Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(docs): automatically add Supported Version to README #521

Merged
merged 3 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/update-supported-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Update Supported Versions

on:
push:
branches:
- master
- develop
paths:
- "requirements.txt"
workflow_dispatch:
inputs:
targetBranch:
description: "Branch to run the script on (default: develop)"
required: false
default: "develop"

permissions:
contents: write
pull-requests: write

jobs:
update-versions:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.targetBranch || github.ref_name }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install dependencies from requirements.txt
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run update script
run: python scripts/update-readme-version.py ${{ github.event.inputs.targetBranch || github.ref_name }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update SUPPORTED_VERSIONS.json
title: "Update SUPPORTED_VERSIONS.json for ${{ github.event.inputs.targetBranch || github.ref_name }}"
branch: update-supported-versions-${{ github.event.inputs.targetBranch || github.ref_name }}
base: develop
body: "This PR updates the SUPPORTED_VERSIONS.json to reflect new versions."
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# <img src="qbm_logo.png" width="75"> qBit Manage
# Qbittorrent Manage

![qBit Manage](qbm_logo.png =75x)

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/StuffAnThings/qbit_manage?style=plastic)](https://github.com/StuffAnThings/qbit_manage/releases)
[![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/StuffAnThings/qbit_manage/latest/develop?label=Commits%20in%20Develop&style=plastic)](https://github.com/StuffAnThings/qbit_manage/tree/develop)
Expand All @@ -14,7 +16,7 @@ This is a program used to manage your qBittorrent instance such as:
* Apply category based on `save_path` to uncategorized torrents in category's `save_path`
* Change categories based on current category (`cat_change`)
* Remove unregistered torrents (delete data & torrent if it is not being cross-seeded, otherwise it will just remove the torrent)
* Automatically add [cross-seed](https://github.com/mmgoodnow/cross-seed) torrents in paused state. **\*Note: cross-seed now allows for torrent injections directly to qBit, making this feature rarely needed/used.\***
* Automatically add [cross-seed](https://github.com/cross-seed/cross-seed) torrents in paused state. **\*Note: cross-seed now allows for torrent injections directly to qBit, making this feature rarely needed/used.\***
* Recheck paused torrents sorted by lowest size and resume if completed
* Remove orphaned files from your root directory that are not referenced by qBittorrent
* Tag any torrents that have no hard links outside the root folder (for multi-file torrents the largest file is used)
Expand All @@ -23,21 +25,38 @@ This is a program used to manage your qBittorrent instance such as:
* Built-in scheduler to run the script every x minutes. (Can use `--run` command to run without the scheduler)
* Webhook notifications with [Notifiarr](https://notifiarr.com/) and [Apprise API](https://github.com/caronc/apprise-api) integration

## Supported Qbittorrent Versions

### Master

![master - qBittorrent version](https://img.shields.io/badge/dynamic/json?label=master%20-%20qBittorrent&query=master.qbit&url=https%3A%2F%2Fraw.githubusercontent.com%2FStuffAnThings%2Fqbit_manage%2Fdevelop%2FSUPPORTED_VERSIONS.json&color=brightgreen)

![master - qbittorrent-api version](https://img.shields.io/badge/dynamic/json?label=master%20-%20qbittorrent-api&query=master.qbitapi&url=https%3A%2F%2Fraw.githubusercontent.com%2FStuffAnThings%2Fqbit_manage%2Fdevelop%2FSUPPORTED_VERSIONS.json&color=blue)

### Develop

![develop - qBittorrent version](https://img.shields.io/badge/dynamic/json?label=develop%20-%20qBittorrent&query=develop.qbit&url=https%3A%2F%2Fraw.githubusercontent.com%2FStuffAnThings%2Fqbit_manage%2Fdevelop%2FSUPPORTED_VERSIONS.json&color=brightgreen)

![develop - qbittorrent-api version](https://img.shields.io/badge/dynamic/json?label=develop%20-%20qbittorrent-api&query=develop.qbitapi&url=https%3A%2F%2Fraw.githubusercontent.com%2FStuffAnThings%2Fqbit_manage%2Fdevelop%2FSUPPORTED_VERSIONS.json&color=blue)

## Getting Started

Check out the [wiki](https://github.com/StuffAnThings/qbit_manage/wiki) for installation help

1. Install qbit_manage either by installing Python 3.8.1+ on the localhost and following the [Local Installation](https://github.com/StuffAnThings/qbit_manage/wiki/Local-Installations) Guide or by installing Docker and following the [Docker Installation](https://github.com/StuffAnThings/qbit_manage/wiki/Docker-Installation) Guide or the [unRAID Installation](https://github.com/StuffAnThings/qbit_manage/wiki/Unraid-Installation) Guide.<br>
2. Once installed, you have to [set up your Configuration](https://github.com/StuffAnThings/qbit_manage/wiki/Config-Setup) by create a [Configuration File](https://github.com/StuffAnThings/qbit_manage/blob/master/config/config.yml.sample) filled with all your values to connect to your qBittorrent instance.
3. Please refer to the list of [Commands](https://github.com/StuffAnThings/qbit_manage/wiki/Commands) that can be used with this tool.
1. Install qbit_manage either by installing Python 3.8.1+ on the localhost and following the [Local Installation](https://github.com/StuffAnThings/qbit_manage/wiki/Local-Installations) Guide or by installing Docker and following the [Docker Installation](https://github.com/StuffAnThings/qbit_manage/wiki/Docker-Installation) Guide or the [unRAID Installation](https://github.com/StuffAnThings/qbit_manage/wiki/Unraid-Installation) Guide.
1. Once installed, you have to [set up your Configuration](https://github.com/StuffAnThings/qbit_manage/wiki/Config-Setup) by create a [Configuration File](https://github.com/StuffAnThings/qbit_manage/blob/master/config/config.yml.sample) filled with all your values to connect to your qBittorrent instance.
bakerboy448 marked this conversation as resolved.
Show resolved Hide resolved
1. Please refer to the list of [Commands](https://github.com/StuffAnThings/qbit_manage/wiki/Commands) that can be used with this tool.

## Usage

To run the script in an interactive terminal with a list of possible commands run:

```bash
python qbit_manage.py -h
```

## Support

* If you have any questions or require support please join the [Notifiarr Discord](https://discord.com/invite/AURf8Yz) and post your question under the `qbit-manage` channel.
* If you're getting an Error or have an Enhancement post in the [Issues](https://github.com/StuffAnThings/qbit_manage/issues/new).
* If you have a configuration question post in the [Discussions](https://github.com/StuffAnThings/qbit_manage/discussions/new).
Expand Down
10 changes: 10 additions & 0 deletions SUPPORTED_VERSIONS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"master": {
"qbit": "v4.6.4",
"qbitapi": "2024.3.60"
},
"develop": {
"qbit": "v4.6.4",
"qbitapi": "2024.3.60"
}
}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.1-develop3
4.1.1-develop6
2 changes: 1 addition & 1 deletion scripts/pre-commit/increase_version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Check if there are any changes staged for commit
if [[ -z $(git diff --cached --name-only) ]]; then
Expand Down
46 changes: 46 additions & 0 deletions scripts/update-readme-version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import json
import re
import sys

from qbittorrentapi import Version

# Check if a branch name was provided
if len(sys.argv) != 2:
print("Usage: python update_versions.py <branch_name>")
sys.exit(1)

branch_name = sys.argv[1]
print(f"Branch name: {branch_name}")

# Load or initialize the SUPPORTED_VERSIONS.json file
versions_file_path = "SUPPORTED_VERSIONS.json"
try:
with open(versions_file_path, encoding="utf-8") as file:
supported_versions = json.load(file)
except FileNotFoundError:
supported_versions = {}

# Extract the current qbittorrent-api version from requirements.txt
print("Reading requirements.txt...")
with open("requirements.txt", encoding="utf-8") as file:
requirements = file.read()
qbittorrent_api_version = re.search(r"qbittorrent-api==(.+)", requirements).group(1)

print(f"Current qbittorrent-api version: {qbittorrent_api_version}")

# Fetch the latest supported qBittorrent version
supported_version = Version.latest_supported_app_version()
print(f"Latest supported qBittorrent version: {supported_version}")

# Ensure the branch is initialized in the dictionary
if branch_name not in supported_versions:
supported_versions[branch_name] = {}

# Update the versions in the dictionary
supported_versions[branch_name]["qbit"] = supported_version
supported_versions[branch_name]["qbitapi"] = qbittorrent_api_version

print("Writing updated versions to SUPPORTED_VERSIONS.json...")
# Write the updated versions back to SUPPORTED_VERSIONS.json
with open(versions_file_path, "w", encoding="utf-8") as file:
json.dump(supported_versions, file, indent=4)