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

Commit 8c05861

Browse files
refactor!: move project to standalone version
1 parent 6580224 commit 8c05861

File tree

139 files changed

+5370
-3433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+5370
-3433
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
.*
66

77
# ignore directories
8-
docs/
98
tests/
109

1110
# ignore venv when building locally

.flake8

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[flake8]
22
filename =
3-
*.py,
4-
*.pys
3+
*.py
54
max-line-length = 120
65
extend-exclude =
76
venv/

.github/workflows/CI.yml

Lines changed: 48 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33

44
on:
55
pull_request:
6-
branches: [master]
6+
branches: [master, dev/standalone] # TODO: remove dev/standalone ... temporarily allow PRs to this branch
77
types: [opened, synchronize, reopened]
88
push:
99
branches: [master]
@@ -37,176 +37,69 @@ jobs:
3737
build:
3838
needs:
3939
- setup_release
40-
runs-on: ubuntu-20.04
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os: [windows-2019, ubuntu-20.04, macos-12]
45+
architecture: [x64]
46+
include: # additional runs
47+
- os: windows-2019
48+
architecture: x86
4149

4250
steps:
4351
- name: Checkout
4452
uses: actions/checkout@v4
45-
with:
46-
path: Themerr-plex.bundle
47-
submodules: recursive
4853

49-
- name: Set up Python
50-
uses: LizardByte/setup-python[email protected]
54+
- name: Setup Python
55+
uses: actions/setup-python@v5
5156
with:
52-
python-version: '2.7'
57+
python-version: '3.12'
58+
architecture: ${{ matrix.architecture }}
5359

54-
- name: Patch third-party deps
55-
if: false # disabled
56-
shell: bash
57-
working-directory: Themerr-plex.bundle/third-party
60+
- name: Setup Python Dependencies
5861
run: |
59-
patch_dir=${{ github.workspace }}/Themerr-plex.bundle/patches
60-
61-
# youtube-dl patches
62-
pushd youtube-dl
63-
git apply -v "${patch_dir}/youtube_dl-compat.patch"
64-
popd
65-
66-
- name: Set up Python Dependencies
67-
shell: bash
68-
working-directory: Themerr-plex.bundle
69-
run: |
70-
echo "Installing Requirements"
71-
python --version
72-
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade pip setuptools
73-
74-
# install dev requirements
75-
python -m pip install --upgrade \
76-
-r requirements-build.txt \
77-
-r requirements-dev.txt
78-
79-
python -m pip install --upgrade --target=./Contents/Libraries/Shared \
80-
-r requirements.txt --no-warn-script-location
62+
python -m pip install --upgrade pip setuptools wheel
63+
python -m pip install -r requirements-dev.txt
8164
8265
- name: Compile Locale Translations
83-
working-directory: Themerr-plex.bundle
8466
run: |
8567
python ./scripts/_locale.py --compile
8668
8769
- name: Install npm packages
88-
working-directory: Themerr-plex.bundle
70+
shell: bash
8971
run: |
72+
# install node_modules
9073
npm install
91-
mv ./node_modules ./Contents/Resources/web
9274
93-
- name: Build plist
94-
shell: bash
95-
working-directory: Themerr-plex.bundle
96-
env:
97-
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
75+
# move node_modules directory to web directory
76+
mv -f ./node_modules/ ./web/
77+
78+
- name: Compile Docs
79+
working-directory: docs
80+
run: |
81+
make html
82+
83+
- name: Build pyinstaller package
9884
run: |
99-
python ./scripts/build_plist.py
85+
python ./scripts/build.py
10086
10187
- name: Package Release
102-
shell: bash
10388
run: |
104-
7z \
105-
"-xr!*.git*" \
106-
"-xr!*.pyc" \
107-
"-xr!__pycache__" \
108-
"-xr!plexhints*" \
109-
"-xr!Themerr-plex.bundle/.*" \
110-
"-xr!Themerr-plex.bundle/cache.sqlite" \
111-
"-xr!Themerr-plex.bundle/codecov.yml" \
112-
"-xr!Themerr-plex.bundle/crowdin.yml" \
113-
"-xr!Themerr-plex.bundle/DOCKER_README.md" \
114-
"-xr!Themerr-plex.bundle/Dockerfile" \
115-
"-xr!Themerr-plex.bundle/docs" \
116-
"-xr!Themerr-plex.bundle/patches" \
117-
"-xr!Themerr-plex.bundle/scripts" \
118-
"-xr!Themerr-plex.bundle/tests" \
119-
a "./Themerr-plex.bundle.zip" "Themerr-plex.bundle"
89+
7z a "./Themerr-plex_${{ runner.os }}_${{ matrix.architecture }}.zip" "dist"
12090
12191
mkdir artifacts
122-
mv ./Themerr-plex.bundle.zip ./artifacts/
92+
mv "./Themerr-plex_${{ runner.os }}_${{ matrix.architecture }}.zip" ./artifacts/
12393
12494
- name: Upload Artifacts
125-
uses: actions/upload-artifact@v4
95+
uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact
12696
with:
127-
name: Themerr-plex.bundle
97+
name: Themerr-plex_${{ runner.os }}_${{ matrix.architecture }}
12898
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
12999
path: |
130100
${{ github.workspace }}/artifacts
131101
132-
- name: Create/Update GitHub Release
133-
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
134-
uses: LizardByte/[email protected]
135-
with:
136-
allowUpdates: true
137-
body: ${{ needs.setup_release.outputs.release_body }}
138-
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
139-
name: ${{ needs.setup_release.outputs.release_tag }}
140-
prerelease: true
141-
tag: ${{ needs.setup_release.outputs.release_tag }}
142-
token: ${{ secrets.GH_BOT_TOKEN }}
143-
144-
pytest:
145-
needs: [build]
146-
strategy:
147-
fail-fast: false
148-
matrix:
149-
os: [windows-latest, ubuntu-latest, macos-latest]
150-
151-
runs-on: ${{ matrix.os }}
152-
steps:
153-
- name: Checkout
154-
uses: actions/checkout@v4
155-
156-
- name: Download artifacts
157-
uses: actions/download-artifact@v4
158-
with:
159-
name: Themerr-plex.bundle
160-
161-
- name: Extract artifacts zip
162-
shell: bash
163-
run: |
164-
# extract zip
165-
7z x Themerr-plex.bundle.zip -o.
166-
167-
# move all files from "Themerr-plex.bundle" to root, with no target directory
168-
cp -r ./Themerr-plex.bundle/. .
169-
170-
# remove zip
171-
rm Themerr-plex.bundle.zip
172-
173-
- name: Set up Python
174-
uses: LizardByte/[email protected]
175-
with:
176-
python-version: '2.7'
177-
178-
- name: Bootstrap Plex server
179-
env:
180-
PLEXAPI_PLEXAPI_TIMEOUT: "60"
181-
id: bootstrap
182-
uses: LizardByte/[email protected]
183-
with:
184-
additional_server_queries: >-
185-
put|/system/agents/com.plexapp.agents.imdb/config/1?order=com.plexapp.agents.imdb%2Cdev.lizardbyte.themerr-plex
186-
put|/system/agents/com.plexapp.agents.themoviedb/config/1?order=com.plexapp.agents.themoviedb%2Cdev.lizardbyte.themerr-plex
187-
put|/system/agents/com.plexapp.agents.themoviedb/config/2?order=com.plexapp.agents.themoviedb%2Cdev.lizardbyte.themerr-plex
188-
put|/system/agents/com.plexapp.agents.thetvdb/config/2?order=com.plexapp.agents.thetvdb%2Cdev.lizardbyte.themerr-plex
189-
get|/:/plugins/dev.lizardbyte.themerr-plex/prefs/set?bool_overwrite_plex_provided_themes=true
190-
plugin_bundles_to_install: >-
191-
Themerr-plex.bundle
192-
without_music: true
193-
without_photos: true
194-
195-
- name: Install python dependencies
196-
shell: bash
197-
run: |
198-
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade \
199-
pip setuptools wheel
200-
python -m pip --no-python-version-warning --disable-pip-version-check install --no-build-isolation \
201-
-r requirements-dev.txt
202-
203102
- name: Test with pytest
204-
env:
205-
PLEX_PLUGIN_LOG_PATH: ${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}
206-
PLEXAPI_AUTH_SERVER_BASEURL: ${{ steps.bootstrap.outputs.PLEX_SERVER_BASEURL }}
207-
PLEXAPI_AUTH_SERVER_TOKEN: ${{ steps.bootstrap.outputs.PLEXTOKEN }}
208-
PLEXAPI_PLEXAPI_TIMEOUT: "60"
209-
PLEXTOKEN: ${{ steps.bootstrap.outputs.PLEXTOKEN }}
210103
id: test
211104
shell: bash
212105
run: |
@@ -215,30 +108,25 @@ jobs:
215108
--tb=native \
216109
--verbose \
217110
--color=yes \
218-
--cov=Contents/Code \
111+
--cov=src \
219112
tests
220113
221-
- name: Debug log file
222-
if: always()
223-
shell: bash
224-
run: |
225-
echo "Debugging log file"
226-
if [[ "${{ runner.os }}" == "Windows" ]]; then
227-
log_file=$(cygpath.exe -u \
228-
"${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}/dev.lizardbyte.themerr-plex.log")
229-
else
230-
log_file="${{ steps.bootstrap.outputs.PLEX_PLUGIN_LOG_PATH }}/dev.lizardbyte.themerr-plex.log"
231-
fi
232-
cat "${log_file}"
233-
234114
- name: Upload coverage
235-
# any except canceled or skipped
236-
if: >-
237-
always() &&
238-
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
239-
startsWith(github.repository, 'LizardByte/')
240115
uses: codecov/codecov-action@v4
241116
with:
242117
fail_ci_if_error: true
243-
flags: ${{ runner.os }}
118+
flags: "${{ runner.os }}-${{ matrix.architecture }}"
244119
token: ${{ secrets.CODECOV_TOKEN }}
120+
verbose: true
121+
122+
- name: Create/Update GitHub Release
123+
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
124+
uses: LizardByte/[email protected]
125+
with:
126+
allowUpdates: true
127+
body: ${{ needs.setup_release.outputs.release_body }}
128+
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
129+
name: ${{ needs.setup_release.outputs.release_tag }}
130+
prerelease: true
131+
tag: ${{ needs.setup_release.outputs.release_tag }}
132+
token: ${{ secrets.GH_BOT_TOKEN }}

.github/workflows/localize.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
branches: [master]
77
paths: # prevents workflow from running unless these files change
88
- '.github/workflows/localize.yml'
9-
- 'Contents/Strings/Themerr-plex.po'
10-
- 'Contents/Code/**.py'
11-
- 'Contents/Resources/web/templates/**'
9+
- 'locale/themerr-plex.po'
10+
- 'src/**.py'
11+
- 'web/templates/**'
1212
workflow_dispatch:
1313

1414
jobs:
@@ -19,18 +19,16 @@ jobs:
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
22-
with:
23-
submodules: recursive
2422

25-
- name: Set up Python
26-
uses: LizardByte/setup-python[email protected]
23+
- name: Install Python
24+
uses: actions/setup-python@v5 # https://github.com/actions/setup-python
2725
with:
28-
python-version: '2.7'
26+
python-version: '3.12'
2927

30-
- name: Set up Python Dependencies
28+
- name: Setup Python Dependencies
3129
run: |
32-
python -m pip install --upgrade pip setuptools requests
33-
python -m pip install -r requirements.txt # requests is required to install python-plexapi
30+
python -m pip install --upgrade pip setuptools wheel
31+
python -m pip install -r requirements.txt
3432
3533
- name: Update Strings
3634
run: |
@@ -42,14 +40,14 @@ jobs:
4240
git config --global pager.diff false
4341
4442
# print the git diff
45-
git diff Contents/Strings/themerr-plex.po
43+
git diff locale/themerr-plex.po
4644
4745
# set the variable with minimal output, replacing `\t` with ` `
48-
OUTPUT=$(git diff --numstat Contents/Strings/themerr-plex.po | sed -e "s#\t# #g")
46+
OUTPUT=$(git diff --numstat locale/themerr-plex.po | sed -e "s#\t# #g")
4947
echo "git_diff=${OUTPUT}" >> $GITHUB_ENV
5048
5149
- name: git reset
52-
if: ${{ env.git_diff == '1 1 Contents/Strings/themerr-plex.po' }} # only run if more than 1 line changed
50+
if: ${{ env.git_diff == '1 1 locale/themerr-plex.po' }} # only run if more than 1 line changed
5351
run: |
5452
git reset --hard
5553
@@ -61,7 +59,7 @@ jobs:
6159
uses: peter-evans/create-pull-request@v7
6260
with:
6361
add-paths: |
64-
Contents/Strings/*.po
62+
locale/*.po
6563
token: ${{ secrets.GH_BOT_TOKEN }} # must trigger PR tests
6664
commit-message: "chore(l10n): new babel updates"
6765
branch: localize/update

.github/workflows/python-flake8.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ jobs:
2626
- name: Set up Python
2727
uses: actions/setup-python@v5 # https://github.com/actions/setup-python
2828
with:
29-
python-version: '3.10'
29+
python-version: '3.12'
3030

3131
- name: Install dependencies
3232
run: |
33-
# pin flake8 before v6.0.0 due to removal of support for type comments (required for Python 2.7 type hints)
34-
python -m pip install --upgrade pip setuptools "flake8<6"
33+
python -m pip install --upgrade pip setuptools flake8
3534
3635
- name: Test with flake8
3736
run: |

.gitignore

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,7 @@ ipython_config.py
101101
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102102
#poetry.lock
103103

104-
# pdm
105-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
110-
.pdm.toml
111-
112-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
104+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
113105
__pypackages__/
114106

115107
# Celery stuff
@@ -159,16 +151,9 @@ cython_debug/
159151
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160152
.idea/
161153

162-
# Remove the agent Info.plist since we are building it
163-
Contents/Info.plist
164-
165-
# Remove plexhints files
166-
plexhints-temp
167-
*cache.sqlite
168-
169-
# Remove python modules
170-
Contents/Libraries/Shared/
171-
172154
# npm
173155
node_modules/
174-
package-lock.json
156+
*package-lock.json
157+
158+
# project files and directories
159+
config/

0 commit comments

Comments
 (0)