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

Commit

Permalink
build(deps): use plexhints from pypi (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Sep 28, 2023
1 parent d2b1c9c commit 772499e
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 858 deletions.
113 changes: 37 additions & 76 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
"-xr!plexhints*" \
"-xr!Themerr-plex.bundle/.*" \
"-xr!Themerr-plex.bundle/cache.sqlite" \
"-xr!Themerr-plex.bundle/codecov.yml" \
"-xr!Themerr-plex.bundle/crowdin.yml" \
"-xr!Themerr-plex.bundle/DOCKER_README.md" \
"-xr!Themerr-plex.bundle/Dockerfile" \
Expand Down Expand Up @@ -120,8 +121,6 @@ jobs:
os: [windows-latest, ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}
env:
PLEXAPI_AUTH_SERVER_BASEURL: http://127.0.0.1:32400
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -146,97 +145,59 @@ jobs:
- name: Set up Python
uses: LizardByte/.github/actions/setup_python2@nightly

- name: Bootstrap Plex server
env:
PLEXAPI_PLEXAPI_TIMEOUT: "60"
id: bootstrap
uses: LizardByte/[email protected]
with:
additional_server_queries_put: >-
/system/agents/com.plexapp.agents.imdb/config/1?order=com.plexapp.agents.imdb%2Cdev.lizardbyte.themerr-plex
/system/agents/com.plexapp.agents.themoviedb/config/1?order=com.plexapp.agents.themoviedb%2Cdev.lizardbyte.themerr-plex
plugin_bundles_to_install: >-
Themerr-plex.bundle
without_shows: true
without_music: true
without_photos: true

- name: Install python dependencies
shell: bash
run: |
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade \
pip setuptools wheel
python -m pip --no-python-version-warning --disable-pip-version-check install -r requirements-dev.txt
- name: Install Plex Media Server
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
choco install plexmediaserver
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
brew install --cask plex-media-server
# starting with pms 1.29.2 servers must be claimed... disable that
# https://forums.plex.tv/t/new-server-claiming-requirement-for-macos/816337
defaults write com.plexapp.plexmediaserver enableLocalSecurity -bool FALSE
# copy plugin before starting plex server
mkdir -p "${HOME}/Library/Application Support/Plex Media Server/Plug-ins"
cp -r ./Themerr-plex.bundle "${HOME}/Library/Application Support/Plex Media Server/Plug-ins/"
open "/Applications/Plex Media Server.app"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
echo deb https://downloads.plex.tv/repo/deb public main | \
sudo tee /etc/apt/sources.list.d/plexmediaserver.list
sudo apt-get update
sudo apt-get install plexmediaserver
# stop service
sudo systemctl stop plexmediaserver
# debug
cat /lib/systemd/system/plexmediaserver.service
# do not edit service directly, use override
override=/etc/systemd/system/plexmediaserver.service.d/override.conf
sudo mkdir -p $(dirname ${override})
sudo touch ${override}
echo "[Service]" | sudo tee ${override}
echo "User=$USER" | sudo tee -a ${override}
# take ownership
sudo chown -R $USER:$USER "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server"
# reload service
sudo systemctl daemon-reload
# start
sudo systemctl start plexmediaserver
else
echo "Unknown OS: ${{ matrix.os }}"
exit 1
fi
- name: Update Plex registry settings
if: ${{ matrix.os == 'windows-latest' }}
run: |
# starting with pmps 1.32.2 servers must be claimed... disable that
# https://forums.plex.tv/t/new-claiming-requirement-for-windows/839096
REG ADD "HKCU\Software\Plex, Inc.\Plex Media Server" /v enableLocalSecurity /t REG_DWORD /d 0 /f
- name: Bootstrap Plex server
id: boostrap
shell: bash
run: |
python \
-u scripts/plex-bootstraptest.py \
--destination plex \
--advertise-ip 127.0.0.1 \
--bootstrap-timeout 540 \
--no-docker \
--server-name plex-test-${{ matrix.os }}-${{ github.run_id }} \
--without-shows \
--without-music \
--without-photos \
--unclaimed
- name: Test with pytest
env:
PLEX_PLUGIN_LOG_PATH: ${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}
PLEXAPI_AUTH_SERVER_BASEURL: ${{ steps.bootstrap.outputs.PLEX_SERVER_BASEURL }}
PLEXAPI_AUTH_SERVER_TOKEN: ${{ steps.bootstrap.outputs.PLEXTOKEN }}
PLEXAPI_PLEXAPI_TIMEOUT: "60"
PLEXTOKEN: ${{ steps.bootstrap.outputs.PLEXTOKEN }}
id: test
shell: bash
run: |
python -m pytest \
-rXs \
-rxXs \
--maxfail=1 \
--tb=native \
--verbose \
--cov=Contents/Code \
tests
- name: Debug log file
if: always()
shell: bash
run: |
echo "Debugging log file"
if [[ "${{ runner.os }}" == "Windows" ]]; then
log_file=$(cygpath.exe -u \
"${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}/dev.lizardbyte.themerr-plex.log")
else
log_file="${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}/dev.lizardbyte.themerr-plex.log"
fi
cat "${log_file}"
- name: Upload coverage
# any except cancelled or skipped
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
Expand Down
9 changes: 8 additions & 1 deletion Contents/Code/scheduled_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@


def run_threaded(target, daemon=None, args=(), **kwargs):
# type: (Callable, Optional[bool], Iterable, Mapping[str, Any]) -> None
# type: (Callable, Optional[bool], Iterable, Mapping[str, Any]) -> threading.Thread
"""
Run a function in a thread.
Expand All @@ -54,6 +54,11 @@ def run_threaded(target, daemon=None, args=(), **kwargs):
kwargs : Mapping[str, Any]
The keyword arguments to pass to the function.
Returns
-------
threading.Thread
The thread that the function is running in.
Examples
--------
>>> run_threaded(target=Log.Info, daemon=True, args=['Hello, world!'])
Expand All @@ -63,6 +68,7 @@ def run_threaded(target, daemon=None, args=(), **kwargs):
if daemon:
job_thread.daemon = True
job_thread.start()
return job_thread


def schedule_loop():
Expand All @@ -77,6 +83,7 @@ def schedule_loop():
>>> schedule_loop()
...
"""
time.sleep(60) # give a little time for the server to start
schedule.run_all() # run all jobs once

while True:
Expand Down
3 changes: 1 addition & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
flake8==3.9.2;python_version<"3"
m2r2==0.3.2;python_version<"3"
numpydoc==0.9.2;python_version<"3"
git+https://github.com/LizardByte/plexhints.git#egg=plexhints # type hinting library for plex development
plexhints==0.1.0 # type hinting library for plex development
plexapi-backport[alert]==4.15.2
pytest==4.6.11;python_version<"3"
pytest-cov==2.12.1;python_version<"3"
rstcheck==3.5.0;python_version<"3"
Sphinx==1.8.6;python_version<"3"
sphinx-rtd-theme==1.2.0;python_version<"3"
tqdm==4.64.1;python_version<"3"
Loading

0 comments on commit 772499e

Please sign in to comment.