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

Commit

Permalink
Merge pull request #28 from LizardByte/nightly
Browse files Browse the repository at this point in the history
v0.0.4
  • Loading branch information
ReenigneArcher authored Oct 9, 2022
2 parents f982aa1 + 1fb507e commit 3e8e28b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 23 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[flake8]
filename =
*.py
*.py,
*.pys
max-line-length = 120
extend-exclude =
venv/
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.0.4] - 2022-10-09
### Fixed
- use try/except/else for plexhints import
- docker build was missing some plugin files
- dockerignore file was not being respected
- issue with special characters being replaced in plist file

## [0.0.3] - 2022-10-04
### Fixed
- `plexhints` import error on Docker
Expand Down
6 changes: 5 additions & 1 deletion Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import sys

# plex debugging
if 'plexscripthost' not in sys.executable.lower() or sys.executable != '': # the code is running outside of Plex
try:
import plexhints # noqa: F401
except ImportError:
pass
else: # the code is running outside of Plex
from plexhints import plexhints_setup, update_sys_path
plexhints_setup() # read the plugin plist file and determine if plexhints should use elevated policy or not
update_sys_path() # when running outside plex, append the path
Expand Down
7 changes: 5 additions & 2 deletions Contents/Services/URL/YouTube/ServiceCode.pys
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
# standard imports
from datetime import datetime
from typing import Optional
import sys

# plex debugging
if 'plexscripthost' not in sys.executable.lower() or sys.executable != '': # the code is running outside of Plex
try:
import plexhints # noqa: F401
except ImportError:
pass
else: # the code is running outside of Plex
from plexhints import update_sys_path
update_sys_path()

Expand Down
37 changes: 22 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# buildstage
FROM python:2.7.18-alpine3.11 as buildstage
# syntax = docker/dockerfile:latest
FROM python:2.7.18-buster AS buildstage

# build args
ARG BUILD_VERSION
Expand All @@ -8,26 +8,33 @@ ARG GITHUB_SHA=$COMMIT
# note: BUILD_VERSION may be blank, COMMIT is also available
# note: build_plist.py uses BUILD_VERSION and GITHUB_SHA

# setup build directory
RUN mkdir /build
WORKDIR /build/
# create build dir and copy GitHub repo there
# todo - add `--link` once hadolint supports this syntax, see https://github.com/hadolint/hadolint/issues/826
COPY . /build

# copy repo
COPY . .
# set build dir
WORKDIR /build

RUN python # update pip \
-m pip --no-python-version-warning --disable-pip-version-check install --upgrade pip==20.3.4 setuptools \
&& python -m pip install --upgrade -r requirements-dev.txt # install dev requirements \
&& python ./scripts/install_requirements.py # install plugin requirements \
&& python ./scripts/build_plist.py # build plist \
&& rm -r ./scripts/ # remove scripts dir
# update pip
RUN python -m pip --no-python-version-warning --disable-pip-version-check install --no-cache-dir --upgrade \
pip==20.3.4 setuptools
# dev requirements not necessary for docker image, significantly speeds up build since lxml doesn't need to build

# single layer deployed image
FROM scratch
# build plugin
RUN python ./scripts/install_requirements.py \
&& python ./scripts/build_plist.py

# clean
RUN rm -rf ./scripts/ \
# list contents
&& ls -a

FROM scratch AS deploy

# variables
ARG PLUGIN_NAME="PlexyGlass.bundle"
ARG PLUGIN_DIR="/config/Library/Application Support/Plex Media Server/Plug-ins"

# add files from buildstage
# todo - add `--link` once hadolint supports this syntax, see https://github.com/hadolint/hadolint/issues/826
COPY --from=buildstage /build/ $PLUGIN_DIR/$PLUGIN_NAME
7 changes: 3 additions & 4 deletions scripts/build_plist.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@
# This is used to send plugin log statements directly to stout when running PMS from the command line. \
# Rarely used anymore

plist_string = plistlib.writePlistToString(pl).replace('&lt;', '<').replace('&gt;', '>')

with open(info_file, 'wb') as fp:
try:
plistlib.dump(value=pl, fp=fp) # python 3
except AttributeError:
plistlib.writePlist(pl, pathOrFile=fp) # python 2.7
fp.write(plist_string)

0 comments on commit 3e8e28b

Please sign in to comment.