Metadata-Version: 2.4
Name: traitorous_jprm
Version: 1.0.1
Summary: Like Jellyfin Plugin Repository Manager but less trustworthy
Home-page: https://gitea.narnian.us/lordwelch/jprm
Author: lordwelch
Author-email: git@lordwelch.me
License: MPL-2.0
Project-URL: documentation, https://jprm.traitorous.enterprises
Keywords: Jellyfin,plugin,repository,compile,publish,development
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: System :: Software Distribution
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: Click!=8.0.0,~=8.0
Requires-Dist: PyYAML<7,>=5.4
Requires-Dist: click-log~=0.4.0
Requires-Dist: python-slugify~=8.0
Requires-Dist: requests
Requires-Dist: tabulate~=0.9.0
Dynamic: license-file

---
include_toc: true
gitea: none
---

What is it?
==========
This is a fork of https://github.com/oddstr13/jellyfin-plugin-repository-manager mainly because I have different opinions on how things should work.

Installing
==========
Use [pipx](https://pipx.pypa.io/latest/how-to/install-pipx.html) or use a virtualenv
From PyPI
---------
```bash
pipx install traitorous-jprm
```

From git
-----------
```
pipx install git+https://gitea.narnian.us/lordwelch/traitorous-jprm
```

From local developement directory
---------------------------------
```
git clone https://gitea.narnian.us/lordwelch/traitorous-jprm
pipx install --editable ./traitorous-jprm
```

Examples
========

Running jprm
------------

```bash
jprm --version
```

```bash
python3 -m jprm --version
```

```bash
python3 jprm.py --version
```

<details>
<summary>

GitHub Release
------------------------------

</summary>

### GitHub Release - Make a plugin

Fork https://github.com/jellyfin/jellyfin-plugin-template

```bash
git clone https://github.com/lordwelch/jellyfin-plugin-template
cd jellyfin-plugin-template
```

### GitHub Release - Migrate to new sln file (optional)

```bash
dotnet sln migrate Jellyfin.Plugin.Template.sln
rm Jellyfin.Plugin.Template.sln
```

### GitHub Release - Get a logo (optional)

```bash
curl -Lo logo.png 'https://github.com/jellyfin/jellyfin-ux/blob/master/logos/PNG-background-space/jellyfin-horizontal--color-on-light.png?raw=true'
```

### GitHub Release - Make your build.yaml

See [Metadata.md](Metadata.md) for explanation
```yaml
name: Template
guid: eb5d7894-8eef-4b36-aa6f-5d124e828ce2
imageUrl: https://github.com/lordwelch/jellyfin-plugin-template/raw/refs/heads/master/logo.png
image: logo.png
targetAbi: 10.11.11.0
framework: net9.0
owner: lordwelch
overview: A template for making jellyfin plugins.
category: Other
description: |
  This plugin is an template for making actually useful plugins
```

### GitHub Release - Push changes
```bash
git add .
git commit -m 'Update for use with traitorous-jprm'
git push origin master
```

### GitHub Release - Make a temporary directory for build assets (optional)

```bash
mkdir assets
cd assets
```

### GitHub Release - Build and package the plugin

```bash
jprm --verbosity debug repo build -c 'this is a changelog' --version 6.0.0.0 ./manifest.json ../
```

### GitHub Release - Create a release on github

```bash
gh release create -R lordwelch/jellyfin-plugin-template 6.0.0.0 --title "v6.0.0.0" --notes "This is an example release for demonstrating https://gitea.narnian.us/lordwelch/traitorous-jprm" manifest.json ./artifacts/*
```

### GitHub Release - Activate repo in Jellyfin

Plugin repository url for this example is: https://github.com/lordwelch/jellyfin-plugin-template/releases/latest/download/manifest.json

</details>

<details>
<summary>

Gitea Release
------------------------------

</summary>

### Gitea Release - Make a plugin

Replace https://gitea.narnian.us/lordwelch/jellyfin-plugin-template with your gitea repository

```bash
git clone https://github.com/jellyfin/jellyfin-plugin-template
cd jellyfin-plugin-template
git remote set-url origin https://gitea.narnian.us/lordwelch/jellyfin-plugin-template
```

### Gitea Release - Migrate to new sln file (optional)

```bash
dotnet sln migrate Jellyfin.Plugin.Template.sln
rm Jellyfin.Plugin.Template.sln
```

### Gitea Release - Get a logo (optional)

```bash
curl -Lo logo.png 'https://github.com/jellyfin/jellyfin-ux/blob/master/logos/PNG-background-space/jellyfin-horizontal--color-on-light.png?raw=true'
```

### Gitea Release - Make your build.yaml

See [Metadata.md](Metadata.md) for explanation of properties

> 📝 **Note:** https://gitea.narnian.us doesn't let you view raw files until you login, so I upload the logo to the release so that this actually works

```yaml
name: Template
guid: eb5d7894-8eef-4b36-aa6f-5d124e828ce2
imageUrl: https://gitea.narnian.us/lordwelch/jellyfin-plugin-template/releases/download/latest/logo.png
image: logo.png
targetAbi: 10.11.11.0
framework: net9.0
owner: lordwelch
overview: A template for making jellyfin plugins.
category: Other
description: |
  This plugin is an template for making actually useful plugins
```

### Gitea Release - Push changes
```bash
git add .
git commit -m 'Update for use with traitorous-jprm'
git push origin master
```

### Gitea Release - Make a temporary directory for build assets (optional)

```bash
mkdir assets
cd assets
```

### Gitea Release - Build and package the plugin

```bash
jprm --verbosity debug repo build -c 'this is a changelog' --version 6.0.0.0 ./manifest.json ../
```

### Gitea Release - Create a release on Gitea

```bash
tea release create --tag 6.0.0.0 --title "v6.0.0.0" --note "This is an example release for demonstrating https://gitea.narnian.us/lordwelch/traitorous-jprm"
tea release asset create 6.0.0.0 ../logo.png manifest.json artifacts/*
```

OR

```bash
response=$(
curl --request POST \
  --url https://gitea.narnian.us/api/v1/repos/lordwelch/jellyfin-plugin-template/releases \
  --header 'Authorization: token <api key>' \
  --header 'Content-Type: application/json' \
  --data '{ "body": "This is an example release for demonstrating https://gitea.narnian.us/lordwelch/traitorous-jprm", "draft": false, "name": "v6.0.0.0", "prerelease": false, "tag_name": "6.0.0.0"}'
)
upload_url=${response##*\"upload_url\":\"}  # removes everything before the json value we need "upload_url"
upload_url=${upload_url%%\"*}               # removes everything after the json value we need
for filename in ../logo.png manifest.json artifacts/*; do
  curl --request POST \
    --url "$upload_url?name=${filename##*/}" \
    --header 'Authorization: token <api key>' \
    --header 'Content-Type: application/octet-stream' \
    --data-binary "@${filename}"
done
```

### Gitea Release - Activate repo in Jellyfin

Plugin repository url for this example is: https://gitea.narnian.us/lordwelch/jellyfin-plugin-template/releases/download/latest/manifest.json

</details>

<details>
<summary>

Gitea Packages
------------------------------

</summary>

### Gitea Packages - Make a plugin

Replace https://gitea.narnian.us/lordwelch/jellyfin-plugin-template with your gitea repository

```bash
git clone https://github.com/jellyfin/jellyfin-plugin-template
cd jellyfin-plugin-template
git remote set-url origin https://gitea.narnian.us/lordwelch/jellyfin-plugin-template
```

### Gitea Packages - Migrate to new sln file (optional)

```bash
dotnet sln migrate Jellyfin.Plugin.Template.sln
rm Jellyfin.Plugin.Template.sln
```

### Gitea Packages - Get a logo (optional)

```bash
curl -Lo logo.png 'https://github.com/jellyfin/jellyfin-ux/blob/master/logos/PNG-background-space/jellyfin-horizontal--color-on-light.png?raw=true'
```

### Gitea Packages - Make your build.yaml

See [Metadata.md](Metadata.md) for explanation of properties

(https://gitea.narnian.us doesn't let you view raw files until you login, so I upload the logo and manifest to a package version called 'assets')
```yaml
name: Template
guid: eb5d7894-8eef-4b36-aa6f-5d124e828ce2
imageUrl: https://gitea.narnian.us/api/packages/lordwelch/generic/jellyfin-plugin-template/assets/oidc-authentication_6.0.0.0.zip
image: logo.png
targetAbi: 10.11.11.0
framework: net9.0
owner: lordwelch
overview: A template for making jellyfin plugins.
category: Other
description: |
  This plugin is an template for making actually useful plugins
```

### Gitea Packages - Push changes
```bash
git add .
git commit -m 'Update for use with traitorous-jprm'
git push origin master
```

### Gitea Packages - Make a temporary directory for build assets (optional)

```bash
mkdir assets
cd assets
```

### Gitea Packages - Build and package the plugin
Note the custom url format used here
```bash
jprm --verbosity debug repo build --url 'https://{hostname}/api/packages/{owner}/generic/{project}/{version}/{slug}_{version}.zip' -c 'this is a changelog' --version 6.0.0.0 ./manifest.json ../
```

### Gitea Packages - Create a package on Gitea

```bash

function upload_package() {
  token=$1
  package_name=$2
  version=$3
  filename=$4
  # First delete any package that exists. Needed for if we upload a manifest for the next version
  url="https://gitea.narnian.us/api/packages/lordwelch/generic/$package_name/$version/${filename##*/}"
  curl -X DELETE \
    --header "Authorization: token $token" \
    "$url" >/dev/null 2>&1
  curl -X PUT \
    --header "Authorization: token $token" \
    "$url" \
    --upload-file "$filename"
}

for file in artifacts/*; do
  upload_package '<api key>' jellyfin-plugin-template 6.0.0.0 "$file"
done
upload_package '<api key>' jellyfin-plugin-template assets ./manifest.json
upload_package '<api key>' jellyfin-plugin-template assets ../logo.png
```

### Gitea Packages - Link package to repository (optional)
Go to https://gitea.narnian.us/lordwelch/-/packages/settings/generic/jellyfin-plugin-template and link to jellyfin-plugin-template

### Gitea Packages - Activate repo in Jellyfin

Plugin repository url for this example is: https://gitea.narnian.us/api/packages/lordwelch/generic/jellyfin-plugin-template/assets/manifest.json

</details>

Why is it called traitorous-jprm?
==========
Because I own the traitorous.enterprises domain.

And if I put traitorous in the name people probably won't take it too seriously
