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

Commit

Permalink
Merge pull request #17 from LizardByte/nightly
Browse files Browse the repository at this point in the history
v0.0.3
  • Loading branch information
ReenigneArcher authored Oct 9, 2022
2 parents fcb6223 + 56684a9 commit 444d70b
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 26 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/
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [0.0.3] - 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
### Changed
- move plugin to `Music` category

## [0.0.2] - 2022-10-04
### Fixed
- `plexhints` import error on Docker
Expand Down
8 changes: 6 additions & 2 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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 Expand Up @@ -161,7 +165,7 @@ def Start():
Log.Debug('Themerr-plex plug-in started.')


@handler(prefix='/video/themerr-plex', name='Themerr-plex', thumb='attribution.png')
@handler(prefix='/music/themerr-plex', name='Themerr-plex', thumb='attribution.png')
def main():
"""
Create the main plug-in ``handler``.
Expand Down
9 changes: 5 additions & 4 deletions Contents/Code/plex_api_helper.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-

# standard imports
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.log_kit import Log
from plexhints.prefs_kit import Prefs

Expand Down
38 changes: 23 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,34 @@ 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 requests
# requests required to install python-plexapi
# 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="Themerr-plex.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
4 changes: 4 additions & 0 deletions docs/source/about/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Minimal setup is required to use Themerr-plex. In addition to the installation,
.. Attention:: You must re-match your movies in order for `Themerr-plex` to apply themes to them. This is a
limitation with Plex.

.. Note:: If the movie was rematched and no theme song was added, it is most likely that the movie is not in the
database. Please see :ref:`contributing/database <contributing/database:database>` for information on how to
contribute.

Preferences
-----------

Expand Down
7 changes: 3 additions & 4 deletions scripts/build_plist.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,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 444d70b

Please sign in to comment.