Skip to content

Commit

Permalink
Auto PR creating, GitHub Releases & Clean-ups (#49)
Browse files Browse the repository at this point in the history
* Allow to publish PR + cleanups

* Enable dependabot

* Updates after linter

* fix: make mypy happy

* New version for clean-ups

* Add release flow

* fix: handle PIL library on android

---------

Co-authored-by: Andrea Ghensi <[email protected]>
  • Loading branch information
Lord-Grey and sanzoghenzo authored Aug 20, 2023
1 parent bd6aaab commit 26cc319
Show file tree
Hide file tree
Showing 31 changed files with 1,018 additions and 586 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
69 changes: 69 additions & 0 deletions .github/workflows/publish-addon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Check, release and publish addon

on: [push]

env:
ADDON_NAME: script.service.hyperion
TARGET_KODI_VER: nexus

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install addon checker
run: |
pip install -q kodi-addon-checker
- name: Check with addon-checker
run: |
kodi-addon-checker --branch $TARGET_KODI_VER --allow-folder-id-mismatch $ADDON_NAME
github_release:
runs-on: ubuntu-latest
permissions:
contents: write

needs: check
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install addon submitter
run: |
pip install -q git+https://github.com/xbmc/kodi-addon-submitter.git
- name: Package addon
run: |
submit-addon -s -z $ADDON_NAME
- name: Publish release
uses: ncipollo/release-action@v1
with:
artifacts: "*.zip"

kodi_publish:
runs-on: ubuntu-latest

needs: check
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install addon submitter
run: |
pip install -q git+https://github.com/xbmc/kodi-addon-submitter.git
- name: Submit addon
run: |
submit-addon -r repo-scripts -b $TARGET_KODI_VER -s --pull-request $ADDON_NAME
env:
GH_USERNAME: ${{ github.actor }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
EMAIL: "${{ github.actor }}@users.noreply.github.com"
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
.idea/
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# python
*.pyo
__pycache__
.idea
Pipfile.lock
.mypy_cache
.ruff_cache
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
exclude: CHANGELOG.md
additional_dependencies:
- mdformat-black
- mdformat-frontmatter
- mdformat-admon
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.252'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.4.1'
hooks:
- id: mypy
additional_dependencies:
- types-protobuf
18 changes: 18 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]
kodistubs = "*"
kodi-addon-checker = "*"

[requires]
python_version = "3.11"

[scripts]
pre-commit = "pre-commit install"
lint = "pre-commit run --all"
check = "kodi-addon-checker --branch nexus --allow-folder-id-mismatch script.service.hyperion-control"
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# script.service.hyperion
# Hyperion Capture for Kodi 20 (Nexus)

[![Latest-Release](https://img.shields.io/github/v/release/hyperion-project/hyperion.kodi?include_prereleases&label=Latest%20Release&logo=github&logoColor=white&color=0f83e7)](https://github.com/hyperion-project/hyperion.kodi/releases)
[![Join Translation](https://img.shields.io/badge/POEditor-translate-green.svg)](https://poeditor.com/join/project/yKr4KrF7G2)
[![Forum](https://img.shields.io/website/https/hyperion-project.org.svg?label=Forum&down_color=red&down_message=offline&up_color=4bc51d&up_message=online&logo=homeadvisor&logoColor=white)](https://www.hyperion-project.org)

Kodi add-on to capture video data and send it to Hyperion.
Note that this plugin does not currently work for Kodi running on Raspberry Pi.
There is an outstanding Kodi fix for that.

Information about Hyperion can be found here: https://wiki.hyperion-project.org
**Note:** This plugin does not currently work for Kodi running on Raspberry Pi. There is an outstanding Kodi fix for that.

Information about Hyperion can be found here: <https://docs.hyperion-project.org/>

### Installation

The add-on can be installed by downloading the zip and installing it via the Kodi Add-On zip install or
extracting it to the addons directory (i.e.~/.kodi/addons on Linux or %AppData%\Kodi\addons on Windows)
- Download .zip from release page and use "Install from zip file" dialog at the Kodi addons section.
43 changes: 0 additions & 43 deletions addon.py

This file was deleted.

34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[tool.mypy]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_calls = false
disallow_untyped_defs = true
no_implicit_optional = true
show_error_codes = true
strict_equality = true
strict_optional = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

[tool.ruff]
select = ["B", "C", "D", "E", "F", "I", "N", "S", "U", "W"]
ignore = ["E501", "D212", "D103", "D107"]
target-version = "py310"
src = ["resources"]

[tool.ruff.per-file-ignores]
"script.service.hyperion/resources/lib/monitor.py" = ["N802", "D102"]
"script.service.hyperion/resources/lib/hyperion/message_pb2.py" = ["D100"]
"__init__.py" = ["D104"]

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.isort]
force-single-line = true

[tool.ruff.pyupgrade]
keep-runtime-typing = true
Binary file removed resources/fanart.png
Binary file not shown.
Loading

0 comments on commit 26cc319

Please sign in to comment.