Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Pulling nightly into master #38

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4782f01
feat: initial version (#1)
ReenigneArcher Oct 8, 2023
093503c
ci: update global workflows (#37)
LizardByte-bot Oct 8, 2023
0b871e0
ci: fix localize workflow (#41)
ReenigneArcher Oct 8, 2023
03c46b9
New Babel Updates (#42)
LizardByte-bot Oct 8, 2023
74b05e1
ci: update global python (#43)
LizardByte-bot Oct 8, 2023
b34ede4
Bump actions/checkout from 3 to 4 (#28)
dependabot[bot] Oct 8, 2023
7e9648b
Bump peter-evans/create-pull-request from 4 to 5 (#11)
dependabot[bot] Oct 8, 2023
5631fab
build(deps): bump @fontsource/open-sans from 4.5.13 to 5.0.15 (#39)
dependabot[bot] Oct 8, 2023
e8c2dc6
Bump @fortawesome/fontawesome-free from 6.2.0 to 6.4.2 (#22)
dependabot[bot] Oct 8, 2023
ad67001
Bump jquery from 3.6.1 to 3.7.1 (#26)
dependabot[bot] Oct 8, 2023
5bbabf9
Bump bootstrap from 5.2.2 to 5.3.2 (#34)
dependabot[bot] Oct 8, 2023
325acbc
ci: update global workflows (#44)
LizardByte-bot Oct 9, 2023
53e9a1b
ci: update global workflows (#46)
LizardByte-bot Oct 10, 2023
b796acb
ci: update release notifier (#47)
LizardByte-bot Oct 10, 2023
ab6c089
ci: update global workflows (#48)
LizardByte-bot Oct 12, 2023
1fc3422
ci: update release notifier (#49)
LizardByte-bot Oct 16, 2023
9561f42
build(deps-dev): bump plexhints from 0.1.0 to 0.1.1 (#50)
dependabot[bot] Oct 17, 2023
05d7c9d
ci: use tagged setup python action (#53)
ReenigneArcher Oct 24, 2023
642190f
ci: update global workflows (#62)
LizardByte-bot Nov 24, 2023
b18a03c
chore: update LizardByte actions (#63)
ReenigneArcher Nov 28, 2023
c6fe2bd
ci: update release notifier (#69)
LizardByte-bot Dec 4, 2023
03cff88
build(deps): bump actions/setup-python from 4 to 5 (#70)
dependabot[bot] Dec 7, 2023
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
10 changes: 6 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ jobs:
with:
path: Plugger.bundle

- name: Install Python 2.7
uses: actions/setup-python@v4
- name: Install Python
uses: LizardByte/action-setup-python@master
with:
python-version: '2.7'

- name: Set up Python 2.7 Dependencies
- name: Set up Python Dependencies
working-directory: Plugger.bundle
run: |
echo "Installing Requirements"
python --version
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade pip setuptools
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade pip setuptools wheel

# install dev requirements
python -m pip install --upgrade -r requirements-dev.txt
Expand Down Expand Up @@ -97,6 +97,7 @@ jobs:
!**/Plugger.bundle/Dockerfile
!**/Plugger.bundle/docs
!**/Plugger.bundle/scripts
!**/Plugger.bundle/tests

- name: Package Release
shell: bash
Expand All @@ -113,6 +114,7 @@ jobs:
"-xr!Plugger.bundle/Dockerfile" \
"-xr!Plugger.bundle/docs" \
"-xr!Plugger.bundle/scripts" \
"-xr!Plugger.bundle/tests" \
a "./Plugger.bundle.zip" "Plugger.bundle"

mkdir artifacts
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/localize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [nightly]
paths: # prevents workflow from running unless these files change
- '.github/workflows/localize.yml'
- 'Contents/Scripts/plugger.po'
- 'Contents/Strings/plugger.po'
- 'Contents/Code/**.py'
- 'Contents/Resources/web/templates/**'
workflow_dispatch:
Expand All @@ -27,8 +27,8 @@ jobs:

- name: Set up Python Dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements.txt
python -m pip install --upgrade pip setuptools requests
python -m pip install -r requirements.txt # requests is required to install python-plexapi

- name: Update Strings
run: |
Expand All @@ -40,14 +40,14 @@ jobs:
git config --global pager.diff false

# print the git diff
git diff Contents/Scripts/plugger.po
git diff Contents/Strings/plugger.po

# set the variable with minimal output, replacing `\t` with ` `
OUTPUT=$(git diff --numstat locale/retroarcher.po | sed -e "s#\t# #g")
OUTPUT=$(git diff --numstat Contents/Strings/plugger.po | sed -e "s#\t# #g")
echo "git_diff=${OUTPUT}" >> $GITHUB_ENV

- name: git reset
if: ${{ env.git_diff == '1 1 Contents/Scripts/plugger.po' }} # only run if more than 1 line changed
if: ${{ env.git_diff == '1 1 Contents/Strings/plugger.po' }} # only run if more than 1 line changed
run: |
git reset --hard

Expand All @@ -59,7 +59,7 @@ jobs:
uses: peter-evans/create-pull-request@v4
with:
add-paths: |
Contents/Scripts/*.po
Contents/Strings/*.po
token: ${{ secrets.GH_BOT_TOKEN }} # must trigger PR tests
commit-message: New localization template
branch: localize/update
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: Install Python
uses: LizardByte/action-setup-python@master
with:
python-version: '2.7'

- name: Install python dependencies
shell: bash
run: |
# requests is required to install python-plexapi
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade \
pip setuptools requests
pip setuptools wheel
python -m pip --no-python-version-warning --disable-pip-version-check install -r requirements-dev.txt
python -m pip --no-python-version-warning --disable-pip-version-check install -r requirements.txt
python -m pip --no-python-version-warning --disable-pip-version-check install \
--target=./Contents/Libraries/Shared -r requirements.txt --no-warn-script-location

- name: Test with pytest
shell: bash # our Python 2.7 setup action doesn't support PowerShell
run: |
python -m pytest -v
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ plexhints-temp
*cache.sqlite

# Remove python modules
Contents/Libraries/Shared/*

# Keep requirements.txt files
!*requirements.txt
Contents/Libraries/Shared/

# npm
node_modules/
Expand Down
7 changes: 6 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ build:
os: ubuntu-20.04
tools:
python: "2.7"
jobs:
pre_build:
- python ./scripts/build_plist.py
post_build:
- rstcheck -r . # lint rst files
# - rstfmt --check --diff -w 120 . # check rst formatting

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand All @@ -25,4 +31,3 @@ python:
install:
- requirements: requirements.txt # plugin requirements
- requirements: requirements-dev.txt # docs requirements
system_packages: true
11 changes: 11 additions & 0 deletions .rstcheck.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# configuration file for rstcheck, an rst linting tool
# https://rstcheck.readthedocs.io/en/latest/usage/config

[rstcheck]
ignore_directives =
automodule,
include,
mdinclude,
todo,
ignore_roles =
modname,
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog

## [0.0.1] - 2023-02-24
### Added
**Added**
- Initial Release

[0.0.1]: https://github.com/lizardbyte/plugger/releases/tag/v0.0.1
24 changes: 3 additions & 21 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# -*- coding: utf-8 -*-

# standard imports
import sys
from threading import Thread

# plex debugging
try:
import plexhints # noqa: F401
Expand All @@ -21,7 +17,7 @@

# local imports
from default_prefs import default_prefs
from webapp import app
from webapp import start_server


def ValidatePrefs():
Expand All @@ -46,7 +42,6 @@ def ValidatePrefs():
>>> ValidatePrefs()
...
"""
# todo - validate username and password
error_message = '' # start with a blank error message

for key in default_prefs:
Expand Down Expand Up @@ -108,24 +103,11 @@ def Start():
if prefs_valid.header == 'Error':
Log.Warn('plug-in preferences are not valid.')

start_server() # start the web server if it is not running
Log.Debug('plug-in started.')

# use threading to start the flask app... or else web server seems to be killed after a couple of minutes
flask_thread = Thread(
target=app.run,
kwargs=dict(
host=Prefs['str_http_host'],
port=Prefs['int_http_port'],
debug=False,
use_reloader=False # reloader doesn't work when running in a separate thread
)
)

# start flask application
flask_thread.start()


@handler(prefix='/applications/plugger', name='Plugger', thumb='attribution.png')
@handler(prefix='/applications/plugger', name='Plugger', thumb='icon-default.png')
def main():
"""
Create the main plug-in ``handler``.
Expand Down
16 changes: 15 additions & 1 deletion Contents/Code/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@
else: # the code is running outside of Plex
from plexhints.core_kit import Core # core kit

bundle_identifier = 'dev.lizardbyte.plugger'
# plex constants
app_support_directory = Core.app_support_path
plex_base_url = 'http://127.0.0.1:32400'
plex_token = os.environ.get('PLEXTOKEN')
plugin_directory = os.path.join(app_support_directory, 'Plug-ins')
plugin_logs_directory = os.path.join(app_support_directory, 'Logs', 'PMS Plugin Logs')
plugin_support_directory = os.path.join(app_support_directory, 'Plug-in Support')
plugin_support_caches_directory = os.path.join(plugin_support_directory, 'Caches')
plugin_support_data_directory = os.path.join(plugin_support_directory, 'Data')
plugin_support_databases_directory = os.path.join(plugin_support_directory, 'Databases')
plugin_support_metadata_combination_directory = os.path.join(plugin_support_directory, 'Metadata Combination')
plugin_support_preferences_directory = os.path.join(plugin_support_directory, 'Preferences')
system_plugins_directory = Core.bundled_plugins_path

# plugger constants
bundle_identifier = 'dev.lizardbyte.plugger'
plugger_data_directory = os.path.join(plugin_support_data_directory, bundle_identifier)
60 changes: 60 additions & 0 deletions Contents/Code/plugin_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# plex debugging
try:
import plexhints # noqa: F401
except ImportError:
pass
else: # the code is running outside of Plex
from plexhints.log_kit import Log # log kit

# local imports
from const import plugger_data_directory, plugin_directory

# servers version newer than 1.13 cannot view plugin routes, maybe we can do something with this later
# https://www.reddit.com/r/PleX/comments/ig64mz/comment/jhk5jbu/?utm_source=share&utm_medium=web2x&context=3


def initialize_install(plugin_data):
# type: (dict) -> bool
"""
Initialize the plugin installation process.

Parses the plugin data for further processing depending on the conditions.

.. todo:: Complete this function.

Parameters
----------
plugin_data : dict
The plugin data to process.

Returns
-------
bool
Whether the plugin was successfully installed/migrated/updated.
"""
Log.Debug("{}: {}".format("plugger_support_directory", plugger_data_directory))
Log.Debug("{}: {}".format("plugin_directory", plugin_directory))

Log.Debug('Initializing plugin installation process for "{}"'.format(plugin_data['plugin']['full_name']))
for k, v in plugin_data.items():
Log.Debug("{}: {}".format(k, v))
return True


def uninstall_plugin(plugin_name):
# type: (str) -> bool
"""
Uninstall a plugin.

Parameters
----------
plugin_name : str
The name of the plugin to uninstall.

Returns
-------
bool
Whether or not the plugin was successfully uninstalled.
"""
Log.Debug("Uninstalling plugin: {}".format(plugin_name))
return True
Loading