Traitorous JPRM

Source
JPRM
Metadata

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 or use a virtualenv From PyPI

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

jprm --version
python3 -m jprm --version
python3 jprm.py --version

GitHub Release

GitHub Release - Make a plugin

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

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

GitHub Release - Migrate to new sln file (optional)

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

GitHub Release - Get a logo (optional)

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 for explanation

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

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)

mkdir assets
cd assets

GitHub Release - Build and package the plugin

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

GitHub Release - Create a release on github

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

Gitea Release

Gitea Release - Make a plugin

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

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)

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

Gitea Release - Get a logo (optional)

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 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

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

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)

mkdir assets
cd assets

Gitea Release - Build and package the plugin

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

Gitea Release - Create a release on Gitea

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

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

Gitea Packages

Gitea Packages - Make a plugin

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

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)

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

Gitea Packages - Get a logo (optional)

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 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’)

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

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)

mkdir assets
cd assets

Gitea Packages - Build and package the plugin

Note the custom url format used here

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


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

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

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